Kendo Charts线性规格十进制比例

时间:2013-05-17 10:28:55

标签: jquery kendo-ui

我在为剑道图表设置线性量表的十进制刻度时遇到问题...

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

当我设置小数范围时,标尺的标签不会出现......

如果有人可以编辑此代码......以下是fiddle

1 个答案:

答案 0 :(得分:1)

问题在于您的majorUnitminorUnit ..更改

majorUnit: 20,
minorUnit: 5,

majorUnit: .20,
minorUnit: .5,

您的比例为0比1,因此您需要确保您的主要和次要单位介于最小值(默认值:0)和最大值(在您的情况下为1)

Working example here