Custom Legend Label

我是研究僧i 提交于 2019-12-12 02:58:51

问题


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/


回答1:


Something like e.series.data[1].fname should do it.


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"
  }
});

With a demo http://jsfiddle.net/1ost124j/3/



来源:https://stackoverflow.com/questions/30658508/custom-legend-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!