Getting formated value of selection in Geochart

178 views
Skip to first unread message

Carlos Moreira

unread,
Jun 5, 2013, 9:30:09 AM6/5/13
to google-visua...@googlegroups.com
Hello all

My data is in this format:
data.addRows([[{v:'AU-NSW',f:'New South Wales'},0,'Click to visit Wikipedia']]);

How can I get 'New South Wales' on a string to use it after a user selects that region?
Let's say, for example, I want to have it on an alert box? I tried a couple of thing with no sucess. Is it possible to do it?

google.visualization.events.addListener(chart, 'select', function() {
  var selection = chart.getSelection();
  if (selection.length == 1) {
  var selectedRow = selection[0].row;
  var selectedRegion = data.getValue(selectedRow, 0);
  var selectedRegionrow = data.getValue(selectedRow, 1);
  var selectedRegiontooltip = data.getValue(selectedRow, 2);
 var selectedRegionformated = ?????;

  alert(selectedRegionformated);
  }
  });


Thank you for your help!
Greetings
Carlos

Sergey Grabkovsky

unread,
Jun 5, 2013, 9:52:37 AM6/5/13
to google-visua...@googlegroups.com
You can use data.getFormattedValue(selectedRow, selectedColumn) to get the formatted value from a DataTable. You may find the documentation for this method here.

Happy coding!

- Sergey



Carlos

--
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 http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Carlos Moreira

unread,
Jun 5, 2013, 10:06:45 AM6/5/13
to google-visua...@googlegroups.com
Thank you Sergey!
Thank you for the prompt reply and the link! Works perfectly.
cheers

- Sergey


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages