xAlignment: 'left' for multi line text #1679
Answered
by
kumilingus
YongheeMinnovation
asked this question in
Q&A
-
Hi there, I have a rectangle element with some text, and the text has three lines.
Thank you so much! |
Beta Was this translation helpful? Give feedback.
Answered by
kumilingus
May 26, 2022
Replies: 1 comment 1 reply
-
Use the SVG rect.attr({
label: {
text: inputText + '\n' + title + '\n' + value,
textAnchor: 'start'
}
}); And JointJS rect.attr({
label: {
text: inputText + '\n' + title + '\n' + value,
x: 'calc(0.5 * w)',
// position the text 10 pixels above the element
y: -10,
textVerticalAnchor: 'bottom'
}
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
YongheeMinnovation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the SVG
textAnchor
attribute (MDN documentation) to align text horizontally.And JointJS
textVerticalAnchor
custom attribute (JointJS documentation) to align text vertically.