-
Notifications
You must be signed in to change notification settings - Fork 204
/
StackingBar100.cs
80 lines (70 loc) · 3.37 KB
/
StackingBar100.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
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
{
[Activity(Label = "100% Stacked Bars")]
public class StackingBar100 : SamplePage
{
public override View GetSampleContent(Context context)
{
var chart = new SfChart(context);
chart.SetBackgroundColor(Color.White);
chart.Title.Text = "Sales Comparison";
chart.Title.TextSize = 15;
chart.SetBackgroundColor(Color.White);
chart.Legend.Visibility = Visibility.Visible;
chart.Legend.ToggleSeriesVisibility = true;
chart.Legend.DockPosition = ChartDock.Bottom;
chart.Legend.IconHeight = 14;
chart.Legend.IconWidth = 14;
chart.ColorModel.ColorPalette = ChartColorPalette.Natural;
CategoryAxis categoryAxis = new CategoryAxis();
categoryAxis.ShowMajorGridLines = false;
categoryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
categoryAxis.LabelPlacement = LabelPlacement.BetweenTicks;
chart.PrimaryAxis = categoryAxis;
NumericalAxis numericalAxis = new NumericalAxis();
numericalAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
numericalAxis.Minimum = 0;
numericalAxis.Maximum = 100;
numericalAxis.Interval = 20;
numericalAxis.LineStyle.StrokeWidth = 0;
numericalAxis.MajorTickStyle.TickSize = 0;
numericalAxis.LabelStyle.LabelFormat = "#'%'";
chart.SecondaryAxis = numericalAxis;
StackingBar100Series stackingBar100Series = new StackingBar100Series();
stackingBar100Series.EnableAnimation = true;
stackingBar100Series.Label = "Apple";
stackingBar100Series.ItemsSource = MainPage.GetStackedBar100Data1();
stackingBar100Series.XBindingPath = "XValue";
stackingBar100Series.YBindingPath = "YValue";
StackingBar100Series stackingBar100Series1 = new StackingBar100Series();
stackingBar100Series1.EnableAnimation = true;
stackingBar100Series1.Label = "Orange";
stackingBar100Series1.ItemsSource = MainPage.GetStackedBar100Data2();
stackingBar100Series1.XBindingPath = "XValue";
stackingBar100Series1.YBindingPath = "YValue";
StackingBar100Series stackingBar100Series2 = new StackingBar100Series();
stackingBar100Series2.EnableAnimation = true;
stackingBar100Series2.Label = "Wastage";
stackingBar100Series2.ItemsSource = MainPage.GetStackedBar100Data3();
stackingBar100Series2.XBindingPath = "XValue";
stackingBar100Series2.YBindingPath = "YValue";
chart.Series.Add(stackingBar100Series);
chart.Series.Add(stackingBar100Series1);
chart.Series.Add(stackingBar100Series2);
stackingBar100Series.TooltipEnabled = true;
stackingBar100Series1.TooltipEnabled = true;
stackingBar100Series2.TooltipEnabled = true;
stackingBar100Series.EnableAnimation = true;
stackingBar100Series1.EnableAnimation = true;
stackingBar100Series2.EnableAnimation = true;
return chart;
}
}
}