majorTicksColor by interval into dojox gauges using dojo toolkit

坚强是说给别人听的谎言 提交于 2019-12-06 13:32:31

问题


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:


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();
});



来源:https://stackoverflow.com/questions/15642472/majortickscolor-by-interval-into-dojox-gauges-using-dojo-toolkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!