Skip to content

Component | Line: Allow lines to be stacked (combine with stacked areas) - #690

Draft
aguingand wants to merge 2 commits into
f5:mainfrom
aguingand:stacked-lines
Draft

Component | Line: Allow lines to be stacked (combine with stacked areas)#690
aguingand wants to merge 2 commits into
f5:mainfrom
aguingand:stacked-lines

Conversation

@aguingand

@aguingand aguingand commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Problem

Today we can put lines over classic areas (same y) but not over stacked area (stacked y). It can be useful for some design systems (e.g. https://www.shadcn-vue.com/charts/area#charts).

Solution

Add a stacked boolean config for Line component.

Todo

  •  Fix crosshair circles Y : the circle Y for stacked line is upside areas when combining the twos. Workaround, pass getCircles config to Crosshair.

Alternative solution

Another solution would be to add a line config to Area but it seems less configurable.

@lee00678

lee00678 commented Dec 18, 2025

Copy link
Copy Markdown
Collaborator

Problem

Today we can put lines over classic areas (same y) but not over stacked area (stacked y). It can be useful for some design systems (e.g. https://www.shadcn-vue.com/charts/area#charts).

Solution

Add a stacked boolean config for Line component.

Todo

  •  Fix crosshair circles Y : the circle Y for stacked line is upside areas when combining the twos. Workaround, pass getCircles config to Crosshair.

Alternative solution

Another solution would be to add a line config to Area but it seems less configurable.

@aguingand thanks for the contribution, I think I prefer the current solution

Add a stacked boolean config for Line component.

@rokotyan

Copy link
Copy Markdown
Contributor

I feel like this will require hacking the behavior of Crosshair, and I'm not sure how I feel about it. Adding a set of line configs to Area sounds more reasonable to me. But I'll give it another thought.

@aguingand

Copy link
Copy Markdown
Contributor Author

@rokotyan I'm also leaning towards line config in area solution, it's also simpler DX (one component instead of 2 to add a stroke to already existing shapes). I will open another PR.

@lee00678

Copy link
Copy Markdown
Collaborator

I feel like this will require hacking the behavior of Crosshair, and I'm not sure how I feel about it. Adding a set of line configs to Area sounds more reasonable to me. But I'll give it another thought.

How is that differ from how we handle area and stacked bar? You should be able to just pass yStacked into crosshair, right? or am I mistaken?

@rokotyan

Copy link
Copy Markdown
Contributor

How is that differ from how we handle area and stacked bar? You should be able to just pass yStacked into crosshair, right? or am I mistaken?

@lee00678 There will be a problem with Crosshair circles. We don't want to show circles for the lines in this case since they are purely decorative, and this will require some hacking.

@lee00678

Copy link
Copy Markdown
Collaborator

How is that differ from how we handle area and stacked bar? You should be able to just pass yStacked into crosshair, right? or am I mistaken?

@lee00678 There will be a problem with Crosshair circles. We don't want to show circles for the lines in this case since they are purely decorative, and this will require some hacking.

I see. Ok, then maybe we should consider these as separate features. I still see having stacked line a valid addition to the library.

@rokotyan

rokotyan commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

I still see having stacked line a valid addition to the library.

@lee00678 Could you elaborate on that a bit more? Specifically, what use cases do you see for a stacked line chart? I'm afraid it might bring more confusion than benefits, and extra code to maintain.

@lee00678

lee00678 commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

I still see having stacked line a valid addition to the library.

@lee00678 Could you elaborate on that a bit more? Specifically, what use cases do you see for a stacked line chart? I'm afraid it might bring more confusion than benefits, and extra code to maintain.

Yes, I think for cases like undefined/null data, we can use interpolated lines to indicate that, whereas area chart doesn't provide that functionality.

@rokotyan

rokotyan commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

@lee00678 You mean if we use it with Area? I get your point, but this will have problems with Crosshair that I described above. I don't mind merging this if we implement a way to opt-out a component from working with Crosshair and provide a public example.

@lee00678

lee00678 commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

@lee00678 You mean if we use it with Area? I get your point, but this will have problems with Crosshair that I described above. I don't mind merging this if we implement a way to opt-out a component from working with Crosshair and provide a public example.

I get your point for crosshair, I will think about it and see what's the best approach.

@lee00678
lee00678 marked this pull request as draft January 8, 2026 19:33
@lee00678

lee00678 commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

Marking as Draft for now.

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.

3 participants