score:0
Accepted answer
Replace one of the series with this:
series: [{
name: 'massively overweight',
data:
<?php
$mysqli = new mysqli("example.com", "user", "password", "database");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$res = $mysqli->query("SELECT date(date, '%b') as month, count(*) as cnt FROM diagnosis where illness = 'massively overweight'");
while ($row = $res->fetch_assoc()) {
$fat_people = $row['cnt'];
}
json_encode($cnt)
?>
}, {
score:0
current_page.php
<script>
$.post( 'get_graph_data.php"', {'id':'data_id'}, function(data) {
var data = jQuery.parseJSON(data);
chart = new Highcharts.Chart({data});
})
</script>
get_graph_data.php
//get data from database
// make array like this
array(
"chart"=> array(
"renderTo"=> 'container',
"type"=> 'column'
),
"title"=> array(
"text"=> 'Monthly Average Rainfall'
),
"subtitle"=> array(
'text'=> array('Source'=> 'WorldClimate.com')
),
'xAxis'=> array(
'categories'=>array(
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'));
so on............
echo json_encode($above_array);
score:0
How your dates looks like? Because Highcharts use timestamps in miliseconds, so probably you need to parse your date by Date.UTC() or use time in appropriate format.
btw. How your JSON looks like?
Source: stackoverflow.com
Related Query
- Make bar graph using highcharts from entries in the database
- Highcharts: How to provide a custom stack label in highcharts bar graph from within the stackLabel formatter?
- How to make hover effect for two bar in highcharts at the same time is there any way by using css or any inbuilt method to achieve this?
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- How to make multiple Y-axis with incoming series of data from database using Highcharts
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Highcharts basic bar graphs. How to remove strokewith from the bars
- How To Call A Function To Make A Graph Using HighCharts in PHP
- How can I make a graph with highcharts from csv file?
- Dynamically set click event on bar from highcharts graph
- Make single bar in highcharts the width of the container
- highcharts example for using data from database with mvc
- How can I make milestone lines with a GANTT chart using the highcharts library?
- How do I use dates from a LinkedHashMap for the x-axis on a Highcharts line graph (using Thymeleaf)?
- How to make the Y Axis values not start from 0 in highcharts? How to display forcefully display the last category data on X axis in HighCharts ?
- Click a point on a highcharts graph from outside of the chart
- Highcharts - How do I keep both line points in from splitting between the two bar charts
- How to set the dynamic value from a text box to the graph using Highcharts?
- Plot a bar graph using Highcharts drilldown with two different JSON end points
- I'm trying to create a bar graph with Highcharts JS, but the bars won't draw on the graph?
- sort chart bar by color with the correct value from the text file using HIGHCHART,PHP
- Highcharts Using Data from Ruby on Rails Database
- I am using click event to trigger a new page to generate the drill down data from highcharts however the entire chart is being generated
- highcharts how to make x and y axis starting on the same zero using categories on yAxis
- How to display historical data and live data from database using Highcharts
- highcharts bar graph from json
- Want to make the Highcharts Bar Chart data labels appear on the far right in the chart
- How to create a drilleable bar graph in jsp page using open source charts API
- Highcharts Chart Bar - How can I display in the chart, only one column from my HTML table?
- How do I have text display within the inside of a stacked bar graph in highcharts
More Query from same tag
- How To Reject An Element From An Array?
- Highcharts - show every other x-axis category
- Highcharts export to svg
- how to have a chart with no spline and no interpolation in Highcharts?
- highcharts legend marker and series marker with different size
- HighCharts Linechart MySQL/PHP data for multiple lines
- How to change the chart title dynamically on tooltip hover in the points Highcharts.. React JS
- alert value on graph hover
- Drilldown in two steps, multiple choice in Highcharts
- put your own series in highcharts sereis
- Dynamical Update data Javascript Highchar
- Highcharts yAxis title click
- HighCharts, HighChartTable - pie chart default slice
- How to disable click in angular high-chart data points?
- Highmaps in React using lat/lon not working
- Highcharts view full screen in older version
- Highcharts with Public Google Spreadsheet does not work
- Highcharts data from google spreadsheet show directed line
- Highcharts Solid Gauge Dynamic Update Using JSON
- Highcharts: X axis, MySQL datetime
- IE 9 64 bit Rendering Issue
- Format number data with comma and unit in Highchart
- Highcharts - line chart dataLabels on every other point?
- Highstock Series Compare To Previous Day
- Highcharts xAxis shows labels from drilldown on drillup
- hightchart line and column chart , line not start with start of chart
- highchart displaying only ever other point on a line
- Reading uploaded csv file in highcharts
- Force Highcharts to use standalone framework instead of jquery?
- In Highcharts, how to make box plot outliers transition from light to dark colors?