I have a table with some pretty basic data (it's a time series going across the columns, and different budget items going down). I want to create a chart that plots a particular row's data against time. When I click on a different row, I want the chart to update to show this row's data. Is this possible?
Google-sheets – Update Google Drive Chart based on which row selected
google sheetsgoogle-apps-scriptgoogle-sheets-charts
Related Topic
- Google Sheets – How to Plot Dates/Times in One Chart
- Google Sheets – How to Skip Columns in a Google Spreadsheets Chart
- Google-sheets – Stacked Bar Chart summing repeated daily likes
- Google Sheets – Creating a Bar Chart of Time Ranges
- Google-sheets – How to preserve colors of each series from changing when inserting new data in Chart Editor
- Google Sheets – How to Create a Pie Chart Without Certain Categories
- Google-sheets – Google Sheets – Filtering Chart Data with Checkboxes
Best Answer
I don't think this is possible, since there is no
onClick
-trigger.There are alternatives, though, using scripts. I've built two different ways.
Dropdown
Use a dropdown where you select the number of the column to choose from.
A button (drawing)
Click on a drawing with a script assigned to it updating the scripts source range.
See example of both here. The "Click me" drawing has the script
updateChart
-function assigned to it.Since you have your chart-ranges on the x-axis I've used Mogsdad's method to
Switch rows / columns
programmatically. The method requires the 2D Arrays Library, read here how to install it. It also requires you to have a sheet namedScratch
, you can hide it, though.Here's the code used:
I hope this helps, ask me if you have any questions!