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

Allow custom legendNode for markers #2432

Merged
merged 4 commits into from
Oct 23, 2024
Merged

Allow custom legendNode for markers #2432

merged 4 commits into from
Oct 23, 2024

Conversation

Bigood
Copy link
Contributor

@Bigood Bigood commented Sep 20, 2023

Allow legendNode props on markers for finer control over legend.

Usecases :

  • Display other content than text (image, shape…)
  • Create tooltips to display additional information, when a lot of markers are rendered and remaining place is low

Usage :

...
markers={[{
    axis: "x",
    lineStyle: {
        stroke: "lightblue",
        strokeWidth: 5
    },
    legendPosition: "top",
    legendNode: <foreignObject x={0} y={0} width={32} height={32}>
                    <FontAwesomeIcon icon={faRocket} />
                </foreignObject>,
}]}

Expected result :

image

Codechanges :

Two lines changed to bypass legendNode creation with legend text.
Doesn't break any existing functionality, and seams easy to maintain across updates.

Allow `legendNode` props for finer control over legend customization for markers
@vercel
Copy link

vercel bot commented Sep 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nivo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 11:36am

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 16ecb26:

Sandbox Source
nivo Configuration

@Bigood
Copy link
Contributor Author

Bigood commented Oct 13, 2023

@plouc Can I do something to help this PR be merged ?

@Nikholau
Copy link

lets aprovve this PR @plouc !

@Bigood
Copy link
Contributor Author

Bigood commented Mar 27, 2024

Up'ing this, how can I help?

@plouc
Copy link
Owner

plouc commented Apr 29, 2024

@Bigood, sorry for the late reply, the PR needs to be rebased, I think it would be good to add a test for it as well, maybe not in the core though, it's probably better to test this on a chart supporting markers.

@Bigood
Copy link
Contributor Author

Bigood commented Oct 9, 2024

@plouc Right on time, as requested here is a test on Line on updated codebase. I don't know what to do to solve Vercel's deploy failure though.

Is that ok?

@Bigood
Copy link
Contributor Author

Bigood commented Oct 22, 2024

@plouc I don't mean to be pushy, but I have a time window to edit this PR if there's something to be done. Otherwise, if everything's mergeable, could you give an estimation of when you'd have time to push the button ?

I'd personally like to upgrade my version of nivo on my project, but I can't for the moment as I heavily depend on this functionality (I dangerously use the package build by codesandbox, and can't yet find a way to use patch-package properly to patch the builded version easily).

@plouc
Copy link
Owner

plouc commented Oct 22, 2024

@plouc Right on time, as requested here is a test on Line on updated codebase. I don't know what to do to solve Vercel's deploy failure though.

Is that ok?

Vercel ran fine, for codesandbox, it's unrelated.

@plouc
Copy link
Owner

plouc commented Oct 22, 2024

@Bigood, could you please run prettier?

@plouc plouc merged commit 1ce58a5 into plouc:master Oct 23, 2024
3 of 4 checks passed
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