score:1
Accepted answer
please try this:
$lowvalue = [];
foreach ($data->data[$i] as $obj) {
if (isset($obj->close)) {
// add the element to the beginning of the array
array_unshift($lowvalue, $obj->close);
}
if(count($lowvalue) >= 30) {
break;
}
}
echo json_encode(['data' => $lowvalue]);
regarding your second question you should create another question on so.
score:0
with @mapek 's help and after i've worked a bit on his example the solution in my case was:
data:<?php
$lowvalue = [];
foreach ($data->data as $obj) {
if (isset($obj->close)) {
// add the element to the beginning of the array
array_unshift($lowvalue, $obj->close);
}
if(count($lowvalue) >= 30) {
break;
}
}
$low = array_map( create_function('$value', 'return (int)$value;'),
$lowvalue);
echo json_encode($low);
?>
which displays my array like this: data:[621, 512, 578]
...
Source: stackoverflow.com
Related Query
- Saving 30 keys from an array to another variable
- Passing data to highcharts from javascript array or variable
- Highcharts data from a variable is not working but from works fine from an array
- Unable to refer javascript array from another javascript file
- How do I pass a PHP variable from one file to another multiple times?
- Use django variable (array of elements from sqlite3 database) inside javascript embedded code
- Highcharts data value from variable array string
- How to draw a chart from one array of data and make labels on the chart from another array of data? Highcharts v.4.0.4
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- How to populate a Highcharts axis with string formatted data from a PHP array
- HighCharts: Getting Y-Value in One Series Based on X-Value From Another Series
- Vertical line on highchart, with position tied to animation frame from another div?
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- Extending typescript interface from another module
- Highcharts adding array of variable to series
- Line not rendered with data in variable but rendering with array data
- Is there a way to pass in variable element ID from Highcharts to launch a modal window?
- passing json values to highcharts from .net code behind
- Highcharts categories from data array
- how to animate the move of a point from a position to another in a HighCharts scatterplot
- Saving images from HTML5 canvas directly
- Is it possible to have two Y Axis in a highstock chart from highcharts one on the left and another on the right?
- Javascript: Plotting data from a variable using HighCharts- no data passing
- add to tooltip additional values from array
- Problem loading an array initialized in another script on webpage
- How to fix values from an array on the y-axis in Highcharts
- highcharts pass variable from plotline
- How to fetch value from another series or data
- Remove Square Bracket From Array Key PHP
- remove quote from array without using JSON_NUMERIC_CHECK
More Query from same tag
- Generate a line chart over column chart using highcharts
- Highcharts - Bubble graph : need bubble to overflow plot area
- getting 0x03 error when performing chart generation: please check your input data in Highchart
- What is the best strategy for testing D3/HighCharts/SVG?
- Highcharts Error #14 with SPServices
- Can I add on the webpage, data that I get from a Highcharts function?
- Highcharts show blank colum with text
- child Progress indicator is not working after collapsed and expanding parent element
- How to make bullet higher and bands thinner
- Highstock - disable vertical indicator
- react-highcharts: canvas size changes when changing tabs
- x-Axis tick alignment
- Jquery Highcharts is not loading when using with common function?
- highchart - pointstart with given x values
- Highcharts Tooltip formatting for shared Tooltips
- Highcharts warning: Invalid attribute 'src' in config
- Highchart Min Max for y-axis per series
- how to use Kendo chart library in Server side
- Highcharts - column chart redraw animation
- How can I hide a series from initially being displayed in Highcharts
- Highcharts tooltip line height in styled mode
- High Chart Issue on VS 2008
- Change shape color in Highmaps programmatically
- Highmaps downloadXLS() issue with MacOS Safari
- Highchart accessing series.data in tooltip pointFormat
- Highchart - overlapping label should NOT be hidden
- React-Native HighCharts Boost Module Usage
- Maximum values series in Highcharts
- Exporting Chart Not Keeping Navigator Series
- Display the total count of json key-value pairs in the series in high charts