【发布时间】:2019-04-15 05:54:21
【问题描述】:
我目前正在使用 c3 图表来绘制 Stack 条形图。我可以根据点击事件填充动态数据,它工作正常,但是当我查看图表时,显示在图表中的条形图根据我的输入没有正确定位
这里附上我的示例代码:
Rowvalue = [['1-10'].concat(processed_value_final0),
['11-50'].concat(processed_value_final1),
['51-200'].concat(processed_value_final2),
['201-500'].concat(processed_value_final3),
['501-1k'].concat(processed_value_final4)];
groupCol = ['1-10', '11-50', '51-200', '201-500', '501-1k'];
var chart = c3.generate({
bindto: div_id,
data: {
columns:Rowvalue,
type: 'bar',
order: 'asc',
groups: [
groupCol
]
},
bar: {
width: barwd
} ,
grid: {
y: {
show: true,
lines: [{value:0}]
}
},
axis: {
x:
{
type: 'category',
categories: keyValue
},
y:
{
min : 0,
padding : {
bottom : 0
}
}
},
color: {
pattern: ['#ED5565', '#23C6C8', '#F8AC59', '#1AB394', '#1C84C6', '#F8AC59', '#23C6C8', '#ED5565', '#F8AC59']
},
legend:
{
show: true,
position:'right'
},
tooltip :
{
show:true
}
});
【问题讨论】:
标签: javascript positioning c3.js