Skip to main content
A newer version of this page is available. .

Add Charts to Xamarin.Forms Solution

  • 2 minutes to read

This topic explains how to integrate the DevExpress Charts component into a Xamarin.Forms cross-platform solution.

Important

The DevExpress Charts for Xamarin.Forms component is available for the iOS and Android platforms, and can be used in Xamarin.Forms solutions that use the .NET Standard code sharing strategy.

Add Library References

Note

Make sure that the downloaded <DevExpress.Xamarin> bundle has been unzipped.

Add the following assembly references to your Xamarin.Forms solution’s corresponding projects:

Project

Assembly

<YourAppName>

(A .NET Standard project containing the shared code)

DevExpress.XamarinForms.Core.dll

DevExpress.XamarinForms.Charts.dll

<YourAppName>.Android

(A project containing Android-specific code)

DevExpress.XamarinForms.Charts.Android.dll

DevExpress.Xamarin.Android.Charts.dll

<YourAppName>.iOS

(A project containing iOS-specific code)

DevExpress.XamarinForms.Charts.iOS.dll

DevExpress.Xamarin.iOS.Charts.dll

Note

These files are in the <DevExpress.Xamarin bundle>/Binaries directory by default.

Initialize the DevExpress Charts Component

Add the following initialization code before the LoadApplication method call in your iOS project’s AppDelegate.cs file:

DevExpress.XamarinForms.Charts.Chart.Init();

Add a Namespace

Add the following namespace to a XAML markup or C# file in which you create a chart:

xmlns:dxc="clr-namespace:DevExpress.XamarinForms.Charts;assembly=DevExpress.XamarinForms.Charts"

Create a Chart

You can create a chart in XAML markup or C# code:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:ChartsExample"
             x:Class="ChartsExample.MainPage"
             xmlns:dxc="clr-namespace:DevExpress.XamarinForms.Charts;assembly=DevExpress.XamarinForms.Charts">
    <dxc:ChartView x:Name="chart">
    </dxc:ChartView>
</ContentPage>

The Getting Started section provides examples with instructions on how to create a Pie or Cartesian chart, bind it to data, and adjust various settings.