HighCharts:如何组合自定义颜色与渐变 [英] HighCharts: How to combine custom colors with gradient
本文介绍了HighCharts:如何组合自定义颜色与渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于有些时候,现在我玩着我的饼图...和我有我的自定义颜色没有渐变,或默认颜色渐变...我的颜色存储在php字段,我想加载像 colors:<?echo $ myColors;?>
。
我的代码的实际状态是这样(它显示默认颜色渐变):
For some while now Im playing with coloring of my pie chart... And either I got my custom colors without gradient, or default colors with gradient... My colors are stored in php field, which I want to load like colors: <?echo $myColors;?>
.
Actual state of my code is like this (it shows default colors with gradient):
colors: Highcharts.map(Highcharts.getOptions().colors, function(color) {
return {
radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
})
我应该如何编辑它以便以简单的方式显示我自己的颜色?我还没有找到什么是停止选项...
How should I edit it so it would show my own colors in simple way? Also I didn´t find what is "stops" option for...
推荐答案
使用 map
而不是Highcharts内置的:
Use your colors in map
instead of Highcharts built-in ones:
colors: Highcharts.map(<?echo $myColors;?>, function(color) {
return {
radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
})
这篇关于HighCharts:如何组合自定义颜色与渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文