0
我试图创建一个jqplot图表,我遇到了一个小问题。同一系列中的jqPlot数据彼此重叠
我希望把所有2008年的数据为一类,并具有一定的色彩风格,然后做同样为2009年
目前我有这样的输出:
how current chart looks (imgur link)
使用此代码:
$(document).ready(function(){
// For horizontal bar charts, x an y values must will be "flipped"
// from their vertical bar counterpart.
var plot2 = $.jqplot('tableTest', [
[[10,2008], [12,2008], [11,2008], [13,2008]],
[[2,2009], [4,2009], [6,2009], [3,2009],]
], {
seriesDefaults: {
renderer:$.jqplot.BarRenderer,
// Show point labels to the right ('e'ast) of each bar.
// edgeTolerance of -15 allows labels flow outside the grid
// up to 15 pixels. If they flow out more than that, they
// will be hidden.
pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
// Rotate the bar shadow as if bar is lit from top right.
shadowAngle: 135,
// Here's where we tell the chart it is oriented horizontally.
rendererOptions: {
barDirection: 'horizontal'
}
},
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
/*rendererOptions: {
groupLabels:['Fruits', 'Vegetables']
}*/
}
}
});
});
有没有人有一个想法,我可以分离出酒吧?
预先感谢您
谢谢你的回复。这很好,但并不完全是我想要做的(不幸的是我问了上面的问题)。这里第一个系列设置为轴标签'2008'。我正在寻找子蜱,所以;系列一数据[10],[12],[11]等被标记为'2008''2009''2010',同时仍然在一起。像这样:[plot example](http://imgur.com/5eotl) 对不起,这是不同于我的原始问题 – blacktea
@blacktea这是你的意思[http://jsfiddle.net/tpp39/3/ ](http://jsfiddle.net/tpp39/3/) – mmcnickle
不完全:更像这样[plot example](http://imgur.com/5eotl)。 虽然我想出了一个不理想的解决方案。我将数据作为单个数组项传入,并传递每个小节的滴答列表。这意味着只有一个系列,限制了我为颜色栏着色的选项。 感谢您的帮助,如果您能想到更好的解决方案,请让我知道 – blacktea