xScalePoint = xScale.getPixelForValue(0);
}
+ var custom = rectangle.custom;
+ var dataset = this.getDataset();
+ var rectangleElementOptions = this.chart.options.elements.rectangle;
helpers.extend(rectangle, {
// Utility
_chart: this.chart.chart,
// Tooltip
label: this.chart.data.labels[index],
- datasetLabel: this.getDataset().label,
+ datasetLabel: dataset.label,
// Appearance
base: reset ? xScalePoint : this.calculateBarBase(this.index, index),
height: this.calculateBarHeight(numBars),
- backgroundColor: customr && customr.backgroundColor ? customr.backgroundColor : helpers.getValueAtIndexOrDefault(this.getDataset().backgroundColor, index, this.chart.options.elements.rectangle.backgroundColor),
- borderSkipped: customr && customr.borderSkipped ? customr.borderSkipped : this.chart.options.elements.rectangle.borderSkipped,
- borderColor: customr && customr.borderColor ? customr.borderColor : helpers.getValueAtIndexOrDefault(this.getDataset().borderColor, index, this.chart.options.elements.rectangle.borderColor),
- borderWidth: customr && customr.borderWidth ? customr.borderWidth : helpers.getValueAtIndexOrDefault(this.getDataset().borderWidth, index, this.chart.options.elements.rectangle.borderWidth)
+ backgroundColor: custom && custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor),
+ borderSkipped: custom && custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped,
+ borderColor: custom && custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor),
+ borderWidth: custom && custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth)
},
draw: function () {
// Remove styling for last active (even if it may still be active)
if (this.lastActive.length) {
+ var lastActive;
switch (this.options.hover.mode) {
case 'single':
- var lastActive = this.lastActive[0];
+ lastActive = this.lastActive[0];
this.getDatasetMeta(lastActive._datasetIndex).controller.removeHoverStyle(lastActive, lastActive._datasetIndex, lastActive._index);
break;
case 'label':
case 'dataset':
for (var i = 0; i < this.lastActive.length; i++) {
- var lastActive = this.lastActive[i];
+ lastActive = this.lastActive[i];
if (lastActive)
this.getDatasetMeta(lastActive._datasetIndex).controller.removeHoverStyle(lastActive, lastActive._datasetIndex, lastActive._index);
}
// Built in hover styling
if (this.active.length && this.options.hover.mode) {
+ var active;
switch (this.options.hover.mode) {
case 'single':
- var active = this.active[0];
+ active = this.active[0];
this.getDatasetMeta(active._datasetIndex).controller.setHoverStyle(active);
break;
case 'label':
case 'dataset':
for (var j = 0; j < this.active.length; j++) {
- var active = this.active[j];
+ active = this.active[j];
if (active)
this.getDatasetMeta(active._datasetIndex).controller.setHoverStyle(active);
}
};
var opts = this.options;
+ var globalDefaults = Chart.defaults.global;
var tickOpts = opts.ticks;
var scaleLabelOpts = opts.scaleLabel;
var display = opts.display;
var skipRatio;
var scaleLabelX;
var scaleLabelY;
-] var useAutoskipper = optionTicks.autoSkip;
+ var useAutoskipper = optionTicks.autoSkip;
// figure out the maximum number of gridlines to show
var maxTicks;