Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148249 | Oct 11,2019 10:14 AM UTC | Mar 11,2020 06:17 PM UTC | Xamarin.Forms | 5 |
![]() |
Tags: SfChart |
<chart:SfChart.Series>
<chart:StackingColumnSeries ItemsSource="{Binding Data1}" XBindingPath="XValue" YBindingPath="YValue"/>
<chart:StackingColumnSeries ItemsSource="{Binding Data2}" DataMarkerLabelCreated="StackingColumnSeries_DataMarkerLabelCreated" XBindingPath="XValue" YBindingPath="YValue">
<chart:StackingColumnSeries.DataMarker>
<chart:ChartDataMarker ShowLabel="True">
<chart:ChartDataMarker.LabelStyle>
<chart:DataMarkerLabelStyle LabelPosition="Outer"/>
</chart:ChartDataMarker.LabelStyle>
</chart:ChartDataMarker>
</chart:StackingColumnSeries.DataMarker>
</chart:StackingColumnSeries>
</chart:SfChart.Series> |
private void StackingColumnSeries_DataMarkerLabelCreated(object sender, ChartDataMarkerLabelCreatedEventArgs e)
{
if (Device.RuntimePlatform == Device.UWP)
{
e.DataMarkerLabel.Label = e.DataMarkerLabel.YPosition.ToString();
}
else
{
Point point = new Point(e.DataMarkerLabel.XPosition, e.DataMarkerLabel.YPosition);
e.DataMarkerLabel.Label = Math.Round(chart.SecondaryAxis.PointToValue(point)).ToString();
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.