forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArea.cs
83 lines (75 loc) · 2.82 KB
/
Area.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#region Copyright Syncfusion Inc. 2001-2019.
// Copyright Syncfusion Inc. 2001-2019. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.OS;
using Android.Views;
using Com.Syncfusion.Charts;
using Com.Syncfusion.Charts.Enums;
namespace SampleBrowser
{
public class Area : SamplePage
{
public override View GetSampleContent(Context context)
{
var chart = new SfChart(context);
chart.SetBackgroundColor(Color.White);
chart.Title.Text = "Average Sales Comparison";
chart.Title.TextSize = 15;
chart.SetBackgroundColor(Color.White);
chart.Legend.DockPosition = ChartDock.Bottom;
chart.Legend.Visibility = Visibility.Visible;
chart.Legend.IconHeight = 14;
chart.Legend.IconWidth = 14;
chart.Legend.ToggleSeriesVisibility = true;
chart.ColorModel.ColorPalette = ChartColorPalette.Natural;
NumericalAxis categoryaxis = new NumericalAxis();
categoryaxis.Minimum = 2000;
categoryaxis.Maximum = 2005;
categoryaxis.Interval = 1;
categoryaxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
categoryaxis.Title.Text = "Year";
chart.PrimaryAxis = categoryaxis;
NumericalAxis numericalaxis = new NumericalAxis();
numericalaxis.Minimum = 2;
numericalaxis.Maximum = 5;
numericalaxis.Interval = 1;
numericalaxis.Title.Text = "Revenue in Millions";
numericalaxis.LabelStyle.LabelFormat = "#'M '";
chart.SecondaryAxis = numericalaxis;
var areaSeries1 = new AreaSeries
{
Label = "Product A",
Alpha = 0.5f,
EnableAnimation= true,
ItemsSource = MainPage.GetAreaData1(),
XBindingPath = "XValue",
YBindingPath = "YValue",
LegendIcon = ChartLegendIcon.SeriesType
};
var areaSeries2 = new AreaSeries
{
Label = "Product B",
Alpha = 0.5f,
EnableAnimation = true,
ItemsSource = MainPage.GetAreaData2(),
XBindingPath = "XValue",
YBindingPath = "YValue",
LegendIcon = ChartLegendIcon.SeriesType
};
chart.Series.Add(areaSeries1);
chart.Series.Add(areaSeries2);
areaSeries1.TooltipEnabled = true;
areaSeries2.TooltipEnabled = true;
areaSeries1.EnableAnimation = true;
areaSeries2.EnableAnimation = true;
return chart;
}
}
}