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

Commit 05a2fdb

Browse files
authored
Merge pull request #97 from tscans/master
fixed issue with conflicting median and segment draws.
2 parents 02f202a + e3f94a9 commit 05a2fdb

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

samples/vertical_segment.html

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,14 @@
3636
label: 'Dataset 1',
3737
backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(),
3838
borderColor: window.chartColors.red,
39-
borderWidth: 5,
39+
borderWidth: 1,
40+
medianColor:"green",
4041
segmentColor:'blue',
4142
data: samples.boxplots({count: 7, random: random}).map((x)=>{
4243
x.segment = 45;
4344
return x
4445
}),
45-
outlierColor: '#999999',
46-
lowerColor: '#461e7d'
47-
}, {
48-
label: 'Dataset 2',
49-
backgroundColor: color(window.chartColors.blue).alpha(0.5).rgbString(),
50-
borderColor: window.chartColors.blue,
51-
borderWidth: 1,
52-
data: samples.boxplotsArray({count: 7, random: random}),
53-
outlierColor: '#999999',
54-
lowerColor: '#461e7d'
46+
outlierColor: '#999999'
5547
}]
5648

5749
};

src/controllers/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function toFixed(value) {
2626
}
2727

2828
const configKeys = ['outlierRadius', 'itemRadius', 'itemStyle', 'itemBackgroundColor', 'itemBorderColor', 'outlierColor', 'medianColor', 'segmentColor', 'hitPadding', 'outlierHitRadius', 'lowerColor'];
29-
const configKeyIsColor = [false, false, false, true, true, true, true, false, false, true];
29+
const configKeyIsColor = [false, false, false, true, true, true, true, true, false, false, true];
3030

3131
const array = {
3232
_elementOptions() {

src/elements/boxandwhiskers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
104104
ctx.beginPath();
105105
ctx.moveTo(x0, boxplot.median);
106106
ctx.lineTo(x0 + width, boxplot.median);
107+
ctx.closePath();
108+
ctx.stroke();
107109

108110
// Draw the segment line
109111
if (boxplot.segment != null) {
@@ -113,8 +115,8 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
113115
ctx.beginPath();
114116
ctx.moveTo(x0, boxplot.segment);
115117
ctx.lineTo(x0 + width, boxplot.segment);
118+
ctx.closePath();
116119
}
117-
118120
// fill the part below the median with lowerColor
119121
if (vm.lowerColor) {
120122
ctx.fillStyle = vm.lowerColor;

0 commit comments

Comments
 (0)