【问题标题】:Kendo Chart - no data message剑道图 - 无数据信息
【发布时间】:2014-05-24 04:35:35
【问题描述】:

我正在使用 Kendo 饼图,并且我想将其配置为在没有要显示的数据时显示一条消息。我正在使用以下 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"
            }
        });
    }

【问题讨论】:

    标签: charts kendo-ui kendo-chart


    【解决方案1】:

    剑道饼图没有任何内置机制来在没有数据时显示消息。

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

    HTML:

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

    JS:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多