【发布时间】:2017-02-25 17:36:56
【问题描述】:
我可以通过 c3.js 实现这一目标
这是我的 c3.js 代码。
var chart = c3
.generate({
bindto : "#topUses",
size : {
height : 180,
width : 400
},
bar : {
width : 14
},
padding : {
left : 100,
top : 50
},
color : {
pattern : [ '#ff1919', '#ff1919', '#ff1919', '#ff1919',
'#ff1919' ]
},
data : {
x : 'x',
columns : [
[ 'x', 'Google', 'Yahoo', 'Facebook',
'Capital One', 'Express' ],
[ 'value', 160, 310, 232, 405, 200 ] ],
type : 'bar',
color : function(inColor, data) {
var colors = [ '#ff1919', '#ff1919', '#ff1919',
'#ff1919', '#ff1919' ];
if (data.index !== undefined) {
return colors[data.index];
}
return inColor;
}
},
axis : {
rotated : true,
x : {
type : 'category',
show : false,
},
y : {
show : false
}
},
tooltip : {
grouped : false
},
legend : {
show : false
}
});
我想实现这个,有什么想法吗?
【问题讨论】:
标签: javascript charts bar-chart c3.js