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.

Pie chart how to break line in dataLabels?

See original GitHub issue

I want to let my dataLabels break line,how do i do? now: A

I wnat this: image

I have try \n,\r\n,
but not work. my code now is: dataLabels: { enabled: true, style: { fontSize: '15px' }, formatter: function (value, opts) { return [opts.w.globals.labels[opts.seriesIndex], value + '%'] } },

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
HoseinGhanbaricommented, Oct 15, 2021

Hi, I using 3.22.2 and try this, but still get error, cause in “apex-types.d.ts” formatter is still this: line 708: formatter?(val: string | number | number[], opts?: any): string | number; Thanks for your help!

Same here …

temporarily fix using as (unknown) as (string | number);

dataLabels: {
        formatter: (val: string | number | number[], opts?: any): string | number => {
          const name = opts.w.globals.labels[opts.seriesIndex];
          return [name, (val as number)?.toFixed(1) + '%'] as (unknown) as (string | number);
        },
      },
2reactions
sasipannoncommented, Sep 20, 2021

Hi, I using 3.22.2 and try this, but still get error, cause in “apex-types.d.ts” formatter is still this: line 708: formatter?(val: string | number | number[], opts?: any): string | number;

Thanks for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pie dataLabels and line break - Highcharts official support forum
Hello, In some conditions, some elements are not visible in a pie chart. This occours especially when a line break is added in...
Read more >
Add \n or line break on chart.js (pie chart) labels - Stack Overflow
I tried to add \n on my pie chart labels. But it doesn't seem working. The reason why I want to add \n...
Read more >
Change the format of data labels in a chart - Microsoft Support
Click the data labels whose border you want to change. Click twice to change the border for just one data label. Click Fill...
Read more >
Pie chart series label line break - OpenText Forums
<p>Adding line breaks in a data label for SVG charts is not as straightforward as with Highcharts, i.e. you cannot directly control the ......
Read more >
Pie chart in Excel with data labels instead of hard to read legend
00:00 Create Pie Chart in Excel00:13 Remove legend from a chart00:18 Add labels to each slice in a pie chart00:29 Change chart labels...
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