【问题标题】:Error Kendo UI Chart graph e.slice is not a function错误 Kendo UI Chart graph e.slice is not a function
【发布时间】:2017-08-01 00:05:11
【问题描述】:

您好,我正在尝试使用 Kendo Chart 绘制图表,但它给了我一个错误:

 var datosConFormato={}
            for(var x=0;x<datos.datos.length;x++){
                var dato={};
                dato.DIA=datos.datos[x][0];
                dato.TOTAL=datos.datos[x][1];
                datosConFormato[x]=dato;
            }

            $("#chartEvolucion").kendoChart({
                chartArea: {
                    height: 200
                },
                dataSource: {
                    data: datosConFormato
                },
                legend: {
                     position: "bottom"
                 },
                series: [{
                    type: "column",
                    field: "TOTAL",
                    name: "Total de consultas por días"
                }],
                seriesColors: ["#03a9f4"],
                tooltip: {
                    visible: true,
                    template: "#= dataItem.DIA # - ${ value } Consulta(s)"
                }
            });

还有错误:

 Uncaught TypeError: e.slice is not a function
at init.success (kendo.all.min.js:11)
at Object.success (kendo.all.min.js:11)
at init.read (kendo.all.min.js:11)
at kendo.all.min.js:11
at init._queueRequest (kendo.all.min.js:11)
at init.read (kendo.all.min.js:11)
at init.query (kendo.all.min.js:11)
at init._query (kendo.all.min.js:11)
at init.fetch (kendo.all.min.js:11)
at init._initDataSource (kendo.all.min.js:58)

它不会将值扔到平面中 DIA 是 String 而 TOTAL 是数字,有什么问题?

【问题讨论】:

    标签: javascript arrays json graph kendo-ui


    【解决方案1】:

    您可以尝试将“.d”添加到数据源绑定中吗?当我从 .net 2.0 迁移到 .net 4.5 时,我遇到了类似的问题,添加“.d”解决了我的问题,我不知道为什么,但你可以试一试。

    dataSource: {
                    data: datosConFormato.d
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-26
      相关资源
      最近更新 更多