1

由于某种原因,jqplot 没有正确呈现标签,并最终将所有线点推到图表的末尾。这是它的样子......

这是它的样子:

在此处输入图像描述

下面是包含情节点的JS...

var _a212064_plot_properties;
$(document).ready(function ()
{
    _a212064_plot_properties =
    {
        "legend" :
        {
            "show" : true
        },
        "series" : [
            {
                "label" : "Current Year"
            },
            {
                "label" : "Previous Year"
            }
        ],
        "axes" :
        {
            "xaxis" :
            {
                "tickOptions" :
                {
                    "formatString" : "%b"
                },
                "label" : "Date",
                "min" : "07\/01\/2012 00:00:00",
                "tickInterval" : "1 Month",
                "renderer" : $.jqplot.DateAxisRenderer,
                "properties" : "xaxis"
            },
            "yaxis" :
            {
                "tickRenderer" : $.jqplot.CanvasAxisTickRenderer,
                "tickOptions" :
                {
                    "angle" : -30,
                    "labelPosition" : "middle"
                },
                "labelRenderer" : $.jqplot.CanvasAxisLabelRenderer,
                "labelOptions" :
                {
                    "fontSize" : "13pt"
                },
                "label" : "Organic Visits",
                "properties" : "yaxis"
            }
        },
        "highlighter" :
        {
            "bringSeriesToFront" : true,
            "tooltipLocation" : "n",
            "tooltipOffset" : "0",
            "formatString" : "Point <\/span>%s: %s<\/strong><\/div>"
        },
        "cursor" :
        {
            "show" : true,
            "zoom" : true
        }
    }

    $.jqplot.config.enablePlugins = true;
    $.jqplot.config.defaultHeight = 300;
    $.jqplot.config.defaultWidth = 400;
    _a212064 = $.jqplot("a212064", [[[1341115200, 2330], [1343793600, 2768], [1346472000, 2462], [1349064000, 2331], [1351742400, 2198], [1354338000, 2258], [1357016400, 2763], [1359694800, 2399], [1362114000, 2643], [1364788800, 1550], [1367380800, 621], [1370059200, 356]], [[1341115200, 4654], [1343793600, 4105], [1346472000, 4347], [1349064000, 4163], [1351742400, 3849], [1354338000, 5579], [1357016400, 4908], [1359694800, 3690], [1362114000, 2314], [1364788800, 3173], [1367380800, 2608], [1370059200, 2330]]], _a212064_plot_properties);

}
);

有任何想法吗?将日期放入该标签是我无法弄清楚的最后一件事。

谢谢!

4

1 回答 1

1

您需要更改xaxis.

这是您的代码的工作副本:Jsfiddle 链接

var _a212064_plot_properties;
$(document).ready(function ()
{
    _a212064_plot_properties =
    {
        "legend" :
        {
            "show" : true
        },
        "series" : [
            {
                "label" : "Current Year"
            },
            {
                "label" : "Previous Year"
            }
        ],
        "axes" :
        {
            "xaxis" :
            {

                "label" : "Date",
                "renderer" : $.jqplot.DateAxisRenderer
            },
            "yaxis" :
            {
                "tickRenderer" : $.jqplot.CanvasAxisTickRenderer,
                "tickOptions" :
                {
                    "angle" : -30,
                    "labelPosition" : "middle"
                },
                "labelRenderer" : $.jqplot.CanvasAxisLabelRenderer,
                "labelOptions" :
                {
                    "fontSize" : "13pt"
                },
                "label" : "Organic Visits"
            }
        },
        "highlighter" :
        {
            "bringSeriesToFront" : true,
            "tooltipLocation" : "n",
            "tooltipOffset" : "0",
            "formatString" : "Point <\/span>%s: %s<\/strong><\/div>"
        },
        "cursor" :
        {
            "show" : true,
            "zoom" : true
        }
    }

    $.jqplot.config.enablePlugins = true;
    $.jqplot.config.defaultHeight = 300;
    $.jqplot.config.defaultWidth = 400;
    _a212064 = $.jqplot("a212064", [[[1341115200, 2330], [1343793600, 2768], [1346472000, 2462], [1349064000, 2331], [1351742400, 2198], [1354338000, 2258], [1357016400, 2763], [1359694800, 2399], [1362114000, 2643], [1364788800, 1550], [1367380800, 621], [1370059200, 356]], [[1341115200, 4654], [1343793600, 4105], [1346472000, 4347], [1349064000, 4163], [1351742400, 3849], [1354338000, 5579], [1357016400, 4908], [1359694800, 3690], [1362114000, 2314], [1364788800, 3173], [1367380800, 2608], [1370059200, 2330]]], _a212064_plot_properties);

}
);
于 2013-07-30T17:53:06.030 回答