1

I currently have a scatter chart with custom tooltips. However, I want to add an extra column (which is not visible on the chart) for filtering purposes. When I add this column my custom tooltip changes to the default tooltip. Anyone has any ideas why?

Current code (works fine):

var columnData = new google.visualization.DataTable();
columnData.addColumn('number', 'IMDB Score');
columnData.addColumn('number', "Likes")
columnData.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}})
columnData.addColumn({type: 'string', role: 'style'} );

movies.forEach(function(m) {
if(m.imdb_score != null && m.title_year >= minYear && m.title_year <= maxYear) 
{
  var tempArr = [parseFloat(m.imdb_score), 
                 m.movie_facebook_likes, 
                 "<div style='margin: 10px'><font size='3'><b>" + m.movie_title + "</b>" + "<br>Title year: <b>" + m.title_year + "</b><br>Facebook likes: <b>" + m.movie_facebook_likes + "</b><br>IMDB score: <b>" + m.imdb_score + "</b></font></div>", 
                 'point {size: 5; fill-color: #' + rainbow.colorAt(m.title_year-minYear)]

  columnData.addRow(tempArr)
} 

});

How can I add an extra column (will not be visible on the chart) to the DataTable without losing my tooltip?

Any other suggestions on how to add a filter to the chart to filter on a value that is not directly on the chart itself are very welcome.

Thanks

Jan
  • 560
  • 6
  • 19
  • 1
    use a [`DataView`](https://developers.google.com/chart/interactive/docs/reference#dataview-class) to draw the chart -- which has a method for [hideColumns](https://developers.google.com/chart/interactive/docs/reference#DataView_hideColumns)... – WhiteHat Dec 15 '17 at 21:11
  • @WhiteHat Thanks that worked! – Jan Dec 16 '17 at 14:04

0 Answers0