`LineSeries` tooltip not visible when using `DateTimePoint`
See original GitHub issueDescribe the bug
Tool tip displays as expected for LineSeries<float>
but not when you use the exact same code for LineSeries<DateTimePoint>
. Any guidance you can provide would be appreciated.
To Reproduce
Steps to reproduce the behavior:
- Display a simple line series.
- Mouse over a data point.
In XAML:
<lvc:CartesianChart x:Name="CartesianChart" Grid.Row="0" Grid.Column="0"
XAxes="{Binding XAxes}"
YAxes="{Binding YAxes}"
Series="{Binding Series}"
TooltipPosition="Top"/>
In the constructor:
LiveCharts.Configure(
settings => settings
.AddDefaultMappers()
.AddSkiaSharp()
.AddDarkTheme());
When the Series
property is called, the following is returned:
private ISeries[] GetSeries(ImmutableArray<IRecord> records)
{
var values = new ObservableCollection<float>();
// Does not work
// var values = new ObservableCollection<DateTimePoint>();
foreach (var record in records)
{
values.Add(record.value);
// Does not work
// values.Add(new DateTimePoint(record.CreatedAt, record.value));
}
return new ISeries[]
{
// Does not work
// new LineSeries<DateTimePoint>
// works
new LineSeries<float>
{
Name = "SeriesName",
Values = values,
TooltipLabelFormatter = (chartPoint) => $"TOOLTIP: {chartPoint.Context.Series.Name}: {chartPoint.PrimaryValue}",
}
};
Expected behavior
LineSeries<float>
displays the tooltip as expected when you mouse over a data point.
Actual Behavior
- Using
LineSeries<DateTimePoint>
and the exact same code… a tooltip is not displayed.
Screenshots
- OS: Windows 10 Pro, 64 bit, Version 21H1, Build 19043.1526
- .NET Framework: 4.8
- NuGet package: 2.0.0-beta.90
Additional context
- None at this time.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Tooltips not working with LineSeries · Issue #51 · amcharts ...
the cursor is hovering for all lineSeries so the tooltips is showing together. i want a hover then only one tooltip can be...
Read more >Basic WPF LiveCharts DateTime example not working
DateTimePoint ). I'm just starting to use these controls, but at first glance it is charting pretty much what I'm expecting to see....
Read more >ToolTip for LineSeries don't show in UI for WPF
Hello Bhukya, The tooltip will display only if you have a visuals for the data points. You can show this by setting PointTemplate...
Read more >Solved: Tooltip not showing all points in a chart but only...
Solved: Hello, I am having a strange behaviour, i have three charts two of them work as intended showing all values, while the...
Read more >Tooltip not showing properly for mixed line and scatter plot
I have a mixed multi-series chart with a scatter and a line plot. The tooltip does not show up for the scatter plot...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for the response @beto-rodriguez.
BTW - cool library 👍
Thanks for the issue and the feedback.
Yes you are right @Pressacco The
UnitWidth
is necessary in this case, it fixes your issue. I am thinking in a way to simplify this but I think that it will be enough if we explain better in the docs how to handleDateTime
plots, I extended the docs in the referenced commits, and changed theDateTime
/TimeSpan
samples to explain that this step is required.About your second query about the repeated point in the tooltip, I also agree, we normally only want to see the closest point to the pointer, so that is how the library will behave by default in the next release, but we could also configure the chart to behave as it does now.
I will close this for now since you found a solution for your issue, your second issue will be gone when you update to the next release of the library.