Aug 23, 2016, 11:54 AM
94 Posts

can you use hover text instead?

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: DOJO Charts,Clustered column charts,Format series data
  • Replies: 1

I'm displaying data in hover text for each bar like this:  (note that my numbers need some better formatting, though!)

Here's the tool tip snippet from my page - seriestt is an array of x-axis labels...

    var axis1 = seriestt;
    var statval = '#{javascript:sessionScope.StatValue}';
    if(statval=="Dollars"){
        var pattern = "<strong>{0}</strong><br>{1}:&nbsp;&#36;{2}";   //&#36 = $
    }
    else {
        var pattern = "<strong>{0}</strong><br>{1}:&nbsp;{2}";
    }
    var myTooltip = new dojox.charting.action2d.Tooltip(chart2, "default",
        {text: function(o){return dojo.replace(pattern, [o.run.name, axis1[o.index], o.run.data[o.index]]); }});

 

where statval is either Dollars or Hours (so, either show a $ sign or not)