mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Remove unused method. Prefix private ones with underscore (#6721)
This commit is contained in:
parent
81f5cf416a
commit
1049aa65b8
@ -72,6 +72,7 @@ Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`.
|
||||
|
||||
* `_model.datasetLabel`
|
||||
* `_model.label`
|
||||
* `TimeScale.getLabelWidth`
|
||||
|
||||
### Renamed
|
||||
|
||||
@ -84,6 +85,9 @@ Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`.
|
||||
* `helpers.log10` was renamed to `helpers.math.log10`
|
||||
* `Chart.Animation.animationObject` was renamed to `Chart.Animation`
|
||||
* `Chart.Animation.chartInstance` was renamed to `Chart.Animation.chart`
|
||||
* `TimeScale.getLabelCapacity` was renamed to `TimeScale._getLabelCapacity`
|
||||
* `TimeScale.tickFormatFunction` was renamed to `TimeScale._tickFormatFunction`
|
||||
* `TimeScale.getPixelForOffset` was renamed to `TimeScale._getPixelForOffset`
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
@ -408,7 +408,7 @@ function getTimestampsForTicks(scale) {
|
||||
var min = scale.min;
|
||||
var max = scale.max;
|
||||
var options = scale.options;
|
||||
var capacity = scale.getLabelCapacity(min);
|
||||
var capacity = scale._getLabelCapacity(min);
|
||||
var source = options.ticks.source;
|
||||
var timestamps;
|
||||
|
||||
@ -593,7 +593,7 @@ module.exports = Scale.extend({
|
||||
// determineUnitForFormatting relies on the number of ticks so we don't use it when
|
||||
// autoSkip is enabled because we don't yet know what the final number of ticks will be
|
||||
me._unit = timeOpts.unit || (tickOpts.autoSkip
|
||||
? determineUnitForAutoTicks(timeOpts.minUnit, me.min, me.max, me.getLabelCapacity(min))
|
||||
? determineUnitForAutoTicks(timeOpts.minUnit, me.min, me.max, me._getLabelCapacity(min))
|
||||
: determineUnitForFormatting(me, ticks.length, timeOpts.minUnit, me.min, me.max));
|
||||
me._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined
|
||||
: determineMajorUnit(me._unit);
|
||||
@ -622,7 +622,7 @@ module.exports = Scale.extend({
|
||||
* Function to format an individual tick mark
|
||||
* @private
|
||||
*/
|
||||
tickFormatFunction: function(time, index, ticks, format) {
|
||||
_tickFormatFunction: function(time, index, ticks, format) {
|
||||
var me = this;
|
||||
var adapter = me._adapter;
|
||||
var options = me.options;
|
||||
@ -648,14 +648,14 @@ module.exports = Scale.extend({
|
||||
|
||||
for (i = 0, ilen = ticks.length; i < ilen; ++i) {
|
||||
tick = ticks[i];
|
||||
tick.label = this.tickFormatFunction(tick.value, i, ticks);
|
||||
tick.label = this._tickFormatFunction(tick.value, i, ticks);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
getPixelForOffset: function(time) {
|
||||
_getPixelForOffset: function(time) {
|
||||
var me = this;
|
||||
var offsets = me._offsets;
|
||||
var pos = interpolate(me._table, 'time', time, 'pos');
|
||||
@ -670,14 +670,14 @@ module.exports = Scale.extend({
|
||||
}
|
||||
|
||||
if (value !== null) {
|
||||
return me.getPixelForOffset(value);
|
||||
return me._getPixelForOffset(value);
|
||||
}
|
||||
},
|
||||
|
||||
getPixelForTick: function(index) {
|
||||
var ticks = this.getTicks();
|
||||
return index >= 0 && index < ticks.length ?
|
||||
this.getPixelForOffset(ticks[index].value) :
|
||||
this._getPixelForOffset(ticks[index].value) :
|
||||
null;
|
||||
},
|
||||
|
||||
@ -707,24 +707,16 @@ module.exports = Scale.extend({
|
||||
},
|
||||
|
||||
/**
|
||||
* Crude approximation of what the label width might be
|
||||
* @private
|
||||
*/
|
||||
getLabelWidth: function(label) {
|
||||
return this._getLabelSize(label).w;
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
getLabelCapacity: function(exampleTime) {
|
||||
_getLabelCapacity: function(exampleTime) {
|
||||
var me = this;
|
||||
var timeOpts = me.options.time;
|
||||
var displayFormats = timeOpts.displayFormats;
|
||||
|
||||
// pick the longest format (milliseconds) for guestimation
|
||||
var format = displayFormats[timeOpts.unit] || displayFormats.millisecond;
|
||||
var exampleLabel = me.tickFormatFunction(exampleTime, 0, ticksFromTimestamps(me, [exampleTime], me._majorUnit), format);
|
||||
var exampleLabel = me._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(me, [exampleTime], me._majorUnit), format);
|
||||
var size = me._getLabelSize(exampleLabel);
|
||||
var capacity = Math.floor(me.isHorizontal() ? me.width / size.w : me.height / size.h);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user