简体   繁体   English

莫里斯甜甜圈图标签显示未定义的错误

[英]Morris Donut Chart label is showing undefined error

I am using Morris Donut chart to display the progress. 我正在使用Morris Donut图表显示进度。 I am getting the count of status correctly. 我正确地获得了状态计数。 But instead of Label it is showing undefined in the donut chart. 但是,它不是Label而是在甜甜圈图中显示未定义。

Morris Donut Chart Showing Undefined Error as Label Morris Donut图表将未定义的错误显示为标签

    var dtData = _.groupBy(jsonData, "status");
    var keys = [];
    keys = Object.keys(dtData);
    dtArr = [];

        for (var n = 0; n < keys.length; n++) {

            dtArr.push({
                name: '' + keys[n] + '', value: '' + dtData[keys[n]].length + '',

            });

        }
    Morris.Donut({ element: 'dashboard-donut-8', 
data: dtArr, 
label: 'name', 
value: 'value', 
colors: ['#33414E', '#E04B4A', '#1caf9a', '#95b75d'], 
resize: true });

I am getting the value correctly. 我正确地获得了价值。 But getting as undefined for label. 但是获得标签的未定义。

Please help me on this 请帮我

Thank You 谢谢

您应该使用钥匙标签而不是名称

label: '' + keys[n] + '', value: '' + dtData[keys[n]].length + '',

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM