If a "%" is used as an Value suffix, it does weird stuff to Y-axis and output

For example, if a value is 0.37, adding "%" will make the output 0.37%, which is about right
If a value is 3.7, adding "%" will make the output 370%, which is wrong
If a value is 37, adding "%" will make the output 3700%, which is wrong, again.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Thanks for the report! I think this is an auto-formatting thing done by the charting library. Are you using Google or Highcharts in this example?

I don't think Highcharts would cause this problem, but Google specifically states a format that includes a % sign gets auto-formatted:

The format string is a subset of the ICU pattern set. For instance, {pattern:'#,###%'} will result in output values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.

My guess is we need to escape that % sign before attempting to use it as a suffix.

quicksketch’s picture

Status: Active » Fixed
FileSize
1.55 KB

This patch should fix the problem with special characters causing unexpected formatting in Google.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.