This is a migrated thread and some comments may be shown as answers.
Update ranges in linear gauge dynamically
3 Answers 54 Views
This is a migrated thread and some comments may be shown as answers.
Nicklas
Top achievements
Rank 1
Nicklas asked on 12 Sep 2013, 01:31 PM
I have a Linear Gauge looking like this:
function createGauges(conveyanceId) {
        $("#depthBar-" + conveyanceId).kendoLinearGauge({
            pointer: {
                value: 0,
                shape: "arrow",
                color: "transparent",
                start: 0,
                reverse: true
            },
            scale: {
                majorUnit: 500,
                minorUnit: 100,
                labels: {
                    visible: false
                },
                min: -2000,
                max: 2000,
                vertical: false,
                reverse: false,
                ranges: [
                    {
                        from: -2000, // LimitLo
                        to: -1500,
                        color: "#ffc700"
                    },
                    {
                        from: 2000, // LimitHi
                        to: 1500,
                        color: "#ffc700"
                    }, {
                        from: 2000, // LimitHiHi
                        to: 1800,
                        color: "#c20000"
                    }, {
                        from: -5000,
                        to: -1800,
                        color: "#c20000" // LimitLoLo
                    }, {
                        from: 0,
                        to: 0,
                        color: "lightblue"
                    }
                ]
            }
        });
Is it possible to update the ranges dynamically with a custom input number?
I'm trying to get the gauge like this: (I'm able to locate the gauge with no problems, it's just the ranges I cannot seem to locate correctly :))
$('#depthBar-' + conveyanceId).data("kendoLinearGauge").options.scale.ranges[4].to = depthMessage;
Any help / suggestions would be greatly appreciated :)

3 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Germanov
Telerik team
answered on 16 Sep 2013, 10:09 AM
Hi Nicklas,

After you change the linear gauge ranges you need to redraw it:

var gauge = $("#yourLinearGaugeSelector").data("kendoLinearGauge");
gauge.options.scale.ranges[0].from = 200;
gauge.redraw();

Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nicklas
Top achievements
Rank 1
answered on 16 Sep 2013, 10:15 AM
Thank you! Have you guys planned for this kind of functionality to be implemented? I.e. instead of using the arrow as a pointer, one could use a bar moving up / down, either from center (0) to max / min values or from 0 (min) to x (max).

If not, can I add a request / wish for this somewhere?
0
Hristo Germanov
Telerik team
answered on 16 Sep 2013, 10:32 AM
Hello Nicklas,

Thank you for the feedback.

Currently there is no such functionality available but this is a good idea and I would suggest to submit your request in Kendo's UserVoice so other members of the community can evaluate, comment on and vote for it. 

Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Nicklas
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Nicklas
Top achievements
Rank 1
Share this question
or