Can I customize the tooltip text in a Google Geochart chart?

前端 未结 5 1737
面向向阳花
面向向阳花 2020-12-24 07:52

Below is the code I\'m using, based on a how to I found in Google\'s documentation, but I\'m not sure if it applies to the Geochart, if I\'m doing it right, or if there is s

5条回答
  •  既然无缘
    2020-12-24 08:47

    There are three alternatives presented in this thread

    • Set the formatted value of your data points manually (using the #setFormattedValue() DataTable method)
    • Use one of the formatters on a DataTable column
    • Include a 'tooltip' role column in the DataTable

    I've personally used first one, and with your example should be like

    var data = google.visualization.arrayToDataTable([
        [ 'State', 'Relevance' ],
        [ 'Alabama', { v: 3, f: 'tooltip test text' } ],
        [ 'Arizona', { v: 1, f: 'tooltip test text' } ],
    ]);
    

提交回复
热议问题