Android Chart Freezes - Xamarin


I’m trying to implement ShinobiCharts for Android (premium) and everything seems to work fine the first time.  I update data live, using the SimpleDataAdapter.AddAll, a few times, and then stop updating.  I then update other parts of the UI.  

Then I try and update the chart again (using AddAll) and it appears “frozen”.  If I try and pan, the X Ticks slide past, but the chart itself, and all the data displayed, doesn’t move.

The only thing I can think of is removing and re-adding the chart to the parent view, but I thought I’d check if it’s possible I’m doing something wrong.

I’m using Xamarin Forms, with a custom renderer to display the chart.  iOS works fine, although it’s (obviously?) using a different renderer and data adapter.



Hi Jamie,

It’s not immediately obvious what the problem is here, and isn’t something I’ve come across myself. That said, I don’t have much experience using Xamarin Forms so I’m not sure if it’s something specific to that and/or the way renderers work.

With the SimpleDataAdapter, it will automatically fire of an update once your data points have been added. This means there will be a bit of computational work for the IShinobiChart to do, the extent of which will depend on things like the number of data points, the type of data and any skip ranges added. However, I don’t see why this is only problematic after you update the other parts of the UI. Could there be an issue with whatever is being done there that’s then having a knock-on effect on the chart?

I think really to go any further we’d need to know a bit more about your app. If it’s at all possible a cut-down sample app that demonstrates the problem reliably would be most helpful but if that’s not possible then could you describe your app in more detail - what type of data is it showing, what Axis types and Series types you’re using, how many data points (roughly) are we talking about, are you using a ChartFragment or a ChartView etc. Feel free to email

Kind regards,




Thanks for your reply.  I think I figured out the problem this morning after more digging.  I was trying to update the chart on a background thread.  I pushed the refresh/reload to the UI/Main thread and it appears to be working now.  If anyone else has this issue, try that :slight_smile:




I face the problem when using Xamarin.Forms with ShinobiCharts for Android (Premium 1.5) and ShinobiCharts for iOS.

The chart has rendered perfectly on iOS but keep crashing on Android.

I using <chartfragment> within axml and page renderer approach like Jamie. But unfortunately, the app crashed when page renderer try to render chartfragment to the page as below:

06-13 14:08:14.598 F/libc    ( 1793): /Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-57861/build-libc++/ndk/sources/cxx-stl/llvm-libc++/…/llvm-libc++abi/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, …): assertion “terminating with uncaught exception of type char const*” failed

terminating with 

uncaught exception of type char const*

/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-57861/build-libc++/ndk/sources/cxx-stl/llvm-libc++/…/llvm-libc++abi/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, …): assertion “terminating with uncaught exception of type char const*” failed

06-13 14:08:14.598 F/libc    ( 1793): Fatal signal 6 (SIGABRT), code -6 in tid 1818 (GLThread 137)

But if I comment out the chartfragment line from axml and initialize code. The content page has displayed correctly.

Here is the code in PCL:

using Xamarin.Forms;
namespace MyNamespace
    public class ChartPage : ContentPage
        public ChartPage()


Here is the code of axml:


<?xml version=“1.0” encoding=“utf-8”?>
<LinearLayout xmlns:android=“
        android:text=“Chart title”
        android:textStyle=“bold” />
        android:layout_height=“match_parent” />

Here is the code of page renderer:

