We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Data Point Selection Question(s)

Thread ID:

Created:

Updated:

Platform:

Replies:

127433 Nov 15,2016 01:17 PM Nov 21,2016 11:40 PM Xamarin.iOS 3
loading
Tags: SfChart
Marco Vicente
Asked On November 15, 2016 01:17 PM

I have a Column Chart with 2 Series and I have 2 questions:
1) When I click a Column I want to reload other Charts in the same ViewControler, but inside the delegate Class I'm out of scope.
2) When I click a Column of Series 1, I want to deselect the column of Series 2


    public class ChartDelegate : SFChartDelegate
    {

    

        public override void DidDataPointSelect(SFChart chart, SFChartSelectionInfo info)
        {

            var alert = new NBAlert();
            alert.showAlert("Data Point", String.Format("Selected Series:{0}\rSelectedDataPointIndex:{1}\rPreviousSelectedDataPointIndex:{2}",
                                                        info.SelectedSeries.Label,
                                                        info.SelectedDataPointIndex,
                                                        info.PreviousSelectedIndex));
            


            
        }

    }
  

Sivaram Ganesan [Syncfusion]
Replied On November 17, 2016 11:05 AM

Hi Marco, 
 
Thanks for contacting Syncfusion support.  

 
We have created a sample based on your requirement. Please download it from below location.  
  

Please refer following code snippet for reference. 
 
Code snippet  

  

publicclassChartDelegate : SFChartDelegate 
{ 
    publicoverridevoidWillDataPointSelect(SFChart chart, SFChartSelectionChangingInfo info) 
    { 
       varchartView = chart.Superview; 
       if (chartView != null) 
       { 
          foreach (var item inchartView.Subviews) 
          { 
             if (!item.IsEqual(chart)) 
             { 
                var Chart1 = (item asSFChart); 
                if (Chart1 != null) 
                { 
                     ////Query – 1 solution.  

                     NSMutableArrayseriesCollection = Chart1.ValueForKey(newNSString("series")) asNSMutableArray; 
                   for (nuinti = 0; i < seriesCollection.Count; i++) 
                   { 
                     var series = seriesCollection.GetItem<SFSeries>(i);  

                     if (series.SelectedDataPointIndex != -1) 
                         series.SelectedDataPointIndex = -1;  
                     //// series.ReloadData(); Reloads chart    
                   } 
                } 
            } 
        } 
    } 
  

// Query – 2 solution  

 
     NSMutableArraynumberOfSeries = chart.ValueForKey(newNSString("series")) asNSMutableArray; 
     for (nuinti = 0; i < numberOfSeries.Count; i++) 
     { 
        var series = numberOfSeries.GetItem<SFSeries>(i); 
        if ((series != null) && (series != info.SelectedSeries) && series.SelectedDataPointIndex != -1) 
           series.SelectedDataPointIndex = -1; 
     } 
   } 
}   

 
Sample
 
Please get back to us for further assistance on this.

Regards,
 
Sivaram.G 



Marco Vicente
Replied On November 21, 2016 06:27 AM

Thanks. I was able to solve both problems.

Sivaram Ganesan [Syncfusion]
Replied On November 21, 2016 11:40 PM

Hi Marco,

Most welcome.

Please get back to us for further assistance on this.

Regards,
Sivaram.G

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;