forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSplineArea.cs
97 lines (87 loc) · 3.44 KB
/
SplineArea.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#region Copyright Syncfusion Inc. 2001-2022.
// Copyright Syncfusion Inc. 2001-2022. 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 SplineArea : SamplePage
{
public override View GetSampleContent(Context context)
{
var chart = new SfChart(context);
chart.SetBackgroundColor(Color.White);
chart.Title.Text = "Inflation Rate in Percentage";
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 primaryAxis = new NumericalAxis();
primaryAxis.ShowMajorGridLines = false;
primaryAxis.Interval = 2;
primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
chart.PrimaryAxis = primaryAxis;
NumericalAxis numericalaxis = new NumericalAxis();
numericalaxis.Minimum = 0;
numericalaxis.Maximum = 4;
numericalaxis.Interval = 1;
numericalaxis.MajorTickStyle.TickSize = 0;
numericalaxis.LineStyle.StrokeWidth = 0;
numericalaxis.LabelStyle.LabelFormat = "#'% '";
chart.SecondaryAxis = numericalaxis;
var areaSeries1 = new SplineAreaSeries
{
Label = "US",
Alpha = 0.5f,
EnableAnimation = true,
ItemsSource = MainPage.GetSplineAreaData1(),
XBindingPath = "XValue",
YBindingPath = "YValue",
LegendIcon = ChartLegendIcon.SeriesType
};
var areaSeries2 = new SplineAreaSeries
{
Alpha = 0.5f,
Label = "France",
EnableAnimation = true,
ItemsSource = MainPage.GetSplineAreaData2(),
XBindingPath = "XValue",
YBindingPath = "YValue",
LegendIcon = ChartLegendIcon.SeriesType
};
var areaSeries3 = new SplineAreaSeries
{
Alpha = 0.5f,
Label = "Germany",
EnableAnimation = true,
ItemsSource = MainPage.GetSplineAreaData3(),
XBindingPath = "XValue",
YBindingPath = "YValue",
LegendIcon = ChartLegendIcon.SeriesType
};
chart.Series.Add(areaSeries1);
chart.Series.Add(areaSeries2);
chart.Series.Add(areaSeries3);
areaSeries1.TooltipEnabled = true;
areaSeries2.TooltipEnabled = true;
areaSeries3.TooltipEnabled = true;
areaSeries1.EnableAnimation = true;
areaSeries2.EnableAnimation = true;
areaSeries3.EnableAnimation = true;
return chart;
}
}
}