我对序列图表有一些问题(带旋转系列的列)。
我的dataProvider
没有色域。我使用了颜色选项和一系列颜色,但它仍然不起作用
请帮帮我。
http://jsfiddle.net/bfbgz0sc/1/
答案 0 :(得分:2)
代码段:
//input data
var input=[{
"country": "USA",
"visits": 3025
}, {
"country": "China",
"visits": 1882
}, {
"country": "Japan",
"visits": 1809
}, {
"country": "Germany",
"visits": 1322
}, {
"country": "UK",
"visits": 1122
}, {
"country": "France",
"visits": 1114
}, {
"country": "India",
"visits": 984
}, {
"country": "Spain",
"visits": 711
}, {
"country": "Netherlands",
"visits": 665
}, {
"country": "Russia",
"visits": 580
}, {
"country": "South Korea",
"visits": 443
}, {
"country": "Canada",
"visits": 441
}];
//your custom colors
var colors= ['#FF6600', '#FCD202', '#B0DE09', '#0D8ECF', '#2A0CD0', '#CD0D74', '#CC0000', '#00CC00', '#0000CC', '#DDDDDD', '#999999', '#333333', '#990000']
//inject color attribute with value
for (i = 0; i < input.length; i++) {input[i].color = colors[i];}
//amCharts initialization code goes here
...
...
<强>输出强>
检查此JSFiddle以查看正在运行的解决方案: http://jsfiddle.net/bfbgz0sc/4/
答案 1 :(得分:1)
Colors属性仅适用于单独的图形,不适用于数据项。所以你应该为dataProvider添加颜色。