Getting error using SfCircularGauge

Hello. In my app I am using in a layout 2 SfCircularGauge graphs. The code of the SfCircularGauge is this: 

private void SetVitaminDGraph(long x)
        {
            SfCircularGauge circularGauge = new SfCircularGauge(this);
            ObservableCollection<CircularScale> scales = new ObservableCollection<CircularScale>();
            CircularScale scale = new CircularScale();
            scale.StartValue = 0;
            scale.EndValue = 100;
            scale.RimWidth = 100;
            scale.ShowTicks = false;
            scale.StartAngle = 160;
            scale.SweepAngle = 220;
            scale.LabelOffset = 0.1;
            scale.LabelTextSize = 0;
            scale.RimColor = Color.ParseColor("#90bdf5");
            scale.LabelColor = Color.ParseColor("#424242");

            //Title
            ;
            Header header = new Header();
            header.Text = "D";
            header.TextSize = 17;
            header.TextStyle = Typeface.CreateFromAsset(Assets, "fonts/Montserrat.ttf");
            header.TextColor = Color.Black;
            header.Position = new PointF((float)0.5, (float)0.35);
            circularGauge.Headers.Add(header);
            Header header1 = new Header();
            if (x> 100)
            {
                header1.Text = "100%";
            }
            else
            {
                header1.Text = x+ "%";
            }
            //header1.Text = x+ "%";
            header1.TextSize = 20;
            header1.TextStyle = Typeface.CreateFromAsset(Assets, "fonts/Montserrat.ttf");
            header1.TextColor = Color.Black;
            header1.Position = new PointF((float)0.5, (float)0.5);
            circularGauge.Headers.Add(header1);
            Header header2 = new Header();
            header2.Text = "Time remaining";
            header2.TextSize = 12;
            header2.TextStyle = Typeface.CreateFromAsset(Assets, "fonts/Montserrat.ttf");
            header2.TextColor = Color.Black;
            header2.Position = new PointF((float)0.5, (float)0.6);
            circularGauge.Headers.Add(header2);

            CircularRange range = new CircularRange();
            range.StartValue = 0;
            range.EndValue = vitaminDPerCent;
            range.Width = 10;
            range.Offset = 1;
            range.Color = Android.Graphics.Color.ParseColor("#4a90e2");
            scale.CircularRanges.Add(range);
            circularGauge.CircularScales.Add(scale);
            circularGauge.SetBackgroundColor(Color.White);
            vitaminDGraph.AddView(circularGauge);
        }

The problem is that some time, when I am launching the layout with the graphs I am getting this error.

UNHANDLED EXCEPTION:
04-09 12:58:34.610 I/MonoDroid(16291): System.ObjectDisposedException: Cannot access a disposed object.
04-09 12:58:34.610 I/MonoDroid(16291): Object name: 'Android.Graphics.PointF'.
04-09 12:58:34.610 I/MonoDroid(16291):   at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <3cb12bce834a498199b2be6cd3e00922>:0
04-09 12:58:34.610 I/MonoDroid(16291):   at Java.Interop.JniPeerMembers+JniInstanceFields.GetSingleValue (System.String encodedMember, Java.Interop.IJavaPeerable self) [0x00000] in <3cb12bce834a498199b2be6cd3e00922>:0
04-09 12:58:34.610 I/MonoDroid(16291):   at Android.Graphics.PointF.get_X () [0x0000a] in <0f4fdd9de5d4461ca741cbb9871ad0ce>:0
04-09 12:58:34.610 I/MonoDroid(16291):   at Com.Syncfusion.Gauges.SfCircularGauge.GaugeHeaderRenderer.AssignPositionForHeader (Com.Syncfusion.Gauges.SfCircularGauge.Header header) [0x0035d] in <662faa27ccf94b7e970b182613d91191>:0
04-09 12:58:34.610 I/MonoDroid(16291):   at Com.Syncfusion.Gauges.SfCircularGauge.GaugeHeaderRenderer.OnDraw (Android.Graphics.Canvas canvas) [0x000b5] in <662faa27ccf94b7e970b182613d91191>:0
04-09 12:58:34.610 I/MonoDroid(16291):   at Android.Views.View.n_OnDraw_Landroid_graphics_Canvas_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_canvas) [0x0000f] in <0f4fdd9de5d4461ca741cbb9871ad0ce>:0
04-09 12:58:34.610 I/MonoDroid(16291):   at (wrapper dynamic-method) System.Object.e4d68244-63a6-4eed-a077-d9a05a8d160f(intptr,intptr,intptr)
04-09 12:58:34.645 W/art     (16291): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
04-09 12:58:34.655 D/Mono    (16291): DllImport searching in: '__Internal' ('(null)').
04-09 12:58:34.655 D/Mono    (16291): Searching for 'java_interop_jnienv_throw'.
04-09 12:58:34.655 D/Mono    (16291): Probing 'java_interop_jnienv_throw'.
04-09 12:58:34.655 D/Mono    (16291): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.

1 Reply

SG Sri Gayathri Gopalakrishnan Syncfusion Team April 10, 2018 12:47 PM UTC

Hi Konstantinos, 
 
Query: Getting error using SfCircularGauge 
 
We have analyzed your query and we tried to reproduce the reported scenario in all possible ways. We have added in various layout, dynamically updated the header values and removed the gauge from the layout. Please download our test sample from the below link, 
 
 
Since we are not aware on the exact scenario on which the reported issue is reproduced, we would like to know the following details, which will be helpful in further analysis and provide you the solution sooner. 
     -  Modify the attached sample to replicate your scenario 
     -  Or provide your sample along with replication steps. 
 
Regards, 
Sri Gayathri. G 
 
 


Loader.
Up arrow icon