KendoUI条形图类别Axis分组问题

时间:2015-02-22 21:04:21

标签: javascript kendo-ui bar-chart

当分组中缺少任何一个项目时,我遇到了categoryAxis的问题。我修改了以下小提琴中的代码

http://jsfiddle.net/v8tsQ/9/

我已将javascript替换为: -

var dr = 
  [{
      "currency":"AUD",
      "paymenttype":"0",
      "amount":"10"
   },
   {
      "currency":"AUD",
      "paymenttype":"3",
      "amount":"11"
   },
   {
      "currency":"CAD",
      "paymenttype":"1",
      "amount":"24"
   },
   {
      "currency":"CAD",
      "paymenttype":"0",
      "amount":"23"
   },
   {
      "currency":"CAD",
      "paymenttype":"3",
      "amount":"22"
   }]

var ds = new kendo.data.DataSource({
    data: dr,
    group: {
        field: "paymenttype"
    },
    sort: [{
        field: "paymenttype",
        dir: "asc"
    }, {
        field: "currency",
        dir: "asc"
    }]

})

$("#chart").kendoChart({
    dataSource: ds,
    seriesDefaults: {
        type: 'column',
        labels: {
            visible: true,
            template: "#=kendo.format('{0:0}', value)#"
        }
    },
    legend: {
        visible: true,
        position: "bottom"
    },
    series: [{
        field: "amount"
    }],
    categoryAxis: {
        field: "currency"
    },
    tooltip: {
        visible: true,
        template: "#= dataItem.currency#"
    }
});

问题:

对于类型1,CAD货币显示在AUD下,货币AUD不存在。

请建议。 感谢

0 个答案:

没有答案