首页 文章

Kendo Barchart自定义工具提示

提问于
浏览
1

是否可以使用数据源中的自定义工具提示文本?

我有这样的数据源架构:

schema: {
                data: "d",
                model: {
                    fields: {
                        text: { type: "string" },
                        value: { type: "number" },
                        desc: { type: "string " }
                    }
                }
            }

我想使用文本作为基本栏值,并使用desc for tooltip,所以我有这个配置:

series: [{
                field: "value",
                categoryField: "desc"
            }],
            categoryAxis: [{
                field: "text"
            }]

并在工具提示配置中:

tooltip: {
                visible: true,
                template: "#= category # : #= value # minutes"
            }

这种配置似乎不起作用 . 有什么方法我只能将 desc 字段用于工具提示吗?

1 回答

  • 1

    只需在kendo模板中使用dataItem对象:

    tooltip: {
        visible: true,
        template: "#= dataItem.desc # minutes"
    }
    

    这是dojo示例:http://dojo.telerik.com/IYOZO .

相关问题