I have json object which i pass to AmCharts.makeChart() function as a data provider and it shows proper graph in firefox, chrome and ie but not in safari
I also see that json data in console but still graph not es
I had used amchart.js, serial.js
Thanks in advance...
I have json object which i pass to AmCharts.makeChart() function as a data provider and it shows proper graph in firefox, chrome and ie but not in safari
I also see that json data in console but still graph not es
I had used amchart.js, serial.js
Thanks in advance...
Share Improve this question edited Nov 4, 2014 at 7:00 Gilsha 14.6k3 gold badges36 silver badges48 bronze badges asked Nov 4, 2014 at 6:27 Kishan UpadhyayKishan Upadhyay 661 silver badge6 bronze badges2 Answers
Reset to default 12I had the same problem. Passing "dataDateFormat": "YYYY-MM-DD HH:NN:SS"
to the AmCharts.makeChart mand solved the issue for me. An example graph code would look like this:
var chart1 = AmCharts.makeChart("chartdiv1", {
"type": "serial",
"theme": "dark",
"pathToImages": "amcharts/images/",
"dataProvider": chartData,
"valueAxes": [{
"position": "left",
"title": "temperature (\xB0C)"
}],
"graphs": [{
"fillAlphas": 0.4,
"valueField": "temp"
}],
"chartScrollbar": {},
"chartCursor": {
"categoryBalloonDateFormat": "JJ:NN, DD MMMM",
"cursorPosition": "mouse"
},
"categoryField": "time",
"categoryAxis": {
"minPeriod": "mm",
"parseDates": true,
"title": "date"
},
"dataDateFormat": "YYYY-MM-DD HH:NN:SS"
});
In my case, the JSON object was created from a mysql database from a php script. The database contained epoch timestamps which I converted into date time format in mysql by using a FROM_UNIXTIME(time)
select query. This gives me dates like 2014-10-06 22:04:16
. Apparently, Chrome and firefox can handle such date strings natively but safari cannot.
This is a Safari
specific issue.
Adding dataDateFormat
: YYYY-MM-DD HH:NN:SS
to AmCharts.makeChart
solved the issue as answered by Thawn here:
https://stackoverflow./a/26795224/4448807
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743952350a4535173.html
评论列表(0条)