Javascript / 调整颜色
Javascript / Adjusting colors
我们正在使用这个 chart。我看到没有 属性 可用于自定义饼图的颜色。
- 有没有办法自定义颜色?
- 此外,我们如何为此启用图例(如果我们可以在图表底部显示图例,那就太好了。例如 this )?并在图表上只显示百分比?
- 要使图表展开,我知道我们需要在数据提供程序中使用 ["pulled": true]。有没有办法在 dataProvider 之外的某个地方提供,而不是在 dataProvider 内部提供它?
自定义颜色有两种方式
1) 使用 colorField
并直接为各个切片定义颜色。
2) 通过修改colors
array or create your own theme.
设置自己的主题
通过在图表配置中设置空图例对象启用图例。您可以找到更多配置属性 in the documentation. You can even change the value label to use percentages by modifying the valueText
property. There's also an example of a pie chart with the legend set up and a completely custom legend。
如果要更改饼图切片标签,请更改 labelText
。
至于你的最后一个问题,不 - 它使用 pulledField
来指定从你的数据中提取哪些切片。没有它就没有爆炸整个图表的设置。
我们正在使用这个 chart。我看到没有 属性 可用于自定义饼图的颜色。
- 有没有办法自定义颜色?
- 此外,我们如何为此启用图例(如果我们可以在图表底部显示图例,那就太好了。例如 this )?并在图表上只显示百分比?
- 要使图表展开,我知道我们需要在数据提供程序中使用 ["pulled": true]。有没有办法在 dataProvider 之外的某个地方提供,而不是在 dataProvider 内部提供它?
自定义颜色有两种方式
1) 使用 colorField
并直接为各个切片定义颜色。
2) 通过修改colors
array or create your own theme.
通过在图表配置中设置空图例对象启用图例。您可以找到更多配置属性 in the documentation. You can even change the value label to use percentages by modifying the valueText
property. There's also an example of a pie chart with the legend set up and a completely custom legend。
如果要更改饼图切片标签,请更改 labelText
。
至于你的最后一个问题,不 - 它使用 pulledField
来指定从你的数据中提取哪些切片。没有它就没有爆炸整个图表的设置。