Merge pull request #2800 from simonbrunel/#2734

#2734 Fix JSHint warnings
This commit is contained in:
Evert Timberg
2016-06-20 14:42:59 -04:00
committed by GitHub
23 changed files with 81 additions and 107 deletions

View File

@@ -1,4 +1,5 @@
{
"node": true,
"unused": true,
"predef": [ "require", "module" ]
}

View File

@@ -22,11 +22,11 @@ module.exports = function(Chart) {
tooltips: {
callbacks: {
title: function(tooltipItems, data) {
title: function() {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
label: function(tooltipItem, data) {
label: function(tooltipItem) {
return '(' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + ')';
}
}

View File

@@ -40,7 +40,7 @@ module.exports = function(Chart) {
},
// Get the number of datasets that display bars. We use this to correctly calculate the bar width
getBarCount: function getBarCount() {
getBarCount: function() {
var me = this;
var barCount = 0;
helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) {
@@ -52,14 +52,14 @@ module.exports = function(Chart) {
return barCount;
},
update: function update(reset) {
update: function(reset) {
var me = this;
helpers.each(me.getMeta().data, function(rectangle, index) {
me.updateElement(rectangle, index, reset);
}, me);
},
updateElement: function updateElement(rectangle, index, reset) {
updateElement: function(rectangle, index, reset) {
var me = this;
var meta = me.getMeta();
var xScale = me.getScaleForId(meta.xAxisID);
@@ -338,7 +338,7 @@ module.exports = function(Chart) {
};
Chart.controllers.horizontalBar = Chart.controllers.bar.extend({
updateElement: function updateElement(rectangle, index, reset, numBars) {
updateElement: function(rectangle, index, reset) {
var me = this;
var meta = me.getMeta();
var xScale = me.getScaleForId(meta.xAxisID);

View File

@@ -24,7 +24,7 @@ module.exports = function(Chart) {
tooltips: {
callbacks: {
title: function(tooltipItems, data) {
title: function() {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
@@ -41,7 +41,7 @@ module.exports = function(Chart) {
dataElementType: Chart.elements.Point,
update: function update(reset) {
update: function(reset) {
var me = this;
var meta = me.getMeta();
var points = meta.data;

View File

@@ -119,7 +119,7 @@ module.exports = function(Chart) {
linkScales: helpers.noop,
// Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
getRingIndex: function getRingIndex(datasetIndex) {
getRingIndex: function(datasetIndex) {
var ringIndex = 0;
for (var j = 0; j < datasetIndex; ++j) {
@@ -131,7 +131,7 @@ module.exports = function(Chart) {
return ringIndex;
},
update: function update(reset) {
update: function(reset) {
var me = this;
var chart = me.chart,
chartArea = chart.chartArea,
@@ -189,7 +189,6 @@ module.exports = function(Chart) {
chartArea = chart.chartArea,
opts = chart.options,
animationOpts = opts.animation,
arcOpts = opts.elements.arc,
centerX = (chartArea.left + chartArea.right) / 2,
centerY = (chartArea.top + chartArea.bottom) / 2,
startAngle = opts.rotation, // non reset case handled later
@@ -198,7 +197,6 @@ module.exports = function(Chart) {
circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI)),
innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius,
outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius,
custom = arc.custom || {},
valueAtIndexOrDefault = helpers.getValueAtIndexOrDefault;
helpers.extend(arc, {

View File

@@ -46,7 +46,7 @@ module.exports = function(Chart) {
}
},
update: function update(reset) {
update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
@@ -181,7 +181,7 @@ module.exports = function(Chart) {
}
x = xScale.getPixelForValue(value, index, datasetIndex, me.chart.isCombo);
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex, me.chart.isCombo);
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
// Utility
point._xScale = xScale;
@@ -206,7 +206,7 @@ module.exports = function(Chart) {
};
},
calculatePointY: function(value, index, datasetIndex, isCombo) {
calculatePointY: function(value, index, datasetIndex) {
var me = this;
var chart = me.chart;
var meta = me.getMeta();
@@ -240,7 +240,6 @@ module.exports = function(Chart) {
updateBezierControlPoints: function() {
var meta = this.getMeta();
var area = this.chart.chartArea;
var points = meta.data || [];
var i, ilen, point, model, controlPoints;

View File

@@ -105,7 +105,7 @@ module.exports = function(Chart) {
linkScales: helpers.noop,
update: function update(reset) {
update: function(reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
@@ -134,8 +134,6 @@ module.exports = function(Chart) {
var dataset = me.getDataset();
var opts = chart.options;
var animationOpts = opts.animation;
var arcOpts = opts.elements.arc;
var custom = arc.custom || {};
var scale = chart.scale;
var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault;
var labels = chart.data.labels;

View File

@@ -30,7 +30,7 @@ module.exports = function(Chart) {
this.updateBezierControlPoints();
},
update: function update(reset) {
update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
@@ -146,7 +146,7 @@ module.exports = function(Chart) {
var easingDecimal = ease || 1;
// Transition Point Locations
helpers.each(meta.data, function(point, index) {
helpers.each(meta.data, function(point) {
point.transition(easingDecimal);
});

View File

@@ -45,7 +45,7 @@ module.exports = function(Chart) {
helpers.extend(Chart.Controller.prototype, /** @lends Chart.Controller */ {
initialize: function initialize() {
initialize: function() {
var me = this;
// Before init plugin notification
Chart.plugins.notify('beforeInit', [me]);
@@ -68,12 +68,12 @@ module.exports = function(Chart) {
return me;
},
clear: function clear() {
clear: function() {
helpers.clear(this.chart);
return this;
},
stop: function stop() {
stop: function() {
// Stops any current animation loop occuring
Chart.animationService.cancelAnimation(this);
return this;
@@ -115,7 +115,7 @@ module.exports = function(Chart) {
return me;
},
ensureScalesHaveIDs: function ensureScalesHaveIDs() {
ensureScalesHaveIDs: function() {
var options = this.options;
var scalesOptions = options.scales || {};
var scaleOptions = options.scale;
@@ -136,7 +136,7 @@ module.exports = function(Chart) {
/**
* Builds a map of scale ID to scale object for future lookup.
*/
buildScales: function buildScales() {
buildScales: function() {
var me = this;
var options = me.options;
var scales = me.scales = {};
@@ -154,7 +154,7 @@ module.exports = function(Chart) {
items.push({ options: options.scale, dtype: 'radialLinear', isDefault: true });
}
helpers.each(items, function(item, index) {
helpers.each(items, function(item) {
var scaleOptions = item.options;
var scaleType = helpers.getValueOrDefault(scaleOptions.type, item.dtype);
var scaleClass = Chart.scaleService.getScaleConstructor(scaleType);
@@ -186,7 +186,7 @@ module.exports = function(Chart) {
Chart.layoutService.update(this, this.chart.width, this.chart.height);
},
buildOrUpdateControllers: function buildOrUpdateControllers() {
buildOrUpdateControllers: function() {
var me = this;
var types = [];
var newControllers = [];
@@ -219,7 +219,7 @@ module.exports = function(Chart) {
return newControllers;
},
resetElements: function resetElements() {
resetElements: function() {
var me = this;
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
me.getDatasetMeta(datasetIndex).controller.reset();
@@ -375,7 +375,7 @@ module.exports = function(Chart) {
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
if (me.isDatasetVisible(datasetIndex)) {
var meta = me.getDatasetMeta(datasetIndex);
helpers.each(meta.data, function(element, index) {
helpers.each(meta.data, function(element) {
if (element.inRange(eventPosition.x, eventPosition.y)) {
elementsArray.push(element);
return elementsArray;
@@ -486,11 +486,11 @@ module.exports = function(Chart) {
return typeof meta.hidden === 'boolean'? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
},
generateLegend: function generateLegend() {
generateLegend: function() {
return this.options.legendCallback(this);
},
destroy: function destroy() {
destroy: function() {
var me = this;
me.stop();
me.clear();
@@ -516,11 +516,11 @@ module.exports = function(Chart) {
delete Chart.instances[me.id];
},
toBase64Image: function toBase64Image() {
toBase64Image: function() {
return this.chart.canvas.toDataURL.apply(this.chart.canvas, arguments);
},
initToolTip: function initToolTip() {
initToolTip: function() {
var me = this;
me.tooltip = new Chart.Tooltip({
_chart: me.chart,
@@ -530,7 +530,7 @@ module.exports = function(Chart) {
}, me);
},
bindEvents: function bindEvents() {
bindEvents: function() {
var me = this;
helpers.bindEvents(me, me.options.events, function(evt) {
me.eventHandler(evt);

View File

@@ -105,7 +105,7 @@ module.exports = function(Chart) {
me.updateElement(element, index, true);
},
buildOrUpdateElements: function buildOrUpdateElements() {
buildOrUpdateElements: function() {
// Handle the number of data points changing
var meta = this.getMeta(),
md = meta.data,
@@ -128,7 +128,7 @@ module.exports = function(Chart) {
draw: function(ease) {
var easingDecimal = ease || 1;
helpers.each(this.getMeta().data, function(element, index) {
helpers.each(this.getMeta().data, function(element) {
element.transition(easingDecimal).draw();
});
},
@@ -138,7 +138,6 @@ module.exports = function(Chart) {
index = element._index,
custom = element.custom || {},
valueOrDefault = helpers.getValueAtIndexOrDefault,
color = helpers.color,
model = element._model;
model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor);
@@ -151,7 +150,6 @@ module.exports = function(Chart) {
index = element._index,
custom = element.custom || {},
valueOrDefault = helpers.getValueAtIndexOrDefault,
color = helpers.color,
getHoverColor = helpers.getHoverColor,
model = element._model;

View File

@@ -267,8 +267,6 @@ module.exports = function(Chart) {
// Step 7 - Position the boxes
var left = xPadding;
var top = yPadding;
var right = 0;
var bottom = 0;
helpers.each(leftBoxes.concat(topBoxes), placeBox);

View File

@@ -274,11 +274,10 @@ module.exports = function(Chart) {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var globalDefault = Chart.defaults.global,
lineDefault = globalDefault.elements.line,
legendWidth = me.width,
legendHeight = me.height,
lineWidths = me.lineWidths;
var globalDefault = Chart.defaults.global;
var lineDefault = globalDefault.elements.line;
var legendWidth = me.width;
var lineWidths = me.lineWidths;
if (opts.display) {
var ctx = me.ctx,
@@ -373,7 +372,6 @@ module.exports = function(Chart) {
cursor.line++;
}
}
drawLegendBox(x, y, legendItem);
@@ -388,7 +386,7 @@ module.exports = function(Chart) {
} else {
cursor.y += itemHeight;
}
});
}
},

View File

@@ -284,9 +284,6 @@ module.exports = function(Chart) {
var tickLabelFont = helpers.fontString(tickFontSize, tickFontStyle, tickFontFamily);
var scaleLabelFontSize = helpers.getValueOrDefault(scaleLabelOpts.fontSize, globalDefaults.defaultFontSize);
var scaleLabelFontStyle = helpers.getValueOrDefault(scaleLabelOpts.fontStyle, globalDefaults.defaultFontStyle);
var scaleLabelFontFamily = helpers.getValueOrDefault(scaleLabelOpts.fontFamily, globalDefaults.defaultFontFamily);
var scaleLabelFont = helpers.fontString(scaleLabelFontSize, scaleLabelFontStyle, scaleLabelFontFamily);
var tickMarkLength = opts.gridLines.tickMarkLength;
@@ -393,7 +390,7 @@ module.exports = function(Chart) {
},
// Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
getRightValue: function getRightValue(rawValue) {
getRightValue: function(rawValue) {
// Null and undefined values first
if (rawValue === null || typeof(rawValue) === 'undefined') {
return NaN;
@@ -407,7 +404,7 @@ module.exports = function(Chart) {
if ((rawValue instanceof Date) || (rawValue.isValid)) {
return rawValue;
} else {
return getRightValue(this.isHorizontal() ? rawValue.x : rawValue.y);
return this.getRightValue(this.isHorizontal() ? rawValue.x : rawValue.y);
}
}
@@ -514,9 +511,7 @@ module.exports = function(Chart) {
var labelRotationRadians = helpers.toRadians(me.labelRotation);
var cosRotation = Math.cos(labelRotationRadians);
var sinRotation = Math.sin(labelRotationRadians);
var longestRotatedLabel = me.longestLabelWidth * cosRotation;
var rotatedLabelHeight = tickFontSize * sinRotation;
// Make sure we draw text in the correct color and font
context.fillStyle = tickFontColor;
@@ -526,11 +521,11 @@ module.exports = function(Chart) {
if (isHorizontal) {
skipRatio = false;
// Only calculate the skip ratio with the half width of longestRotateLabel if we got an actual rotation
// See #2584
if (isRotated) {
longestRotatedLabel /= 2;
}
// Only calculate the skip ratio with the half width of longestRotateLabel if we got an actual rotation
// See #2584
if (isRotated) {
longestRotatedLabel /= 2;
}
if ((longestRotatedLabel + optionTicks.autoSkipPadding) * me.ticks.length > (me.width - (me.paddingLeft + me.paddingRight))) {
skipRatio = 1 + Math.floor(((longestRotatedLabel + optionTicks.autoSkipPadding) * me.ticks.length) / (me.width - (me.paddingLeft + me.paddingRight)));
@@ -712,7 +707,7 @@ module.exports = function(Chart) {
scaleLabelY = me.top + ((me.bottom - me.top) / 2);
rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;
}
context.save();
context.translate(scaleLabelX, scaleLabelY);
context.rotate(rotation);

View File

@@ -111,9 +111,7 @@ module.exports = function(Chart) {
beforeFit: noop,
fit: function() {
var me = this,
ctx = me.ctx,
valueOrDefault = helpers.getValueOrDefault,
opts = me.options,
globalDefaults = Chart.defaults.global,

View File

@@ -328,7 +328,7 @@ module.exports = function(Chart) {
return me;
},
getTooltipSize: function getTooltipSize(vm) {
getTooltipSize: function(vm) {
var ctx = this._chart.ctx;
var size = {
@@ -391,7 +391,7 @@ module.exports = function(Chart) {
return size;
},
determineAlignment: function determineAlignment(size) {
determineAlignment: function(size) {
var me = this;
var model = me._model;
var chart = me._chart;
@@ -453,7 +453,7 @@ module.exports = function(Chart) {
}
}
},
getBackgroundPoint: function getBackgroundPoint(vm, size) {
getBackgroundPoint: function(vm, size) {
// Background Position
var pt = {
x: vm.x,
@@ -498,7 +498,7 @@ module.exports = function(Chart) {
return pt;
},
drawCaret: function drawCaret(tooltipPoint, size, opacity, caretPadding) {
drawCaret: function(tooltipPoint, size, opacity) {
var vm = this._view;
var ctx = this._chart.ctx;
var x1, x2, x3;
@@ -562,7 +562,7 @@ module.exports = function(Chart) {
ctx.closePath();
ctx.fill();
},
drawTitle: function drawTitle(pt, vm, ctx, opacity) {
drawTitle: function(pt, vm, ctx, opacity) {
var title = vm.title;
if (title.length) {
@@ -587,7 +587,7 @@ module.exports = function(Chart) {
}
}
},
drawBody: function drawBody(pt, vm, ctx, opacity) {
drawBody: function(pt, vm, ctx, opacity) {
var bodyFontSize = vm.bodyFontSize;
var bodySpacing = vm.bodySpacing;
var body = vm.body;
@@ -648,7 +648,7 @@ module.exports = function(Chart) {
helpers.each(vm.afterBody, fillLineOfText);
pt.y -= bodySpacing; // Remove last body spacing
},
drawFooter: function drawFooter(pt, vm, ctx, opacity) {
drawFooter: function(pt, vm, ctx, opacity) {
var footer = vm.footer;
if (footer.length) {
@@ -667,7 +667,7 @@ module.exports = function(Chart) {
});
}
},
draw: function draw() {
draw: function() {
var ctx = this._chart.ctx;
var vm = this._view;
@@ -692,7 +692,7 @@ module.exports = function(Chart) {
ctx.fill();
// Draw Caret
this.drawCaret(pt, tooltipSize, opacity, vm.caretPadding);
this.drawCaret(pt, tooltipSize, opacity);
// Draw Title, Body, and Footer
pt.x += vm.xPadding;

View File

@@ -1,6 +1,6 @@
"use strict";
module.exports = function(Chart, moment) {
module.exports = function(Chart) {
var helpers = Chart.helpers,
globalOpts = Chart.defaults.global;

View File

@@ -2,8 +2,7 @@
module.exports = function(Chart) {
var helpers = Chart.helpers,
globalOpts = Chart.defaults.global;
var globalOpts = Chart.defaults.global;
globalOpts.elements.rectangle = {
backgroundColor: globalOpts.defaultColor,
@@ -46,7 +45,7 @@ module.exports = function(Chart) {
[rightX, vm.base]
];
// Find first (starting) corner with fallback to 'bottom'
// Find first (starting) corner with fallback to 'bottom'
var borders = ['bottom', 'left', 'top', 'right'];
var startCorner = borders.indexOf(vm.borderSkipped, 0);
if (startCorner === -1)
@@ -72,8 +71,8 @@ module.exports = function(Chart) {
},
inRange: function(mouseX, mouseY) {
var vm = this._view;
return vm ?
(vm.y < vm.base ?
return vm ?
(vm.y < vm.base ?
(mouseX >= vm.x - vm.width / 2 && mouseX <= vm.x + vm.width / 2) && (mouseY >= vm.y && mouseY <= vm.base) :
(mouseX >= vm.x - vm.width / 2 && mouseX <= vm.x + vm.width / 2) && (mouseY >= vm.base && mouseY <= vm.y)) :
false;

View File

@@ -9,7 +9,7 @@ module.exports = function(Chart) {
};
var DatasetScale = Chart.Scale.extend({
// Implement this so that
// Implement this so that
determineDataLimits: function() {
var me = this;
me.minIndex = 0;
@@ -32,13 +32,13 @@ module.exports = function(Chart) {
me.max = me.chart.data.labels[me.maxIndex];
},
buildTicks: function(index) {
buildTicks: function() {
var me = this;
// If we are viewing some subset of labels, slice the original array
me.ticks = (me.minIndex === 0 && me.maxIndex === me.chart.data.labels.length - 1) ? me.chart.data.labels : me.chart.data.labels.slice(me.minIndex, me.maxIndex + 1);
},
getLabelForIndex: function(index, datasetIndex) {
getLabelForIndex: function(index) {
return this.ticks[index];
},

View File

@@ -39,7 +39,6 @@ module.exports = function(Chart) {
determineDataLimits: function() {
var me = this;
var opts = me.options;
var tickOpts = opts.ticks;
var chart = me.chart;
var data = chart.data;
var datasets = data.datasets;
@@ -148,7 +147,7 @@ module.exports = function(Chart) {
return maxTicks;
},
// Called after the ticks are built. We need
// Called after the ticks are built. We need
handleDirectionalChanges: function() {
if (!this.isHorizontal()) {
// We are in a vertical orientation. The top value is the highest. So reverse the array
@@ -159,9 +158,9 @@ module.exports = function(Chart) {
return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
},
// Utils
getPixelForValue: function(value, index, datasetIndex, includeOffset) {
getPixelForValue: function(value) {
// This must be called after fit has been run so that
// this.left, this.top, this.right, and this.bottom have been defined
// this.left, this.top, this.right, and this.bottom have been defined
var me = this;
var paddingLeft = me.paddingLeft;
var paddingBottom = me.paddingBottom;
@@ -191,8 +190,8 @@ module.exports = function(Chart) {
var offset = (isHorizontal ? pixel - me.left - paddingLeft : me.bottom - paddingBottom - pixel) / innerDimension;
return me.start + ((me.end - me.start) * offset);
},
getPixelForTick: function(index, includeOffset) {
return this.getPixelForValue(this.ticksAsNumbers[index], null, null, includeOffset);
getPixelForTick: function(index) {
return this.getPixelForValue(this.ticksAsNumbers[index]);
}
});
Chart.scaleService.registerScaleType("linear", LinearScale, defaultConfig);

View File

@@ -53,11 +53,9 @@ module.exports = function(Chart) {
buildTicks: function() {
var me = this;
var opts = me.options;
var ticks = me.ticks = [];
var tickOpts = opts.ticks;
var getValueOrDefault = helpers.getValueOrDefault;
var isHorizontal = me.isHorizontal();
var ticks = me.ticks = [];
// Figure out what the max number of ticks we can support it is based on the size of
// the axis area. For now, we say that the minimum tick spacing in pixels must be 50

View File

@@ -177,10 +177,10 @@ module.exports = function(Chart) {
getLabelForIndex: function(index, datasetIndex) {
return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
},
getPixelForTick: function(index, includeOffset) {
return this.getPixelForValue(this.tickValues[index], null, null, includeOffset);
getPixelForTick: function(index) {
return this.getPixelForValue(this.tickValues[index]);
},
getPixelForValue: function(value, index, datasetIndex, includeOffset) {
getPixelForValue: function(value) {
var me = this;
var innerDimension;
var pixel;
@@ -215,10 +215,8 @@ module.exports = function(Chart) {
},
getValueForPixel: function(pixel) {
var me = this;
var offset;
var range = helpers.log10(me.end) - helpers.log10(me.start);
var value;
var innerDimension;
var value, innerDimension;
if (me.isHorizontal()) {
innerDimension = me.width - (me.paddingLeft + me.paddingRight);

View File

@@ -164,8 +164,7 @@ module.exports = function(Chart) {
xProtrusionLeft,
xProtrusionRight,
radiusReductionRight,
radiusReductionLeft,
maxWidthRadius;
radiusReductionLeft;
this.ctx.font = pointLabeFont;
for (i = 0; i < this.getValueCount(); i++) {

View File

@@ -94,7 +94,7 @@ module.exports = function(Chart) {
// these
var scaleLabelMoments = [];
if (me.chart.data.labels && me.chart.data.labels.length > 0) {
helpers.each(me.chart.data.labels, function(label, index) {
helpers.each(me.chart.data.labels, function(label) {
var labelMoment = me.parseTime(label);
if (labelMoment.isValid()) {
@@ -117,7 +117,7 @@ module.exports = function(Chart) {
var datasetVisible = me.chart.isDatasetVisible(datasetIndex);
if (typeof dataset.data[0] === 'object' && dataset.data[0] !== null) {
helpers.each(dataset.data, function(value, index) {
helpers.each(dataset.data, function(value) {
var labelMoment = me.parseTime(me.getRightValue(value));
if (labelMoment.isValid()) {
@@ -154,7 +154,7 @@ module.exports = function(Chart) {
me.firstTick = (me.firstTick || moment()).clone();
me.lastTick = (me.lastTick || moment()).clone();
},
buildTicks: function(index) {
buildTicks: function() {
var me = this;
me.ctx.save();
@@ -309,7 +309,7 @@ module.exports = function(Chart) {
return label;
},
// Function to format an individual tick mark
tickFormatFunction: function tickFormatFunction(tick, index, ticks) {
tickFormatFunction: function(tick, index, ticks) {
var formattedTick = tick.format(this.displayFormat);
var tickOpts = this.options.ticks;
var callback = helpers.getValueOrDefault(tickOpts.callback, tickOpts.userCallback);
@@ -325,7 +325,7 @@ module.exports = function(Chart) {
me.tickMoments = me.ticks;
me.ticks = me.ticks.map(me.tickFormatFunction, me);
},
getPixelForValue: function(value, index, datasetIndex, includeOffset) {
getPixelForValue: function(value, index, datasetIndex) {
var me = this;
var labelMoment = value && value.isValid && value.isValid() ? value : me.getLabelMoment(datasetIndex, index);
@@ -336,21 +336,19 @@ module.exports = function(Chart) {
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var valueWidth = innerWidth / Math.max(me.ticks.length - 1, 1);
var valueOffset = (innerWidth * decimal) + me.paddingLeft;
return me.left + Math.round(valueOffset);
} else {
var innerHeight = me.height - (me.paddingTop + me.paddingBottom);
var valueHeight = innerHeight / Math.max(me.ticks.length - 1, 1);
var heightOffset = (innerHeight * decimal) + me.paddingTop;
return me.top + Math.round(heightOffset);
}
}
},
getPixelForTick: function(index, includeOffset) {
return this.getPixelForValue(this.tickMoments[index], null, null, includeOffset);
getPixelForTick: function(index) {
return this.getPixelForValue(this.tickMoments[index], null, null);
},
getValueForPixel: function(pixel) {
var me = this;