-
Notifications
You must be signed in to change notification settings - Fork 204
/
ZoomingAndPanning.cs
94 lines (80 loc) · 3.44 KB
/
ZoomingAndPanning.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
using Android.App;
using Android.Content;
using Android.OS;
using Android.Views;
using Android.Widget;
using Com.Syncfusion.Charts;
using Com.Syncfusion.Charts.Enums;
using Android.Graphics;
namespace SampleBrowser
{
public class ZoomingandPanning : SamplePage
{
public override View GetSampleContent(Context context)
{
var chart = new SfChart(context);
chart.Title.Text = "Height vs Weight";
chart.Title.TextSize = 15;
chart.SetBackgroundColor(Color.White);
chart.ColorModel.ColorPalette = ChartColorPalette.Natural;
NumericalAxis primariyAxis = new NumericalAxis();
primariyAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
primariyAxis.ShowMajorGridLines = false;
primariyAxis.Minimum = 100;
primariyAxis.Maximum = 220;
primariyAxis.Interval = 20;
primariyAxis.Title.Text = "Height in Inches";
chart.PrimaryAxis = primariyAxis;
NumericalAxis secondaryAxis = new NumericalAxis();
secondaryAxis.ShowMajorGridLines = false;
secondaryAxis.Minimum = 50;
secondaryAxis.Maximum = 80;
secondaryAxis.Interval = 5;
secondaryAxis.Title.Text = "Weight in Pounds";
chart.SecondaryAxis = secondaryAxis;
ScatterSeries scatter = new ScatterSeries();
scatter.Alpha = 0.7f;
scatter.ScatterWidth = 12;
scatter.ScatterHeight = 12;
scatter.ItemsSource = MainPage.GetScatterMaleData();
scatter.XBindingPath = "XValue";
scatter.YBindingPath = "YValue";
scatter.Label = "Male";
scatter.LegendIcon = ChartLegendIcon.SeriesType;
scatter.EnableAnimation = true;
ScatterSeries scatter1 = new ScatterSeries();
scatter1.Alpha = 0.7f;
scatter1.ScatterWidth = 12;
scatter1.ScatterHeight = 12;
scatter1.ShapeType = ChartScatterShapeType.Diamond;
scatter1.ItemsSource = MainPage.GetScatterFemaleData();
scatter1.XBindingPath = "XValue";
scatter1.YBindingPath = "YValue";
scatter1.Label = "Female";
scatter1.LegendIcon = ChartLegendIcon.SeriesType;
scatter1.EnableAnimation = true;
chart.Series.Add(scatter);
chart.Series.Add(scatter1);
chart.Behaviors.Add(new ChartZoomPanBehavior { SelectionZoomingEnabled = true, SelectionRectStrokeWidth = 1 });
var label = new TextView(context);
label.SetPadding(5, 5, 5, 5);
label.Text = "Pinch to zoom or double tap and drag to select a region to zoom in.";
var layout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical };
var layoutLabel = new LinearLayout(context)
{
Orientation = Android.Widget.Orientation.Horizontal,
LayoutParameters =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
};
layoutLabel.SetHorizontalGravity(GravityFlags.CenterHorizontal);
layoutLabel.AddView(label);
layout.AddView(layoutLabel);
layout.AddView(chart);
return layout;
}
public override void OnApplyChanges()
{
base.OnApplyChanges();
}
}
}