|
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis Maximum="52" Minimum="28">
<chart:NumericalAxis.StripLines>
<chart:NumericalStripLine Start="0" Width ="500" FillColor="#F4C762"/>
</chart:NumericalAxis.StripLines>
<chart:NumericalAxis.StripLines>
<chart:NumericalStripLine Start="500" Width ="500" FillColor="#0000FF"/>
</chart:NumericalAxis.StripLines>
<chart:NumericalAxis.StripLines>
<chart:NumericalStripLine Start="1000" Width ="500" FillColor="#F4C762"/>
</chart:NumericalAxis.StripLines>
<chart:NumericalAxis.StripLines>
<chart:NumericalStripLine Start="1500" Width ="500" FillColor="#0000FF"/>
</chart:NumericalAxis.StripLines>
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis> |
|
NumericalStripLine stripLine1 = new NumericalStripLine();
stripLine1.FillColor = Color.FromRgb(215, 244, 212);
stripLine1.Start = 0;
stripLine1.Width = 500;
secondaryAxis.StripLines.Add(stripLine1);
NumericalStripLine stripLine2 = new NumericalStripLine();
stripLine2.FillColor = Color.FromRgb(207,223,238);
stripLine2.Start = 500;
stripLine2.Width = 500;
secondaryAxis.StripLines.Add(stripLine2);
NumericalStripLine stripLine3 = new NumericalStripLine();
stripLine3.FillColor = Color.FromRgb(249,215,187);
stripLine3.Start = 1000;
stripLine3.Width = 500;
secondaryAxis.StripLines.Add(stripLine3);
NumericalStripLine stripLine4 = new NumericalStripLine();
stripLine4.FillColor = Color.FromRgb(243,220,219);
stripLine4.Start = 1500;
stripLine4.Width = 1000;
secondaryAxis.StripLines.Add(stripLine4); |
|
<chart:ScatterSeries.TooltipTemplate>
<DataTemplate>
<StackLayout>
<Label Text="{Binding XValue,StringFormat='XValue: {0}'}"/>
<Label Text="{Binding YValue,StringFormat='YValue: {0}'}"/>
</StackLayout>
</DataTemplate>
</chart:ScatterSeries.TooltipTemplate> |
|
series.TooltipTemplate = new DataTemplate(() =>
{
StackLayout layout = new StackLayout();
Label xValue = new Label();
xValue.SetBinding(Label.TextProperty, new Binding("XValue", stringFormat: "XValue: {0}"));
Label yValue = new Label();
yValue.SetBinding(Label.TextProperty, new Binding("YValue", stringFormat: "YValue: {0}"));
layout.Children.Add(xValue);
layout.Children.Add(yValue);
return layout;
}); |
|
series.TooltipTemplate = new DataTemplate(() =>
{
StackLayout layout = new StackLayout();
StackLayout layout1 = new StackLayout();
layout1.Orientation = StackOrientation.Horizontal;
StackLayout layout2 = new StackLayout();
layout2.Orientation = StackOrientation.Horizontal;
Label label1 = new Label();
label1.Text = "XValue:";
Label label2 = new Label();
label2.Text = "YValue:";
Entry xValue = new Entry();
xValue.WidthRequest = 50;
xValue.SetBinding(Entry.TextProperty,"XValue",BindingMode.OneWay,null);
xValue.Completed += (sender, e) =>
{
double value;
if (double.TryParse((sender as Entry).Text, out value))
{
((sender as Entry).BindingContext as Model).XValue = value;
}
};
Entry yValue = new Entry();
yValue.WidthRequest = 50;
yValue.SetBinding(Entry.TextProperty, "YValue", BindingMode.OneWay, null);
yValue.Completed += (sender, e) =>
{
double value;
if (double.TryParse((sender as Entry).Text, out value))
{
((sender as Entry).BindingContext as Model).YValue = value;
}
};
layout1.Children.Add(label1);
layout1.Children.Add(xValue);
layout2.Children.Add(label2);
layout2.Children.Add(yValue);
layout.Children.Add(layout1);
layout.Children.Add(layout2);
return layout;
}); |
|
xValue.Completed += (sender, e) =>
{
double value;
if (double.TryParse((sender as Entry).Text, out value))
{
// you can save this value as you required
}
}; |
|
dataMarker.LabelTemplate = new DataTemplate(() =>
{
StackLayout layout = new StackLayout();
Label label = new Label();
label.SetBinding(Label.TextProperty, "YValue");
var tapGesture = new TapGestureRecognizer();
tapGesture.Tapped += (sender, e) =>
{
var data = (sender as Label).BindingContext as Model;
Navigation.PushAsync(new DetailPage() { Item = data });
};
label.GestureRecognizers.Add(tapGesture);
layout.Children.Add(label);
return layout;
}); |