Skip to content

Axis won't use decimal point values for scaling #5392

@serratedserenade

Description

@serratedserenade

Hey guys, I want to make the y axis ticks be in the step size of the max value (e.g. if the max value is 10, the ticks are 0, 2.5, 5, 7.5, 10). However it's rounding up and I'm not sure how to prevent that. Option used:

Expected Behavior

Steps to have decimal values: [0, 2.5, 5, 7.5, 10]

Current Behavior

Steps get rounded up to : [0, 3, 5, 8, 10].

Steps to Reproduce (for bugs)

  1. Make sample chart with any data and use the following scale option: scales: { yAxes: [{ ticks: { min: 0, max: 10, stepSize: 2.5, display: true, beginAtZero: true } }] }

Context

I want to be able to set the step size to any value I want and be able to scale properly. Currently when it automatically rounds up, it looks off and it's not the result I want anyway.

Environment

  • Chart.js version: 2.6
  • Browser name and version: Nodejs 9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions