majorTicksColor by interval into dojox gauges usin

2019-04-15 18:44发布

I'm trying to use dojo toolkit and exactly this gauge.

In fact, I want a feature to majorTicksColor and minorTicksColor, I want the color depends for the interval, eg : from 0 to 30 green, from 30 to 70 yellow and from 70 red to 100, or maybe it is degraded.

Like this image.

Is that possible ?

Thank you.

Regards,

1条回答
【Aperson】
2楼-- · 2019-04-15 19:13

Something like this fiddle?

The principal here is to use an aspect to enhance the drawRange method of the dojox/gauges/GlossyCircularGauge widget.

//
// Use the new "drawGreenYellowRedCurves" as an *after* aspect to the existing "drawRange" function.
//
require(['dojox/gauges/GlossyCircularGauge', 'dojo/aspect', 'drawGreenYellowRedCurves', 'dojo/domReady!'],
  function (GlossyCircularGauge, aspect, drawGreenYellowRedCurves) {
    var gauge = new GlossyCircularGauge({
        background: [255, 255, 255, 0],
        title: 'Value',
        id: "glossyGauge",
        width: 300,
        height: 300
    }, dojo.byId("CircularGauge"));
    aspect.after(gauge, "drawRange", drawGreenYellowRedCurves, true);
    gauge.startup();
});

Image of gauge

查看更多
登录 后发表回答