2

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.

Any idea?

Thanks!

gotcha
  • 151
  • 2
  • 14
  • you want to add a permanently visible label for each point on the chart? – Ted Feb 03 '12 at 19:48
  • @TedPrz yes, I want to name the points, so that I don't have to hover over the points for the tooltip. – gotcha Feb 03 '12 at 20:19
  • as far as I know, you can only add labels on the x and y axes for specific values, or labels to a pie chart, but I think what you're looking for doesn't exist – Ted Feb 03 '12 at 21:23
  • ok, thank you...what a pity :( would be also useful for bar charts to write the exact y value of every bar on the bar itself... – gotcha Feb 03 '12 at 23:07
  • I think that this is something that may come along with dojo later on, I know I've read it in a sitepen tutorial before, cant remember which right now. If I were you, with no other solution available, I would just overlay some divs where your bars/columns are with text content of some sort, (you should be able to figure out where exactly to place them from your chart data). – Jeremy Oct 26 '12 at 14:41

1 Answers1

0

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; } This function tells the Chart which label to display. I updated the fiddle example: Updated JSFiddle

Tariq
  • 2,853
  • 3
  • 22
  • 29