Kendo图表 - 无数据消息

3

我正在使用Kendo Pie Chart,并希望配置它在没有数据可显示时显示一条消息。我正在使用以下js函数配置饼图 - 变量“JsPieChartDataSet”是一组JSON格式化的数据。

是否有属性可以设置在不存在数据时显示消息?

function pieType() {
        /*Pie chart render*/
        $("#piechart").kendoChart
        ({
            theme: $(document).data("kendoSkin") || "metro",
            title: { visible: true, color: "black", margin: 0, text: JsBreakdownPieTitle },
            legend: { position: "bottom", margin: 0 },             
            seriesDefaults:
            {
                labels: {
                    template: "#= kendo.format('{0:P}', percentage)#",
                    font: "8pt Arial, Helvetica, sans-serif",
                    visible: true,
                    distance: 10
                },
                type: "pie"
            },
            series: JsPieChartDataSet,
            tooltip: {
                visible: true,
                format: "{0:N2} tCO2e",
                font: "10px Arial, Helvetica, sans-serif"
            }
        });
    }
1个回答

1

Kendo饼图没有内置机制来显示如果没有数据的消息。

如果没有可用的数据,您可以自己隐藏图表并显示消息。请参见下面的示例。

HTML:

<div id="noDataNotification" style="display: none;">No data exists.</div>

JS:

if (JsPieChartDataSet.Items.Count == 0)
{
    yourPie.Visible = false;
    $("#noDataNotification").show();
}

PS. 在Telerik论坛中讨论了类似的问题: http://www.telerik.com/forums/no-data-message-pie-chart


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接