imaNNeo / imaNNeo/fl_chart

Hoverable Vertical/Horizontal extra lines

Open
#1,559 0 comments 0 reactions 0 assignees View on GitHub
enhancement Line Chart
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

Problem:
I am using `extraLinesData` on the `LineChart`. I want to be able to show additional information when a user hovers over/clicks on the line. Right now, the only optional is to show an optional static label (see screenshot). However, things quickly get overwhelming when trying to show more than just a couple characters. Furthermore, for a better user experience, I don't want to show that information until a user wants to see it through a hover/click event.

Solution:
Similar to the spot touched events, it would be nice if the lines had a way to handle their own space in the chart, so that a click/hover over the line itself would trigger an event that could be used to show the additional information.

Alternatives:
The only solution I can see if somehow grabbing the offset of the lines, then watching for those offsets to specifically be hovered or clicked, then setting state to `show` the label. But this feels more hacky and prone to error than if the event could recognize the line itself as being part of the chart.

![CleanShot 2024-01-17 at 20 05 24@2x](https://github.com/imaNNeo/fl_chart/assets/37080484/228bb900-5605-4bea-9416-0123bfd5f43e)

Contributor guide

Open the contributing guide

Research direction

Start with the LineChart handling for extraLinesData and compare it with the existing spot touched events. Define how hovering or clicking an extra vertical or horizontal line should expose its information, then verify that the event can drive a dynamic label without requiring offset-based workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.