添加文本到dojo图表(在这种情况下是散点图) [英] add text to dojo chart (in this case scatter chart)
问题描述
我想添加自定义文本到我的(散点图)。我可以找到一个例子,也可以找到任何其他适当的dojo函数。
I want to add custom text to my (scatter) chart. I could netiher find an example nor any other appropriate dojo function for that.
现在我有一个分散图的每个点的工具提示,但我宁愿有一个标签。
By now I have a tooltip for each point of my scatter chart, but I'd rather like to have a label for it.
任何想法?
谢谢!
推荐答案
您需要升级到dojo 1.9.7至少使用这个答案:
首先,你必须设置一个新的选项: labelStyle:'outside'。如果标签宽度大于圆圈,则将文本置于圆圈上方。
下一个选项是:
You need to upgrade to dojo 1.9.7 at least to use this answer: First of all, You have to set a new option: "labelStyle: 'outside'". This position the text uppon the circle in case the label width is larger than than the circle. The next option to use is:
labelFunc:function(value){
return value.text;
}
此功能告诉Chart要显示的标签。
我更新了小提琴的例子:更新了JSFiddle
labelFunc: function(value){ return value.text; } This function tells the Chart which label to display. I updated the fiddle example: Updated JSFiddle
这篇关于添加文本到dojo图表(在这种情况下是散点图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!