mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 12:49:07 +02:00
Fixed typo in core.helpers.js.
Added ticks.fixedStepSize configuration parameter to force linear scale steps.
This commit is contained in:
parent
df218ead82
commit
9a20381af4
@ -843,7 +843,7 @@
|
||||
},
|
||||
isDatasetVisible = helpers.isDatasetVisible = function(dataset) {
|
||||
return !dataset.hidden;
|
||||
};
|
||||
},
|
||||
pushAllIfDefined = helpers.pushAllIfDefined = function(element, array) {
|
||||
if (typeof element == "undefined") {
|
||||
return;
|
||||
|
@ -156,6 +156,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.options.ticks.suggestedMin) {
|
||||
this.min = Math.min(this.min, this.options.ticks.suggestedMin);
|
||||
}
|
||||
@ -169,6 +170,12 @@
|
||||
this.max++;
|
||||
}
|
||||
|
||||
if (this.options.ticks.fixedStepSize) {
|
||||
for (var j = this.min; j <= this.max; ++j) {
|
||||
console.log(j * this.options.ticks.fixedStepSize);
|
||||
this.ticks.push(j * this.options.ticks.fixedStepSize);
|
||||
}
|
||||
} else {
|
||||
var niceRange = helpers.niceNum(this.max - this.min, false);
|
||||
var spacing = helpers.niceNum(niceRange / (maxTicks - 1), true);
|
||||
var niceMin = Math.floor(this.min / spacing) * spacing;
|
||||
@ -180,6 +187,7 @@
|
||||
for (var j = 0; j <= numSpaces; ++j) {
|
||||
this.ticks.push(niceMin + (j * spacing));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.position == "left" || this.options.position == "right") {
|
||||
// We are in a vertical orientation. The top value is the highest. So reverse the array
|
||||
@ -203,11 +211,9 @@
|
||||
|
||||
this.zeroLineIndex = this.ticks.indexOf(0);
|
||||
},
|
||||
|
||||
getLabelForIndex: function (index, datasetIndex) {
|
||||
return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
|
||||
},
|
||||
|
||||
// Utils
|
||||
getPixelForValue: function (value, index, datasetIndex, includeOffset) {
|
||||
// This must be called after fit has been run so that
|
||||
|
Loading…
Reference in New Issue
Block a user