Skip to content

Commit 61ae5f3

Browse files
committed
symbol edits
1 parent 5b576f6 commit 61ae5f3

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

src/marks/dot.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type {ChannelValue, ChannelValueIntervalSpec, ChannelValueSpec} from "../channel.js";
22
import type {Interval} from "../interval.js";
33
import type {Data, FrameAnchor, MarkOptions, RenderableMark} from "../mark.js";
4-
import type {SymbolImplementation, SymbolName} from "../symbol.js";
4+
import type {SymbolType} from "../symbol.js";
55

66
export interface DotOptions extends MarkOptions {
77
x?: ChannelValueSpec;
88
y?: ChannelValueSpec;
99
r?: ChannelValueSpec | number;
1010
rotate?: ChannelValue | number;
11-
symbol?: ChannelValueSpec | SymbolName | SymbolImplementation;
11+
symbol?: ChannelValueSpec | SymbolType;
1212
frameAnchor?: FrameAnchor;
1313
}
1414

src/marks/vector.d.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import type {ChannelValue, ChannelValueSpec} from "../channel.js";
22
import type {Data, FrameAnchor, MarkOptions, RenderableMark} from "../mark.js";
33

4-
/** The built-in vector shape implementations. */
4+
/**
5+
* The built-in vector shape implementations; one of:
6+
*
7+
* - *arrow* - a straight line with an open arrowhead at the end (↑)
8+
* - *spike* - an isosceles triangle with a flat base (▲)
9+
*/
510
export type VectorShapeName = "arrow" | "spike";
611

712
/** A vector shape implementation. */
@@ -10,7 +15,7 @@ export interface VectorShapeImplementation {
1015
draw(context: CanvasPath, length: number, radius: number): void;
1116
}
1217

13-
/** How to draw a vector. */
18+
/** How to draw a vector: either a named shape or a custom implementation. */
1419
export type VectorShape = VectorShapeName | VectorShapeImplementation;
1520

1621
/** Options for the vector mark. */

src/symbol.d.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
1-
import type {SymbolType} from "d3";
1+
import type {SymbolType as SymbolImplementation} from "d3";
2+
export type {SymbolType as SymbolImplementation} from "d3";
23

4+
/**
5+
* The built-in symbol implementations. For fill, one of:
6+
*
7+
* - *circle* - a circle
8+
* - *cross* - a Greek cross with arms of equal length
9+
* - *diamond* - a rhombus
10+
* - *square* - a square
11+
* - *star* - a pentagonal star (pentagram)
12+
* - *triangle* - an up-pointing triangle
13+
* - *wye* - a Y with arms of equal length
14+
*
15+
* For stroke (based on [Heman Robinson’s research][1]), one of:
16+
*
17+
* - *circle* - a circle
18+
* - *plus* - a plus sign
19+
* - *times* - an X with arms of equal length
20+
* - *triangle2* - an (alternate) up-pointing triangle
21+
* - *asterisk* - an asterisk
22+
* - *square2* - a (alternate) square
23+
* - *diamond2* - a rotated square
24+
*
25+
* The *hexagon* symbol is also supported.
26+
*
27+
* [1]: https://www.tandfonline.com/doi/abs/10.1080/10618600.2019.1637746
28+
*/
329
export type SymbolName =
430
| "asterisk"
531
| "circle"
@@ -16,4 +42,5 @@ export type SymbolName =
1642
| "triangle2"
1743
| "wye";
1844

19-
export type SymbolImplementation = SymbolType;
45+
/** How to draw a symbol: either a named symbol or a custom implementation. */
46+
export type SymbolType = SymbolName | SymbolImplementation;

0 commit comments

Comments
 (0)