I'm using Google Gauges and would like to add a % sign after the value in the gauge. My values display with fine without the percent symbol (whole numbers 0 - 100), but when I start trying to add the percent symbol things get wonky.
Here's what I've tried
// Format the data to include % symbol
var formatter = new google.visualization.NumberFormat(
{suffix: '\u0025'}
//{suffix: '%'}
//{pattern: '#%'}
);
All three attempts display the correct visualization, but for the actual value text I get varying results.
Using either suffix method it adds two decimal places:
6 => 6.00%
26 => 26.00%
and so on
Using the pattern method it multiples the value by 100
6 => 600%
26 => 2600%
and so on
Any clue on how to simply display the value along with a percent symbol?
Pie, line and scatter charts can display a maximum of two dimensions, bar, block and grid charts three.
It's simpler than all that. If you just make a number formatter, specifying the pattern
, and the suffix
, you're all set:
http://jsfiddle.net/fHnnn/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With