-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathTooltipCustomization.cs
85 lines (74 loc) · 2.72 KB
/
TooltipCustomization.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Com.Syncfusion.Charts;
using Com.Syncfusion.Charts.Enums;
using Android.Graphics;
namespace SampleBrowser
{
public class TooltipCustomization : SamplePage
{
CustomTooltipBehavior tooltipBehavior;
public override View GetSampleContent(Context con)
{
SfChart sfChart = new SfChart(con);
sfChart.Title.Text = "Wheat Production in Tons";
sfChart.Title.TextSize = 15;
sfChart.PrimaryAxis = new CategoryAxis()
{
PlotOffset = 10,
MajorGridLineStyle = { StrokeWidth = 0.5f },
Interval = 2,
ShowMajorGridLines = false,
};
sfChart.SecondaryAxis = new NumericalAxis()
{
Maximum = 2.7f,
Minimum = 1.5,
Interval = 0.2,
EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift,
LineStyle = { StrokeWidth = 0 },
MajorGridLineStyle = { StrokeWidth = 0.5f },
};
sfChart.SecondaryAxis.LabelStyle.LabelFormat = "##.##M";
SplineSeries splineSeries = new SplineSeries()
{
Color = Color.Argb(255, 255, 150, 00),
DataMarker =
{
ShowMarker = true,
ShowLabel = false,
MarkerColor = Color.Rgb(250, 0, 0)
},
TooltipEnabled = true,
};
splineSeries.EnableAnimation = true;
splineSeries.ItemsSource = MainPage.GetTooltipData();
splineSeries.XBindingPath = "XValue";
splineSeries.YBindingPath = "YValue";
sfChart.Series.Add(splineSeries);
tooltipBehavior = new CustomTooltipBehavior(con);
tooltipBehavior.BackgroundColor = Color.Argb(255, 193, 39, 45);
sfChart.Behaviors.Add(tooltipBehavior);
sfChart.TooltipCreated += sfChart_TooltipCreated;
return sfChart;
}
void sfChart_TooltipCreated(object sender, SfChart.TooltipCreatedEventArgs e)
{
tooltipBehavior.MarginLeft = 5;
tooltipBehavior.MarginTop = 25;
tooltipBehavior.MarginRight = 85;
tooltipBehavior.MarginBottom = 20;
tooltipBehavior.BackgroundColor = Color.Argb(255, 193, 39, 45);
tooltipBehavior.TextColor = Color.Transparent;
tooltipBehavior.StrokeWidth = 1f;
}
}
}