问题
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