SelectionClear() does not seem to affect the visual component

Hey guys,

I was trying to use ClearSelection() to programmatically clear any previous selection in my Chart. Eventhough the SelectionBehavior.SelectedIndexes is cleared the chart segmentes are still selected in UI. A workaround like setting SelectionBehavior.Type to None does not work also.

public class ChartInteractiveExt : ChartInteractiveBehavior
{
 protected override void OnTouchDown(ChartBase chart, float pointX, float pointY)

 {

  base.OnTouchDown(chart, pointX, pointY);
  if (chart is not SfCartesianChart gc) return;
  foreach (var series in gc.Series)
  {
   if (series.SelectionBehavior is null)
   {
    series.SelectionBehavior = new DataPointSelectionBehavior()
    {

    Type = ChartSelectionType.Multiple, SelectionBrush = new SolidColorBrush(Colors.Fuchsia)
     };
     series.SelectionBehavior.ClearSelection();
     var idxs = new List();
     for (var i = series.XRange.Start; i <= series.XRange.End; i++)
     {
      var yPoint = gc.ValueToPoint(gc.XAxes[0], i);
      var idx = series.GetDataPointIndex(pointX, yPoint);
      if (idx < 0) continue;
      idxs.Add(idx);
     }

    if (idxs.Count == 0)
    {continue};

    series.SelectionBehavior.SelectedIndexes = idxs; 
}}}}


Attachment: Record_20240129_111922_4b41ec83.zip

3 Replies

NM Nanthini Mahalingam Syncfusion Team January 30, 2024 02:43 PM UTC

Hi Christian,


Currently, we were able to reproduce the issue where the chart UI does not update when the selected index is cleared. Our development team will validate the reported issue and provide an update within two business days (01/02/2024).


Regards,

Nanthini M.



NM Nanthini Mahalingam Syncfusion Team February 1, 2024 02:25 PM UTC

Hi Christian,


Currently, we are working on fixing the issue and logged the bug report. You can track the status in the following feedback portal.


https://www.syncfusion.com/feedback/49549/dynamic-issue-with-selected-indexes-for-data-point-selection-in-sfcircularchart


The fix will be available in the upcoming weekly NuGet release, expected to roll out on or before February 7th, 2024.


When we dynamically set the selection type to None, the existing selected segment does not change its behavior until you select or deselect it. What do you expect to happen when you set it to None?. 


Please let us know if you need further assistance.


Regards,

Nanthini M.



NM Nanthini Mahalingam Syncfusion Team February 6, 2024 03:24 PM UTC

Hi Christian,


We are pleased to inform you that the fix for the reported issue, where the ClearSelection() method and chart UI do not update when the selected index is cleared, has been included in our latest weekly NuGet release, version 24.2.4, which is now available for download here (https://www.nuget.org).


NuGet Version: 24.2.4


We appreciate your support and patience while awaiting this release. Please don't hesitate to contact us if you require any further assistance.


Regards,

Nanthini M.


Loader.
Up arrow icon