},
// 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) {
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);
};
Chart.controllers.horizontalBar = Chart.controllers.bar.extend({
- updateElement: function updateElement(rectangle, index, reset) {
+ updateElement: function(rectangle, index, reset) {
var me = this;
var meta = me.getMeta();
var xScale = me.getScaleForId(meta.xAxisID);
dataElementType: Chart.elements.Point,
- update: function update(reset) {
+ update: function(reset) {
var me = this;
var meta = me.getMeta();
var points = meta.data;
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) {
return ringIndex;
},
- update: function update(reset) {
+ update: function(reset) {
var me = this;
var chart = me.chart,
chartArea = chart.chartArea,
}
},
- update: function update(reset) {
+ update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
linkScales: helpers.noop,
- update: function update(reset) {
+ update: function(reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
this.updateBezierControlPoints();
},
- update: function update(reset) {
+ update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
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]);
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;
return me;
},
- ensureScalesHaveIDs: function ensureScalesHaveIDs() {
+ ensureScalesHaveIDs: function() {
var options = this.options;
var scalesOptions = options.scales || {};
var scaleOptions = options.scale;
/**
* 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 = {};
Chart.layoutService.update(this, this.chart.width, this.chart.height);
},
- buildOrUpdateControllers: function buildOrUpdateControllers() {
+ buildOrUpdateControllers: function() {
var me = this;
var types = [];
var newControllers = [];
return newControllers;
},
- resetElements: function resetElements() {
+ resetElements: function() {
var me = this;
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
me.getDatasetMeta(datasetIndex).controller.reset();
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();
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,
}, me);
},
- bindEvents: function bindEvents() {
+ bindEvents: function() {
var me = this;
helpers.bindEvents(me, me.options.events, function(evt) {
me.eventHandler(evt);
me.updateElement(element, index, true);
},
- buildOrUpdateElements: function buildOrUpdateElements() {
+ buildOrUpdateElements: function() {
// Handle the number of data points changing
var meta = this.getMeta(),
md = meta.data,
},
// 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;
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);
}
}
return me;
},
- getTooltipSize: function getTooltipSize(vm) {
+ getTooltipSize: function(vm) {
var ctx = this._chart.ctx;
var size = {
return size;
},
- determineAlignment: function determineAlignment(size) {
+ determineAlignment: function(size) {
var me = this;
var model = me._model;
var chart = me._chart;
}
}
},
- getBackgroundPoint: function getBackgroundPoint(vm, size) {
+ getBackgroundPoint: function(vm, size) {
// Background Position
var pt = {
x: vm.x,
return pt;
},
- drawCaret: function drawCaret(tooltipPoint, size, opacity) {
+ drawCaret: function(tooltipPoint, size, opacity) {
var vm = this._view;
var ctx = this._chart.ctx;
var x1, x2, x3;
ctx.closePath();
ctx.fill();
},
- drawTitle: function drawTitle(pt, vm, ctx, opacity) {
+ drawTitle: function(pt, vm, ctx, opacity) {
var title = vm.title;
if (title.length) {
}
}
},
- 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;
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) {
});
}
},
- draw: function draw() {
+ draw: function() {
var ctx = this._chart.ctx;
var vm = this._view;
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);