Kendo 带标签的图表模板,在里面显示 html 标签

Kendo chart template with label, show html tag inside

您好,我正在使用 Kendo 图表,我正在使用模板显示标签,我正在通过 html 标签格式化标签,但格式化不起作用。 请检查图像

同样适用于其他 kendo 元素,但不适用于图表

下面是我的代码

 $("#chart").kendoChart({
                    ..
                    seriesDefaults: {
                        type: "line",
                        style: "smooth",
                        labels: {
                            visible: true,
                            position: "auto",
                            template: kendo.template('<b>sss</b>')

                           }
                    ..
)};

嗯, 我只找到了这个解决方案:

labels: {
    template: "Year: #: value #",
    font: "bold normal 15px Arial,Helvetica,sans-serif", // or any font
},

看起来 html 完全不受支持

编辑:

好吧,我有点玩那个和下一个例子我发现了什么。的确,它不是 100% 清楚,但您可以根据需要使用此代码片段格式化文本。

要点是您可以将函数分配给颜色或字体属性..

labels: {
    visible: true,
    position: "auto",
    template: kendo.template('#=MyFunction(value) #'),
    color: Test,
    font: Test2
}

function Test(e)
{
        console.log(e.value);

        if(e.value %2 == 0)
        {
            return "red";
        }
        else
        {
            return "blue";
        }
}

Example here