Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/controllers/controller.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function computeMinSampleSize(scale, pixels) {
min = Math.min(min, Math.abs(pixels[i] - pixels[i - 1]));
}

for (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) {
for (i = 0, ilen = scale.ticks.length; i < ilen; ++i) {
curr = scale.getPixelForTick(i);
min = i > 0 ? Math.min(min, Math.abs(curr - prev)) : min;
prev = curr;
Expand Down
2 changes: 1 addition & 1 deletion src/scales/scale.category.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class CategoryScale extends Scale {
if (index < 0 || index > ticks.length - 1) {
return null;
}
return this.getPixelForValue(index * me._numLabels / ticks.length + this.min);
return me.getPixelForValue(index * me._numLabels / ticks.length + me.min);
}

getValueForPixel(pixel) {
Expand Down
4 changes: 2 additions & 2 deletions src/scales/scale.linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class LinearScale extends LinearScaleBase {
}

getPixelForTick(index) {
var ticks = this._tickValues;
const ticks = this.ticks;
if (index < 0 || index > ticks.length - 1) {
return null;
}
return this.getPixelForValue(ticks[index]);
return this.getPixelForValue(ticks[index].value);
}
}

Expand Down
8 changes: 1 addition & 7 deletions src/scales/scale.linearbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,9 @@ class LinearScaleBase extends Scale {
return ticks;
}

generateTickLabels(ticks) {
var me = this;
me._tickValues = ticks.map(t => t.value);
Scale.prototype.generateTickLabels.call(me, ticks);
}

_configure() {
var me = this;
var ticks = me.getTicks();
var ticks = me.ticks;
var start = me.min;
var end = me.max;
var offset;
Expand Down
4 changes: 2 additions & 2 deletions src/scales/scale.radialLinear.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class RadialLinearScale extends LinearScaleBase {
if (gridLineOpts.display) {
me.ticks.forEach(function(tick, index) {
if (index !== 0) {
offset = me.getDistanceFromCenterForValue(me._tickValues[index]);
offset = me.getDistanceFromCenterForValue(me.ticks[index].value);
drawRadiusLine(me, gridLineOpts, offset, index);
}
});
Expand Down Expand Up @@ -508,7 +508,7 @@ class RadialLinearScale extends LinearScaleBase {
return;
}

offset = me.getDistanceFromCenterForValue(me._tickValues[index]);
offset = me.getDistanceFromCenterForValue(me.ticks[index].value);

if (tickOpts.showLabelBackdrop) {
width = ctx.measureText(tick.label).width;
Expand Down
9 changes: 5 additions & 4 deletions src/scales/scale.time.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,11 @@ class TimeScale extends Scale {
}

getPixelForTick(index) {
const ticks = this.getTicks();
return index >= 0 && index < ticks.length ?
this.getPixelForValue(ticks[index].value) :
null;
const ticks = this.ticks;
if (index < 0 || index > ticks.length - 1) {
return null;
}
return this.getPixelForValue(ticks[index].value);
}

getValueForPixel(pixel) {
Expand Down