forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadarChart.xaml.cs
98 lines (90 loc) · 3.2 KB
/
RadarChart.xaml.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
98
#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 SampleBrowser.Core;
using Syncfusion.SfChart.XForms;
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace SampleBrowser.SfChart
{
public partial class RadarChart : SampleView
{
public RadarChart()
{
InitializeComponent();
angle.SelectedIndex = 3;
angle.SelectedIndexChanged += polarStartAngle_Changed;
radarDrawType.SelectedIndex = 1;
radarDrawType.SelectedIndexChanged += radarDrawType_Changed;
if (Device.RuntimePlatform == Device.UWP)
{
secondaryAxisLabelSyle.LabelFormat = "0'M'";
}
else
{
secondaryAxisLabelSyle.LabelFormat = "#'M'";
}
if (Device.RuntimePlatform == Device.macOS || Device.RuntimePlatform == Device.UWP)
{
Chart.Legend.OverflowMode = ChartLegendOverflowMode.Scroll;
}
}
void polarStartAngle_Changed(object sender, EventArgs e)
{
switch (angle.SelectedIndex)
{
case 0:
secondary.PolarAngle = ChartPolarAngle.Rotate0;
break;
case 1:
secondary.PolarAngle = ChartPolarAngle.Rotate90;
break;
case 2:
secondary.PolarAngle = ChartPolarAngle.Rotate180;
break;
case 3:
secondary.PolarAngle = ChartPolarAngle.Rotate270;
break;
}
}
void radarDrawType_Changed(object sender, EventArgs e)
{
switch (radarDrawType.SelectedIndex)
{
case 0:
series1.DrawType = PolarRadarSeriesDrawType.Line;
series2.DrawType = PolarRadarSeriesDrawType.Line;
series3.DrawType = PolarRadarSeriesDrawType.Line;
break;
case 1:
series1.DrawType = PolarRadarSeriesDrawType.Area;
series2.DrawType = PolarRadarSeriesDrawType.Area;
series3.DrawType = PolarRadarSeriesDrawType.Area;
break;
}
}
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if ((Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.iOS))
{
if (height > 0 && width > 0)
{
if (height > width)
{
Chart.Legend.DockPosition = LegendPlacement.Top;
}
else
{
Chart.Legend.DockPosition = LegendPlacement.Right;
}
}
}
}
}
}