mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fixed unit tests :D
This commit is contained in:
parent
53b08415ad
commit
7e85245e4f
@ -398,6 +398,9 @@ module.exports = function(Chart) {
|
||||
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,
|
||||
@ -413,15 +416,15 @@ module.exports = function(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 () {
|
||||
|
||||
@ -540,15 +540,16 @@ module.exports = function(Chart) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
@ -560,15 +561,16 @@ module.exports = function(Chart) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -265,6 +265,7 @@ module.exports = function(Chart) {
|
||||
};
|
||||
|
||||
var opts = this.options;
|
||||
var globalDefaults = Chart.defaults.global;
|
||||
var tickOpts = opts.ticks;
|
||||
var scaleLabelOpts = opts.scaleLabel;
|
||||
var display = opts.display;
|
||||
@ -463,7 +464,7 @@ module.exports = function(Chart) {
|
||||
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;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
module.exports = function(Chart) {
|
||||
|
||||
var helpers = Chart.helpers;
|
||||
var globalDefaults = globalDefaults;
|
||||
var globalDefaults = Chart.defaults.global;
|
||||
|
||||
var defaultConfig = {
|
||||
display: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user