[英]Emprise Javascript Bar Charts - How to create grouped bars in bar chart
I'm trying to create a bar chart where the data is grouped. 我正在尝试创建将数据分组的条形图。 Eg.
例如。 let's say the first 4 bars are 'Dark Orange', the next 10 are 'Fire Brick', the next 5 are 'Dark Orchid' & the last group are Yellow.
假设前4个小节为“深橙色”,接下来的10个为“火砖”,接下来的5个为“暗兰花”,最后一组为黄色。 I know there's a property called groupdBars, but I'm unsure of how to utilise this:
我知道有一个名为groupdBars的属性,但是我不确定如何利用此属性:
http://www.ejschart.com/help/index.html?ejsc_barseries_properties_groupedbars.html http://www.ejschart.com/help/index.html?ejsc_barseries_properties_groupedbars.html
Anyone know how I do this? 有人知道我该怎么做吗? I thought I could do it like below, but it doesn't work:
我以为我可以像下面那样做,但是不起作用:
var chart = new EJSC.Chart("myChart", {
show_legend: false
});
chart.addSeries(new EJSC.BarSeries(
new EJSC.ArrayDataHandler([
[[1,1],[2,1],[3,1]],
[[4,1],[5,1],[6,1]],
[[7,1],[8,1],[9,1]],
[[10,1],[11,1],[12,1]]
]),
{
lineWidth: 0,
title: "The Green Series",
groupedBars: true,
useColorArray: true ,
defaultColors: [
'rgb(255,140,0)', //DarkOrange
'rgb(178,34,34)', //FireBrick
'rgb(153,50,204)', //DarkOrchid
'rgb(255,255,0)' //Yellow
]
}
));
I'm a bit of a newbie when it comes to Emprise... :) 关于Emprise我有点新手... :)
Found it out myself :) You add them as separate 'series': 我自己发现的:)您将它们添加为单独的“系列”:
var chart = new EJSC.Chart("myChart", {
show_legend: false,
groupedBars: true
});
chart.addSeries(new EJSC.BarSeries(
new EJSC.ArrayDataHandler([
[1,1],[2,1],[3,1]
]),
{
lineWidth: 0,
color: "rgb(255,140,0)"
}
));
chart.addSeries(new EJSC.BarSeries(
new EJSC.ArrayDataHandler([
[4,1],[5,1],[6,1]
]),
{
lineWidth: 0,
color: "rgb(178,34,34)"
}
));
etc 等等
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.