Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tooltips #1028

Merged
merged 47 commits into from
Jun 2, 2023
Merged

Improve tooltips #1028

merged 47 commits into from
Jun 2, 2023

Conversation

beto-rodriguez
Copy link
Owner

@beto-rodriguez beto-rodriguez commented May 25, 2023

Multiple improvements to tooltips.

Fixed issues

fixes #849
fixes #869
fixes #1046

Breaking changes

1. IChartTooltip.Hide() changed

This should only affect you if you built a custom tooltip, this change prevents a tooltip to hold a refence to the chart, instead LiveCharts will inject the chart.

IChartTooltip<SkiaSharpDrawingContext>.Hide() method changed to IChartTooltip<SkiaSharpDrawingContext>.Hide(Chart<TDrawingContext> chart)

This is an example of how to migrate a custom tooltip from version beta.710 and lower:

Previously

public class SKDefaultTooltip : IChartTooltip<SkiaSharpDrawingContext>
{
    private Chart<SkiaSharpDrawingContext> _chart;

   // then we used to set the _chart in the Show() method.

    public void Hide()
    {
        if (_chart is null || _panel is null) return;
        _chart.RemoveVisual(_panel);
    }
}

Now

public class SKDefaultTooltip : IChartTooltip<SkiaSharpDrawingContext>
{
    public void Hide(Chart<SkiaSharpDrawingContext> chart)
    {
        if (chart is null || _panel is null) return;
        chart.RemoveVisual(_panel);
    }
}

2. Some event handlers were simplified

For the series: LineSeries, StepLineSeries, StackedAreaSeries and StackedStepAreaSeries the ChartPointPointerDown, ChartPointPointerHover and ChartPointPointerHoverLost events are now much simpler, if you are using any of those events in any of those series, you must update the handler method. This makes all the series events consistent.

This is an example of how to migrate from beta.710 and lower:

Previously

var lineSeries = new LineSeries<int>();

lineSeries.ChartPointPointerDown +=
   (IChartView chart, ChartPoint<int, BezierPoint<CircleGeometry>, LabelGeometry>? point) =>
    {
        // point was clicked!
    };

Now

var lineSeries = new LineSeries<int>();

lineSeries.ChartPointPointerDown +=
    (IChartView chart, ChartPoint<int, CircleGeometry, LabelGeometry>? point) =>
    {
        // point was clicked!
    };

@beto-rodriguez beto-rodriguez changed the base branch from master to dev May 25, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant