自定义图例标签 [英] Custom Legend Label
本文介绍了自定义图例标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下实现,它可以正常工作.但是我想将fname
属性指定为图例,而不是series
属性.
I have the following implementation, it works and functional. However I would like to assign fname
attribute as a legend, not series
attribute.
我认为我需要处理以下代码行,但是我还无法弄清楚.
I believe that I need to work on the following line of code, but I could not able to figure out yet.
var label = new kendo.drawing.Text(e.series.name, [0, 0], {
fill: {
color: "black"
}
});
http://jsfiddle.net/1ost124j/1/
推荐答案
应该使用e.series.data[1].fname
之类的方法.
更准确地(根据您的建议),以下是完全有效的代码
More accurately (based on your suggestion) the below is the fully working code
for (var i = 0; i < e.series.data.length; i++) {
if (e.series.data[i].valueColor != "" && e.series.data[i].fname != "") {
color = e.series.data[i].valueColor,
legendName = e.series.data[i].fname
}
}
var label = new kendo.drawing.Text(legendName, [0, 0], {
fill: {
color: "black"
}
});
通过演示 http://jsfiddle.net/1ost124j/3/
With a demo http://jsfiddle.net/1ost124j/3/
这篇关于自定义图例标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文