import {callback as call, each, finiteOrDefault, isArray, isFinite, isNullOrUndef, isObject} from '../helpers/helpers.core';
import {toDegrees, toRadians, _int16Range, _limitValue, HALF_PI} from '../helpers/helpers.math';
import {_alignStartEnd, _toLeftRightCenter} from '../helpers/helpers.extras';
-import {toFont, toPadding} from '../helpers/helpers.options';
+import {toFont, toPadding, _addGrace} from '../helpers/helpers.options';
import './core.scale.defaults';
this.labelRotation = undefined;
this.min = undefined;
this.max = undefined;
+ this._range = undefined;
/** @type {Tick[]} */
this.ticks = [];
/** @type {object[]|null} */
me.beforeDataLimits();
me.determineDataLimits();
me.afterDataLimits();
+ me._range = _addGrace(me, me.options.grace);
me._dataLimitsCached = true;
}
import {almostEquals, almostWhole, niceNum, _decimalPlaces, _setMinAndMaxByKey, sign} from '../helpers/helpers.math';
import Scale from '../core/core.scale';
import {formatNumber} from '../helpers/helpers.intl';
-import {_addGrace} from '../helpers/helpers.options';
/**
* Generate a set of linear ticks for an axis
step: tickOpts.stepSize,
count: tickOpts.count,
};
- const ticks = generateTicks(numericGeneratorOptions, _addGrace(me, opts.grace));
+ const dataRange = me._range || me;
+ const ticks = generateTicks(numericGeneratorOptions, dataRange);
// At this point, we need to update our max and min given the tick values,
// since we probably have expanded the range of the scale
--- /dev/null
+module.exports = {
+ description: 'https://github.com/chartjs/Chart.js/issues/8912',
+ config: {
+ type: 'bar',
+ data: {
+ labels: ['Red', 'Blue'],
+ datasets: [{
+ data: [10, -10]
+ }]
+ },
+ options: {
+ plugins: false,
+ scales: {
+ x: {
+ display: false,
+ },
+ y: {
+ grace: '100%'
+ }
+ }
+ }
+ },
+ options: {
+ spriteText: true
+ }
+};