question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

line chart support new-lined text and multi-byte labels?

See original GitHub issue

Hey 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.

2019-01-16 18 44 02

Thou I use 2020\n4/12 string, but it didn’t draw new-lined text like this.

fix (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?

2019-01-16 18 50 52

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nagixcommented, Jan 17, 2019

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.

0reactions
simonbrunelcommented, Jan 17, 2019

Closing per our contribution guidelines.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found