Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix private time scale methods with underscore #5512

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 10 additions & 10 deletions src/scales/scale.time.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ module.exports = function() {
break;
case 'auto':
default:
timestamps = generate(min, max, me.getLabelCapacity(min), options);
timestamps = generate(min, max, me._getLabelCapacity(min), options);
}

if (options.bounds === 'ticks' && timestamps.length) {
Expand Down Expand Up @@ -673,7 +673,7 @@ module.exports = function() {
* Function to format an individual tick mark
* @private
*/
tickFormatFunction: function(tick, index, ticks, formatOverride) {
_tickFormatFunction: function(tick, index, ticks, formatOverride) {
var me = this;
var options = me.options;
var time = tick.valueOf();
Expand All @@ -696,7 +696,7 @@ module.exports = function() {
var i, ilen;

for (i = 0, ilen = ticks.length; i < ilen; ++i) {
labels.push(this.tickFormatFunction(moment(ticks[i].value), i, ticks));
labels.push(this._tickFormatFunction(moment(ticks[i].value), i, ticks));
}

return labels;
Expand All @@ -705,7 +705,7 @@ module.exports = function() {
/**
* @private
*/
getPixelForOffset: function(time) {
_getPixelForOffset: function(time) {
var me = this;
var size = me._horizontal ? me.width : me.height;
var start = me._horizontal ? me.left : me.top;
Expand All @@ -727,14 +727,14 @@ module.exports = function() {
}

if (time !== null) {
return me.getPixelForOffset(time);
return me._getPixelForOffset(time);
}
},

getPixelForTick: function(index) {
var ticks = this.getTicks();
return index >= 0 && index < ticks.length ?
this.getPixelForOffset(ticks[index].value) :
this._getPixelForOffset(ticks[index].value) :
null;
},

Expand All @@ -752,7 +752,7 @@ module.exports = function() {
* Crude approximation of what the label width might be
* @private
*/
getLabelWidth: function(label) {
_getLabelWidth: function(label) {
var me = this;
var ticksOpts = me.options.ticks;
var tickLabelWidth = me.ctx.measureText(label).width;
Expand All @@ -767,13 +767,13 @@ module.exports = function() {
/**
* @private
*/
getLabelCapacity: function(exampleTime) {
_getLabelCapacity: function(exampleTime) {
var me = this;

var formatOverride = me.options.time.displayFormats.millisecond; // Pick the longest format for guestimation

var exampleLabel = me.tickFormatFunction(moment(exampleTime), 0, [], formatOverride);
var tickLabelWidth = me.getLabelWidth(exampleLabel);
var exampleLabel = me._tickFormatFunction(moment(exampleTime), 0, [], formatOverride);
var tickLabelWidth = me._getLabelWidth(exampleLabel);
var innerWidth = me.isHorizontal() ? me.width : me.height;

var capacity = Math.floor(innerWidth / tickLabelWidth);
Expand Down