@d3plus/core 3.0.16 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88485 -2998
- package/es/index.js +1 -1
- package/es/src/charts/AreaPlot.js +1 -3
- package/es/src/charts/BarChart.js +1 -3
- package/es/src/charts/BoxWhisker.js +2 -4
- package/es/src/charts/BumpChart.js +4 -5
- package/es/src/charts/Donut.js +1 -3
- package/es/src/charts/Geomap.js +47 -88
- package/es/src/charts/LinePlot.js +1 -3
- package/es/src/charts/Matrix.js +27 -46
- package/es/src/charts/Network.js +87 -81
- package/es/src/charts/Pack.js +21 -34
- package/es/src/charts/Pie.js +12 -24
- package/es/src/charts/Plot.js +226 -321
- package/es/src/charts/Priestley.js +18 -36
- package/es/src/charts/Radar.js +100 -47
- package/es/src/charts/RadialMatrix.js +35 -47
- package/es/src/charts/Rings.js +99 -90
- package/es/src/charts/Sankey.js +85 -75
- package/es/src/charts/StackedArea.js +1 -3
- package/es/src/charts/Tree.js +27 -28
- package/es/src/charts/Treemap.js +117 -71
- package/es/src/charts/Viz.js +296 -492
- package/es/src/charts/drawSteps/drawAttribution.js +1 -1
- package/es/src/charts/drawSteps/drawBack.js +1 -2
- package/es/src/charts/drawSteps/drawColorScale.js +1 -2
- package/es/src/charts/drawSteps/drawLegend.js +8 -10
- package/es/src/charts/drawSteps/drawSubtitle.js +1 -3
- package/es/src/charts/drawSteps/drawTimeline.js +12 -9
- package/es/src/charts/drawSteps/drawTitle.js +1 -3
- package/es/src/charts/drawSteps/drawTotal.js +1 -3
- package/es/src/charts/drawSteps/zoomControls.js +19 -21
- package/es/src/charts/events/click.legend.js +2 -3
- package/es/src/charts/events/click.shape.js +2 -4
- package/es/src/charts/events/mouseenter.js +7 -8
- package/es/src/charts/events/mouseleave.js +1 -3
- package/es/src/charts/events/mousemove.legend.js +3 -4
- package/es/src/charts/events/mousemove.shape.js +2 -4
- package/es/src/charts/events/touchstart.body.js +1 -1
- package/es/src/charts/helpers/matrixData.js +11 -4
- package/es/src/charts/helpers/tileAttributions.js +2 -1
- package/es/src/charts/plotBuffers/Bar.js +55 -12
- package/es/src/charts/plotBuffers/Box.js +55 -12
- package/es/src/charts/plotBuffers/Circle.js +9 -11
- package/es/src/charts/plotBuffers/Line.js +4 -6
- package/es/src/charts/plotBuffers/Rect.js +10 -12
- package/es/src/charts/plotBuffers/discreteBuffer.js +4 -2
- package/es/src/charts/plotBuffers/numericBuffer.js +7 -6
- package/es/src/components/Axis.js +298 -426
- package/es/src/components/AxisBottom.js +1 -3
- package/es/src/components/AxisLeft.js +1 -3
- package/es/src/components/AxisRight.js +1 -3
- package/es/src/components/AxisTop.js +1 -3
- package/es/src/components/ColorScale.js +80 -197
- package/es/src/components/Legend.js +82 -135
- package/es/src/components/Message.js +27 -19
- package/es/src/components/TextBox.js +106 -262
- package/es/src/components/Timeline.js +88 -155
- package/es/src/components/Tooltip.js +301 -330
- package/es/src/shapes/Area.js +95 -74
- package/es/src/shapes/Bar.js +46 -86
- package/es/src/shapes/Box.js +104 -118
- package/es/src/shapes/Circle.js +29 -30
- package/es/src/shapes/Image.js +44 -102
- package/es/src/shapes/Line.js +74 -40
- package/es/src/shapes/Path.js +23 -25
- package/es/src/shapes/Rect.js +29 -41
- package/es/src/shapes/Shape.js +146 -363
- package/es/src/shapes/Whisker.js +89 -90
- package/es/src/utils/AccessorFn.js +4 -0
- package/es/src/utils/BaseClass.js +53 -82
- package/es/src/utils/D3plusConfig.js +1 -0
- package/es/src/utils/RESET.js +2 -4
- package/es/src/utils/accessor.js +4 -5
- package/es/src/utils/configPrep.js +13 -12
- package/es/src/utils/constant.js +2 -3
- package/es/src/utils/getProp.js +4 -4
- package/es/src/utils/index.js +0 -1
- package/package.json +30 -22
- package/types/index.d.ts +5 -0
- package/types/src/charts/AreaPlot.d.ts +16 -0
- package/types/src/charts/BarChart.d.ts +16 -0
- package/types/src/charts/BoxWhisker.d.ts +11 -0
- package/types/src/charts/BumpChart.d.ts +36 -0
- package/types/src/charts/Donut.d.ts +11 -0
- package/types/src/charts/Geomap.d.ts +120 -0
- package/types/src/charts/LinePlot.d.ts +15 -0
- package/types/src/charts/Matrix.d.ts +74 -0
- package/types/src/charts/Network.d.ts +78 -0
- package/types/src/charts/Pack.d.ts +47 -0
- package/types/src/charts/Pie.d.ts +44 -0
- package/types/src/charts/Plot.d.ts +199 -0
- package/types/src/charts/Priestley.d.ts +37 -0
- package/types/src/charts/Radar.d.ts +38 -0
- package/types/src/charts/RadialMatrix.d.ts +78 -0
- package/types/src/charts/Rings.d.ts +74 -0
- package/types/src/charts/Sankey.d.ts +81 -0
- package/types/src/charts/StackedArea.d.ts +14 -0
- package/types/src/charts/Tree.d.ts +33 -0
- package/types/src/charts/Treemap.d.ts +51 -0
- package/types/src/charts/Viz.d.ts +402 -0
- package/types/src/charts/drawSteps/drawAttribution.d.ts +7 -0
- package/types/src/charts/drawSteps/drawBack.d.ts +6 -0
- package/types/src/charts/drawSteps/drawColorScale.d.ts +6 -0
- package/types/src/charts/drawSteps/drawLegend.d.ts +12 -0
- package/types/src/charts/drawSteps/drawSubtitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTimeline.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTotal.d.ts +7 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +7 -0
- package/types/src/charts/events/click.legend.d.ts +8 -0
- package/types/src/charts/events/click.shape.d.ts +8 -0
- package/types/src/charts/events/mouseenter.d.ts +8 -0
- package/types/src/charts/events/mouseleave.d.ts +8 -0
- package/types/src/charts/events/mousemove.legend.d.ts +9 -0
- package/types/src/charts/events/mousemove.shape.d.ts +9 -0
- package/types/src/charts/events/touchstart.body.d.ts +7 -0
- package/types/src/charts/helpers/matrixData.d.ts +11 -0
- package/types/src/charts/helpers/tileAttributions.d.ts +6 -0
- package/types/src/charts/index.d.ts +21 -0
- package/types/src/charts/plotBuffers/Bar.d.ts +16 -0
- package/types/src/charts/plotBuffers/Box.d.ts +16 -0
- package/types/src/charts/plotBuffers/Circle.d.ts +20 -0
- package/types/src/charts/plotBuffers/Line.d.ts +16 -0
- package/types/src/charts/plotBuffers/Rect.d.ts +19 -0
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +7 -0
- package/types/src/charts/plotBuffers/numericBuffer.d.ts +5 -0
- package/types/src/components/Axis.d.ts +309 -0
- package/types/src/components/AxisBottom.d.ts +11 -0
- package/types/src/components/AxisLeft.d.ts +11 -0
- package/types/src/components/AxisRight.d.ts +11 -0
- package/types/src/components/AxisTop.d.ts +11 -0
- package/types/src/components/ColorScale.d.ts +208 -0
- package/types/src/components/Legend.d.ts +157 -0
- package/types/src/components/Message.d.ts +40 -0
- package/types/src/components/TextBox.d.ts +278 -0
- package/types/src/components/Timeline.d.ts +157 -0
- package/types/src/components/Tooltip.d.ts +297 -0
- package/types/src/components/index.d.ts +11 -0
- package/types/src/shapes/Area.d.ts +81 -0
- package/types/src/shapes/Bar.d.ts +104 -0
- package/types/src/shapes/Box.d.ts +121 -0
- package/types/src/shapes/Circle.d.ts +44 -0
- package/types/src/shapes/Image.d.ts +124 -0
- package/types/src/shapes/Line.d.ts +48 -0
- package/types/src/shapes/Path.d.ts +38 -0
- package/types/src/shapes/Rect.d.ts +54 -0
- package/types/src/shapes/Shape.d.ts +378 -0
- package/types/src/shapes/Whisker.d.ts +96 -0
- package/types/src/shapes/index.d.ts +10 -0
- package/types/src/utils/AccessorFn.d.ts +6 -0
- package/types/src/utils/BaseClass.d.ts +76 -0
- package/types/src/utils/D3plusConfig.d.ts +164 -0
- package/types/src/utils/RESET.d.ts +3 -0
- package/types/src/utils/accessor.d.ts +13 -0
- package/types/src/utils/configPrep.d.ts +28 -0
- package/types/src/utils/constant.d.ts +11 -0
- package/types/src/utils/getProp.d.ts +9 -0
- package/types/src/utils/index.d.ts +8 -0
- package/umd/d3plus-core.full.js +20127 -18701
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2920 -5394
- package/umd/d3plus-core.js +1920 -4074
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1605 -3937
- package/es/src/utils/uuid.js +0 -13
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { D3Selection } from "@d3plus/dom";
|
|
3
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
4
|
+
/**
|
|
5
|
+
Creates SVG images based on an array of data.
|
|
6
|
+
@example <caption>a sample row of data</caption>
|
|
7
|
+
var data = {"url": "file.png", "width": "100", "height": "50"};
|
|
8
|
+
@example <caption>passed to the generator</caption>
|
|
9
|
+
new Image().data([data]).render();
|
|
10
|
+
@example <caption>creates the following</caption>
|
|
11
|
+
<image class="d3plus-Image" opacity="1" href="file.png" width="100" height="50" x="0" y="0"></image>
|
|
12
|
+
@example <caption>this is shorthand for the following</caption>
|
|
13
|
+
image().data([data])();
|
|
14
|
+
@example <caption>which also allows a post-draw callback function</caption>
|
|
15
|
+
image().data([data])(function() { alert("draw complete!"); })
|
|
16
|
+
*/
|
|
17
|
+
export default class Image {
|
|
18
|
+
_duration: number;
|
|
19
|
+
_height: AccessorFn;
|
|
20
|
+
_id: AccessorFn;
|
|
21
|
+
_opacity: AccessorFn;
|
|
22
|
+
_pointerEvents: AccessorFn;
|
|
23
|
+
_select: D3Selection;
|
|
24
|
+
_url: AccessorFn;
|
|
25
|
+
_width: AccessorFn;
|
|
26
|
+
_x: AccessorFn;
|
|
27
|
+
_y: AccessorFn;
|
|
28
|
+
_data: DataPoint[];
|
|
29
|
+
/**
|
|
30
|
+
Invoked when creating a new class instance, and sets any default parameters.
|
|
31
|
+
@private
|
|
32
|
+
*/
|
|
33
|
+
constructor();
|
|
34
|
+
/**
|
|
35
|
+
Renders the current Image to the page. If a *callback* is specified, it will be called once the images are done drawing.
|
|
36
|
+
@param callback Optional callback invoked after rendering completes.
|
|
37
|
+
*/
|
|
38
|
+
render(callback?: () => void): this;
|
|
39
|
+
/**
|
|
40
|
+
The data array used to create image shapes. An <image> tag will be drawn for each object in the array.
|
|
41
|
+
*/
|
|
42
|
+
data(): DataPoint[];
|
|
43
|
+
data(_: DataPoint[]): this;
|
|
44
|
+
/**
|
|
45
|
+
The animation duration in milliseconds.
|
|
46
|
+
*/
|
|
47
|
+
duration(): number;
|
|
48
|
+
duration(_: number): this;
|
|
49
|
+
/**
|
|
50
|
+
The height accessor for each image.
|
|
51
|
+
|
|
52
|
+
@example
|
|
53
|
+
function(d) {
|
|
54
|
+
return d.height;
|
|
55
|
+
}
|
|
56
|
+
*/
|
|
57
|
+
height(): AccessorFn;
|
|
58
|
+
height(_: AccessorFn | number): this;
|
|
59
|
+
/**
|
|
60
|
+
The unique id accessor for each image.
|
|
61
|
+
|
|
62
|
+
@example
|
|
63
|
+
function(d) {
|
|
64
|
+
return d.id;
|
|
65
|
+
}
|
|
66
|
+
*/
|
|
67
|
+
id(): AccessorFn;
|
|
68
|
+
id(_: AccessorFn): this;
|
|
69
|
+
/**
|
|
70
|
+
The opacity of each image.
|
|
71
|
+
*/
|
|
72
|
+
opacity(): AccessorFn;
|
|
73
|
+
opacity(_: AccessorFn | number): this;
|
|
74
|
+
/**
|
|
75
|
+
The pointer-events.
|
|
76
|
+
*/
|
|
77
|
+
pointerEvents(): AccessorFn;
|
|
78
|
+
pointerEvents(_: AccessorFn | string): this;
|
|
79
|
+
/**
|
|
80
|
+
The SVG container element as a d3 selector or DOM element.
|
|
81
|
+
*/
|
|
82
|
+
select(): D3Selection;
|
|
83
|
+
select(_: string | HTMLElement | SVGElement | null): this;
|
|
84
|
+
/**
|
|
85
|
+
Accessor function for the URL of each image.
|
|
86
|
+
|
|
87
|
+
@example
|
|
88
|
+
function(d) {
|
|
89
|
+
return d.url;
|
|
90
|
+
}
|
|
91
|
+
*/
|
|
92
|
+
url(): AccessorFn;
|
|
93
|
+
url(_: AccessorFn): this;
|
|
94
|
+
/**
|
|
95
|
+
The width accessor for each image.
|
|
96
|
+
|
|
97
|
+
@example
|
|
98
|
+
function(d) {
|
|
99
|
+
return d.width;
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
width(): AccessorFn;
|
|
103
|
+
width(_: AccessorFn | number): this;
|
|
104
|
+
/**
|
|
105
|
+
The x position accessor for each image.
|
|
106
|
+
|
|
107
|
+
@example
|
|
108
|
+
function(d) {
|
|
109
|
+
return d.x || 0;
|
|
110
|
+
}
|
|
111
|
+
*/
|
|
112
|
+
x(): AccessorFn;
|
|
113
|
+
x(_: AccessorFn | number): this;
|
|
114
|
+
/**
|
|
115
|
+
The y position accessor for each image.
|
|
116
|
+
|
|
117
|
+
@example
|
|
118
|
+
function(d) {
|
|
119
|
+
return d.y || 0;
|
|
120
|
+
}
|
|
121
|
+
*/
|
|
122
|
+
y(): AccessorFn;
|
|
123
|
+
y(_: AccessorFn | number): this;
|
|
124
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
3
|
+
import Shape, { type ShapeAes } from "./Shape.js";
|
|
4
|
+
/**
|
|
5
|
+
Creates SVG lines based on an array of data.
|
|
6
|
+
*/
|
|
7
|
+
export default class Line extends Shape {
|
|
8
|
+
_curve: AccessorFn;
|
|
9
|
+
_defined: AccessorFn;
|
|
10
|
+
_fill: AccessorFn;
|
|
11
|
+
_hitArea: ((d: DataPoint, i: number, aes: ShapeAes) => Record<string, unknown>) | null;
|
|
12
|
+
_name: string;
|
|
13
|
+
_path: Record<string, unknown>;
|
|
14
|
+
_stroke: AccessorFn;
|
|
15
|
+
_strokeWidth: AccessorFn;
|
|
16
|
+
_strokeDasharray: AccessorFn;
|
|
17
|
+
/**
|
|
18
|
+
Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
19
|
+
@private
|
|
20
|
+
*/
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
Filters/manipulates the data array before binding each point to an SVG group.
|
|
24
|
+
@param data @private
|
|
25
|
+
*/
|
|
26
|
+
_dataFilter(data: DataPoint[]): DataPoint[];
|
|
27
|
+
/**
|
|
28
|
+
Draws the lines.
|
|
29
|
+
@param callback Optional callback invoked after rendering completes.
|
|
30
|
+
*/
|
|
31
|
+
render(callback?: () => void): this;
|
|
32
|
+
/**
|
|
33
|
+
Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
34
|
+
@param data point*
|
|
35
|
+
@param index @private
|
|
36
|
+
*/
|
|
37
|
+
_aes(d: DataPoint, i: number): ShapeAes;
|
|
38
|
+
/**
|
|
39
|
+
The d3 curve function used to interpolate the line.
|
|
40
|
+
*/
|
|
41
|
+
curve(): AccessorFn;
|
|
42
|
+
curve(_: AccessorFn | string): this;
|
|
43
|
+
/**
|
|
44
|
+
An accessor function that determines whether a data point is defined (not a gap in the line).
|
|
45
|
+
*/
|
|
46
|
+
defined(): AccessorFn;
|
|
47
|
+
defined(_: AccessorFn): this;
|
|
48
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
3
|
+
import Shape, { type ShapeAes } from "./Shape.js";
|
|
4
|
+
/**
|
|
5
|
+
Creates SVG Paths based on an array of data.
|
|
6
|
+
*/
|
|
7
|
+
export default class Path extends Shape {
|
|
8
|
+
_d: AccessorFn;
|
|
9
|
+
_labelBounds: ((d: DataPoint, i: number, aes: ShapeAes) => Record<string, unknown> | null | false) | null;
|
|
10
|
+
_name: string;
|
|
11
|
+
_labelConfig: Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
14
|
+
@private
|
|
15
|
+
*/
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
19
|
+
@param data point*
|
|
20
|
+
@param index @private
|
|
21
|
+
*/
|
|
22
|
+
_aes(d: DataPoint, i: number): ShapeAes;
|
|
23
|
+
/**
|
|
24
|
+
Draws the paths.
|
|
25
|
+
@param callback Optional callback invoked after rendering completes.
|
|
26
|
+
*/
|
|
27
|
+
render(callback?: () => void): this;
|
|
28
|
+
/**
|
|
29
|
+
The "d" attribute.
|
|
30
|
+
|
|
31
|
+
@example
|
|
32
|
+
function(d) {
|
|
33
|
+
return d.path;
|
|
34
|
+
}
|
|
35
|
+
*/
|
|
36
|
+
d(): AccessorFn;
|
|
37
|
+
d(_: AccessorFn | string): this;
|
|
38
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { D3Selection } from "@d3plus/dom";
|
|
3
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
4
|
+
import Shape, { type ShapeAes } from "./Shape.js";
|
|
5
|
+
/**
|
|
6
|
+
Creates SVG rectangles based on an array of data. See [this example](https://d3plus.org/examples/d3plus-shape/getting-started/) for help getting started using the rectangle generator.
|
|
7
|
+
*/
|
|
8
|
+
export default class Rect extends Shape {
|
|
9
|
+
_height: AccessorFn;
|
|
10
|
+
_labelBounds: ((d: DataPoint, i: number, aes: ShapeAes) => Record<string, unknown> | null | false) | null;
|
|
11
|
+
_name: string;
|
|
12
|
+
_width: AccessorFn;
|
|
13
|
+
/**
|
|
14
|
+
Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
15
|
+
@private
|
|
16
|
+
*/
|
|
17
|
+
constructor();
|
|
18
|
+
/**
|
|
19
|
+
Draws the rectangles.
|
|
20
|
+
@param callback Optional callback invoked after rendering completes.
|
|
21
|
+
*/
|
|
22
|
+
render(callback?: () => void): this;
|
|
23
|
+
/**
|
|
24
|
+
Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
25
|
+
@param data point*
|
|
26
|
+
@param index @private
|
|
27
|
+
*/
|
|
28
|
+
_aes(d: DataPoint, i: number): ShapeAes;
|
|
29
|
+
/**
|
|
30
|
+
Provides the default positioning to the <rect> elements.
|
|
31
|
+
@param elem @private
|
|
32
|
+
*/
|
|
33
|
+
_applyPosition(elem: D3Selection): void;
|
|
34
|
+
/**
|
|
35
|
+
The height accessor for each rectangle.
|
|
36
|
+
|
|
37
|
+
@example
|
|
38
|
+
function(d) {
|
|
39
|
+
return d.height;
|
|
40
|
+
}
|
|
41
|
+
*/
|
|
42
|
+
height(): AccessorFn;
|
|
43
|
+
height(_: AccessorFn | number): this;
|
|
44
|
+
/**
|
|
45
|
+
The width accessor for each rectangle.
|
|
46
|
+
|
|
47
|
+
@example
|
|
48
|
+
function(d) {
|
|
49
|
+
return d.width;
|
|
50
|
+
}
|
|
51
|
+
*/
|
|
52
|
+
width(): AccessorFn;
|
|
53
|
+
width(_: AccessorFn | number): this;
|
|
54
|
+
}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { transition } from "d3-transition";
|
|
2
|
+
import type { DataPoint } from "@d3plus/data";
|
|
3
|
+
import type { D3Selection } from "@d3plus/dom";
|
|
4
|
+
import { TextBox } from "../components/index.js";
|
|
5
|
+
import { BaseClass } from "../utils/index.js";
|
|
6
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
7
|
+
export interface ShapeAes {
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
points?: [number, number][];
|
|
11
|
+
r?: number;
|
|
12
|
+
x?: number;
|
|
13
|
+
y?: number;
|
|
14
|
+
}
|
|
15
|
+
import Image from "./Image.js";
|
|
16
|
+
/**
|
|
17
|
+
An abstracted class for generating shapes.
|
|
18
|
+
*/
|
|
19
|
+
export default class Shape extends BaseClass {
|
|
20
|
+
_activeOpacity: number;
|
|
21
|
+
_activeStyle: Record<string, unknown>;
|
|
22
|
+
_ariaLabel: AccessorFn;
|
|
23
|
+
_backgroundImage: AccessorFn;
|
|
24
|
+
_backgroundImageClass: Image;
|
|
25
|
+
_data: DataPoint[];
|
|
26
|
+
_duration: number;
|
|
27
|
+
_fill: AccessorFn;
|
|
28
|
+
_fillOpacity: AccessorFn;
|
|
29
|
+
_hoverOpacity: number;
|
|
30
|
+
_hoverStyle: Record<string, unknown>;
|
|
31
|
+
_id: AccessorFn;
|
|
32
|
+
_label: AccessorFn;
|
|
33
|
+
_labelClass: TextBox;
|
|
34
|
+
_labelConfig: Record<string, unknown>;
|
|
35
|
+
_labelBounds: ((d: DataPoint, i: number, aes: ShapeAes) => Record<string, unknown> | null | false) | null;
|
|
36
|
+
_name: string;
|
|
37
|
+
_opacity: AccessorFn;
|
|
38
|
+
_pointerEvents: AccessorFn;
|
|
39
|
+
_role: AccessorFn;
|
|
40
|
+
_rotate: AccessorFn;
|
|
41
|
+
_rx: AccessorFn;
|
|
42
|
+
_ry: AccessorFn;
|
|
43
|
+
_scale: AccessorFn;
|
|
44
|
+
_shapeRendering: AccessorFn;
|
|
45
|
+
_stroke: AccessorFn;
|
|
46
|
+
_strokeDasharray: AccessorFn;
|
|
47
|
+
_strokeLinecap: AccessorFn;
|
|
48
|
+
_strokeOpacity: AccessorFn;
|
|
49
|
+
_strokeWidth: AccessorFn;
|
|
50
|
+
_tagName: string;
|
|
51
|
+
_textAnchor: AccessorFn;
|
|
52
|
+
_texture: AccessorFn;
|
|
53
|
+
_textureDefault: Record<string, unknown>;
|
|
54
|
+
_textureDefs: Record<string, Record<string, unknown>>;
|
|
55
|
+
_vectorEffect: AccessorFn;
|
|
56
|
+
_verticalAlign: AccessorFn;
|
|
57
|
+
_x: AccessorFn;
|
|
58
|
+
_y: AccessorFn;
|
|
59
|
+
_select: D3Selection;
|
|
60
|
+
_transition: ReturnType<typeof transition>;
|
|
61
|
+
/** @param data The raw data array to filter. */
|
|
62
|
+
_dataFilter?(data: DataPoint[]): DataPoint[];
|
|
63
|
+
_sort: ((a: DataPoint, b: DataPoint) => number) | null;
|
|
64
|
+
_group: D3Selection;
|
|
65
|
+
_update: D3Selection;
|
|
66
|
+
_enter: D3Selection;
|
|
67
|
+
_exit: D3Selection;
|
|
68
|
+
_hoverGroup: D3Selection;
|
|
69
|
+
_activeGroup: D3Selection;
|
|
70
|
+
_hitArea: ((d: DataPoint, i: number, aes: ShapeAes) => Record<string, unknown>) | null;
|
|
71
|
+
_active: ((d: DataPoint, i: number) => boolean) | null;
|
|
72
|
+
_hover: ((d: DataPoint, i: number) => boolean) | null;
|
|
73
|
+
_discrete: string | undefined;
|
|
74
|
+
_path: Record<string, unknown>;
|
|
75
|
+
_defined: AccessorFn;
|
|
76
|
+
_curve: AccessorFn;
|
|
77
|
+
/**
|
|
78
|
+
Invoked when creating a new class instance, and sets any default parameters.
|
|
79
|
+
@private
|
|
80
|
+
*/
|
|
81
|
+
constructor(tagName?: string);
|
|
82
|
+
/**
|
|
83
|
+
Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
84
|
+
@param data point*
|
|
85
|
+
@param index @private
|
|
86
|
+
*/
|
|
87
|
+
_aes(_d?: DataPoint, _i?: number): ShapeAes;
|
|
88
|
+
/**
|
|
89
|
+
Adds event listeners to each shape group or hit area.
|
|
90
|
+
@private
|
|
91
|
+
*/
|
|
92
|
+
_applyEvents(handler: D3Selection): void;
|
|
93
|
+
/**
|
|
94
|
+
Provides the updated styling to the given shape elements.
|
|
95
|
+
|
|
96
|
+
@private
|
|
97
|
+
*/
|
|
98
|
+
_updateStyle(elem: D3Selection, style: Record<string, unknown>): void;
|
|
99
|
+
/**
|
|
100
|
+
Provides the default styling to the shape elements.
|
|
101
|
+
@param elem @private
|
|
102
|
+
*/
|
|
103
|
+
_applyStyle(elem: D3Selection): void;
|
|
104
|
+
/**
|
|
105
|
+
Calculates the transform for the group elements.
|
|
106
|
+
@param elem @private
|
|
107
|
+
*/
|
|
108
|
+
_applyTransform(elem: D3Selection): void;
|
|
109
|
+
/**
|
|
110
|
+
Returns a full JSON string of the texture config for a given data point.
|
|
111
|
+
|
|
112
|
+
@private
|
|
113
|
+
*/
|
|
114
|
+
_getTextureKey(d: DataPoint, i: number): string | false;
|
|
115
|
+
/**
|
|
116
|
+
Checks for nested data and uses the appropriate variables for accessor functions.
|
|
117
|
+
@param elem @private
|
|
118
|
+
*/
|
|
119
|
+
_nestWrapper(method: AccessorFn): (d: DataPoint, i: number) => DataPoint[keyof DataPoint];
|
|
120
|
+
/**
|
|
121
|
+
Modifies existing shapes to show active status.
|
|
122
|
+
@private
|
|
123
|
+
*/
|
|
124
|
+
_renderActive(): void;
|
|
125
|
+
/**
|
|
126
|
+
Modifies existing shapes to show hover status.
|
|
127
|
+
@private
|
|
128
|
+
*/
|
|
129
|
+
_renderHover(): void;
|
|
130
|
+
/**
|
|
131
|
+
Adds background image to each shape group.
|
|
132
|
+
@private
|
|
133
|
+
*/
|
|
134
|
+
_renderImage(): void;
|
|
135
|
+
/**
|
|
136
|
+
Adds labels to each shape group.
|
|
137
|
+
@private
|
|
138
|
+
*/
|
|
139
|
+
_renderLabels(): void;
|
|
140
|
+
/**
|
|
141
|
+
Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
142
|
+
@param callback Optional callback invoked after rendering completes.
|
|
143
|
+
*/
|
|
144
|
+
render(callback?: () => void): this;
|
|
145
|
+
/**
|
|
146
|
+
The active callback function for highlighting shapes.
|
|
147
|
+
*/
|
|
148
|
+
active(): ((d: DataPoint, i: number) => boolean) | null;
|
|
149
|
+
active(_: ((d: DataPoint, i: number) => boolean) | null): this;
|
|
150
|
+
/**
|
|
151
|
+
When shapes are active, this is the opacity of any shape that is not active.
|
|
152
|
+
*/
|
|
153
|
+
activeOpacity(): number;
|
|
154
|
+
activeOpacity(_: number): this;
|
|
155
|
+
/**
|
|
156
|
+
The style to apply to active shapes.
|
|
157
|
+
*/
|
|
158
|
+
activeStyle(): Record<string, unknown>;
|
|
159
|
+
activeStyle(_: Record<string, unknown>): this;
|
|
160
|
+
/**
|
|
161
|
+
The aria-label attribute for each shape.
|
|
162
|
+
*/
|
|
163
|
+
ariaLabel(): AccessorFn;
|
|
164
|
+
ariaLabel(_: AccessorFn | string): this;
|
|
165
|
+
/**
|
|
166
|
+
The background-image accessor for each shape.
|
|
167
|
+
*/
|
|
168
|
+
backgroundImage(): AccessorFn;
|
|
169
|
+
backgroundImage(_: AccessorFn | string): this;
|
|
170
|
+
/**
|
|
171
|
+
The data array used to create shapes. A shape will be drawn for each object in the array.
|
|
172
|
+
*/
|
|
173
|
+
data(): DataPoint[];
|
|
174
|
+
data(_: DataPoint[]): this;
|
|
175
|
+
/**
|
|
176
|
+
Determines if either the X or Y position is discrete along a Line, which helps in determining the nearest data point on a line for a hit area event.
|
|
177
|
+
*/
|
|
178
|
+
discrete(): string | undefined;
|
|
179
|
+
discrete(_: string): this;
|
|
180
|
+
/**
|
|
181
|
+
The animation duration in milliseconds.
|
|
182
|
+
*/
|
|
183
|
+
duration(): number;
|
|
184
|
+
duration(_: number): this;
|
|
185
|
+
/**
|
|
186
|
+
The fill color accessor for each shape.
|
|
187
|
+
*/
|
|
188
|
+
fill(): AccessorFn;
|
|
189
|
+
fill(_: AccessorFn | string): this;
|
|
190
|
+
/**
|
|
191
|
+
Defines the "fill-opacity" attribute for the shapes.
|
|
192
|
+
*/
|
|
193
|
+
fillOpacity(): AccessorFn;
|
|
194
|
+
fillOpacity(_: AccessorFn | number): this;
|
|
195
|
+
/**
|
|
196
|
+
The hover callback function for highlighting shapes on mouseover.
|
|
197
|
+
*/
|
|
198
|
+
hover(): ((d: DataPoint, i: number) => boolean) | null;
|
|
199
|
+
hover(_: ((d: DataPoint, i: number) => boolean) | null): this;
|
|
200
|
+
/**
|
|
201
|
+
The style to apply to hovered shapes.
|
|
202
|
+
*/
|
|
203
|
+
hoverStyle(): Record<string, unknown>;
|
|
204
|
+
hoverStyle(_: Record<string, unknown>): this;
|
|
205
|
+
/**
|
|
206
|
+
The opacity of non-hovered shapes when any shape is hovered.
|
|
207
|
+
*/
|
|
208
|
+
hoverOpacity(): number;
|
|
209
|
+
hoverOpacity(_: number): this;
|
|
210
|
+
/**
|
|
211
|
+
The mouse hit area accessor function.
|
|
212
|
+
@example
|
|
213
|
+
function(d, i, shape) {
|
|
214
|
+
return {
|
|
215
|
+
"width": shape.width,
|
|
216
|
+
"height": shape.height,
|
|
217
|
+
"x": -shape.width / 2,
|
|
218
|
+
"y": -shape.height / 2
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
*/
|
|
222
|
+
hitArea(): ((d: DataPoint, i: number, aes: Record<string, unknown>) => Record<string, unknown>) | null;
|
|
223
|
+
hitArea(_: ((d: DataPoint, i: number, aes: Record<string, unknown>) => Record<string, unknown>) | Record<string, unknown>): this;
|
|
224
|
+
/**
|
|
225
|
+
The unique id accessor for each shape.
|
|
226
|
+
*/
|
|
227
|
+
id(): AccessorFn;
|
|
228
|
+
id(_: AccessorFn): this;
|
|
229
|
+
/**
|
|
230
|
+
The text label accessor for each shape.
|
|
231
|
+
*/
|
|
232
|
+
label(): AccessorFn;
|
|
233
|
+
label(_: AccessorFn | string | string[]): this;
|
|
234
|
+
/**
|
|
235
|
+
The label bounds accessor function.
|
|
236
|
+
@example
|
|
237
|
+
function(d, i, shape) {
|
|
238
|
+
return {
|
|
239
|
+
"width": shape.width,
|
|
240
|
+
"height": shape.height,
|
|
241
|
+
"x": -shape.width / 2,
|
|
242
|
+
"y": -shape.height / 2
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
*/
|
|
246
|
+
labelBounds(): ((d: DataPoint, i: number, aes: Record<string, unknown>) => Record<string, unknown> | null | false) | null;
|
|
247
|
+
labelBounds(_: ((d: DataPoint, i: number, aes: Record<string, unknown>) => Record<string, unknown> | null | false) | Record<string, unknown>): this;
|
|
248
|
+
/**
|
|
249
|
+
A pass-through to the config method of the TextBox class used to create a shape's labels.
|
|
250
|
+
*/
|
|
251
|
+
labelConfig(): Record<string, unknown>;
|
|
252
|
+
labelConfig(_: Record<string, unknown>): this;
|
|
253
|
+
/**
|
|
254
|
+
The opacity accessor for each shape.
|
|
255
|
+
*/
|
|
256
|
+
opacity(): AccessorFn;
|
|
257
|
+
opacity(_: AccessorFn | number): this;
|
|
258
|
+
/**
|
|
259
|
+
The pointer-events CSS property for each shape.
|
|
260
|
+
*/
|
|
261
|
+
pointerEvents(): AccessorFn;
|
|
262
|
+
pointerEvents(_: AccessorFn | string): this;
|
|
263
|
+
/**
|
|
264
|
+
The role attribute.
|
|
265
|
+
*/
|
|
266
|
+
role(): AccessorFn;
|
|
267
|
+
role(_: AccessorFn | string): this;
|
|
268
|
+
/**
|
|
269
|
+
The rotation angle in degrees for each shape.
|
|
270
|
+
*/
|
|
271
|
+
rotate(): AccessorFn;
|
|
272
|
+
rotate(_: AccessorFn | number): this;
|
|
273
|
+
/**
|
|
274
|
+
Defines the "rx" attribute for the shapes.
|
|
275
|
+
*/
|
|
276
|
+
rx(): AccessorFn;
|
|
277
|
+
rx(_: AccessorFn | number): this;
|
|
278
|
+
/**
|
|
279
|
+
Defines the "rx" attribute for the shapes.
|
|
280
|
+
*/
|
|
281
|
+
ry(): AccessorFn;
|
|
282
|
+
ry(_: AccessorFn | number): this;
|
|
283
|
+
/**
|
|
284
|
+
The scale transform accessor for each shape.
|
|
285
|
+
*/
|
|
286
|
+
scale(): AccessorFn;
|
|
287
|
+
scale(_: AccessorFn | number): this;
|
|
288
|
+
/**
|
|
289
|
+
The SVG container element as a d3 selector or DOM element.
|
|
290
|
+
*/
|
|
291
|
+
select(): D3Selection;
|
|
292
|
+
select(_: string | HTMLElement | SVGElement | null): this;
|
|
293
|
+
/**
|
|
294
|
+
The shape-rendering.
|
|
295
|
+
|
|
296
|
+
@example
|
|
297
|
+
function(d) {
|
|
298
|
+
return d.x;
|
|
299
|
+
}
|
|
300
|
+
*/
|
|
301
|
+
shapeRendering(): AccessorFn;
|
|
302
|
+
shapeRendering(_: AccessorFn | string): this;
|
|
303
|
+
/**
|
|
304
|
+
A comparator function used to sort shapes for layering order.
|
|
305
|
+
*/
|
|
306
|
+
sort(): ((a: DataPoint, b: DataPoint) => number) | null;
|
|
307
|
+
sort(_: ((a: DataPoint, b: DataPoint) => number) | null): this;
|
|
308
|
+
/**
|
|
309
|
+
The stroke color accessor for each shape.
|
|
310
|
+
*/
|
|
311
|
+
stroke(): AccessorFn;
|
|
312
|
+
stroke(_: AccessorFn | string): this;
|
|
313
|
+
/**
|
|
314
|
+
Defines the "stroke-dasharray" attribute for the shapes.
|
|
315
|
+
*/
|
|
316
|
+
strokeDasharray(): AccessorFn;
|
|
317
|
+
strokeDasharray(_: AccessorFn | string): this;
|
|
318
|
+
/**
|
|
319
|
+
Defines the "stroke-linecap" attribute for the shapes. Accepted values are `"butt"`, `"round"`, and `"square"`.
|
|
320
|
+
*/
|
|
321
|
+
strokeLinecap(): AccessorFn;
|
|
322
|
+
strokeLinecap(_: AccessorFn | string): this;
|
|
323
|
+
/**
|
|
324
|
+
Defines the "stroke-opacity" attribute for the shapes.
|
|
325
|
+
*/
|
|
326
|
+
strokeOpacity(): AccessorFn;
|
|
327
|
+
strokeOpacity(_: AccessorFn | number): this;
|
|
328
|
+
/**
|
|
329
|
+
The stroke-width.
|
|
330
|
+
*/
|
|
331
|
+
strokeWidth(): AccessorFn;
|
|
332
|
+
strokeWidth(_: AccessorFn | number): this;
|
|
333
|
+
/**
|
|
334
|
+
The text-anchor.
|
|
335
|
+
*/
|
|
336
|
+
textAnchor(): AccessorFn;
|
|
337
|
+
textAnchor(_: AccessorFn | string): this;
|
|
338
|
+
/**
|
|
339
|
+
Defines the texture used inside of each shape. This uses the [textures.js](https://riccardoscalco.it/textures/) package, and expects either a simple string (`"lines"` or `"circles"`) or a more complex Object containing the various properties of the texture (ie. `{texture: "lines", orientation: "3/8", stroke: "darkorange"}`). If multiple textures are necessary, provide an accsesor Function that returns the correct String/Object for each given data point and index.
|
|
340
|
+
*/
|
|
341
|
+
texture(): AccessorFn;
|
|
342
|
+
texture(_: AccessorFn | string | Record<string, unknown>): this;
|
|
343
|
+
/**
|
|
344
|
+
A series of global texture methods to be used for all textures (ie. `{stroke: "darkorange", strokeWidth: 2}`).
|
|
345
|
+
*/
|
|
346
|
+
textureDefault(): Record<string, unknown>;
|
|
347
|
+
textureDefault(_: Record<string, unknown>): this;
|
|
348
|
+
/**
|
|
349
|
+
The vector-effect.
|
|
350
|
+
*/
|
|
351
|
+
vectorEffect(): AccessorFn;
|
|
352
|
+
vectorEffect(_: AccessorFn | string): this;
|
|
353
|
+
/**
|
|
354
|
+
The vertical alignment.
|
|
355
|
+
*/
|
|
356
|
+
verticalAlign(): AccessorFn;
|
|
357
|
+
verticalAlign(_: AccessorFn | string): this;
|
|
358
|
+
/**
|
|
359
|
+
The x position accessor for each shape.
|
|
360
|
+
|
|
361
|
+
@example
|
|
362
|
+
function(d) {
|
|
363
|
+
return d.x;
|
|
364
|
+
}
|
|
365
|
+
*/
|
|
366
|
+
x(): AccessorFn;
|
|
367
|
+
x(_: AccessorFn | number): this;
|
|
368
|
+
/**
|
|
369
|
+
The y position accessor for each shape.
|
|
370
|
+
|
|
371
|
+
@example
|
|
372
|
+
function(d) {
|
|
373
|
+
return d.y;
|
|
374
|
+
}
|
|
375
|
+
*/
|
|
376
|
+
y(): AccessorFn;
|
|
377
|
+
y(_: AccessorFn | number): this;
|
|
378
|
+
}
|