1

I have a kendo linear gauge defined like this...

$("#gauge").kendoLinearGauge({

    pointer: {
        value: 4.5,
        shape: "arrow"
    },

    scale: {
        majorUnit: 1,
        minorUnit: 1,
        max: 6,
        ranges: [
            {
                from: 0,
                to: 1,
                color: "#ffc700"
            }, {
                from: 1,
                to: 2,
                color: "#ff7a00"
            }, {
                from: 2,
                to: 3,
                color: "#c20000"
            }, {
                from: 3,
                to: 4,
                color: "#FF0000"
            }, {
                from: 4,
                to: 5,
                color: "#00FF00"
            }, {
                from: 5,
                to: 6,
                color: "#0000FF"
            }
        ]
    }
});

And this produces a gauge that looks like this...

enter image description here

What I want to do is replace the numeric labels with string values like "Unverified", "Verified", "Open", etc so that I end up with something more akin to this...enter image description here

I'm fairly confident that I should be able to do this using a template, but I can't get even the simplest of examples (including the one shown below from the telerik website) to work.

$("#linear-gauge").kendoLinearGauge({
     scale: {
         labels: {
             // labels template
             template: "#= value #%"
         }
     }
});

Can anyone offer any suggestions?

Stuart Hemming
  • 1,553
  • 2
  • 21
  • 44

1 Answers1

2

Create a template function

template: function (rec) {
    var label;
    switch (rec.value) {
        case 0:
            label = 'un verified';
            break;
        case 1:
            label = 'verified';
            break;
        default:
            label = 'open';
    }
    return label;
}

http://dojo.telerik.com/@harsh/EgeVa

Harsh
  • 1,072
  • 1
  • 10
  • 16