Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using a time scale with rounding #4328

Closed
moonchen opened this issue Jun 5, 2017 · 0 comments
Closed

Error when using a time scale with rounding #4328

moonchen opened this issue Jun 5, 2017 · 0 comments

Comments

@moonchen
Copy link

moonchen commented Jun 5, 2017

I get a javascript error when using a time axis with rounding enabled, in chartjs 2.6.0.

Expected Behavior

Rounding was working in 2.5.0

Current Behavior

[Error] TypeError: minMoment.round is not a function. (In 'minMoment.round(timeOpts.round)', 'minMoment.round' is undefined)
buildTicks (Chart.bundle.js:17082)
update (Chart.bundle.js:11794)
getMinimumBoxSize (Chart.bundle.js:11062)
each (Chart.bundle.js:9515)
update (Chart.bundle.js:11076)
updateLayout (Chart.bundle.js:8577)
update (Chart.bundle.js:8543)
construct (Chart.bundle.js:8307)
Chart (Chart.bundle.js:10803)
onload (show:74)

Possible Solution

In scale.time.js, line 307, replace minMoment.round with minMoment.startOf

Steps to Reproduce (for bugs)

  1. https://jsfiddle.net/moonchen/er7Lem6y/

Context

I'm trying to draw a time-series line chart and control the rounding on the x-axis.

Environment

  • Chart.js version: 2.6.0
  • Browser name and version: Tried in the latest Chrome and Safari
  • Link to your project: N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants