question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`LineSeries` tooltip not visible when using `DateTimePoint`

See original GitHub issue

Describe 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:

  1. Display a simple line series.
  2. 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:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Pressaccocommented, Apr 26, 2022

Thank you for the response @beto-rodriguez.

BTW - cool library 👍

0reactions
beto-rodriguezcommented, Apr 26, 2022

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 handle DateTime plots, I extended the docs in the referenced commits, and changed the DateTime/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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found