Flot图在Firefox或Internet Explorer中无效,仅适用于Chrome

Joh*_*ean 4 javascript firefox jquery google-chrome flot

我正在使用Flot jQuery插件在我的网站上呈现图形.它在最新版本的Chrome中运行良好,但在Firefox和Internet Explorer中似乎失败了.我使用的是Firefox 21版和Internet Explorer 10版.这是相关的代码:

$(document).ready(function() {

    var currentURL = window.location;

    // This will hold our plot data
    var playersPlots = [];
    var pingPlots = [];

    // Make an AJAX request to get the server stats
    $.get(currentURL + '/stats.json', function(data) {
        $.each(data.stats, function(index, value) {
            playersPlots.push([new Date(value.ServerStat.created).getTime(), value.ServerStat.players]);
            pingPlots.push([new Date(value.ServerStat.created).getTime(), value.ServerStat.ping]);
        });

        $.plot($('#server-stats'), [{label: 'Players', data: playersPlots}, {label: 'Ping (ms)', data: pingPlots}], {
            xaxis: {
                mode: 'time',
                timeformat: '%I:%M',
                'tickSize': [3, "hour"]
            }
        });
    }, 'json');

});
Run Code Online (Sandbox Code Playgroud)

图表在Chrome下正常呈现(正确):

在此输入图像描述

但是在Firefox和Internet Explorer下是这样的:

在此输入图像描述

有没有人之前遇到过这个问题并且知道原因?

还值得一提的是,Firefox和IE都没有控制台错误,他们都在制作AJAX请求并获取正确的数据,我已经通过查看开发人员工具的网络选项卡确认了这些数据.

编辑:还值得一说,如果我像这样硬编码值:

$.plot($('#server-stats'), [{label: 'Players', data: [[10, 10], [20, 20]]}, {label: 'Ping (ms)', data: [[30, 30], [40, 40]]}], {
Run Code Online (Sandbox Code Playgroud)

它适用于Firefox,IE和Chrome.

Joh*_*ean 7

这是因为我的日期格式.默认情况下,MySQL会YYYY-MM-DD HH:MM:SS在需要时返回DATETIMEYYYY-MM-DDTHH:MM:SS