[[["09251A0428",90],["10251A0547",37]],[["09251A0428",4],["10251A0547",54]]]
以上数据包含两个系列。每个系列的x值相同。如果x值是数字,则jqplot显示具有两个系列的折线图。但我们需要在x轴上显示字符串,并为每个字符串显示相应的系列值。
如何在xaxis上为jqplot的多个系列折线图设置字符串?
答案 0 :(得分:1)
我根据您拥有的数据为您准备了一个示例: JsFiddle link
$.jqplot.config.enablePlugins = true;
var chartData = [[["09251A0428",90],["10251A0547",37]],[["09251A0428",4],["10251A0547",54]]];
function PlotChart(chartData) {
var plot2 = $.jqplot('chart1', chartData, {
title: 'Mouse Cursor Tracking',
seriesDefaults: {
pointLabels: {
show: true
}
},
axes: {
xaxis: {
pad: 1,
// a factor multiplied by the data range on the axis to give the
renderer: $.jqplot.CategoryAxisRenderer,
// renderer to use to draw the axis,
tickOptions: {
formatString: '%b %#d'
}
},
yaxis: {
}
},
highlighter: {
sizeAdjust: 7.5
},
cursor: {
show: true
}
});
}
PlotChart(chartData);