I'm looking for a way to programmatically clear the selection of my column chart. I tried resetting chart to null and then recreating it, but for some reason sometime sticks somewhere and can't figure out where.
Scenario:
Display a year with filter options for 3m / 6m / 9m.
When I'm on any of the views (3m) and I select a month when I press on either 6m or 9m the view does not reset and the columns being displayed are "dimm"
Hi Casper,
We are analyzing your query, and we will update the status within one business day (April 25th, 2024). We appreciate your patience until then.
Regards,
Gopalakrishnan Veeraraghavan
Hi Casper,
Thank you for your patience,
We have analyzed your query based on that we have created chart sample which will display 3 months, 6 months, and 9 months data based on the selected value in dropdown.
Code-snippet:
|
document.getElementById('select-period').addEventListener('change', function () { var selectedPeriod = this.value; chart.series[0].dataSource = generateChartData(parseInt(selectedPeriod)); });
function generateChartData(period) { var data = {}; let periodKeys = period.toString() + 'M'; var periodData = []; for (var i = 0; i < period; i++) { periodData.push({ x: new Date(2023, i, 1), y: Math.floor(Math.random() * 20) + 5, }); } data[periodKeys] = periodData; return data[periodKeys]; } |
Screenshot:
|
3M |
6M |
9M |
|
|
|
|
Sample: https://stackblitz.com/edit/2qzxdf-qsv68z?file=index.js
If you are still experiencing difficulties, we request you to share the following information which will be helpful for further analysis and provide you the solution sooner.
Regards,
Nishanthi
As soon as you insert the option
selectionMode: 'Point'
the issue remains even in this solution. I want to remove the selection when switching between the different views.
Casper,
We analyzed your reported query based on that we recommend clearing the selectedIndexes when changing the dataSource via the dropdown. This action will ensure that the selection is removed when switching between different chart views.
We have attached code-snippet, sample and screenshot for your reference.
Code-snippet:
|
document .getElementById('select-period') .addEventListener('change', function () { var selectedPeriod = this.value; chart.series[0].dataSource = generateChartData(parseInt(selectedPeriod)); chart.selectionModule.selectedDataIndexes = []; }); |
GIF:
|
|
Sample: https://stackblitz.com/edit/2qzxdf-tkfwmx?file=index.js
Kindly revert us if you have any concerns.
Regards,
Nishanthi