@motionscript/charts 0.0.0-stage → 0.1.0-alpha.10
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/CHANGELOG.md +110 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +98 -3
- package/dist/bar-chart/bar-chart.d.ts +191 -0
- package/dist/bar-chart/bar-chart.d.ts.map +1 -0
- package/dist/bar-chart/bar-chart.js +431 -0
- package/dist/bar-chart/bar-chart.js.map +1 -0
- package/dist/bar-chart/category-axis.d.ts +71 -0
- package/dist/bar-chart/category-axis.d.ts.map +1 -0
- package/dist/bar-chart/category-axis.js +119 -0
- package/dist/bar-chart/category-axis.js.map +1 -0
- package/dist/bar-chart/chart-bars.d.ts +129 -0
- package/dist/bar-chart/chart-bars.d.ts.map +1 -0
- package/dist/bar-chart/chart-bars.js +181 -0
- package/dist/bar-chart/chart-bars.js.map +1 -0
- package/dist/bar-chart/index.d.ts +16 -0
- package/dist/bar-chart/index.d.ts.map +1 -0
- package/dist/bar-chart/index.js +12 -0
- package/dist/bar-chart/index.js.map +1 -0
- package/dist/bar-chart/shared.d.ts +146 -0
- package/dist/bar-chart/shared.d.ts.map +1 -0
- package/dist/bar-chart/shared.js +182 -0
- package/dist/bar-chart/shared.js.map +1 -0
- package/dist/browser/chunks/chunk-TJNHLQGV.js +2 -0
- package/dist/browser/chunks/chunk-TJNHLQGV.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +13 -0
- package/dist/engine.d.ts +29 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +29 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/cartesian.d.ts +44 -0
- package/dist/kit/cartesian.d.ts.map +1 -0
- package/dist/kit/cartesian.js +59 -0
- package/dist/kit/cartesian.js.map +1 -0
- package/dist/kit/chart-border.d.ts +27 -0
- package/dist/kit/chart-border.d.ts.map +1 -0
- package/dist/kit/chart-border.js +28 -0
- package/dist/kit/chart-border.js.map +1 -0
- package/dist/kit/chart-canvas.d.ts +67 -0
- package/dist/kit/chart-canvas.d.ts.map +1 -0
- package/dist/kit/chart-canvas.js +68 -0
- package/dist/kit/chart-canvas.js.map +1 -0
- package/dist/kit/chart-legend.d.ts +164 -0
- package/dist/kit/chart-legend.d.ts.map +1 -0
- package/dist/kit/chart-legend.js +163 -0
- package/dist/kit/chart-legend.js.map +1 -0
- package/dist/kit/entries.d.ts +17 -0
- package/dist/kit/entries.d.ts.map +1 -0
- package/dist/kit/entries.js +19 -0
- package/dist/kit/entries.js.map +1 -0
- package/dist/kit/motion.d.ts +48 -0
- package/dist/kit/motion.d.ts.map +1 -0
- package/dist/kit/motion.js +63 -0
- package/dist/kit/motion.js.map +1 -0
- package/dist/kit/paints.d.ts +10 -0
- package/dist/kit/paints.d.ts.map +1 -0
- package/dist/kit/paints.js +12 -0
- package/dist/kit/paints.js.map +1 -0
- package/dist/kit/shared.d.ts +302 -0
- package/dist/kit/shared.d.ts.map +1 -0
- package/dist/kit/shared.js +496 -0
- package/dist/kit/shared.js.map +1 -0
- package/dist/kit/vertical-axis.d.ts +86 -0
- package/dist/kit/vertical-axis.d.ts.map +1 -0
- package/dist/kit/vertical-axis.js +141 -0
- package/dist/kit/vertical-axis.js.map +1 -0
- package/dist/line-chart/chart-line.d.ts +74 -0
- package/dist/line-chart/chart-line.d.ts.map +1 -0
- package/dist/line-chart/chart-line.js +135 -0
- package/dist/line-chart/chart-line.js.map +1 -0
- package/dist/line-chart/chart-region.d.ts +46 -0
- package/dist/line-chart/chart-region.d.ts.map +1 -0
- package/dist/line-chart/chart-region.js +67 -0
- package/dist/line-chart/chart-region.js.map +1 -0
- package/dist/line-chart/horizontal-axis.d.ts +79 -0
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -0
- package/dist/line-chart/horizontal-axis.js +129 -0
- package/dist/line-chart/horizontal-axis.js.map +1 -0
- package/dist/line-chart/index.d.ts +22 -0
- package/dist/line-chart/index.d.ts.map +1 -0
- package/dist/line-chart/index.js +19 -0
- package/dist/line-chart/index.js.map +1 -0
- package/dist/line-chart/line-chart.d.ts +200 -0
- package/dist/line-chart/line-chart.d.ts.map +1 -0
- package/dist/line-chart/line-chart.js +473 -0
- package/dist/line-chart/line-chart.js.map +1 -0
- package/dist/line-chart/shared.d.ts +171 -0
- package/dist/line-chart/shared.d.ts.map +1 -0
- package/dist/line-chart/shared.js +285 -0
- package/dist/line-chart/shared.js.map +1 -0
- package/dist/line-chart/x-scale.d.ts +77 -0
- package/dist/line-chart/x-scale.d.ts.map +1 -0
- package/dist/line-chart/x-scale.js +313 -0
- package/dist/line-chart/x-scale.js.map +1 -0
- package/dist/nodes.d.ts +17 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +18 -0
- package/dist/nodes.js.map +1 -0
- package/dist/pie-chart/index.d.ts +18 -0
- package/dist/pie-chart/index.d.ts.map +1 -0
- package/dist/pie-chart/index.js +14 -0
- package/dist/pie-chart/index.js.map +1 -0
- package/dist/pie-chart/pie-chart.d.ts +152 -0
- package/dist/pie-chart/pie-chart.d.ts.map +1 -0
- package/dist/pie-chart/pie-chart.js +222 -0
- package/dist/pie-chart/pie-chart.js.map +1 -0
- package/dist/pie-chart/pie-legend.d.ts +113 -0
- package/dist/pie-chart/pie-legend.d.ts.map +1 -0
- package/dist/pie-chart/pie-legend.js +117 -0
- package/dist/pie-chart/pie-legend.js.map +1 -0
- package/dist/pie-chart/pie-ring.d.ts +304 -0
- package/dist/pie-chart/pie-ring.d.ts.map +1 -0
- package/dist/pie-chart/pie-ring.js +680 -0
- package/dist/pie-chart/pie-ring.js.map +1 -0
- package/dist/pie-chart/shared.d.ts +216 -0
- package/dist/pie-chart/shared.d.ts.map +1 -0
- package/dist/pie-chart/shared.js +246 -0
- package/dist/pie-chart/shared.js.map +1 -0
- package/package.json +72 -3
- package/registry.json +23 -0
- package/src/bar-chart/bar-chart.ts +542 -0
- package/src/bar-chart/category-axis.ts +162 -0
- package/src/bar-chart/chart-bars.ts +287 -0
- package/src/bar-chart/index.ts +31 -0
- package/src/bar-chart/shared.ts +354 -0
- package/src/engine.ts +28 -0
- package/src/index.ts +5 -0
- package/src/kit/cartesian.ts +81 -0
- package/src/kit/chart-border.ts +50 -0
- package/src/kit/chart-canvas.ts +122 -0
- package/src/kit/chart-legend.ts +229 -0
- package/src/kit/entries.ts +20 -0
- package/src/kit/motion.ts +90 -0
- package/src/kit/paints.ts +15 -0
- package/src/kit/shared.ts +782 -0
- package/src/kit/vertical-axis.ts +194 -0
- package/src/line-chart/chart-line.ts +156 -0
- package/src/line-chart/chart-region.ts +90 -0
- package/src/line-chart/horizontal-axis.ts +151 -0
- package/src/line-chart/index.ts +39 -0
- package/src/line-chart/line-chart.ts +598 -0
- package/src/line-chart/shared.ts +473 -0
- package/src/line-chart/x-scale.ts +382 -0
- package/src/nodes.ts +18 -0
- package/src/pie-chart/index.ts +37 -0
- package/src/pie-chart/pie-chart.ts +296 -0
- package/src/pie-chart/pie-legend.ts +169 -0
- package/src/pie-chart/pie-ring.ts +848 -0
- package/src/pie-chart/shared.ts +496 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { type FillResolved, type NodeOf, type Node2D, type Node2DProps, type Vector2 } from "@motionscript/sdk";
|
|
2
|
+
import { type CenterConfig, type LabelConfig, type PieArc, type PieLabelMode, type PieLabelPlacement, type PieSlice, type RingConfig } from "./shared.js";
|
|
3
|
+
export interface PieRingProps extends Node2DProps {
|
|
4
|
+
/** One entry per slice: its `category`, `value` and `fill`. */
|
|
5
|
+
slices: PieSlice[];
|
|
6
|
+
/** Ring geometry and paint — gap, hole, start angle, selection growth. */
|
|
7
|
+
ring: RingConfig;
|
|
8
|
+
/** How the labels are set, and the leader lines that point at them. */
|
|
9
|
+
label: LabelConfig;
|
|
10
|
+
/**
|
|
11
|
+
* How the hole's summary is set.
|
|
12
|
+
*
|
|
13
|
+
* Named `centerStyle` rather than `center` because every node already has a
|
|
14
|
+
* `center` — the anchor its position is measured from.
|
|
15
|
+
*/
|
|
16
|
+
centerStyle: CenterConfig;
|
|
17
|
+
/** What the labels say, or `"none"` to drop them entirely. */
|
|
18
|
+
labelMode: PieLabelMode;
|
|
19
|
+
/** Where the labels sit: inside their wedge, outside on a leader, or nowhere. */
|
|
20
|
+
labelPlacement: PieLabelPlacement;
|
|
21
|
+
/**
|
|
22
|
+
* Sweep of the ring in `[0, 1]`: 0 draws nothing, 1 the full circle. The
|
|
23
|
+
* wedges grow around clockwise from the ring's `startAngle` as this rises.
|
|
24
|
+
*/
|
|
25
|
+
growth: number;
|
|
26
|
+
/**
|
|
27
|
+
* Fade of the leader lines and labels in `[0, 1]`, held separate from
|
|
28
|
+
* {@link growth} so they arrive *after* the ring has swept in.
|
|
29
|
+
*/
|
|
30
|
+
labelReveal: number;
|
|
31
|
+
/**
|
|
32
|
+
* How far each slice is currently pushed out of the ring, `0`–`1` per index.
|
|
33
|
+
* Owned by the chart, so the ring and the legend read one signal.
|
|
34
|
+
*/
|
|
35
|
+
pops: number[];
|
|
36
|
+
/** Opacity everything *unselected* falls back to while any slice is selected. */
|
|
37
|
+
dimOpacity: number;
|
|
38
|
+
/**
|
|
39
|
+
* Text set in the middle of the ring's hole — the largest uninterrupted area
|
|
40
|
+
* the chart owns, and on a donut otherwise empty. A one-line summary there
|
|
41
|
+
* routinely does more work than the whole ring around it. Empty (the default)
|
|
42
|
+
* leaves the hole clear; ignored when there is no hole.
|
|
43
|
+
*/
|
|
44
|
+
centerLabel: string;
|
|
45
|
+
/** Smaller second line under {@link centerLabel}. Empty (the default) drops it. */
|
|
46
|
+
centerCaption: string;
|
|
47
|
+
/**
|
|
48
|
+
* Fade of the hole's summary in `[0, 1]`. Its own signal, untouched by the
|
|
49
|
+
* ring's entrance — a hole label is usually a *conclusion*, so a scene that
|
|
50
|
+
* wants it to land on a later beat sets this to 0 and calls
|
|
51
|
+
* `PieChart.revealCenter` when it gets there.
|
|
52
|
+
*/
|
|
53
|
+
centerReveal: number;
|
|
54
|
+
}
|
|
55
|
+
/** Where one slice's label sits and the polyline that points at it. */
|
|
56
|
+
interface LabelPlacement {
|
|
57
|
+
/** Index of the slice. */
|
|
58
|
+
index: number;
|
|
59
|
+
/** Which side of the ring the label sits on: +1 right, −1 left. */
|
|
60
|
+
side: 1 | -1;
|
|
61
|
+
/** Leader polyline: wedge edge → elbow → label. */
|
|
62
|
+
leader: Vector2[];
|
|
63
|
+
/** Point the label's inner edge is pinned to. */
|
|
64
|
+
text: Vector2;
|
|
65
|
+
}
|
|
66
|
+
/** What the ring's geometry reads off its entries. */
|
|
67
|
+
interface RingState {
|
|
68
|
+
readonly slices: PieSlice[];
|
|
69
|
+
readonly ring: RingConfig;
|
|
70
|
+
readonly label: LabelConfig;
|
|
71
|
+
readonly centerStyle: CenterConfig;
|
|
72
|
+
readonly labelMode: PieLabelMode;
|
|
73
|
+
readonly labelPlacement: PieLabelPlacement;
|
|
74
|
+
readonly pops: readonly number[];
|
|
75
|
+
readonly dimOpacity: number;
|
|
76
|
+
readonly centerLabel: string;
|
|
77
|
+
readonly centerCaption: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The ring's geometry for one box: every radius, gutter and label position,
|
|
81
|
+
* derived from the entries and the size the ring was laid out at, and asked
|
|
82
|
+
* afresh wherever it is read — the drawing, and the labels' bound positions
|
|
83
|
+
* and sizes alike, so the two cannot disagree.
|
|
84
|
+
*/
|
|
85
|
+
export declare class RingGeometry {
|
|
86
|
+
private readonly s;
|
|
87
|
+
private readonly box;
|
|
88
|
+
constructor(s: RingState, box: {
|
|
89
|
+
readonly width: number;
|
|
90
|
+
readonly height: number;
|
|
91
|
+
});
|
|
92
|
+
/** The drawn slices' angular spans, re-read every frame so a value tween re-cuts them. */
|
|
93
|
+
get arcs(): PieArc[];
|
|
94
|
+
/** Whether any slice is labelled on a leader — the only thing that costs a gutter. */
|
|
95
|
+
get hasLeaderLabels(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* How wide a horizontal label centred in slice `arc`'s band can run before it
|
|
98
|
+
* leaves the wedge, in px.
|
|
99
|
+
*
|
|
100
|
+
* Two things bound it, and which one binds depends entirely on where the wedge
|
|
101
|
+
* sits. Stepping sideways from the label's centre moves you *radially* by
|
|
102
|
+
* `dx·sin(mid)` and *tangentially* by `dx·cos(mid)`, so a wedge at 3 o'clock is
|
|
103
|
+
* limited by the band's thickness (its label runs straight across the band)
|
|
104
|
+
* while a wedge at 12 o'clock is limited by its own arc (its label runs along
|
|
105
|
+
* the band, which is much roomier). Taking the smaller of the two is what stops
|
|
106
|
+
* a label overflowing the ring on one chart and being pointlessly shrunk on the
|
|
107
|
+
* next.
|
|
108
|
+
*
|
|
109
|
+
* Measured off the *unpopped* radius, so a slice growing out of the ring
|
|
110
|
+
* doesn't resize its own text mid-animation.
|
|
111
|
+
*/
|
|
112
|
+
insideRoom(arc: PieArc): number;
|
|
113
|
+
/** Widest line, in glyphs at the leading line's size, an inside label runs to. */
|
|
114
|
+
insideGlyphs(arc: PieArc): number;
|
|
115
|
+
/**
|
|
116
|
+
* Font size of an inside label's leading line: what the theme asked for,
|
|
117
|
+
* shrunk if that wouldn't fit inside its wedge. **One size across every inside
|
|
118
|
+
* label** — the smallest any of them needs — because labels at mismatched
|
|
119
|
+
* sizes read as a mistake rather than as emphasis.
|
|
120
|
+
*
|
|
121
|
+
* So the theme's `insideStyle.fontSize` is an upper bound, not a promise: ask
|
|
122
|
+
* for the size the chart wants and the ring keeps it legal.
|
|
123
|
+
*/
|
|
124
|
+
get insideFont(): number;
|
|
125
|
+
/**
|
|
126
|
+
* Font size of the hole's summary: the configured size, capped so it still
|
|
127
|
+
* fits across the hole. The cap matters because the hole's radius derives from
|
|
128
|
+
* the box, so a chart that reflows smaller would otherwise push its summary out
|
|
129
|
+
* through the ring.
|
|
130
|
+
*/
|
|
131
|
+
get centerFont(): number;
|
|
132
|
+
/** Rim radius of a fully selected slice as a multiple of the ring's, clamped sane. */
|
|
133
|
+
get growFactor(): number;
|
|
134
|
+
/** How far past the ring's rim a fully selected slice reaches, in px. */
|
|
135
|
+
get maxPop(): number;
|
|
136
|
+
/** Height of one **leader** label block, in px — the unit those columns are spaced by. */
|
|
137
|
+
get labelRowHeight(): number;
|
|
138
|
+
/** Widest line, in glyphs, that a leader label for slice `index` can run to. */
|
|
139
|
+
captionGlyphs(index: number): number;
|
|
140
|
+
/**
|
|
141
|
+
* Horizontal room reserved on each side for the leaders and their labels, in
|
|
142
|
+
* px — measured **per side**, from the slices that actually leader out that
|
|
143
|
+
* way. A ring whose labels are all inside reserves nothing and draws bigger.
|
|
144
|
+
*
|
|
145
|
+
* Excludes the ring's own selection-growth allowance, which scales with the
|
|
146
|
+
* radius and so is divided out in {@link outerRadius} instead.
|
|
147
|
+
*/
|
|
148
|
+
get labelGutters(): {
|
|
149
|
+
left: number;
|
|
150
|
+
right: number;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* How far the ring's centre sits from the node's, in px. Zero while the
|
|
154
|
+
* gutters match; when the labels all fall one way it slides the ring into the
|
|
155
|
+
* empty half so the ring-plus-labels group stays centred in the box instead of
|
|
156
|
+
* the ring sitting dead centre with a bald patch beside it.
|
|
157
|
+
*/
|
|
158
|
+
get centerX(): number;
|
|
159
|
+
/**
|
|
160
|
+
* Radius of the ring's outer edge, fitted to whatever the label gutters leave.
|
|
161
|
+
* A fully selected slice reaches `radius × growFactor`, so the room has to
|
|
162
|
+
* cover that — hence the divisor, which keeps even the grown slice inside the
|
|
163
|
+
* box (and holds the ring the same size whether or not anything is selected).
|
|
164
|
+
*/
|
|
165
|
+
get outerRadius(): number;
|
|
166
|
+
/** Radius of the hole in the middle: a fraction of the outer radius, or explicit px. */
|
|
167
|
+
get holeRadius(): number;
|
|
168
|
+
/** Radius of the circle every leader elbows on, clear of even a popped-out slice. */
|
|
169
|
+
get elbowRadius(): number;
|
|
170
|
+
/** How far slice `index` is currently pushed out, in `[0, 1]`. */
|
|
171
|
+
popOf(index: number): number;
|
|
172
|
+
/** Radius of slice `index`'s outer edge, its selection growth included. */
|
|
173
|
+
anchorRadius(index: number): number;
|
|
174
|
+
/**
|
|
175
|
+
* Radius an inside label sits at on slice `index`: halfway across the band on a
|
|
176
|
+
* donut, and further out than halfway on a solid pie, where "halfway" would
|
|
177
|
+
* crowd the point every wedge converges on. Rides the slice's own pop, so an
|
|
178
|
+
* inside label travels out with the wedge it belongs to.
|
|
179
|
+
*/
|
|
180
|
+
bandMidRadius(index: number): number;
|
|
181
|
+
/** The point slice `index`'s inside label is centred on. */
|
|
182
|
+
insideAnchor(index: number): Vector2;
|
|
183
|
+
/**
|
|
184
|
+
* How selected the ring is overall, in `[0, 1]` — the most-grown slice. Rides
|
|
185
|
+
* the same tween the pops do, so the dim below arrives with the growth rather
|
|
186
|
+
* than needing an animation of its own.
|
|
187
|
+
*/
|
|
188
|
+
get selectionStrength(): number;
|
|
189
|
+
/**
|
|
190
|
+
* Opacity slice `index` (and its leader and label) is drawn at: full while
|
|
191
|
+
* nothing is selected, falling toward `dimOpacity` in proportion to how
|
|
192
|
+
* selected the *rest* of the ring is. A slice that's selected itself stays at
|
|
193
|
+
* full — the two factors cancel.
|
|
194
|
+
*/
|
|
195
|
+
sliceOpacity(index: number): number;
|
|
196
|
+
/** Slice `index`'s share of the ring as its label reads it, off the live values. */
|
|
197
|
+
percentText(index: number): string;
|
|
198
|
+
/**
|
|
199
|
+
* Where every leader label sits and how its leader gets there. Labels are split
|
|
200
|
+
* into a right and a left column by their slice's bisector, each column is
|
|
201
|
+
* spread so nothing overlaps (and nothing leaves the box), and each leader is
|
|
202
|
+
* then built as wedge edge → elbow → label. The elbow rides the leader circle at
|
|
203
|
+
* the label's *settled* y, which keeps the final run horizontal and the whole
|
|
204
|
+
* polyline outside the ring however far the label was nudged.
|
|
205
|
+
*/
|
|
206
|
+
placements(): LabelPlacement[];
|
|
207
|
+
/** This frame's placement for slice `index`, or `undefined` if it isn't leadered. */
|
|
208
|
+
placementFor(index: number): LabelPlacement | undefined;
|
|
209
|
+
}
|
|
210
|
+
/** Each slice's fill, resolved. */
|
|
211
|
+
export declare function ringFills(slices: readonly PieSlice[]): FillResolved[][];
|
|
212
|
+
/**
|
|
213
|
+
* The ring itself: one wedge per {@link PieSlice}, sized by its share of the
|
|
214
|
+
* total, swept clockwise from the theme's `startAngle` with a `gap` of clear
|
|
215
|
+
* space between neighbours — a *constant-width* channel, the same at the hole as
|
|
216
|
+
* at the rim (see {@link wedgePath}). A **selected** slice reaches further out
|
|
217
|
+
* while its hole edge stays put — so it reads as that band swelling out of the
|
|
218
|
+
* ring rather than breaking off it — and the rest of the ring dims behind it,
|
|
219
|
+
* leaders and labels included.
|
|
220
|
+
*
|
|
221
|
+
* This is the only part of the chart family that draws a path: the wedges are
|
|
222
|
+
* filled {@link PathBuilder} polygons approximating each arc, and the leaders are
|
|
223
|
+
* stroked polylines — both in the node's centred, y-up space, so neither depends
|
|
224
|
+
* on SVG arc-sweep conventions. The **labels are real {@link Text} nodes**
|
|
225
|
+
* (stacked in a hug vertical flow and pinned by their inner edge), so no
|
|
226
|
+
* glyph-width guesswork decides where a caption starts.
|
|
227
|
+
*
|
|
228
|
+
* ### Label placement
|
|
229
|
+
* Each label sits either **inside** its wedge or **outside** on a leader.
|
|
230
|
+
*
|
|
231
|
+
* An inside label is centred on its slice's band and leads with the number, the
|
|
232
|
+
* caption set small underneath — inside a wedge the reader already knows which
|
|
233
|
+
* slice they're on, so the magnitude is the thing being read. It costs no gutter
|
|
234
|
+
* and no eye round-trip, so a ring labelled that way draws considerably bigger in
|
|
235
|
+
* the same box.
|
|
236
|
+
*
|
|
237
|
+
* A leader label sits outside on the end of a polyline that lifts off its wedge,
|
|
238
|
+
* elbows, and runs horizontally into the text. Labels are split into a left and a
|
|
239
|
+
* right column by which way their slice's bisector points, and each column is
|
|
240
|
+
* de-conflicted independently (see {@link relaxLabels}): a label takes the spot
|
|
241
|
+
* nearest its wedge that still clears its neighbour, and the column is squeezed
|
|
242
|
+
* to fit the node's height rather than spilling out of it. The elbow then rides on
|
|
243
|
+
* a circle just outside the ring **at the label's settled y**, so the run into the
|
|
244
|
+
* text is always horizontal and a nudged label never drags its leader back across
|
|
245
|
+
* the ring.
|
|
246
|
+
*
|
|
247
|
+
* Only the sides that actually carry a leader reserve a gutter, and the ring's
|
|
248
|
+
* centre slides into whatever the other side left over — so a ring whose slices
|
|
249
|
+
* all leader one way doesn't leave a bald patch on the other.
|
|
250
|
+
*/
|
|
251
|
+
export declare const PieRing: import("@motionscript/sdk").Component<"pieRing", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
252
|
+
readonly slices: import("@motionscript/sdk").Type<PieSlice[], PieSlice[], false>;
|
|
253
|
+
readonly ring: import("@motionscript/sdk").Type<RingConfig, RingConfig, false>;
|
|
254
|
+
readonly label: import("@motionscript/sdk").Type<LabelConfig, LabelConfig, false>;
|
|
255
|
+
readonly centerStyle: import("@motionscript/sdk").Type<CenterConfig, CenterConfig, false>;
|
|
256
|
+
readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
|
|
257
|
+
readonly labelPlacement: import("@motionscript/sdk").Type<PieLabelPlacement, PieLabelPlacement, false>;
|
|
258
|
+
readonly growth: 1;
|
|
259
|
+
readonly labelReveal: 1;
|
|
260
|
+
readonly pops: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
261
|
+
readonly dimOpacity: number;
|
|
262
|
+
readonly centerLabel: "";
|
|
263
|
+
readonly centerCaption: "";
|
|
264
|
+
readonly centerReveal: 1;
|
|
265
|
+
}>, {
|
|
266
|
+
readonly sweep: unknown;
|
|
267
|
+
readonly revealLabels: unknown;
|
|
268
|
+
readonly revealCenter: unknown;
|
|
269
|
+
}, null, Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
270
|
+
readonly slices: import("@motionscript/sdk").Type<PieSlice[], PieSlice[], false>;
|
|
271
|
+
readonly ring: import("@motionscript/sdk").Type<RingConfig, RingConfig, false>;
|
|
272
|
+
readonly label: import("@motionscript/sdk").Type<LabelConfig, LabelConfig, false>;
|
|
273
|
+
readonly centerStyle: import("@motionscript/sdk").Type<CenterConfig, CenterConfig, false>;
|
|
274
|
+
readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
|
|
275
|
+
readonly labelPlacement: import("@motionscript/sdk").Type<PieLabelPlacement, PieLabelPlacement, false>;
|
|
276
|
+
readonly growth: 1;
|
|
277
|
+
readonly labelReveal: 1;
|
|
278
|
+
readonly pops: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
279
|
+
readonly dimOpacity: number;
|
|
280
|
+
readonly centerLabel: "";
|
|
281
|
+
readonly centerCaption: "";
|
|
282
|
+
readonly centerReveal: 1;
|
|
283
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
284
|
+
readonly slices: import("@motionscript/sdk").Type<PieSlice[], PieSlice[], false>;
|
|
285
|
+
readonly ring: import("@motionscript/sdk").Type<RingConfig, RingConfig, false>;
|
|
286
|
+
readonly label: import("@motionscript/sdk").Type<LabelConfig, LabelConfig, false>;
|
|
287
|
+
readonly centerStyle: import("@motionscript/sdk").Type<CenterConfig, CenterConfig, false>;
|
|
288
|
+
readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
|
|
289
|
+
readonly labelPlacement: import("@motionscript/sdk").Type<PieLabelPlacement, PieLabelPlacement, false>;
|
|
290
|
+
readonly growth: 1;
|
|
291
|
+
readonly labelReveal: 1;
|
|
292
|
+
readonly pops: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
293
|
+
readonly dimOpacity: number;
|
|
294
|
+
readonly centerLabel: "";
|
|
295
|
+
readonly centerCaption: "";
|
|
296
|
+
readonly centerReveal: 1;
|
|
297
|
+
}>, {
|
|
298
|
+
readonly sweep: unknown;
|
|
299
|
+
readonly revealLabels: unknown;
|
|
300
|
+
readonly revealCenter: unknown;
|
|
301
|
+
}, Node2D<Node2DProps>>>>;
|
|
302
|
+
export type PieRing = NodeOf<typeof PieRing>;
|
|
303
|
+
export {};
|
|
304
|
+
//# sourceMappingURL=pie-ring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-ring.d.ts","sourceRoot":"","sources":["../../src/pie-chart/pie-ring.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,WAAW,EAEhB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,+DAA+D;IAC/D,MAAM,EAAE,QAAQ,EAAE,CAAA;IAClB,0EAA0E;IAC1E,IAAI,EAAE,UAAU,CAAA;IAChB,uEAAuE;IACvE,KAAK,EAAE,WAAW,CAAA;IAClB;;;;;OAKG;IACH,WAAW,EAAE,YAAY,CAAA;IACzB,8DAA8D;IAC9D,SAAS,EAAE,YAAY,CAAA;IACvB,iFAAiF;IACjF,cAAc,EAAE,iBAAiB,CAAA;IACjC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,iFAAiF;IACjF,UAAU,EAAE,MAAM,C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