# How to change the dataset used by a chart using the "viewof" command

**URL:** <https://talk.observablehq.com/t/how-to-change-the-dataset-used-by-a-chart-using-the-viewof-command/4327>\
**Category:** Uncategorized\
**Created:** [December 14, 2020, 9:44pm UTC](https://talk.observablehq.com/t/how-to-change-the-dataset-used-by-a-chart-using-the-viewof-command/4327 "2020-12-14T21:44:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenjaminLeiva](https://avatars.discourse-cdn.com/v4/letter/b/a5b964/32.png) [@BenjaminLeiva](https://talk.observablehq.com/u/BenjaminLeiva)\
**Post date:** [December 14, 2020, 9:44pm UTC](https://talk.observablehq.com/t/how-to-change-the-dataset-used-by-a-chart-using-the-viewof-command/4327/1 "2020-12-14T21:44:23Z")

</div>

Hello, I am new to Observable and would like to ask help with the following:

I want to use the Hierarchical Edge Bundling chart to show the relations between sectors of an economy. I already arranged the data to show all relations (see [https://observablehq.com/@benleiva/hierarchical-edge-bundling-complete-guatemala-economy](https://observablehq.com/@benleiva/hierarchical-edge-bundling-complete-guatemala-economy)).

As the chart is too crowded, I would like to add the “viewof” command to allow for interactivity, only retaining flows in the economy that are more than 1 million, 10 million, or 100 million. I added the “viewof” command to show these categories, but I have not managed to understand how do you include the interactivity in this case. How do you link the chart and the various datasets to the viewof. Any suggestions?

A very artesan way would be to have a different graph for each different datasets. Yet if there is a way to include four versions of the same dataset and have the viewof comand change the data to be used, that would be great!

Thanks in advance!
