This is a guest post from Aloïs Deniel. Aloïs works at Orange Applications for Business as a Xamarin consultant. You can find him on Twitter at @aloisdeniel and on Github at @aloisdeniel.

Displaying charts in mobile apps has always been a great way to offer users a clear overview of numerical data. In my time as a developer, I wanted this task to be as easy as writing a few lines of code, but I couldn’t find a straight-forward way to achieve this, which is why I started exploring SkiaSharp and created Microcharts. Microcharts is a selection of common charts that are easy to use, visually pleasing, and built with cross-platform compatibility in mind.

Microcharts provides ready-to-use charts for Android, iOS, macOS, UWP, and even Xamarin.Forms. If you’re already using SkiaSharp in your application, you can also render them into any SkiaSharp canvas.

Data Entries

Every chart displayed via Microcharts consumes a set of data entries, and they will always have the same structure regardless of the chart type that you want to display.
Each entry will have:

  • A floating number representing its value (required).
  • A Label describing what your entry is associated with.
  • A ValueLabel to format your value.
  • A Color associated with the entry.

Here’s a quick sample of a set of entry points that we’ll chart in a moment:

Chart Types

A wide range of charts are included in Microcharts, so you can pick the one that fits your application and data best. All you need to do is set the data entries through the Entries property of any chart control.







Displaying a Chart

To display a chart, we’ll need to host it in a ChartView.

The chart data can now be affected by the view Chart property.

The Chart property is a bindable property, so it’s also perfectly fine to use a binding from a ViewModel
for this.

The above example uses Xamarin.Forms, but built-in views are also available for iOS, Android, macOS, and UWP directly.

Tweaking the Visual Aspect

Each type of graph has several properties to slightly modify its final rendering. For example, our previous LineChart example looked like this :

By changing the line and point properties, we can finely tune the design:

Feel free to explore each chart property to make it your own and create a unique design.

Sample Application

For a more contextual usage of Microcharts, please take a look at the dedicated repository, which shows off a biking application with various use cases for charts.

This is just the beginning!

Microcharts is still young and will continue to be improved, so stay tuned on GitHub or Twitter! This project is open-source, so please don’t hesitate to share new charts type, missing properties, and issues.

Discuss this post on the forums.