@d3plus/core 3.0.16 → 3.1.0
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 +88482 -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 +29 -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 +20126 -18700
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2919 -5393
- package/umd/d3plus-core.js +1919 -4073
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1604 -3936
- package/es/src/utils/uuid.js +0 -13
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { D3Selection } from "@d3plus/dom";
|
|
3
|
+
import { BaseClass } from "../utils/index.js";
|
|
4
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
5
|
+
import Circle from "./Circle.js";
|
|
6
|
+
import Line from "./Line.js";
|
|
7
|
+
import Rect from "./Rect.js";
|
|
8
|
+
/**
|
|
9
|
+
Creates SVG whisker based on an array of data.
|
|
10
|
+
*/
|
|
11
|
+
export default class Whisker extends BaseClass {
|
|
12
|
+
_endpoint: AccessorFn;
|
|
13
|
+
_endpointConfig: Record<string, unknown>;
|
|
14
|
+
_length: AccessorFn;
|
|
15
|
+
_lineConfig: Record<string, unknown>;
|
|
16
|
+
_orient: AccessorFn;
|
|
17
|
+
_x: AccessorFn;
|
|
18
|
+
_y: AccessorFn;
|
|
19
|
+
_data: DataPoint[];
|
|
20
|
+
_select: D3Selection;
|
|
21
|
+
_line: Line;
|
|
22
|
+
_whiskerEndpoint: (Circle | Rect)[];
|
|
23
|
+
/**
|
|
24
|
+
Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.
|
|
25
|
+
@private
|
|
26
|
+
*/
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
Draws the whisker.
|
|
30
|
+
@param callback Optional callback invoked after rendering completes.
|
|
31
|
+
*/
|
|
32
|
+
render(callback?: () => void): this;
|
|
33
|
+
/**
|
|
34
|
+
The active highlight state for all sub-shapes in this Whisker.
|
|
35
|
+
*/
|
|
36
|
+
active(_: ((d: DataPoint, i: number) => boolean) | null): void;
|
|
37
|
+
/**
|
|
38
|
+
The data array used to create shapes.
|
|
39
|
+
*/
|
|
40
|
+
data(): DataPoint[];
|
|
41
|
+
data(_: DataPoint[]): this;
|
|
42
|
+
/**
|
|
43
|
+
The endpoint shape type for each whisker.
|
|
44
|
+
*/
|
|
45
|
+
endpoint(): AccessorFn;
|
|
46
|
+
endpoint(_: AccessorFn | string): this;
|
|
47
|
+
/**
|
|
48
|
+
Configuration object for each endpoint.
|
|
49
|
+
*/
|
|
50
|
+
endpointConfig(): Record<string, unknown>;
|
|
51
|
+
endpointConfig(_: Record<string, unknown>): this;
|
|
52
|
+
/**
|
|
53
|
+
The hover highlight state for all sub-shapes in this Whisker.
|
|
54
|
+
*/
|
|
55
|
+
hover(_: ((d: DataPoint, i: number) => boolean) | null): void;
|
|
56
|
+
/**
|
|
57
|
+
Length accessor for whisker.
|
|
58
|
+
*/
|
|
59
|
+
length(): AccessorFn;
|
|
60
|
+
length(_: AccessorFn | number): this;
|
|
61
|
+
/**
|
|
62
|
+
Configuration object for the line shape.
|
|
63
|
+
*/
|
|
64
|
+
lineConfig(): Record<string, unknown>;
|
|
65
|
+
lineConfig(_: Record<string, unknown>): this;
|
|
66
|
+
/**
|
|
67
|
+
The orientation of the whisker shape.
|
|
68
|
+
*/
|
|
69
|
+
orient(): AccessorFn;
|
|
70
|
+
orient(_: AccessorFn | string): this;
|
|
71
|
+
/**
|
|
72
|
+
The SVG container element for this visualization. 3 selector or DOM element.
|
|
73
|
+
*/
|
|
74
|
+
select(): D3Selection;
|
|
75
|
+
select(_: string | HTMLElement | SVGElement | null): this;
|
|
76
|
+
/**
|
|
77
|
+
The x position accessor for each whisker.
|
|
78
|
+
|
|
79
|
+
@example
|
|
80
|
+
function(d) {
|
|
81
|
+
return d.x;
|
|
82
|
+
}
|
|
83
|
+
*/
|
|
84
|
+
x(): AccessorFn;
|
|
85
|
+
x(_: AccessorFn | number): this;
|
|
86
|
+
/**
|
|
87
|
+
The y position accessor for each whisker.
|
|
88
|
+
|
|
89
|
+
@example
|
|
90
|
+
function(d) {
|
|
91
|
+
return d.y;
|
|
92
|
+
}
|
|
93
|
+
*/
|
|
94
|
+
y(): AccessorFn;
|
|
95
|
+
y(_: AccessorFn | number): this;
|
|
96
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as Shape, type ShapeAes } from "./Shape.js";
|
|
2
|
+
export { default as Area } from "./Area.js";
|
|
3
|
+
export { default as Bar } from "./Bar.js";
|
|
4
|
+
export { default as Box } from "./Box.js";
|
|
5
|
+
export { default as Circle } from "./Circle.js";
|
|
6
|
+
export { default as Image } from "./Image.js";
|
|
7
|
+
export { default as Line } from "./Line.js";
|
|
8
|
+
export { default as Path } from "./Path.js";
|
|
9
|
+
export { default as Rect } from "./Rect.js";
|
|
10
|
+
export { default as Whisker } from "./Whisker.js";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { D3plusConfig } from "./D3plusConfig.js";
|
|
2
|
+
/**
|
|
3
|
+
Provides shared configuration, event handling, and locale management inherited by all d3plus classes.
|
|
4
|
+
*/
|
|
5
|
+
export default class BaseClass {
|
|
6
|
+
_locale: string;
|
|
7
|
+
_on: Record<string, (...args: unknown[]) => unknown>;
|
|
8
|
+
_parent: Record<string, unknown>;
|
|
9
|
+
_translate: (d: string, locale?: string) => string;
|
|
10
|
+
_uuid: string;
|
|
11
|
+
_configDefault?: D3plusConfig;
|
|
12
|
+
_shapeConfig?: D3plusConfig;
|
|
13
|
+
/**
|
|
14
|
+
Invoked when creating a new class instance, and sets any default parameters.
|
|
15
|
+
@private
|
|
16
|
+
*/
|
|
17
|
+
constructor();
|
|
18
|
+
/**
|
|
19
|
+
Methods that correspond to the key/value pairs and returns this class.
|
|
20
|
+
*/
|
|
21
|
+
config(): D3plusConfig;
|
|
22
|
+
config(_: D3plusConfig): this;
|
|
23
|
+
/**
|
|
24
|
+
The locale used for all text and number formatting. Supports the locales defined in [d3plus-format](https://github.com/d3plus/d3plus-format/blob/master/src/locale.js). The locale can be a complex Object, a locale code (like "en-US"), or a 2-digit language code (like "en"). If a 2-digit code is provided, the "findLocale" function is used to identify the most approximate locale.
|
|
25
|
+
|
|
26
|
+
@example
|
|
27
|
+
{
|
|
28
|
+
separator: "",
|
|
29
|
+
suffixes: ["y", "z", "a", "f", "p", "n", "\u00b5", "m", "", "k", "M", "B", "t", "q", "Q", "Z", "Y"],
|
|
30
|
+
grouping: [3],
|
|
31
|
+
delimiters: {
|
|
32
|
+
thousands: ",",
|
|
33
|
+
decimal: "."
|
|
34
|
+
},
|
|
35
|
+
currency: ["$", ""]
|
|
36
|
+
}
|
|
37
|
+
*/
|
|
38
|
+
locale(): string;
|
|
39
|
+
locale(_: string | object): this;
|
|
40
|
+
/**
|
|
41
|
+
Event listener for the specified event *typenames*. Mirrors the core [d3-selection](https://github.com/d3/d3-selection#selection_on) behavior.
|
|
42
|
+
|
|
43
|
+
@example <caption>By default, listeners apply globally to all objects, however, passing a namespace with the class name gives control over specific elements:</caption>
|
|
44
|
+
new Plot
|
|
45
|
+
.on("click.Shape", function(d) {
|
|
46
|
+
console.log("data for shape clicked:", d);
|
|
47
|
+
})
|
|
48
|
+
.on("click.Legend", function(d) {
|
|
49
|
+
console.log("data for legend clicked:", d);
|
|
50
|
+
})
|
|
51
|
+
*/
|
|
52
|
+
on(): Record<string, (...args: unknown[]) => unknown>;
|
|
53
|
+
on(_: string): ((...args: unknown[]) => unknown) | undefined;
|
|
54
|
+
on(_: string, f: (...args: unknown[]) => unknown): this;
|
|
55
|
+
on(_: Record<string, (...args: unknown[]) => unknown>): this;
|
|
56
|
+
/**
|
|
57
|
+
Parent config used by the wrapper.
|
|
58
|
+
*/
|
|
59
|
+
parent(): Record<string, unknown>;
|
|
60
|
+
parent(_: Record<string, unknown>): this;
|
|
61
|
+
/**
|
|
62
|
+
Defines how informational text strings should be displayed. By default, this function will try to find the string in question (which is the first argument provided to this function) inside of an internally managed translation Object. If you'd like to override to use custom text, simply pass this method your own custom formatting function.
|
|
63
|
+
|
|
64
|
+
@example <caption>For example, if we wanted to only change the string "Back" and allow all other string to return in English:</caption>
|
|
65
|
+
.translate(function(d) {
|
|
66
|
+
return d === "Back" ? "Get outta here" : d;
|
|
67
|
+
})
|
|
68
|
+
*/
|
|
69
|
+
translate(): (d: string, locale?: string) => string;
|
|
70
|
+
translate(_: (d: string, locale?: string) => string): this;
|
|
71
|
+
/**
|
|
72
|
+
Configuration object with key/value pairs applied as method calls on each shape.
|
|
73
|
+
*/
|
|
74
|
+
shapeConfig(): D3plusConfig;
|
|
75
|
+
shapeConfig(_: D3plusConfig): this;
|
|
76
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
type Position = "top" | "right" | "bottom" | "left";
|
|
3
|
+
type DataPointAccessor<T> = string | ((d: DataPoint) => T);
|
|
4
|
+
type AxisScale = "auto" | "band" | "diverging" | "divergingLog" | "divergingPow" | "divergingSqrt" | "divergingSymlog" | "identity" | "implicit" | "jenks" | "linear" | "log" | "ordinal" | "point" | "pow" | "quantile" | "quantize" | "radial" | "sequential" | "sequentialLog" | "sequentialPow" | "sequentialQuantile" | "sequentialSqrt" | "sequentialSymlog" | "sqrt" | "symlog" | "threshold" | "time" | "utc";
|
|
5
|
+
export interface AxisConfig {
|
|
6
|
+
barConfig?: Record<string, string | number>;
|
|
7
|
+
gridConfig?: Record<string, string | number>;
|
|
8
|
+
label?: string;
|
|
9
|
+
labels?: unknown[];
|
|
10
|
+
labelOffset?: false | number;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
scale?: AxisScale;
|
|
13
|
+
tickFormat?: (d: number | string) => string | number;
|
|
14
|
+
ticks?: unknown[];
|
|
15
|
+
tickSize?: number;
|
|
16
|
+
title?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface TooltipConfig {
|
|
19
|
+
title?: ((d: DataPoint) => string) | string;
|
|
20
|
+
body?: ((d: DataPoint) => string) | string;
|
|
21
|
+
thead?: ((d: DataPoint) => [string, string][]) | Array<Array<((d: DataPoint, i?: number, x?: {
|
|
22
|
+
share: number;
|
|
23
|
+
}) => string) | string>>;
|
|
24
|
+
tbody?: ((d: DataPoint) => [string, string][]) | Array<Array<((d: DataPoint, i?: number, x?: {
|
|
25
|
+
share: number;
|
|
26
|
+
}) => string) | string>>;
|
|
27
|
+
}
|
|
28
|
+
export interface D3plusConfig {
|
|
29
|
+
/** Data array or URL string to load data from. */
|
|
30
|
+
data?: DataPoint[] | string;
|
|
31
|
+
/** Locale code used for text and number formatting. */
|
|
32
|
+
locale?: string;
|
|
33
|
+
/** Custom aggregation functions keyed by data property. */
|
|
34
|
+
aggs?: {
|
|
35
|
+
[k: string]: (d: DataPoint[]) => unknown;
|
|
36
|
+
};
|
|
37
|
+
/** Padding between bars in pixels. */
|
|
38
|
+
barPadding?: number;
|
|
39
|
+
/** Color scale key or custom color function. */
|
|
40
|
+
colorScale?: string | ((d: number) => string);
|
|
41
|
+
/** Configuration for the color scale component. */
|
|
42
|
+
colorScaleConfig?: {
|
|
43
|
+
axisConfig?: AxisConfig;
|
|
44
|
+
centered?: boolean;
|
|
45
|
+
colors?: string[];
|
|
46
|
+
colorMin?: string;
|
|
47
|
+
colorMid?: string;
|
|
48
|
+
colorMax?: string;
|
|
49
|
+
scale?: AxisScale;
|
|
50
|
+
};
|
|
51
|
+
/** Position of the color scale, or false to hide it. */
|
|
52
|
+
colorScalePosition?: false | Position;
|
|
53
|
+
/** Column key for matrix-style layouts. */
|
|
54
|
+
column?: string;
|
|
55
|
+
/** Active depth level for nested groupings. */
|
|
56
|
+
depth?: number;
|
|
57
|
+
/** Sets orientation of main category axis. */
|
|
58
|
+
discrete?: "x" | "y";
|
|
59
|
+
/** Allows removing specific geographies from topojson file to improve zoom. */
|
|
60
|
+
fitFilter?: number | string | ((d: Record<string, unknown>) => boolean);
|
|
61
|
+
/** Grouping key(s) or accessor function(s). */
|
|
62
|
+
groupBy?: string | string[] | ((d: DataPoint) => string | number) | ((d: DataPoint) => string | number)[];
|
|
63
|
+
/** Padding between groups of bars in pixels. */
|
|
64
|
+
groupPadding?: number;
|
|
65
|
+
/** Label accessor for shapes. */
|
|
66
|
+
label?: string | ((...args: unknown[]) => string);
|
|
67
|
+
/** Whether to show the legend. */
|
|
68
|
+
legend?: boolean;
|
|
69
|
+
/** Configuration for the legend component. */
|
|
70
|
+
legendConfig?: {
|
|
71
|
+
label?: DataPointAccessor<string>;
|
|
72
|
+
shapeConfig?: Record<string, string | number>;
|
|
73
|
+
};
|
|
74
|
+
/** Position of the legend. */
|
|
75
|
+
legendPosition?: Position;
|
|
76
|
+
/** Tooltip configuration for legend items. */
|
|
77
|
+
legendTooltip?: TooltipConfig;
|
|
78
|
+
/** Whether to show labels on line charts. */
|
|
79
|
+
lineLabels?: boolean;
|
|
80
|
+
/** Whether to show the loading message. */
|
|
81
|
+
loadingMessage?: boolean;
|
|
82
|
+
/** Custom HTML content for the loading indicator. */
|
|
83
|
+
loadingHTML?: string;
|
|
84
|
+
/** Metric key for the visualization. */
|
|
85
|
+
metric?: string;
|
|
86
|
+
/** Ocean color for geomaps (any CSS value including 'transparent'). */
|
|
87
|
+
ocean?: string;
|
|
88
|
+
/** Event listeners keyed by event name. */
|
|
89
|
+
on?: Record<string, (event: Event) => void>;
|
|
90
|
+
/** Coordinate accessor for point-based geomaps. */
|
|
91
|
+
point?: (d: DataPoint) => number[];
|
|
92
|
+
/** Point size accessor for geomaps. */
|
|
93
|
+
pointSize?: string | ((d: DataPoint) => number);
|
|
94
|
+
/** Minimum point size for geomaps. */
|
|
95
|
+
pointSizeMin?: number;
|
|
96
|
+
/** Maximum point size for geomaps. */
|
|
97
|
+
pointSizeMax?: number;
|
|
98
|
+
/** Map projection name or function. */
|
|
99
|
+
projection?: string | ((x: number, y: number) => [number, number]);
|
|
100
|
+
/** Outer padding between the visualization edge and map shapes. */
|
|
101
|
+
projectionPadding?: number | string;
|
|
102
|
+
/** Rotation offset for the map projection center. */
|
|
103
|
+
projectionRotate?: [number, number];
|
|
104
|
+
/** Row key for matrix-style layouts. */
|
|
105
|
+
row?: string;
|
|
106
|
+
/** Scrollable container selector for tooltip positioning. */
|
|
107
|
+
scrollContainer?: string;
|
|
108
|
+
/** Configuration for shape rendering. */
|
|
109
|
+
shapeConfig?: {
|
|
110
|
+
duration?: number;
|
|
111
|
+
[key: string]: unknown;
|
|
112
|
+
};
|
|
113
|
+
/** Size accessor key. */
|
|
114
|
+
size?: string;
|
|
115
|
+
/** Whether to stack series. */
|
|
116
|
+
stacked?: boolean;
|
|
117
|
+
/** Custom order for stacked series. */
|
|
118
|
+
stackOrder?: string[];
|
|
119
|
+
/** Value accessor for treemaps and aggregation. */
|
|
120
|
+
sum?: DataPointAccessor<number>;
|
|
121
|
+
/** Threshold value for grouping small slices. */
|
|
122
|
+
threshold?: number;
|
|
123
|
+
/** Label for the threshold group. */
|
|
124
|
+
thresholdName?: string;
|
|
125
|
+
/** URL to XYZ map tiles. */
|
|
126
|
+
tileUrl?: string;
|
|
127
|
+
/** Whether to show map tiles. */
|
|
128
|
+
tiles?: boolean;
|
|
129
|
+
/** Time key for temporal data. */
|
|
130
|
+
time?: string;
|
|
131
|
+
/** Chart title or title accessor function. */
|
|
132
|
+
title?: string | ((data: DataPoint[]) => string);
|
|
133
|
+
/** CSS style configuration for the title. */
|
|
134
|
+
titleConfig?: Record<string, string | number>;
|
|
135
|
+
/** Whether to show tooltips. */
|
|
136
|
+
tooltip?: boolean;
|
|
137
|
+
/** Configuration for the tooltip component. */
|
|
138
|
+
tooltipConfig?: TooltipConfig;
|
|
139
|
+
/** Path or object for the topojson data. */
|
|
140
|
+
topojson?: string | object;
|
|
141
|
+
/** CSS color to fill the map shapes. */
|
|
142
|
+
topojsonFill?: string;
|
|
143
|
+
/** Accessor function for topojson feature IDs. */
|
|
144
|
+
topojsonId?: (obj: Record<string, unknown>) => string;
|
|
145
|
+
/** Value accessor for the visualization. */
|
|
146
|
+
value?: DataPointAccessor<number>;
|
|
147
|
+
/** Key, index, or accessor function for x-axis values. */
|
|
148
|
+
x?: string | number | ((...args: unknown[]) => unknown);
|
|
149
|
+
/** Configuration for the x-axis. */
|
|
150
|
+
xConfig?: AxisConfig;
|
|
151
|
+
/** Custom sort function for x-axis values. */
|
|
152
|
+
xSort?: (a: DataPoint, b: DataPoint) => number;
|
|
153
|
+
/** Key, index, or accessor function for y-axis values. */
|
|
154
|
+
y?: string | number | ((...args: unknown[]) => unknown);
|
|
155
|
+
/** Configuration for the y-axis. */
|
|
156
|
+
yConfig?: AxisConfig;
|
|
157
|
+
/** Custom sort function for y-axis values. */
|
|
158
|
+
ySort?: (a: DataPoint, b: DataPoint) => number;
|
|
159
|
+
/** Set to false to disable zooming on geomaps. */
|
|
160
|
+
zoom?: false;
|
|
161
|
+
/** Allows additional custom properties. */
|
|
162
|
+
[key: string]: unknown;
|
|
163
|
+
}
|
|
164
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
/**
|
|
3
|
+
Wraps an object key in a simple accessor function.
|
|
4
|
+
@param key The key to be returned from each Object passed to the function.
|
|
5
|
+
@param def A default value to be returned if the key is not present.
|
|
6
|
+
@example <caption>this</caption>
|
|
7
|
+
accessor("id");
|
|
8
|
+
@example <caption>returns this</caption>
|
|
9
|
+
function(d) {
|
|
10
|
+
return d["id"];
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
|
+
export default function accessor(key: string, def?: DataPoint[keyof DataPoint]): (d: DataPoint) => DataPoint[keyof DataPoint];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import { D3plusConfig } from "./D3plusConfig";
|
|
3
|
+
interface D3PlusWrapped {
|
|
4
|
+
__d3plus__?: boolean;
|
|
5
|
+
__d3plusParent__?: D3PlusWrapped;
|
|
6
|
+
data?: DataPoint;
|
|
7
|
+
feature?: DataPoint;
|
|
8
|
+
i?: number;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
type DataAccessor = (d: DataPoint, i: number, s?: D3PlusWrapped, e?: Event) => DataPoint[keyof DataPoint];
|
|
12
|
+
interface ConfigObject extends D3plusConfig {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface VizContext {
|
|
16
|
+
_shapeConfig: ConfigObject;
|
|
17
|
+
_duration: number;
|
|
18
|
+
_on: Record<string, DataAccessor>;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
Preps a config object for d3plus data, and optionally bubbles up a specific nested type. When using this function, you must bind a d3plus class' `this` context.
|
|
23
|
+
@param config The configuration object to parse.
|
|
24
|
+
@param type The event classifier to user for "on" events. For example, the default event type of "shape" will apply all events in the "on" config object with that key, like "click.shape" and "mouseleave.shape", in addition to any gloval events like "click" and "mouseleave".
|
|
25
|
+
@param nest An optional nested key to bubble up to the parent config level.
|
|
26
|
+
*/
|
|
27
|
+
export default function configPrep(this: VizContext, config?: ConfigObject, type?: string, nest?: string | false): ConfigObject;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Wraps non-function variables in a simple return function.
|
|
3
|
+
@param value The value to wrap in a return function.
|
|
4
|
+
@example <caption>this</caption>
|
|
5
|
+
constant(42);
|
|
6
|
+
@example <caption>returns this</caption>
|
|
7
|
+
function() {
|
|
8
|
+
return 42;
|
|
9
|
+
}
|
|
10
|
+
*/
|
|
11
|
+
export default function <T>(value: T): () => T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
/**
|
|
3
|
+
@module getProp
|
|
4
|
+
@param type
|
|
5
|
+
@param d
|
|
6
|
+
@param i
|
|
7
|
+
@private
|
|
8
|
+
*/
|
|
9
|
+
export default function getProp(this: Record<string, (d: DataPoint, i: number) => DataPoint[keyof DataPoint]>, type: string, d: DataPoint, i: number): DataPoint[keyof DataPoint];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { AccessorFn } from "./AccessorFn.js";
|
|
2
|
+
export { default as accessor } from "./accessor.js";
|
|
3
|
+
export { default as BaseClass } from "./BaseClass.js";
|
|
4
|
+
export type { D3plusConfig, AxisConfig, TooltipConfig } from "./D3plusConfig.js";
|
|
5
|
+
export { default as configPrep } from "./configPrep.js";
|
|
6
|
+
export { default as constant } from "./constant.js";
|
|
7
|
+
export { default as getProp } from "./getProp.js";
|
|
8
|
+
export { default as RESET } from "./RESET.js";
|