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

Added custom css class on edge labels #398

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kaelhem
Copy link

@kaelhem kaelhem commented Mar 27, 2020

Hi,
I've just made a small update on edge label to be able to specify custom css classes.


This PR allow to add a labelClass parameter on the setEdge function.

// sample :
g.setEdge(link.source, link.target, {
  labelClass: 'cutomClass1 customClass2'
})

The original label class is untouched.

It should fix #195

@tik-stbuehler
Copy link

For consistency (with labelStyle and labelType) you probably should name the label class property labelClass instead of className.

(And I have no idea why you had to redo the way the class is applied - didn't classed work with the calculated class list?)

@kaelhem
Copy link
Author

kaelhem commented May 18, 2020

Hello. I changed the property name for labelClass as you asked. I replaced the "classed" stuff that allow to add/remove a specific class name to be able to specify several classes in the className parameter (like this : customClass1 customClass2).

If you think there is a better way to do it, tell me I will update the PR.

@tik-stbuehler
Copy link

I'm not a maintainer, just a user (and I'm interested in the feature too) :)

According to the API doc classed should work with multiple classes (like "label customClass1 customClass2" - i.e. just pass labelClass instead of "label") - but I'm no d3 expert, so perhaps I'm missing something here.

@kaelhem
Copy link
Author

kaelhem commented May 18, 2020

ok :)
I will have look, not a d3 expert too :)

edit:
@tik-stbuehler You were right, I've update the PR.

@tbo47
Copy link

tbo47 commented Jan 6, 2022

I ported the project to es6 and I accept contributions!
https://github.com/tbo47/dagre-es

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.

Add a class to edgeLabel?
3 participants