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
Add Support to pass a function to node.labelProperty #135
Conversation
sandbox/data/marvel/marvel.config.js
Outdated
@@ -30,7 +30,7 @@ module.exports = { | |||
highlightFontWeight: 'bold', | |||
highlightStrokeColor: 'red', | |||
highlightStrokeWidth: 1.5, | |||
labelProperty: 'id', | |||
labelProperty: n => n.id + n.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labelProperty: n => n.id + n.name, | |
labelProperty: n => `${n.id} - ${n.name}`, |
package.json
Outdated
@@ -7,7 +7,7 @@ | |||
"scripts": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase with master and also drop the changes on sandbox/rd3g.sandbox.**
src/components/graph/graph.helper.js
Outdated
@@ -331,6 +331,7 @@ function buildNodeProps(node, config, nodeCallbacks = {}, highlightedNode, highl | |||
node.id === (highlightedLink && highlightedLink.target)); | |||
const opacity = _getNodeOpacity(node, highlightedNode, highlightedLink, config); | |||
let fill = node.color || config.node.color; | |||
let labelProperty = node[config.node.labelProperty] || node.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename labelProperty
to label and move this assignment next to the new logic that you added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor comments.
@danielcaldas Thanks for the feedback! I made the changes you suggested. |
Sweet! |
Changes
Fixes #133