Every Dojo chart that I have worked with has allowed for the use of an array of objects that contain the series of values and tooltips for each value point.

When using the StackedAreas chart type, Dojo seems to ignore my values inside the objects. For example:

var values = [
    {x: 1, y: 10, tooltip: 'test1'},
    {x: 2, y: 30, tooltip: 'test2'},
    {x: 3, y: 60, tooltip: 'test3'}
];

This works in Lines, Columns and StackedColumns chart types. The chart renders the axis and you can see the markers sitting on the base line of the char as if I had only supplied zero for all values.

Thanks in advance. Hope this makes sense.

有帮助吗?

解决方案

The doc specifies the different types on this page : http://dojotoolkit.org/reference-guide/dojox/charting.html in the paragraph "Connecting Charts to Data and Specifying a Data Series".

For any non “stacked” line plot type you can specify coordinate pairs. You need to use keys that correspond to the hAxis and vAxis parameters defined in the addPlot() call. These default to x and y.

[...]

With any of the stacked plot types each data set added with addSeries() is placed relative to the previous set. Here is a simple example that shows this concept. Instead of the second data set being a straight line across at 1, all the points are 1 above the point from the first data set.

chart1.addSeries("Series 1", [1, 2, 3, 4, 5]);
chart1.addSeries("Series 2", [1, 1, 1, 1, 1], {stroke: {color: "red"}});

So, for your tooltips on a stackedareas graph, first you have to activate the markers on your plot, then you have to use a custom dojox/charting/action2d/Tooltip, which takes a custom function to produce the desired tooltip.

I've made an example here : http://jsfiddle.net/psoares/nUe3C/

Hope it helps...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top