using Android.App;
using Android.Views;
using Android.Widget;
using Com.ShinobiControls.Charts;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(MyNamespace.ChartPage), typeof(MyNamespace.Droid.Renderer.ChartPageRenderer))]
namespace MyNamespace.Droid.Renderer
    public class ChartPageRenderer : PageRenderer
        Activity activity;
        global::Android.Views.View view;
        public ChartPageRenderer()
        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
            if (e.OldElement != null || Element == null)
                activity = this.Context as Activity;
                view = activity.LayoutInflater.Inflate(Resource.Layout.PieChart, this, false);
                TextView textView = view.FindViewById<TextView>(Resource.Id.symbolTextView);
                textView.Text =“Display my chart”;
                ChartFragment chartFragment = activity.FragmentManager.FindFragmentById<ChartFragment>(Resource.Id.chart);
                // Get the a reference to the ShinobiChart from the ChartFragment
                IShinobiChart shinobiChart = chartFragment.ShinobiChart;
                shinobiChart.Title = “Shinobi Chart Title”;
                // Create our DataAdapter and data
                DataAdapter dataAdapter = new SimpleDataAdapter();
                dataAdapter.Add(new DataPoint(“one”, 1.0));
                dataAdapter.Add(new DataPoint(“two”, 2.0));
                dataAdapter.Add(new DataPoint(“three”, 3.0));
                // Create a PieSeries and give it the data adapter
                PieSeries series = new PieSeries();
                series.DataAdapter = dataAdapter;
                // Set the selection mode to only select a single segment and to rotate to the top
                series.SeriesSelectionMode = Series.SelectionMode.PointSingle;
                series.SelectedPosition = 0.0f;
                // Add the series to the chart
                // Apply styling to the Pie Series
                PieSeriesStyle style = (PieSeriesStyle)series.Style;
                style.SetFlavorColors(new int[] {
                    Android.Graphics.Color.Argb(255, 103, 169, 66), // green
Android.Graphics.Color.Argb(255, 248, 184, 60), // yellow
Android.Graphics.Color.Argb(255, 233, 74, 114)  // pink
                style.RadialEffect = PieDonutSeries.RadialEffect.BevelledLight;
                style.CrustShown = false;
                style.LabelTextSize = 16.0f;
                // apply style to selected slices
                PieSeriesStyle selectedSeriesStyle = series.SelectedStyle;
                selectedSeriesStyle.SetFlavorColors(new int[] {
                    Android.Graphics.Color.Argb(255, 103, 169, 66), // green
Android.Graphics.Color.Argb(255, 248, 184, 60), // yellow
Android.Graphics.Color.Argb(255, 233, 74, 114)  // pink
                selectedSeriesStyle.CrustThickness = 10f;
                selectedSeriesStyle.SetCrustColors(new int[] {
                    Android.Graphics.Color.Argb(255, 0, 0, 0), // black
                series.SelectedStyle = selectedSeriesStyle;

            catch (Exception ex)
                string x = ex.Message;
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
            base.OnLayout(changed, l, t, r, b);
            var msw = MeasureSpec.MakeMeasureSpec(r - l, MeasureSpecMode.Exactly);
            var msh = MeasureSpec.MakeMeasureSpec(b - t, MeasureSpecMode.Exactly);
            view.Measure(msw, msh);
            view.Layout(0, 0, r - l, b - t);

 I have open the ticket in and get the reply as “Shinobi Charts not supported on Xamarin.Forms yet” and losing hope with these until I found this forum thread which show that Jamie find to way to make it works on Xamarin.Forms.

Please leave some advices for my issue and thank you for your helps.

Best regards,

Chawalit (Thailand)


Hello Chawalit.

Just to let you know that I have responded to your query via our customer ticketing system.




Hi there, can you post the solution for this issue? We have the same problem (same error message) in Android Studio. But only with some devices (running Android 4 but it might be processor type related). With newer devices everything works. Before we used Eclipse and there we didn’t have this problem, but we also updated the Library version to 1.8 (to get it working in Android Studio).

Any suggestions about how to resolve this or what might cause this are welcome.


Hi harmelzinga,

Have you tried using the latest version of  shinobicharts for Android? The latest version is 1.9.0.

We found a bug relating to KitKat devices in v1.8.0 and another relating to specific GPUs in v1.8.2 but both are fixed in v1.9.0 so hopefully that should fix your problem. Do let us know if after updating you’re still experiencing problems.

Kind regards,