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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Bigood
Copy link

@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 ❌ Failed (Inspect) Sep 20, 2023 3:06pm

@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
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
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.

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.

None yet

3 participants