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

How to change the color of the links in a network? #28

Closed
AlmahaAlmalki opened this issue Dec 20, 2019 · 2 comments
Closed

How to change the color of the links in a network? #28

AlmahaAlmalki opened this issue Dec 20, 2019 · 2 comments
Assignees

Comments

@AlmahaAlmalki
Copy link

Hi,

I'm trying to change the color of the links, and it's not clear in the documentation how to do so.

 const methods = {
            links: this.state.nodes,
            nodes: this.state.links,
            color: (d: any) => d['color'],
            label: (d: any) => d['OccupationTitle'],
            hover: (d: any) =>  d['id'],
            zoom: true,
} 
   

Thanks

@davelandry
Copy link
Member

hi @AlmahaAlmalki! apologies for the unclear docs (known bug 😅)

you're looking for the shapeConfig method, which acts as a pass-through to any Shape class that is being drawn on the screen. So if you wanted to change the stroke on every shape you would do this:

shapeConfig: {
  stroke: "red"
}

...but for visualizations with multiple shape types, like Networks which have Rect and Line shapes, you can provide a namespaced config:

shapeConfig: {
  Line: {
    stroke: "red"
  }
}

@davelandry davelandry self-assigned this Dec 20, 2019
@AlmahaAlmalki
Copy link
Author

Great, thank you Dave 👍

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

No branches or pull requests

2 participants