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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Removing SfChart from SuperView

Thread ID:

Created:

Updated:

Platform:

Replies:

123316 Mar 7,2016 02:06 PM UTC Mar 9,2016 06:08 AM UTC Xamarin.iOS 3
loading
Tags: SfChart
Guillaume L'Heureux
Asked On March 7, 2016 02:06 PM UTC

What's the procedure for properly removing a SfChart from superview.
Let said that I have the following chart:

_Chart = new SFChart ();

SFNumericalAxis primaryAxis = new SFNumericalAxis ();

_Chart.PrimaryAxis = primaryAxis;

primaryAxis.Interval = new NSNumber (25);

SFNumericalAxis secondaryAxis = new SFNumericalAxis ();

_Chart.SecondaryAxis = secondaryAxis;

secondaryAxis.Minimum = new NSNumber (2);

secondaryAxis.Maximum = new NSNumber (5);

secondaryAxis.Interval = new NSNumber (0.5);


ChartAreaDataSource dataModel = new ChartAreaDataSource ();
 //from the sample app
_Chart.DataSource = dataModel as SFChartDataSource;

If I try to remove the graph form the superview the app instantly crash with a SIGSEGV error.

Alternatively, if I comment the datasource lines (defeating the purpose of the chart) I can remove it from the super view without causing it to crash the application.

If I try to override the RemoveFromSuperview function in my view and set the datasource to null I got a null reference exception.
public override void RemoveFromSuperview () {
_Chart.DataSource = null; // throw null reference exception
base.RemoveFromSuperview ();
}

Thanks for your input

Manivannan Elangovan [Syncfusion]
Replied On March 8, 2016 07:29 AM UTC

Hi Guillaume,

Thanks for contacting Syncfusion support.

We can remove SfChart from its SuperView by calling its RemoveFromSuperView() method and it is not necessary to override this method.

We have prepared a sample and it can be downloaded from the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/123316/ze/ChartSample-951298044

Regards,
Manivannan E.


Guillaume L'Heureux
Replied On March 8, 2016 04:40 PM UTC

Thanks,

The sample work as advertised. 

After further analysis of it appear that it was a threading issue. 
The remove from super view wasn't called from the ui thread. 

Manivannan Elangovan [Syncfusion]
Replied On March 9, 2016 06:08 AM UTC

Hi Guillaume,

Thanks for the update. Please let us know if you have any other queries.

Regards,
Manivannan E.

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.

Warning Icon 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.Close Icon

;