最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - HighCharts: How to combine custom colors with gradient - Stack Overflow

programmeradmin0浏览0评论

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...

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...

Share Improve this question asked Feb 13, 2013 at 10:29 Michal SMichal S 1,1136 gold badges19 silver badges32 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

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
        ]
    };
})
发布评论

评论列表(0)

  1. 暂无评论