本文介绍了具有梯度情节带的Highchart的测量仪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Highcharts测量仪。有没有办法将绘图区设置为线性渐变?如果我的衡量标准值为0-100,我希望情节乐队从0红色变为50黄色变为100绿色。

我以为我可以为每个停止点1-100生成单独的plotband部分,但是如果有一种方法可以设置一个更清洁的线性外观。任何一个人都知道一个方法吗?

解决方案

是的,这是可能的。尝试如下所示:

  yAxis:{
min:0,
max:100,
plotBands:[{
color:{
linearGradient:[300,300,0,0],
stops:[
[0,'rgb(255,255, 255)'],
[1,'rgb(150,200,155)']
]
},
从:0,
到:100
}],
},



通过仔细选择颜色,linearGradients和从/到,你应该能够结合几个情节带来做你想做的事。


I am trying to use the Highcharts gauge. Is there a way to set the plotband to a linear gradient? If my gauge has a value from 0-100, I want the plot band to shift from red at 0 to yellow at 50 to green at 100.

I thought that I could just generate the indiviual plotband sections for each stop point, 1-100 but if there was a way to set a linear grandient that would be so much cleaner. Any one know a way?

解决方案

Yes, it is possible. Try something like this:

yAxis: {
        min: 0,
        max: 100,
        plotBands: [{
            color: {
                linearGradient:  [300, 300, 0, 0],
                stops: [
                    [0, 'rgb(255, 255, 255)'],
                    [1, 'rgb(150, 200, 155)']
                ]
            },
            from: 0,
            to: 100
        }],
    },

http://jsfiddle.net/fsQZ7/

By carefully chosing your colours, linearGradients and from/to, you should be able to combine several plotbands to do what you want.

这篇关于具有梯度情节带的Highchart的测量仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 14:00