Error applying custom tooltips to a bar chart

View: New views
3 Messages — Rating Filter:   Alert me  

Error applying custom tooltips to a bar chart

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have this code:
chart.addAxis("y", {
  vertical: true,
  minorTicks: false,
  labels: [{text:'a',value: 1},{text:'b',value: 2},{text:'c',value: 3},{text:'d',value: 4},{text:'e',value: 5}]
});
chart.addAxis("x", {
  min: 0,
  max: 2,
  minorTicks: false
});
chart.addSeries('z', [2,1,2,0,1]);
It works perfectly. If I now try to add a custom tootip here modifying the series data
chart.addSeries('z', [{x:2, tooltip:'a'},{x:1, tooltip:'a'},{x:2, tooltip:'a'}..]);
It fails with a JS error. The error disappears when the values of x are all different (say 1,2,3,4,5) but even then no bar is painted. Can anyone spot the problem?

Regards

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Error applying custom tooltips to a bar chart

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For those interested. It seems that tooltips are generated in different ways depending on the chart type. For bars I ended up with:

new dojox.charting.action2d.Tooltip(pollgraph${fn:replace(id, ".", "_")}, "default", {
   text: function (o) {
      return "whatever";
   }
});

On Mon, Jun 8, 2009 at 10:35 AM, Jose Noheda <jose.noheda@...> wrote:
I have this code:
chart.addAxis("y", {
  vertical: true,
  minorTicks: false,
  labels: [{text:'a',value: 1},{text:'b',value: 2},{text:'c',value: 3},{text:'d',value: 4},{text:'e',value: 5}]
});
chart.addAxis("x", {
  min: 0,
  max: 2,
  minorTicks: false
});
chart.addSeries('z', [2,1,2,0,1]);
It works perfectly. If I now try to add a custom tootip here modifying the series data
chart.addSeries('z', [{x:2, tooltip:'a'},{x:1, tooltip:'a'},{x:2, tooltip:'a'}..]);
It fails with a JS error. The error disappears when the values of x are all different (say 1,2,3,4,5) but even then no bar is painted. Can anyone spot the problem?

Regards


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Error applying custom tooltips to a bar chart

by Eugene Lazutkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bar/column charts don't support composite values yet, only numbers.

Thanks,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 06/08/2009 03:35 AM, Jose Noheda wrote:

> I have this code:
>
> chart.addAxis("y", {
>   vertical: true,
>   minorTicks: false,
>   labels: [{text:'a',value: 1},{text:'b',value: 2},{text:'c',value: 3},{text:'d',value: 4},{text:'e',value: 5}]
> });
> chart.addAxis("x", {
>   min: 0,
>   max: 2,
>   minorTicks: false
> });
>
> chart.addSeries('z', [2,1,2,0,1]);
>
> It works perfectly. If I now try to add a custom tootip here modifying
> the series data
>
> chart.addSeries('z', [{x:2, tooltip:'a'},{x:1, tooltip:'a'},{x:2, tooltip:'a'}..]);
>
> It fails with a JS error. The error disappears when the values of x are
> all different (say 1,2,3,4,5) but even then no bar is painted. Can
> anyone spot the problem?
>
> Regards
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest