Bar Chart - Mirrored (Stack)

109 views
Skip to first unread message

Rossco P

unread,
Jun 19, 2012, 6:08:04 AM6/19/12
to google-visua...@googlegroups.com
Hi All,

Is there a way to recreate the following highcharts chart using Google Charts?


Also does anyone know how to change the legend for a mirrored chart to be positive on both sides of the axis i.e. negatives displayed as positive.

All help much appreciated,
Ross.

asgallant

unread,
Jun 20, 2012, 10:48:00 PM6/20/12
to google-visua...@googlegroups.com
Yes, you can do both.  For the first, give the first data set negative values, but use a NumberFormatter to strip the minus sign; for the second, use the same ICU pattern as the hAxis.format option:

// create a format, then format the second and third columns and the hAxis
// the pattern is split into two subpatterns (';' is the separator):
//   the first is the positive numbers, the second is negative numbers
//   use the same pattern for both to make them appear the same (ie, without a minus sign)
var pattern '#,###;#,###';
var formatter new google.visualization.NumberFormat({patternpattern});
formatter.format(data1);
formatter.format(data2);

chart.draw(data{
    hAxis{
        formatpattern
    }
}); 
Reply all
Reply to author
Forward
0 new messages