Hi. I'm trying to show a tooltip with both X value (DateTime) and Y value, based on the information on https://www.syncfusion.com/kb/10723/how-to-customize-the-tooltip-in-chart
The problem is that two tooltips are shown for one data point when zoomed in. It switches if I hover the mouse one pixel to left or right on the marker.
The correct one is the tooltip with '2021/07/01' timestamp (you can confirm it by primary axis). The data on the other wrong tooltip is actually exists in this series, and if I pan the chart to the far left, I can see it.
XAML:
<sf:SfChart Grid.Row="0"
MinWidth="300" MinHeight="200" Margin="10" VerticalAlignment="Stretch" Background="White" Visibility="{Binding StandardPlotHasData, Converter={StaticResource BoolToVisibilityConverter}}"> <sf:SfChart.Behaviors> <sf:ChartZoomPanBehavior EnableMouseWheelZooming="True" EnableSelectionZooming="True" EnableZoomingToolBar="True" ToolBarItemHeight="20" ToolBarItemWidth="20"/> </sf:SfChart.Behaviors> <sf:SfChart.PrimaryAxis> <sf:DateTimeAxis EnableScrollBar="True" FontSize="12" Header="Timestamp" LabelFormat="yyyy/MM/ddHH:mm" RangePadding="Auto"/> </sf:SfChart.PrimaryAxis> <sf:SfChart.SecondaryAxis> <sf:NumericalAxis EnableScrollBar="True" FontSize="12" Header="{Binding KindUnitName}" RangePadding="Auto"/> </sf:SfChart.SecondaryAxis> <sf:FastLineSeries x:Name="ValueSeries" sf:ChartTooltip.ShowDuration="5000" EnableAnimation="False" Interior="DeepSkyBlue" ItemsSource="{Binding Data}" Label="{Binding KindDisplayName}" ShowTooltip="True" StrokeThickness="1" ListenPropertyChange="True" AdornmentsInfo="{Binding ChartAdornmentInfo}" XBindingPath="X" YBindingPath="Y"> <sf:FastLineSeries.TooltipTemplate> <DataTemplate> <Border Padding="4" Background="Black" BorderBrush="Black" BorderThickness="0"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Foreground="White" Text="{Binding Item.TimestampString}" TextAlignment="Center"/> <TextBlock Foreground="White" Text="{Binding Item.Y}" TextAlignment="Center" /> </StackPanel> </Border> </DataTemplate> </sf:FastLineSeries.TooltipTemplate> </sf:FastLineSeries> <sf:FastLineBitmapSeries EnableAnimation="False" Interior="DeepPink" ItemsSource="{Binding UpperThres}" Label="Upper Threshold" ShowTooltip="False" XBindingPath="X" YBindingPath="Y"/> <sf:FastLineBitmapSeries EnableAnimation="False" Interior="DarkOrange" ItemsSource="{Binding LowerThres}" Label="Lower Threshold" ShowTooltip="False" XBindingPath="X" YBindingPath="Y" /></sf:SfChart>What I discovered so far:
As the number of the data can be over tens of thousands, migrating to LineSeries is not an option.
Is there any workaround for this problem?
Thanks in advance.
|
<chart:SfChart.Series>
<chart:FastLineSeries Name="Lettuce"
EnableAnimation="False"
StrokeThickness="1"
ListenPropertyChange="True"
ShowTooltip="True"
Interior="DeepSkyBlue"
chart:ChartTooltip.ShowDuration="1500"
XBindingPath="XValue"
ItemsSource="{Binding Data}"
YBindingPath="YValue">
<chart:FastLineSeries.TooltipTemplate>
<DataTemplate>
<Border
Padding="4"
Background="Black"
BorderBrush="Black"
BorderThickness="0">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Foreground="White" Text="{Binding Item.XValue}" TextAlignment="Center"/>
<TextBlock Foreground="White" Text="{Binding Item.YValue}" TextAlignment="Center" />
</StackPanel>
</Border>
</DataTemplate>
</chart:FastLineSeries.TooltipTemplate>
</chart:FastLineSeries>
<chart:FastScatterBitmapSeries ShapeType="Square"
ScatterHeight="4"
ScatterWidth="4"
ListenPropertyChange="True"
Interior="DeepSkyBlue"
XBindingPath="XValue"
ItemsSource="{Binding Data}"
YBindingPath="YValue"/>
</chart:SfChart.Series> |
Hi Yuvaraj,
Thank you for the solution using FastScatterBitmapSeries as AdornmentInfo.
I tried it on my project and the performance is just great!
But now I have small problem with this.
When I zoomed in, there are unwanted spot on both left and right edge on the plot area like this:
It seems these spots are located at the same Y coordinate as the next data point off the visible area to left or right. When I pan the above plot to the left, this appears:
Your sample project does not have problem somehow.
Can you think of any reason why this happens?
Best Regards,
|
<chart:FastScatterBitmapSeries ShapeType="Square"
ScatterHeight="4"
ScatterWidth="4"
ListenPropertyChange="True"
Interior="DeepSkyBlue"
XBindingPath="XValue"
ItemsSource="{Binding Data}"
YBindingPath="YValue"/> |
Hi Yuvaraj,
Thank you for the workaround for the problem "The segment has plot at the edges in Zoomin state".
Changing ShapeType to Square solved the problem!
I hope the problem will be solved for Shapetype=Ellipse case in a future release, because I think the 'Ellipse' data point looks better and our end user also prefer it.
|
Please clear the NuGet cache, before using the latest one.
https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache |