Rajat Suneja
Rajat Suneja

Reputation: 552

Kendo Charts Linear gauge Decimal Scale

I am having issues in setting decimal scales for Linear Gauge in kendo Charts...

Fiddle

function createGauge() {
     $("#gauge").kendoLinearGauge({

         pointer: {
             value: 0.5,
             size: 15,
             shape: "arrow",
             color: '#0000ff'
         },

         scale: {
             majorUnit: 20,
             minorUnit: 5,
             max: 1,
             labels: {
                 format: "n2"
             },
             vertical: false,
             ranges: [{
                 from: 0,
                 to: 0.3,
                 color: "#00ff00"
             }, {
                 from: 0.3,
                 to: 0.6,
                 color: "#ffff00"
             }, {
                 from: 0.6,
                 to: 1,
                 color: "#ff0000"
             }]
         }
     });
 }

 $(document).ready(function () {
     setTimeout(function () {
         createGauge();

         $("#example").bind("kendo:skinChange", function (e) {
             createGauge();
         });
     }, 400);
 });

When i set decimal ranges the labels of the scale do not appear...

If someone can edit this code... Here is the fiddle

Upvotes: 1

Views: 997

Answers (1)

Manse
Manse

Reputation: 38147

The problem is with your majorUnit and minorUnit .. change

majorUnit: 20,
minorUnit: 5,

to

majorUnit: .20,
minorUnit: .5,

Your scale was 0 to 1 so you need to ensure your major and minor units are between min (default: 0) and max (1 in your case)

Working example here

Upvotes: 1

Related Questions