Skip to content

Commit 67bfac4

Browse files
committed
fix hull fill
1 parent 0007c0f commit 67bfac4

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ Equivalent to [Plot.cell](#plotcelldata-options), except that if the **y** optio
984984
985985
### Delaunay
986986
987-
[Source](./src/marks/delaunay.js) · Plot provides a handful of marks for Delaunay and Voronoi diagrams (using [d3-delaunay](https://github.com/d3/d3-delaunay) and [Delaunator](https://github.com/mapbox/delaunator)). These marks require the **x** and **y** channels to be specified.
987+
[Source](./src/marks/delaunay.js) · [Examples](https://observablehq.com/@observablehq/plot-delaunay) · Plot provides a handful of marks for Delaunay and Voronoi diagrams (using [d3-delaunay](https://github.com/d3/d3-delaunay) and [Delaunator](https://github.com/mapbox/delaunator)). These marks require the **x** and **y** channels to be specified.
988988
989989
#### Plot.delaunayLink(*data*, *options*)
990990

src/marks/delaunay.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class DelaunayLink extends Mark {
120120
}
121121
}
122122

123-
class DelaunayMesh extends Mark {
124-
constructor(data, options = {}, defaults = delaunayMeshDefaults) {
123+
class AbstractDelaunayMark extends Mark {
124+
constructor(data, options = {}, defaults) {
125125
const {x, y, z, stroke} = options;
126126
super(
127127
data,
@@ -133,10 +133,7 @@ class DelaunayMesh extends Mark {
133133
options,
134134
defaults
135135
);
136-
this.fill = "none";
137-
}
138-
_render(delaunay) {
139-
return delaunay.render();
136+
if (defaults.fill === null) this.fill = "none";
140137
}
141138
render(index, {x, y}, {x: X, y: Y, z: Z, ...channels}, dimensions) {
142139
const {dx, dy} = this;
@@ -161,7 +158,16 @@ class DelaunayMesh extends Mark {
161158
}
162159
}
163160

164-
class Hull extends DelaunayMesh {
161+
class DelaunayMesh extends AbstractDelaunayMark {
162+
constructor(data, options = {}) {
163+
super(data, options, delaunayMeshDefaults);
164+
}
165+
_render(delaunay) {
166+
return delaunay.render();
167+
}
168+
}
169+
170+
class Hull extends AbstractDelaunayMark {
165171
constructor(data, options = {}) {
166172
super(data, options, hullDefaults);
167173
}
@@ -211,7 +217,7 @@ class Voronoi extends Mark {
211217
}
212218
}
213219

214-
class VoronoiMesh extends DelaunayMesh {
220+
class VoronoiMesh extends AbstractDelaunayMark {
215221
constructor(data, options) {
216222
super(data, options, voronoiMeshDefaults);
217223
}

0 commit comments

Comments
 (0)