【发布时间】:2016-11-12 16:44:21
【问题描述】:
如何在 django-graphos google Column Chart 中为每个列系列设置颜色?
要做到这一点,谷歌图表在文档中有这个 (https://developers.google.com/chart/interactive/docs/gallery/columnchart#coloring-columns)
var data = google.visualization.arrayToDataTable([
['Element', 'Density', { role: 'style' }],
['Copper', 8.94, '#b87333'], // RGB value
['Silver', 10.49, 'silver'], // English color name
['Gold', 19.30, 'gold'],
]);
但是当我在 django-graphos 的数据数组中使用它时
data = [
['Type', 'Amount', { role: 'style' }],
['Current Month', 2000, '#b87333'], // RGB value
['Previous Month', 3000, 'silver'], // English color name
]
我收到此错误:给定轴上的所有系列必须是相同的数据类型。
我应该怎么做才能在 django-graphos 中为谷歌柱形图的每个列系列设置不同的颜色?
谢谢
【问题讨论】:
-
为每个
'Element'使用一列,而不是一行 -- 然后使用colors配置选项
标签: django graph google-visualization