dot as grouping separator on vaxis data

1,003 views
Skip to first unread message

Giulio Mastrosanti

unread,
May 17, 2016, 1:15:41 PM5/17/16
to Google Visualization API
HI,

cant find a way to format the vaxis numbers on a AreaChart created by a ChartWrapper linked to a Dashboard

I have managed to format correctly the data loaded using a formatter:

formatter = new google.visualization.NumberFormat({fractionDigits: 0, groupingSymbol:'.'});

and applying it to the data column, but the values that appear as a reference on the vertical axis are using the comma as grouping separator

thank you,

Giulio

Daniel LaLiberte

unread,
May 17, 2016, 2:02:02 PM5/17/16
to Google Visualization API
Hi Giulio,

The axis tick values are generated, so formatting your data won't help.  Instead, you have to specify a format in your vAxis options.

If you need the groupingSymbol option, there is an undocumented way you can get it.  

options: {
  vAxis: { 
    gridlines: { count: -1 }, // variable number of gridlines, enables formatOptions as well.
    formatOptions: { groupingSymbol: '.' },
  }
}


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/367547e2-ad5b-484c-97c9-ad6754fe6ebc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Message has been deleted

Giulio Mastrosanti

unread,
May 17, 2016, 3:11:59 PM5/17/16
to Google Visualization API
Hi Daniel,
thank you for your answer,
but unfortunately I still see commas as group separator for the numbers on the vAxis
while I was able to correctly format the generated data for the hAxis, that's a date
here it is my code for chart creation, including your suggestion ( the AreaChart is created using a ChartWrapper, because it is part of a Dashboard ) :

        var AreaChartasc = new google.visualization.ChartWrapper({
          'chartType': 'AreaChart',
          'containerId': 'chart_Ascolti',
          'options': {
          'title': 'titolo',
          'vAxis': { 
            'gridlines': { 'count': -1 }, // variable number of gridlines, enables formatOptions as well.
            'formatOptions': { 'groupingSymbol': '.' },
           },
          'hAxis': { 'format': 'dd/MM' },
          'crosshair': { 'trigger': 'both' },
          'view': {'columns': [0, 1, 2, 3]}
          }
        });

thanks again for your effort,

Giulio

Giulio Mastrosanti

unread,
May 17, 2016, 3:25:22 PM5/17/16
to Google Visualization API
addendum:

I'm also trying if it could help specifying a format using ICU standard,
and I did try

'vAxis': { 'format': '#.###' },

but that shows me the values without any grouping symbol

and a pattern like:

'vAxis': { 'format': '#.###,#' },

results in chart not displaying and a 'Malformed pattern' error


Daniel LaLiberte

unread,
May 17, 2016, 3:51:33 PM5/17/16
to Google Visualization API
Sorry, my mistake.  There is potential to use the groupingSymbol, but it is not used.  A few other format options are supported, including scaleFactor and prefix, but not groupingSymbol.  I suspect one reason for this is that the grouping symbol is automatically determined based on the locale, so if you add the 'language' property to your google.charts.load() call, you should see the appropriate symbol.

In a format pattern, the comma always represents the grouping symbol, and the period always represents the decimal point.  But then those characters will be replaced with the locale specific character/symbol.


On Tue, May 17, 2016 at 3:04 PM, Giulio Mastrosanti <giu...@bitbazar.com> wrote:
Hi Daniel,
thanks so much for you answer,
but I did try it without success.

I'm able to format as I want the hAxis generated data, that's in date format, but trying to apply your suggestion does not seem to solve the problem,
here a little snippet of code ( the AreaChart id generated using a chartWrapper, because it is part of Dashboard ) :

        var AreaChartasc = new google.visualization.ChartWrapper({
          'chartType': 'AreaChart',
          'containerId': 'chart_Ascolti',
          'options': {
          'title': 'titolo',
          'vAxis': { 
            'gridlines': { 'count': -1 }, // variable number of gridlines, enables formatOptions as well.
            'formatOptions': { 'groupingSymbol': '.' },
           },
          'hAxis': { 'format': 'dd/MM' },
          'crosshair': { 'trigger': 'both' },
          'view': {'columns': [0, 1, 2, 3]}
          }
        });

thsnaks again for your effort,


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.

Giulio Mastrosanti

unread,
May 17, 2016, 4:22:15 PM5/17/16
to Google Visualization API
Daniel,

thank you so MUCH!

I wasn't aware of the possibility os settings the language on load,
it solved my symbol problem, and I think will help me on much more ways.

thanks again!



the grouping symbol is automatically determined based on the locale, so if you add the 'language' property to your google.charts.load() call, you should see the appropriate symbol.


Reply all
Reply to author
Forward
0 new messages