javascript - AmChart is not working in safari - Stack Overflow

I have json object which i pass toAmCharts.makeChart() function as a data provider and it shows prope

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 badges
Add a ment  | 

2 Answers 2

Reset to default 12

I 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

相关推荐

  • javascript - AmChart is not working in safari - Stack Overflow

    I have json object which i pass toAmCharts.makeChart() function as a data provider and it shows prope

    2天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信