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.

stepSize is not working in chart js for line chart x-axis

See original GitHub issue
I am using below option in chart :

option : {
                    scales: {
                        xAxes: [{
                            display: true,
                            scaleLabel: {
                                display: true,
                                labelString: 'fpr',
                                fontStyle: 'bold'
                            },
                            ticks: {
                                callback: function(value, index, values) {
                                    return parseFloat(value).toFixed(2);
                                },
                                autoSkip: true,
                                maxTicksLimit: 10,
                                stepSize: .2
                            }
                        }],
                        yAxes: [{
                        	
                            display: true,
                            scaleLabel: {
                                display: true,
                                labelString: 'tpr',
                                fontStyle: 'bold'
                            },
                            ticks: {
                                callback: function(value, index, values) {
                                    return parseFloat(value).toFixed(2);
                                },
                                autoSkip: true,
                                 maxTicksLimit: 10,
                                 stepSize: .2
                            }
                        }]
                    }
                }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

7reactions
etimbergcommented, Jan 20, 2017

Also, the step size won’t work for the bottom because the default x axis is a ‘category’ axis that doesn’t interpolate numerically.

if you want to change that you can do

xAxes: [{
  type: 'linear',
  display: true,
  scaleLabel: {
    display: true,
    labelString: 'fpr',
    fontStyle: 'bold'
  },
  ticks: {
    callback: function(value, index, values) {
      return parseFloat(value).toFixed(2);
    },
    autoSkip: true,
    maxTicksLimit: 10,
    stepSize: .2
  }
}]
3reactions
wjadevriescommented, Sep 8, 2021

PS: why is this issue closed???

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chart.js stepSize not working with min - Stack Overflow
This looks like a typo. In your snippet you have stepSize: 8 . Change it to stepSize: 7 and the scale works correctly....
Read more >
Step Size - Chart.js
No information is available for this page.
Read more >
How to Reduce the Label Ticks in the X Axis in Chart JS
The Chart JS documentation does not cover how to reduce the label ... bar chart or a line chart, or any type of...
Read more >
How to Control Ticks Steps on the Y Scale in Chart js - YouTube
The default tick stepsize is not always the right structure for displaying ... With chart js you can make line chart, bar chart,...
Read more >
How to set x-axis tick values for Charts.js line chart?
but it doesn't seem to make any difference. I've also tried changing the settings in Horizontal Axis Settings > Tick Settings, but they...
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