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

Fix to change arrow color when link color or highlight color changes #361

Merged
merged 2 commits into from
Aug 28, 2020

Conversation

chetanladha
Copy link
Contributor

@chetanladha chetanladha commented Aug 27, 2020

closes #360

Issue #360

Our application allow user to choose between light and dark theme. We set link color and highlight color to text color for theme. When the graph is loaded initially, both link and arrow color are in sync. But when user switches theme, the arrow color remain same, giving a bad user experience.

Change Detail

  • Current code assumes that defs are static and they need not be changed ever after the graph is loaded.
  • Current code caches the defs based on initial render and always returns cached copy of defs
  • Changed the code to maintain a cache for link.color and link.highlightColor combinations
  • A new cache key is added for each combination of link.color and link.highlightColor
  • defs are returned from cache, if it already exists in cache
  • Added e2e tests to validate that the changes indeed fix the issue Arrow color go out of sync with link color when link.color or link.highlightColor is updated #360. These tests fail currently
  • See screenshots after fix

Screenshot

  • Link and arrow color mismatch in normal mode

Screen Shot 2020-08-27 at 10 22 22 AM

  • Link and arrow color mismatch when hover over node/link

Screen Shot 2020-08-27 at 10 22 48 AM

Copy link
Owner

@danielcaldas danielcaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This work looks amazing @chetanladhal, thanks for the tests 💯

There's a small caveat tough on link colors and markers. The link.color can have link granularity, each link can set its own color, and although this approach is an improvement compared to the current state, it will not handle cases where for individually colored links, I'll make sure to document this limitation in the official docs. Thanks! 🚀

image

@danielcaldas danielcaldas merged commit 622f1b2 into danielcaldas:master Aug 28, 2020
@chetanladha chetanladha deleted the fix/arrow-color-fix branch September 8, 2020 15:49
@mhuzaifa-2000
Copy link

Any chances of this limitation being solved? The arrow heads still don't have the same color as the link.

Thanks

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.

Arrow color go out of sync with link color when link.color or link.highlightColor is updated
3 participants