|
<ContentPage.Resources>
<ResourceDictionary>
<DataTemplate x:Key="trackballTemplate">
<Frame BackgroundColor="Gray">
<StackLayout Orientation="Vertical" BackgroundColor="Gray">
<Label TextColor="Black" >
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding XValue}" FontAttributes="Bold"/>
</FormattedString>
</Label.FormattedText>
</Label>
<Label TextColor="DarkOrange" >
<Label.FormattedText>
<FormattedString>
<Span Text=" bAvg : "/>
<Span Text="{Binding YValue}" FontAttributes="Bold"/>
</FormattedString>
</Label.FormattedText>
. . . . .
</Label>
</StackLayout>
</Frame>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>
. . . .
<chart:StackingColumnSeries x:Name="series3" ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue2" Label="Good" LegendIcon="SeriesType" Color="Green" EnableAnimation="True" ShowTrackballInfo="True"
TrackballLabelTemplate="{StaticResource trackballTemplate}">
</chart:StackingColumnSeries>
. . . . . .
<chart:SfChart.ChartBehaviors>
<chart:ChartTrackballBehavior ActivationMode="TouchMove" ShowLine="True"/>
</chart:SfChart.ChartBehaviors>
</chart:SfChart> |
|
foreach (var item in e.ChartPointsInfo)
{
var data = item.DataPoint as Model;
item.Label = item.Series.Label + " : " + data.Value;
item.LabelStyle.BackgroundColor = Color.Gray;
. . . .
}
|
|
private void SfChart_TrackballCreated(object sender, ChartTrackballCreatedEventArgs e)
{
var chart = sender as SfChart;
var color = chart.ColorModel.GetColors(ChartColorPalette.Metro);
foreach (var item in e.ChartPointsInfo)
{
var data = item.DataPoint as Model;
item.Label = item.Series.Label + " : " + data.Value;
item.LabelStyle.BackgroundColor = Color.Gray;
int index = chart.Series.IndexOf(item.Series);
var color1 = color[index % 10];
item.LabelStyle.TextColor = color1;
}
} |