line chart support new-lined text and multi-byte labels?
See original GitHub issueHey there!
I use line chart. And I want to use new-lined text and multi-byte labels for it.
it is my snippet (TypeScript).
const labels = [
'2020\n4/12',
'2020\n7/14',
'2020\n10/10'
];
const currentData = {
data: [
80, 55, 40
],
fill: false,
borderColor: 'rgb(244,154,60)',
lineTension: 0,
pointBorderWidth: 10,
pointBorderColor: 'rgb(238,88,53)',
};
const config = {
type: 'line',
data: { labels: labels, datasets: [currentData]},
options: {
scales: {
xAxes: [{
ticks: {
fontSize: 35
}
}],
yAxes: [{
ticks: {
fontSize: 35
}
}]
},
animation: {
duration: 0,
},
legend: {
display: false,
}
}
} as Chart.ChartConfiguration;
const myLineChart = new Chart(context, config);
it is result.
Thou I use 2020\n4/12
string, but it didn’t draw new-lined text like this.
(I edited the picture.)
And, I change the labels
to multi-byte character (like Japanese).
const labels = [
'2020年4月12日',
'2020年7月14日', // didn't show
'2020年10月10日'
];
second data didn’t show is it bug?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
EOL or End of Line or newline ascii character
Learn what are EOL (End of Line) or LF (Line Feed) or NL (New Line) ascii characters (\n\r) and why there are two...
Read more >How do I include newlines in labels in D3 charts?
I ended up using the following code to break each x-axis label across lines: var insertLinebreaks = function (d) { var el =...
Read more >Newline - Wikipedia
Newline is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. ... is used...
Read more >How to add newline in the text · Issue #384 · mermaid ... - GitHub
I am trying to break the text in two lines on top of arrows or on notes but newline is not working anywhere....
Read more >DAX – How to get a line break in a DAX measure for Labels or ...
This blog post shows how to use a DAX measure with adding in line breaks with Power BI which makes for easier reading...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think this is a multi-byte character issue, but the issue in the
autoSkip
code, which has been fixed in #5922. The fix has not been released yet, but you can try the master build.For your last question, #5914 introduced
ticks.lineHeight
option to change the height of text lines (see line-height in CSS for details), so you can also try it using the master build.Closing per our contribution guidelines.