Hi Andrew,
Google Charts don't support functions in our options, which means that we
can't just provide a mechanism where you specify a function to calculate
the tooltip text. This in turn means that you need to precalculate your
tooltips, and put them in your DataTable.
In the example you gave, the values are passed to the
function createCustomHTMLContent, but those values aren't based off of any
data. The values are hardcoded into the function call, which isn't ideal
and doesn't really apply to real world use cases. In reality, if you wanted
to use a function like createCustomHTMLContent, you would probably do so
with a DataView and a calculated column. It's primarily used as an example,
and our examples assume that you understand how function declarations and
calls work. I put one of the rows below and bolded the values being passed
to the function. If you'll notice, the values are listed twice: once to
show up on the chart, and another time to pass to the tooltip.
['USA',
createCustomHTMLContent('http://upload.wikimedia.org/wikipedia/commons/2/28/Flag_of_the_USA.svg',
*46, 29, 29*), 46, 29, 29],
Hopefully this helps you.
On Thu Dec 11 2014 at 11:12:27 AM Andrew Bailey <[email protected]>
wrote:
> I was seeking an answer to this question but I wasn't expecting having to
> manually put the value in the tooltip. In the example here (
> https://google-developers.appspot.com/chart/interactive/docs/customizing_tooltip_content#custom_html_content)
> for custom HTML content they seem to have created variables totalGold,
> totalSilver and totalBronze that allows the showing of the total within the
> tooltip but I don't understand how they are getting it to pass the value to
> those variables.
>
> --
> 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
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>
--
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.