- Home
- Forum
- Xamarin.Forms
- Duplicated data marker
Duplicated data marker
Greeting, Sync team!
I have an issue with my DataMarker. It appears that in some cases the label is duplicated when selecting a point.
This is my code:
<ResourceDictionary> <ChartHelpers:ColorConverter x:Key="colorConverter" /> <DataTemplate x:Key="trackballTemplate"> <Frame HasShadow="False" BorderColor="{Binding Color}" Padding="0" Margin="0" CornerRadius="0" BackgroundColor="{Binding Converter={StaticResource colorConverter} }" WidthRequest="150" HeightRequest="60"> <StackLayout> <Label Text="{Binding ValueGlucose}" TextColor="{DynamicResource DefaultEntry}" FontSize ="18" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" HorizontalOptions="Center" Margin="0,5,0,0"/> <Label Text="{Binding DateFormatted}" TextColor="{DynamicResource DefaultLabelPlaceholder}" FontSize ="15" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" HorizontalOptions="Center"/> </StackLayout> </Frame> </DataTemplate> </ResourceDictionary> <chart:SfChart x:Name="SyncChart" Margin="0" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"> <chart:SfChart.Legend/> <chart:SfChart.ColorModel> <chart:ChartColorModel Palette="Natural"></chart:ChartColorModel> </chart:SfChart.ColorModel> <chart:SfChart.PrimaryAxis> <extensions:ChartAxisExtension x:Name="XAxis" EdgeLabelsVisibilityMode="AlwaysVisible" EdgeLabelsDrawingMode="Fit"> <chart:DateTimeAxis.LabelStyle> <chart:ChartAxisLabelStyle LabelFormat="hh:mm tt" Margin="20,0,0,0"> </chart:ChartAxisLabelStyle> </chart:DateTimeAxis.LabelStyle> </extensions:ChartAxisExtension> </chart:SfChart.PrimaryAxis> <chart:SfChart.SecondaryAxis> <chart:NumericalAxis x:Name="secondaryAxis" Minimum="0" Maximum="{Binding Maximum}" OpposedPosition="True" LabelCreated="secondaryAxis_LabelCreated"> <chart:NumericalAxis.StripLines> <chart:NumericalStripLine Start="{Binding StripStart}" Width ="{Binding StripEnd}" FillColor="#D9F2F8"> </chart:NumericalStripLine> </chart:NumericalAxis.StripLines> </chart:NumericalAxis> </chart:SfChart.SecondaryAxis> <chart:SfChart.ChartAnnotations> <chart:HorizontalLineAnnotation Y1="{Binding Y1_Low}" CoordinateUnit="Axis" ShowAxisLabel="False" StrokeWidth="5" StrokeColor="{DynamicResource LowGlucose}" /> <chart:HorizontalLineAnnotation Y1="{Binding Y1_High}" CoordinateUnit="Axis" ShowAxisLabel="False" StrokeWidth="5" StrokeColor="{DynamicResource HighGlucose}" /> </chart:SfChart.ChartAnnotations> <chart:LineSeries x:Name="ReadingSeries" ItemsSource="{Binding FilteredPoints}" StrokeWidth="0" XBindingPath="Date" Opacity="0.5" YBindingPath="Value" Color="Transparent" TrackballLabelTemplate="{StaticResource trackballTemplate}"> <chart:LineSeries.DataMarker> <chart:ChartDataMarker ShowLabel="False" MarkerBorderColor="Transparent" ShowMarker="False" MarkerWidth="4" MarkerHeight="4"/> </chart:LineSeries.DataMarker> </chart:LineSeries> <chart:FastLineSeries x:Name="VisibleReadingSeries" ItemsSource="{Binding FilteredPoints}" StrokeWidth="0" XBindingPath="Date" Opacity="0.5" YBindingPath="Value" ShowTrackballInfo="False" DataMarkerLabelCreated="VisibleReadingSeries_DataMarkerLabelCreated"> <chart:FastLineSeries.DataMarker> <chart:ChartDataMarker ShowLabel="False" MarkerBorderColor="Transparent" ShowMarker="True" MarkerWidth="4" MarkerHeight="4"/> </chart:FastLineSeries.DataMarker> <chart:FastLineSeries.ColorModel> <chart:ChartColorModel Palette="Custom"/> </chart:FastLineSeries.ColorModel> </chart:FastLineSeries> </chart:SfChart> |
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
SJ
Suyamburaja Jayakumar
Syncfusion Team
December 17, 2020 01:23 PM UTC
Hi Jorge Valenzuela,
Greetings from Syncfusion.
We have validated with the provided code snippet and figure, we suspect that you have bind same data points twice so the trackball label displayed multi time. Can you please confirm about the same data points using in same series?
Regards,
Suyamburaja J.
Hi Jorge Valenzuela,Greetings from Syncfusion.We have validated with the provided code snippet and figure, we suspect that you have bind same data points twice so the trackball label displayed multi time. Can you please confirm about the same data points using in same series?Regards,Suyamburaja J.
Actually I tried that but what I just found is exactly that, in the code behind I was setting the same value twice for every point, so the data maker was displaying twice the label because of that. So it was completely my fault.
Thank you so much for your time and support.
Kind regards.
Marked as answer
SJ
Suyamburaja Jayakumar
Syncfusion Team
December 18, 2020 11:02 AM UTC
Hi Jorge Valenzuela,
No problem. Please let us know if you need any further assistance and don’t hesitate to contact us.
Regards,
Suyamburaja J.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
JV Jorge Valenzuela
- Dec 16, 2020 11:38 PM UTC
- Dec 18, 2020 11:02 AM UTC