Skip to content

Commit

Permalink
Time scale improvements to improve performance and reliability
Browse files Browse the repository at this point in the history
* Make parseTime private
* start on fixing time scale
* Reimplement existing functionality
* Tidy tests
* Fix labels for non-linearly sized units

Months, quarters and years have non-constant numbers of seconds. A scale that's linear WRT milliseconds produces incorrect tick labels due to the label formatting losing precision (eg year labels lose month and day so a label of 2016-12-32 displays as 2016 instead of 2017).

* Re-implement tick generation

As in v2.5
  • Loading branch information
tredston authored and etimberg committed Apr 2, 2017
1 parent 222479c commit 35dcfe0
Show file tree
Hide file tree
Showing 3 changed files with 481 additions and 466 deletions.
3 changes: 2 additions & 1 deletion samples/scales/time/line-point-data.html
Expand Up @@ -119,7 +119,8 @@

document.getElementById('addData').addEventListener('click', function() {
if (config.data.datasets.length > 0) {
var lastTime = myLine.scales['x-axis-0'].labelMoments[0].length ? myLine.scales['x-axis-0'].labelMoments[0][myLine.scales['x-axis-0'].labelMoments[0].length - 1] : moment();
var numTicks = myLine.scales['x-axis-0'].ticksAsTimestamps.length;
var lastTime = numTicks ? moment(myLine.scales['x-axis-0'].ticksAsTimestamps[numTicks - 1]) : moment();
var newTime = lastTime
.clone()
.add(1, 'day')
Expand Down

0 comments on commit 35dcfe0

Please sign in to comment.