Yes, you can do that. If the URL is in the fifth column, then you would do
it like this:
var formatter = new google.visualization.PatternFormat('<a href="{1}"><img
src="{0}" /></a>');
// replace the '{0}' in the patter with the contents of column 3 (the
links) and the '{1}' with the contents of column 4 and put the result in
column 0
formatter.format(data, [3, 4], 0);
The way this works is that the formatter takes the values from the columns
in the array (the second parameter to the format call) and maps them to the
bracketed numbers in the pattern, where the number in the bracket
corresponds to the index in the array (not the index of the column!). In
this case, since 3 is at index 0 in the array, the {0} gets replaced with
the contents of column 3.
On Wednesday, October 24, 2012 1:39:25 PM UTC-4, Billy Bones wrote:
>
> Follow up question.
>
> If I want those images to also be individual links, is there a way to use
> the formatter to do that?
>
> for example, the formatter below will send every click to "markdash" but I
> would like to replace "markdash" with different urls that go with each
> picture. Is it possible to have two options built into the formatter?
>
> var formatter = new google.visualization.PatternFormat('<a
> href=/markdash><img src="{0}" />');
> // replace the '{0}' in the patter with the contents of column 3
> (the links) and put the result in column 0
> formatter.format(data, [3], 0);
>
> I really appreciate all the help! I started this project knowing
> absolutely nothing about coding and it is all coming together slowly.
>
> Billy
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/gw3PTvx2VmYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.