我使用c3js并尝试渲染三个层中的每一个,并将每个月的流失条形分组在x轴层下。我的问题是数据结构应该是什么?
目前的数据是:
[
[
"x",
"Tier I",
"Tier II",
"Tier III"
],
[
[
"Apr 2015",
"6"
],
[
"May 2015",
"3"
],
[
"Jun 2015",
"61"
],
[
"Jul 2015",
"4"
]
],
[
[
"Apr 2015",
"13"
],
[
"May 2015",
"3"
],
[
"Jun 2015",
"0"
],
[
"Jul 2015",
"0"
]
],
[
[
"Apr 2015",
"4"
],
[
"May 2015",
"5"
],
[
"Jun 2015",
"4"
],
[
"Jul 2015",
"8"
]
]
当前的c3电话是:
var chart = c3.generate({
data: {
x: 'x',
columns: full,
type: 'bar'
},
bar: {
width: {
ratio: 0.8 // this makes bar width 50% of length between ticks
}
},
axis: {
x: {
type: 'categorized' // this is needed to load string x value
}
},
bindto: '#chart'
});
谢谢!
答案 0 :(得分:4)
请注意,x轴类型为CABasicAnimation * pathAnimation = [CABasicAnimation animationWithKeyPath:@"path"];
pathAnimation.fromValue = (__bridge id)[_startPath CGPath];
pathAnimation.duration = 3.0f;
[myLineShapeLayer addAnimation:pathAnimation forKey:@"animationKey"];
而非category
categorized
小提琴 - http://jsfiddle.net/6au5aLax/
答案 1 :(得分:0)