Scatter plot legend options keep only vs exlude

When you click on a scatter plot option in the legend it grays out the link and excludes that series from the chart. Clicking a grayed out/excluded option then re-enables it and adds it back to the chart.

Is there a solution or recommended approach to allow the user to click on a value in the legend and have the option to "Keep only" or "Exclude". "Exclude" would function as-is today. "Keep only" would exclude/gray out all of the other options but the one clicked.

Thank you!



1 Reply

NP Nishanthi Panner Selvam Syncfusion Team August 11, 2023 10:50 AM UTC

Luke,


Greetings from Syncfusion.


We have analyzed your query, we recommend the following configuration to achieve your desired outcomes:


When using "Keep only", we suggest making the following changes:

  • Set the selectionMode as 'Point' in chart.
  • Set the toggleVisibility as false in legendSettings.

This will ensures that only the selected series remains visible on the chart.


When using "Exclude", we suggest making the following changes:

  • set the selectionMode as 'None' in chart.
  • Set the toggleVisibility as true in legendSettings.


We have attached sample, screenshot and code-snippet for your reference.


Code-snippet:


<ejs-chart  selectionMode='Point' [legendSettings] = 'legend' </ejs-chart>

public legend: Object = {

        visible: true,

        toggleVisibility: false,

    }


Screenshot:



Sample: https://stackblitz.com/edit/angular-bf18qg-sl3gca?file=src%2Fapp.component.html,src%2Fapp.component.ts


Please let us know if the above sample meets your requirement.


Regards,

Nishanthi


Loader.
Up arrow icon