同一系列的 jqPlot 数据相互重叠
我尝试创建的 jqplot 图表有一个小问题。
我想将 2008 年的所有数据放入一个类别,并使用某种颜色对其进行样式设置,然后对 2009 年执行相同的操作。
目前我有以下输出:
使用此代码:
$(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']
}*/
}
}
});
});
有人知道如何分离柱形图吗?
先感谢您
I have a small issue with a jqplot chart im trying to create.
I want to put all 2008 data into one category and style it with a certain colour, then do the same for 2009.
Currently I have this output:
how current chart looks (imgur link)
Using this code:
$(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']
}*/
}
}
});
});
Does anyone have an idea how I can seperate out the bars?
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您添加自己的自定义刻度,并且数据格式略有不同。我对 jsFiddle 中的代码进行了调整:
You add your own custom ticks, and format the data slightly differently. I've made the adjustments to the code in a jsFiddle: