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

[Feature] Allow separate style customization if mark highlighted from legend #20626

Open
pa7-sigma opened this issue Dec 27, 2024 · 0 comments
Open
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.

Comments

@pa7-sigma
Copy link

pa7-sigma commented Dec 27, 2024

What problem does this feature solve?

Use case

I'd like to visually distinguish direct interactions with marks from legend interactions.
When hovering over a Pie slice I'd like to apply emphasis styles, but when highlighting a Pie slice through the legend I'd like to apply different styles.

Example Experience

echarts-highlight.mov

Current Workaround

  • customize styles through mutating the graphics elements when legend items are hovered
  • rely on emphasis state for direct interactions
    // for legend highlight, iterate through each graphic element and apply opacity as needed
    const data = series.getData(); // from chart model
    data.eachItemGraphicEl((graphic, index) => {
        graphic.setStyle({
          opacity:
            dataIndexes.includes(index)
              ? HIGHLIGHT_OPACITY
              : HIGHLIGHT_OPACITY_MUTED,
        });
    });

Open Questions

Is there a better way to achieve this without customizing on the renderer level?

What does the proposed API look like?

This may not be a good idea so open to alternative approaches:

  • Extend the highlight action payload support applying custom styles when dispatching a highlight action
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

1 participant