Skip to content

Commit 7654aba

Browse files
authored
add mark.plot shorthand (observablehq#344)
1 parent 9ca3b88 commit 7654aba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/mark.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {color} from "d3";
22
import {ascendingDefined, nonempty} from "./defined.js";
3+
import {plot} from "./plot.js";
34

45
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
56
const TypedArray = Object.getPrototypeOf(Uint8Array);
@@ -46,6 +47,9 @@ export class Mark {
4647
})
4748
};
4849
}
50+
plot({marks = [], ...options} = {}) {
51+
return plot({...options, marks: [...marks, this]});
52+
}
4953
}
5054

5155
// TODO Type coercion?

0 commit comments

Comments
 (0)