Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 77fde9d

Browse files
committed
Changed the order of drawing. The items are now drawn
after the boxes in order to bring them to the front
1 parent a731da2 commit 77fde9d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/elements/boxandwhiskers.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
'use strict';
22

33
import * as Chart from 'chart.js';
4-
import ArrayElementBase, {defaults} from './base';
4+
import ArrayElementBase, {
5+
defaults
6+
} from './base';
57

68

7-
Chart.defaults.global.elements.boxandwhiskers = {...defaults};
9+
Chart.defaults.global.elements.boxandwhiskers = {
10+
...defaults
11+
};
812

913
function transitionBoxPlot(start, view, model, ease) {
1014
const keys = Object.keys(model);
@@ -58,9 +62,6 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
5862
const boxplot = vm.boxplot;
5963
const vert = this.isVertical();
6064

61-
62-
this._drawItems(vm, boxplot, ctx, vert);
63-
6465
ctx.save();
6566

6667
ctx.fillStyle = vm.backgroundColor;
@@ -72,6 +73,8 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
7273

7374
ctx.restore();
7475

76+
this._drawItems(vm, boxplot, ctx, vert);
77+
7578
},
7679
_drawBoxPlot(vm, boxplot, ctx, vert) {
7780
if (vert) {
@@ -185,7 +188,10 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
185188
}
186189

187190
if (vert) {
188-
const {x, width} = vm;
191+
const {
192+
x,
193+
width
194+
} = vm;
189195
const x0 = x - width / 2;
190196
return {
191197
left: x0,
@@ -194,7 +200,10 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
194200
bottom: boxplot.whiskerMin
195201
};
196202
}
197-
const {y, height} = vm;
203+
const {
204+
y,
205+
height
206+
} = vm;
198207
const y0 = y - height / 2;
199208
return {
200209
left: boxplot.whiskerMin,

0 commit comments

Comments
 (0)