Dojo charting Tooltips
It took me a while to get the tooltips working on my chart. There was no definitive answer anywhere.
What I found is that in dojo 1.6.1, you need to do the following:
What I found is that in dojo 1.6.1, you need to do the following:
- dojo.require("dojox.charting.action2d.Tooltip");
- chart.addSeries("seriesName", chartData, {plot : "default"}); // Here you have to make sure chartData is an array of objects like this [{y: 1234, tooltip: "Tooltip text 1"},{y: 2000, tooltip: "Tooltip text 2"}]
- tooltip = new dojox.charting.action2d.Tooltip(chart, "default"); // Where default is an already defined plot and chart is also already defined.
- chart.render(); // You MUST declare the tooltip before adding the chart.
I read some stuff out on the net that you have to create a div or add dojoTheme: true to your dojoConfig. From what I did, neither of these are required.
I also read that I have to use a theme. I am already including and using claro, so maybe that requirement was already met in my app.
Good luck. I hope this helps someone.
Comments
Post a Comment