Taking the code at 
https://developers.google.com/chart/interactive/docs/reference#patternformatter 
as an example. 

The data looks like this

data.addRows([
  ['John Lennon', '[email protected]'],
  ['Paul McCartney', '[email protected]'],
  ['George Harrison', '[email protected]'],
  ['Ringo Starr', '[email protected]']
]);


But suppose the data looks like this:

data.addRows([
  ['John Lennon', ''],
  ['Paul McCartney', '[email protected]'],
  ['George Harrison', ''],
  ['Ringo Starr', '[email protected]']
]);


The formatter looks like this:




*var formatter = new google.visualization.PatternFormat(    '<a 
href="mailto:{1}";>{0}</a>');// Apply formatter and set the formatted value of 
the first column.formatter.format(data, [0, 1]);*


Is it possible to conditionally apply the PatternFormat so that if the 
email data is empty then the formatter is not applied?

I know I could create a new column by stepping through the data, and 
creating and populating that with either the name or the name and an email 
link, but then the column sorting is not going to work properly because 
it's gong to sort on "<" as well as the name.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/8a3c8237-16e3-4ebf-876c-3e714d396350%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to