How to create HTML Tooltips using the Charts module's API with Google Charts? I'm using the Charts module and I've been trying to set up a simple pie chart that has HTML in the tooltips.  We would like the HTML to be menu links, but they can just be manually coded into the chart code.  However, I have not been able to get this working.  Looking at the API (http://cgit.drupalcode.org/charts/tree/charts.module#n46) it seems there is an option to set: '#tooltips_use_html' =&gt; TRUE

But I haven't been able to get it to work.  I've tried the following code in the body of a node:

$chart = array(
    '#type' =&gt; 'chart',
    '#title' =&gt; t('Pie Chart with tooltips (no data labels)'),
    '#chart_type' =&gt; 'pie',
    '#chart_library' =&gt; 'google', // Allowed values: 'google' or 'highcharts'
    '#legend_position' =&gt; 'right',
    '#data_labels' =&gt; FALSE,
     '#tooltips' =&gt; TRUE,
     '#tooltips_use_html' =&gt; TRUE
  );
  $chart['pie_data'] = array(
    '#type' =&gt; 'chart_data',
    '#title' =&gt; t('Gender'),
    '#labels' =&gt; array('&lt;a href="http://localhost:8888/node/246095/edit"&gt;Male&lt;/a&gt;', 'Female'),
    '#data' =&gt; array(10, 20),
  );

/*
$chart['pie_data_item'] = array(
    '#data' =&gt; 10,
    '#color' =&gt; 'NULL',
    '#title' =&gt;'&lt;a href="http://localhost:8888/node/246095/edit"&gt;Male&lt;/a&gt;', 
  );

$chart['pie_data_item'] = array(
    '#data' =&gt; 20,
    '#color' =&gt; 'NULL',
    '#title' =&gt;'Female', 
  );
*/

  $example['chart'] = $chart;


In place of $chart['pie_data'] I've also tried the commented out code $chart['pie_data_item'].  With the first approach I do get a result, but the HTML is not rendered correctly, and labels are being treated as the tooltips?  Is there anyway to tell what HTML goes into each tooltip?



EDIT: Using the patch in https://www.drupal.org/files/issues/2209467-9--raw_options.patch as recommended by Pierre.Vriens I was able to enable the #raw_options array.  I've looked around and haven't found any clear documentation what that array is supposed to look like though.  How would I use #raw_options to generate HTML tooltips?
The most recent Charts version does not yet support "tooltips" as such. However, have a look at Pass library-specific options via existing #raw_options, which provides an alternative (using #raw_options) to what you're trying to get to work. For charting engine Highcharts it's already supported (and committed to the most recent dev version), while for charting engine Google Charts you'd need to apply the RTBC-patch attached to comment nr 9 (from about 6 months ago). Obviously, after that patch is committed, my recommendation here to use the #raw_options will continue to work (for either charting engine). And rest assured, this patch will make it (so it's not a patch that might make it).

With this #raw_options solution, we have a solution for using options that are specific for either of the supported charting engines (Google Charts or Highcharts). While still not deviating from a key design concept of the Charts module, which is that all supported charting options should work for either charting engines (you should be able to easily swap from one to the other charting engine, without your charts being affected).

Disclosure: I'm a co-maintainer of the Charts module.