score:1
Accepted answer
Remember that json_encode
must be used once:
foreach($present_g as $row) {
$value = $row['present'];
$datetime = $row['date'] * 1000; // convert from Unix timestamp to JavaScript time
// Also remove quotes here, you don't need a string
$data[] = [$datetime, $value];
}
$result = json_encode($data);
echo $result;
Source: stackoverflow.com
Related Query
- Bars does not show up when loading JSON encoded data from PHP in Highcharts
- Formatting JSON data monthwise for HighCharts using MySQL
- Formatting JSON Data with ColdFusion for HighCharts
- Formatting JSON from a Pandas data frame for Highcharts within a Django template
- passing formatting JavaScript code to HighCharts with JSON
- JSON Data formatting for Highcharts
- Highcharts data import JSON - formatting
- Having trouble JSON encoded data from MySQL through Highcharts
- Formatting JSON_ENCODED data PHP Highcharts
- HighCharts Bubble graph JSON as data source
- Highcharts not displaying json data in php
- Formatting PHP/MySQL data in correct JSON format for HighCharts
- HighCharts Data with JavaScript PHP JSON
- Highcharts format json data from php script / unixtime
- Passing data from PHP array to Highcharts chart with JSON
- Highcharts JSON formatting - splitting up and preprocessing data for charts?
- Highcharts Data (using PHP JSON MYSQL)
- Highcharts displays series names but missing data points from json source
- Highcharts and JSON data from PHP
- PHP and MySQL, get JSON data to feed HighCharts
- Highcharts PHP JSON - correct data format
- Reload chart data via JSON with Highcharts
- Highcharts data series issue with ajax/json and PHP
- How to pass json data to highcharts series?
- Send JSON data to highcharts pie from asp.net MVC controller in C#
- Highcharts with JSON data and multiple series
- Highcharts Beta 3: Best Practice loading JSON data
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts C# To JSON - Structuring Series Data
- How to populate a Highcharts axis with string formatted data from a PHP array
More Query from same tag
- How to spread Y Axis values in "area" chart using HighCharts
- Value of same item in one treemap doesn't correctly represent its size when we compare it with the item in other treemap
- highcharts stacked area with irregular x-intervals
- Behavior of multiple HighCharts on single page when removing one div
- Creating a ring chart with Highcharts
- Highmap not displaying map with angular-highcharts in Angular5
- Chart js pie or doughnut charts 3 inside instead of 1
- Issue with Highcharts master-slave chart
- Highcharts- Unable to change yAxis label
- Display multiple points with exact same value in scatter HighCharts
- JSON data not showing in highstock Candlestick chart using PHP & MYSQL
- How filter json data with date from datepicker Angular2 app
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- Highcharts stacked bar graph as timeline
- Different tooltip and value in Treemap || Highcharts
- Is it possible? xAxis categories with Json?
- Redraw/Resize highcharts when printing website
- How to set default range selected on chart draw in Highcharts/Highstock
- Highchart - Column range as arrows
- How to add custom exporting button in highCharts?
- Accessing another list in the dataLabels.formatter function in Highcharts
- Highcharts - Changing color of text if not enough room on bar graph
- How to enable plotting only if values are present in Highcharts?
- Highcharts 3D Scatter Plot: Change Description shown when hovering points
- Change the style of Highchart stacked colum chart
- Download pdf from High Charts
- Highcharts: Format series names in tooltip
- Highcharts: allowDecimals on y-axis when it's logarithmic is ignored
- Highcharts multiple charts, each with live data
- HighChart Chart displaying incorrect data when switched to StockChart