I am unable to add custom tooltip for type:'Lines'
charts, as I did for clusturedbar and pie charts.
This is the code I am using..
makeCharts = function(){
var chart1 = new dojox.charting.Chart2D("simplechart");
chart1.addPlot("default",{
type: 'Lines',
markers: true,
tension: 'S',
lines: true,
areas: false,
labelOffset: -30,
labels:true,
shadows: { dx:10, dy:12, dw:12 }
});
chart1.addAxis("x");
chart1.addAxis("y", {vertical: true});
chart1.addSerie开发者_高级运维s("Series 1", [{y:1, tooltip:'bla bla'},
{y:2, tooltip:'bla bla'},
{y:2, tooltip:'bla bla'},
{y:3, tooltip:'bla bla'},
{y:4, tooltip:'bla bla'},
{y:5, tooltip:'bla bla'},
{y:5, tooltip:'bla bla'},
{y:7, tooltip:'bla bla'}]
);
new dojox.charting.action2d.Magnify(chart1, 'default');
new dojox.charting.action2d.Tooltip(chart1, 'default');
chart1.render();
};
dojo.addOnLoad(makeCharts);
Note: if I am using the json notation in the add series ({y:1, tooltip:'blabla'})
, even chart is not shown up. Chart is coming only when I give addseries('series 1', [1,2,2,3,4,5,5,6]);
Can anyone tell me what is the wrong in my code to get custom tooltip?
Thanks in advance!
I was trying to do this for a Dojo line chart - had to change to an x,y chart as it seems lines only takes an array of numbers. This example helped me - http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/charting/tests/test_event2d.html
An array of x: and y: and tooltip: works
{x: 1, y: 2, tooltip: "hello"}, {...}
If like me you want x to be a set of dates or other non numerical markers then just add ->
chart1.addAxis("x", {
labels: [
{value: 0, text: "20110901"},
{value: 1, text: "20110902"},
{value: 2, text: "20110903"},
... etc
],
rotation: 90})
精彩评论