Jul 26, 2016, 6:01 AM
12 Posts

DOJO Column chart Data Formatting

  • 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

Hi All,

In clustered column chart, is there any way to show the data within each bar as percentage instead of numbers only?

By default, the chart displays actual count within the bars.

Currently, the chart is being rendered like this:

 

In place of 2.0,1.0.---- it should display 67%,33%,-----,75%,-----.

Please guide me how I can achieve this.

 

Thanks...

 

 

Aug 23, 2016, 11:54 AM
94 Posts
can you use hover text instead?

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)