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.

autoSkip data Labels

See original GitHub issue
screen shot 2018-06-26 at 2 32 42 pm

Hi, how to autoskip the datalabels if I got a bunch of data?

Eg. 10000 data, I want to display 100 labels only

Tried using this but it didn’t work

datalabels: {
       display: function (context) {
             return context.dataIndex % 3;
        }
};

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
simonbrunelcommented, Dec 11, 2018

Since v0.5.0 (released today), a better solution could be to use display: 'auto'.

1reaction
simonbrunelcommented, Jun 26, 2018
display: function (ctx) {
    var capacity = 25;
    var count = ctx.dataset.data.length;
    var step = Math.ceil(count / capacity);
    return ctx.dataIndex  % step === 0;
}

This will guarantee to display a maximum of 25 labels whatever the number of data:

  • count <= 25: all labels are displayed,
  • count > 25: 1 label every 2 is displayed,
  • count > 50: 1 label every 3 is displayed,
  • count > 75: 1 label every 4 is displayed,
Read more comments on GitHub >

github_iconTop Results From Across the Web

chart.js - AutoSkip: False not working on time xAxes labels
I need to show all labels, however setting AutoSkip: False is having no ... label: function (tooltipItem, data) { return '$' + tooltipItem....
Read more >
'autoskip' feature in chartjs, doesn't seem to be working. #6591
Everything I have read says this autoSkip feature should automatically skip overlapping labels. However, when setting this to both true or false ...
Read more >
Cartesian Axes - Chart.js
Turn autoSkip off to show all labels no matter what. autoSkipPadding, number, 3, Padding between the ticks on the horizontal axis when ...
Read more >
ChartJS autoskip:False not working on line chart-Chart.js
Coding example for the question ChartJS autoskip:False not working on line ... setup const data = { datasets: [{ label: 'PZ-1', data: [{...
Read more >
Outbound data stream example - IBM
Bytes Contents Notes 3 X'11' SBA order to position first field at … 6 X'1D' SF order to begin first field definition. 8‑17 'Car record' Display...
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