beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.39k stars 574 forks source link

Tooltip for DateTimePoint #1442

Open mx2rel opened 9 months ago

mx2rel commented 9 months ago

Is your feature request related to a problem? Please describe. Currently, when displaying a DateTimePoint CartesianChart, the tooltip only displays the values corresponding to the hovered date. However, there is no option to display the latest (up to the hovered day) values of all series, not just the values on the specific hovered date.

Describe the solution you'd like I would like to propose adding a property that allows users to choose whether to display only the value on the hovered date or the latest value of all series up to the hovered date in the tooltip.

Describe alternatives you've considered I don't think there are any alternatives.

Additional context This feature would enhance the usability of the DateTimePoint CartesianChart by providing users with more comprehensive information in the tooltip, allowing for easier interpretation of the data trends.

normannoe54 commented 8 months ago

I have had success with this code:

` LineSeries ls = new LineSeries {

            Name = EmployeeVis.Name,
            Values = values,
            GeometrySize = 10,
            LineSmoothness = 0,
            Stroke = new SolidColorPaint(new SKColor(EmployeeVis.VisualColor.Color.R, EmployeeVis.VisualColor.Color.G, EmployeeVis.VisualColor.Color.B)) { StrokeThickness = 2 },
            GeometryStroke = new SolidColorPaint(new SKColor(EmployeeVis.VisualColor.Color.R, EmployeeVis.VisualColor.Color.G, EmployeeVis.VisualColor.Color.B)),
            GeometryFill = new SolidColorPaint(SKColors.White),
            Fill = null
        };

        ls.TooltipLabelFormatter = (x) => $"{EmployeeVis.Name} [{x.PrimaryValue}hr.]{Environment.NewLine}{new DateTime((long)x.SecondaryValue): MM/dd/yyyy}";`