I have written a below code which generates a area graph for selected dates (to and from dates).
$(document).ready(function() {
var options = {
"series": [{
"showInLegend": false,
"color": "#D0D0D0",
"name": "Revenue",
"data": [0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}],
"credits": {
"enabled": false
},
"chart": {
"renderTo": "highchart_id",
"defaultSeriesType": "area",
"shadow": true
},
"title": {
"text": null,
"align": "center",
"x": 0,
"y": 20
},
"xAxis": {
"type": "datetime",
"dateTimeLabelFormats": {
"month": "%e. %b",
"year": "%b"
},
"labels": {
"enabled": "false"
}
},
"legend": {
"enabled": true
},
"yAxis": {
"title": {
"text": ""
},
"labels": {
"enabled": true
}
},
"plotOptions": {
"area": {
"stacking": "normal",
"lineColor": "#3E3E3E",
"lineWidth": 3,
"marker": {
"lineWidth": "1",
"lineColor": "#3E3E3E",
"states": {
"hover": {
"enabled": true,
"radius": 1
}
}
}
},
"series": {
"pointStart": 1335823200000,
"pointInterval": 86400000
}
}
};
var chart = new Highcharts.Chart(options);
});
The interval of dates on x-axis is coming one day less. here the series value 2 is for 10 may whereas it is showing for 9 may in graph.
I am new to this highchart, can anybody advice the solution please and let me known if you need any more clarification on the problem.
Try adding this code before declaring the chart
Highcharts.setOptions({
time: {
useUTC: false
}
});
By default highchart used UTC times. By adding the code above it will use the time zone of the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With