Search code examples
javascriptgoogle-visualizationdata-visualization

Is there a way to show all values corresponding to a value on x-axis in the tooltip of Google Charts linechart?


I have a simple linechart with 2 lines. On hover, I would like to display both y-values in the tooltip that appears. I know I can accomplish this by writing a Javascript function that creates a custom tooltip for every x-value on the graph, but this seems so redundant to do, especially when the graph gets large. Since Google Chart is able to auto-generate the standard tooltip which contain both the x and y-value I feel like there should be an option to do this with built-in tools, is there?


Solution

  • Probably setting focusTarget to 'category' will do the trick.

    See here for an example that uses it.