The following quick start guide is intended to get you up and running with the FlexChart control. In this quick start, you start by creating a new MAUI application, add the FlexChart control to it, and bind it with a datasource. The following image displays the FlexChart control showing the sales details of products.
C# |
Copy Code
|
---|---|
.RegisterCoreControls() |
XAML |
Copy Code
|
---|---|
xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:c1="clr-namespace:C1.Maui.Chart;assembly=C1.Maui.Chart" |
XAML |
Copy Code
|
---|---|
<c1:FlexChart x:Name="chart" ChartType="Column" ItemsSource="{Binding ListItem}" BindingX="year" Stacking="Stacked" Header="Country GDP (M$)"> <c1:Series Binding="Japan" SeriesName="Japan"/> <c1:Series Binding="India" SeriesName="India"/> <c1:Series Binding="US" SeriesName="US"/> <c1:Series Binding="UK" SeriesName="UK"/> <c1:FlexChart.AxisX> <c1:Axis Position="Bottom" /> </c1:FlexChart.AxisX> <c1:FlexChart.AxisY> <c1:Axis Position="Left" /> </c1:FlexChart.AxisY> </c1:FlexChart> |
C# |
Copy Code
|
---|---|
private List<object> _listItem; public List<object> ListItem { get { return _listItem; } set { _listItem = value; } } public QuickStart() { InitializeComponent(); ListItem = GdpDataSource.GetCountryGdp(); this.BindingContext = this; } public static class GdpDataSource { public static List<object> GetCountryGdp() { return new List<object> { new { year = "2021", US = 17348075, Japan = 4602367, UK = 2950039, India = 2051228 }, new { year = "2022", US = 18036650, Japan = 4124211, UK = 2858482, India = 2073002 }, new { year = "2023", US = 18624450, Japan = 4936540, UK = 2629190, India = 2263790 } }; } } |