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

Commit f7e6a66

Browse files
author
Tom Scanlan
committed
Added segment line to vertical box plots
1 parent 324631c commit f7e6a66

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"email": "[email protected]",
88
"url": "https://www.datavisyn.io"
99
},
10-
"contributors": [{
10+
"contributors": [
11+
{
1112
"name": "Samuel Gratzl",
1213
"email": "[email protected]",
1314
"url": "https://www.sgratzl.com"

src/elements/boxandwhiskers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ const BoxAndWiskers = Chart.elements.BoxAndWhiskers = ArrayElementBase.extend({
105105
ctx.moveTo(x0, boxplot.median);
106106
ctx.lineTo(x0 + width, boxplot.median);
107107

108+
// Draw the segment line
109+
if (vm.segmentColor) {
110+
ctx.strokeStyle = vm.segmentColor;
111+
}
112+
ctx.beginPath();
113+
ctx.moveTo(x0, boxplot.segment);
114+
ctx.lineTo(x0 + width, boxplot.segment);
115+
108116
// fill the part below the median with lowerColor
109117
if (vm.lowerColor) {
110118
ctx.fillStyle = vm.lowerColor;

0 commit comments

Comments
 (0)