由于某种原因,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);
}
);
有什么想法吗?将日期放入该标签是我最不明白的事情。
谢谢!
最佳答案
您需要更改xaxis
的参数。
这是您的代码的工作副本:Jsfiddle link
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);
}
);
关于javascript - jqplot 1个月失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17951034/