Use a button to clear a bar chart selection

I have a button that’s triggering a layer change (returning to an initial layer that selecting a value on this bar chart also changed). I want this button to basically return to initial settings since I can’t configure that on the bar chart itself. How can I script it to clear the selection on a chart?

Hi Lindsey,

If it’s data points that are selected and you want to clear them with script, you can use script like in this sample but just pass no arguments to the selectData method:

chart1.control.series.forEach(function (series) {
  series.selectData();
});  

If you don’t mind clearing selected data in all visible charts, it also looks like you could do this without script by adding a Filter action to the button’s Click actions. Click “Set up parameters” in the filter setup dialog, click to edit the default parameter mapping that’s listed, then choose any empty/unused view parameter as Source on the left and “Brush View Parameter” as the Target on the right. (When setting up a new filter action, Dundas BI likes to generate a new view parameter for you so you should already see a new one on the left starting with “[Generated]” and you can rename it “Empty” later, or you could create one ahead of time.)

Thank you, this works great!