public api for custom multiline note
Closed this issue · 3 comments
mipac commented
It would be very useful to choose how the wrapping is done.
For example I found very useful to wrap based on the "\n" I insert in my label.
Using the wrap function:
var wrap = function wrap(text, width) {
var lineHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1.2;
text.each(function () {
var text = d3.select(this),
words = text.text().split(/\n/).reverse().filter(function (w) {return w !== "";});
var word,
tspan = text.text(null);
while (word = words.pop()) {
tspan = text.append("tspan")
.style("text-anchor", "start")
.attr("x", 0)
.attr("dy", lineHeight + "em")
.text(word);
}
});
Perhaps could you expose a way to substitute the "warp" function or a "warp mode" for the existing one and some others like this, and some others...
Thank you for that cool lib :)
susielu commented
Thanks for this idea! I'm on vacay without a laptop for a few weeks will
take a look once I'm home .
On Sep 22, 2017 3:59 PM, "michel" <notifications@github.com> wrote:
It would be very useful to choose how the wrapping is done.
For example I found very useful to wrap based on the "\n" I insert in my
label.
Using the wrap function:
var wrap = function wrap(text, width) {
var lineHeight = arguments.length > 2 && arguments[2] !==
undefined ? arguments[2] : 1.2;
text.each(function () {
var text = d3.select(this),
words =
text.text().split(/\n/).reverse().filter(function (w) {return w !==
"";});
var word,
tspan = text.text(null);
while (word = words.pop()) {
tspan = text.append("tspan")
.style("text-anchor", "start")
.attr("x", 0)
.attr("dy", lineHeight + "em")
.text(word);
}
});
Perhaps could you expose a way to substitute le "warp" function or a "warp
mode" for the existing one and some others like this, and some others...
Thank you for that cool lib :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#41>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABYfbQxJAGtyCKsLtSQHxLlc4HrY_vGQks5sk70mgaJpZM4PgvxH>
.
susielu commented
This is available in v2.1.0 you can pass a wrapSplitter
property to the note configuration for your own split settings. For example:
{ note: {
label: " A different\n annotation type with long wrap",
title: "Another title with a long wrap for testing",
wrapSplitter: /\n/
}
}
In this case it would only wrap on the new line in the label. Thanks for this feature suggestion. Let me know if you have any issues with using it.
mipac commented
great!
thank you very much 😊
Le lun. 9 oct. 2017 à 22:21, Susie <notifications@github.com> a écrit :
… This is available in v2.1.0 you can pass a wrapSplitter property to the
note configuration for your own split settings. For example:
{ note: {
label: " A different\n annotation type with long wrap",
title: "Another title with a long wrap for testing",
wrapSplitter: /\n/
}
}
In this case it would only wrap on the new line in the label. Thanks for
this feature suggestion. Let me know if you have any issues with using it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFj5A9Oyty89aCFZvamThul-u4t0Kr4Xks5sqoBOgaJpZM4PgvxH>
.