ngx-mira-charts 0.2.0-dev.1 → 0.2.0-dev.2
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/README.md +3 -2
- package/fesm2022/ngx-mira-charts.mjs +433 -59
- package/fesm2022/ngx-mira-charts.mjs.map +1 -1
- package/index.d.ts +267 -49
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -6,7 +6,15 @@ import { TemplateRef, Signal, ElementRef } from '@angular/core';
|
|
|
6
6
|
* key, so any object will do: `{ hour: '12:00', solar: 4.1 }`.
|
|
7
7
|
*/
|
|
8
8
|
type ChartDatum = object;
|
|
9
|
-
/** The
|
|
9
|
+
/** The size a chart draws at, in px. */
|
|
10
|
+
type ChartSize = {
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The room between the edges of a chart and what it draws, in px. A legend
|
|
16
|
+
* sits right at the chart's edge, outside the margin.
|
|
17
|
+
*/
|
|
10
18
|
type ChartMargin = {
|
|
11
19
|
top: number;
|
|
12
20
|
right: number;
|
|
@@ -68,10 +76,12 @@ declare abstract class MiraChartLayer {
|
|
|
68
76
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MiraChartLayer, never, never, {}, {}, never, never, true, never>;
|
|
69
77
|
}
|
|
70
78
|
|
|
79
|
+
/** The shape that marks a series in the legend, in the series' color. */
|
|
80
|
+
type LegendIcon = 'circle' | 'line' | 'square';
|
|
71
81
|
/**
|
|
72
82
|
* A layer that plots the values under a key of the chart's data: a line or
|
|
73
83
|
* bars now, areas later. The chart fits its y axis to the values of all its
|
|
74
|
-
* series, whatever kind they are.
|
|
84
|
+
* series that aren't hidden, whatever kind they are.
|
|
75
85
|
*
|
|
76
86
|
* A series extends this class, and provides itself under it as well as under
|
|
77
87
|
* {@link MiraChartLayer}. It also implements `color`, the color it's drawn
|
|
@@ -81,22 +91,42 @@ declare abstract class MiraSeries extends MiraChartLayer {
|
|
|
81
91
|
/** The key of the values to plot. */
|
|
82
92
|
readonly dataKey: _angular_core.InputSignal<string>;
|
|
83
93
|
/**
|
|
84
|
-
* What the tooltip
|
|
85
|
-
* `dataKey`.
|
|
94
|
+
* What the tooltip and the legend call the series. Unset, they call it by
|
|
95
|
+
* its `dataKey`.
|
|
86
96
|
*/
|
|
87
97
|
readonly name: _angular_core.InputSignal<string | undefined>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the series is hidden: the chart doesn't draw it, fits its y axis
|
|
100
|
+
* to the series that aren't, and leaves it out of the tooltip; the bars of
|
|
101
|
+
* the visible series share its room in the band. Shown by default. A click
|
|
102
|
+
* on its item in a toggleable legend toggles it. Write `[hidden]="true"`,
|
|
103
|
+
* not a bare `hidden`, to start hidden, or `[(hidden)]` to keep the state in
|
|
104
|
+
* your app. An app that sets the state after a click binds it both ways: a
|
|
105
|
+
* one-way binding takes effect only when its own value changes, so setting
|
|
106
|
+
* the value it last set does nothing.
|
|
107
|
+
*/
|
|
108
|
+
readonly hidden: _angular_core.ModelSignal<boolean>;
|
|
109
|
+
/** What the series is called: its `name`, or its `dataKey` without one. */
|
|
110
|
+
readonly displayName: Signal<string>;
|
|
111
|
+
/**
|
|
112
|
+
* The shape that marks the series in the legend: `'line'` for a line,
|
|
113
|
+
* `'square'` for bars, and `'circle'` by default. A series of your own picks
|
|
114
|
+
* the shape that looks like what it draws by overriding the field:
|
|
115
|
+
* `override readonly legendIcon: LegendIcon = 'square'`.
|
|
116
|
+
*/
|
|
117
|
+
readonly legendIcon: LegendIcon;
|
|
88
118
|
/**
|
|
89
119
|
* The color the series is drawn in: a line's `stroke`, a bar's `fill`. The
|
|
90
|
-
* tooltip marks the series' value with it.
|
|
120
|
+
* tooltip marks the series' value with it, and the legend its name.
|
|
91
121
|
*/
|
|
92
122
|
abstract readonly color: Signal<string>;
|
|
93
123
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MiraSeries, never>;
|
|
94
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MiraSeries, never, never, { "dataKey": { "alias": "dataKey"; "required": true; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
124
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MiraSeries, never, never, { "dataKey": { "alias": "dataKey"; "required": true; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; }, { "hidden": "hiddenChange"; }, never, never, true, never>;
|
|
95
125
|
}
|
|
96
126
|
|
|
97
127
|
/**
|
|
98
128
|
* The rectangle the series are drawn in: the chart less its margin and the
|
|
99
|
-
* room its axes take, in px within the chart's svg.
|
|
129
|
+
* room its axes and its legend take, in px within the chart's svg.
|
|
100
130
|
*/
|
|
101
131
|
type PlotArea = {
|
|
102
132
|
readonly left: number;
|
|
@@ -121,21 +151,25 @@ type ActiveDatum = {
|
|
|
121
151
|
readonly label: string;
|
|
122
152
|
};
|
|
123
153
|
/**
|
|
124
|
-
* What the parts of a chart with an x and a y axis, its layers
|
|
125
|
-
*
|
|
126
|
-
* labels along x, and the pointer and the datum under it. Every
|
|
127
|
-
* provides itself under it, with `provideCartesianChart`, and
|
|
128
|
-
* own parts inject it: they can't import the chart, which
|
|
129
|
-
* leave room for them. The way Angular
|
|
130
|
-
* `MAT_TAB_GROUP`.
|
|
154
|
+
* What the parts of a chart with an x and a y axis, its layers, its tooltip
|
|
155
|
+
* and its legend, draw by: the data, the series, the size, the plot area, the
|
|
156
|
+
* scales, the labels along x, and the pointer and the datum under it. Every
|
|
157
|
+
* kind of chart provides itself under it, with `provideCartesianChart`, and
|
|
158
|
+
* the library's own parts inject it: they can't import the chart, which
|
|
159
|
+
* imports the axes and the legend to leave room for them. The way Angular
|
|
160
|
+
* Material's tabs inject `MAT_TAB_GROUP`.
|
|
131
161
|
*
|
|
132
162
|
* @internal
|
|
133
163
|
*/
|
|
134
164
|
declare abstract class CartesianContext {
|
|
135
165
|
/** The rows to plot. */
|
|
136
166
|
abstract readonly data: Signal<readonly ChartDatum[]>;
|
|
137
|
-
/** The series, of whatever kind, in the order they're written. */
|
|
167
|
+
/** The series, of whatever kind, in the order they're written, hidden too. */
|
|
138
168
|
abstract readonly series: Signal<readonly MiraSeries[]>;
|
|
169
|
+
/** The series that aren't hidden, in the order they're written. */
|
|
170
|
+
abstract readonly visibleSeries: Signal<readonly MiraSeries[]>;
|
|
171
|
+
/** The size the chart draws at, in px. */
|
|
172
|
+
abstract readonly size: Signal<ChartSize>;
|
|
139
173
|
/** Where the series are drawn. */
|
|
140
174
|
abstract readonly plot: Signal<PlotArea>;
|
|
141
175
|
/** Maps a value to its y. */
|
|
@@ -160,6 +194,175 @@ declare abstract class CartesianContext {
|
|
|
160
194
|
abstract readonly active: Signal<ActiveDatum | null>;
|
|
161
195
|
}
|
|
162
196
|
|
|
197
|
+
/** The edge of the chart that a legend sits along. */
|
|
198
|
+
type LegendPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
199
|
+
/** A series, as the legend lists it. */
|
|
200
|
+
type LegendItem = {
|
|
201
|
+
/** What the series is called: its `name`, or its `dataKey` without one. */
|
|
202
|
+
readonly name: string;
|
|
203
|
+
/** The series' color. */
|
|
204
|
+
readonly color: string;
|
|
205
|
+
/** The shape that marks the series: its `legendIcon`. */
|
|
206
|
+
readonly icon: LegendIcon;
|
|
207
|
+
/** Whether the series is hidden. */
|
|
208
|
+
readonly hidden: boolean;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* What a template of your own for an item of the legend gets
|
|
212
|
+
* (`MiraLegendItemContent`): the item as `let-item`.
|
|
213
|
+
*/
|
|
214
|
+
type LegendItemContext = {
|
|
215
|
+
/** The series, as the legend lists it. */
|
|
216
|
+
readonly $implicit: LegendItem;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Marks a template of your own for what each item of `<mira-legend>` shows,
|
|
220
|
+
* in place of its icon and its name. It flows as text inside the item, which
|
|
221
|
+
* stays the legend's: in a toggleable legend, a button, marked `aria-pressed`,
|
|
222
|
+
* that hides or shows the series. A hidden series' item takes a gray color,
|
|
223
|
+
* which your template can keep or set its own from `item.hidden`. Its context
|
|
224
|
+
* is a `LegendItemContext`, and typed: `let-item` holds the series' `name`,
|
|
225
|
+
* `color`, `icon` and `hidden`.
|
|
226
|
+
*
|
|
227
|
+
* Screen readers read the template's text out, as the button's name in a
|
|
228
|
+
* toggleable legend:
|
|
229
|
+
*
|
|
230
|
+
* - keep the series' name in it, the same whether the series is hidden or
|
|
231
|
+
* not, and show the state in the look: the button already tells it;
|
|
232
|
+
* - mark what only decorates, such as a swatch or an emoji,
|
|
233
|
+
* `aria-hidden="true"`;
|
|
234
|
+
* - in a toggleable legend, put no buttons or links in it, as it's inside a
|
|
235
|
+
* button.
|
|
236
|
+
*
|
|
237
|
+
* Forced colors replace the colors you set, and print drops backgrounds by
|
|
238
|
+
* default: give what shows the series' color `forced-color-adjust: none` and
|
|
239
|
+
* `print-color-adjust: exact`, as the legend's own icons have.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```html
|
|
243
|
+
* <mira-legend>
|
|
244
|
+
* <ng-template miraLegendItemContent let-item>
|
|
245
|
+
* <span
|
|
246
|
+
* aria-hidden="true"
|
|
247
|
+
* [style.color]="item.hidden ? null : item.color"
|
|
248
|
+
* >●</span>
|
|
249
|
+
* <b>{{ item.name }}</b>
|
|
250
|
+
* </ng-template>
|
|
251
|
+
* </mira-legend>
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
declare class MiraLegendItemContent {
|
|
255
|
+
/**
|
|
256
|
+
* Types the template's context, for Angular's template checks.
|
|
257
|
+
*
|
|
258
|
+
* @internal
|
|
259
|
+
*/
|
|
260
|
+
static ngTemplateContextGuard(directive: MiraLegendItemContent, context: unknown): context is LegendItemContext;
|
|
261
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MiraLegendItemContent, never>;
|
|
262
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MiraLegendItemContent, "ng-template[miraLegendItemContent]", never, {}, {}, never, never, true, never>;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Lists the chart's series along one of its edges, in the order they're
|
|
266
|
+
* written, each with its icon in its color and its name: a stretch of line
|
|
267
|
+
* marks a line, a square marks bars, and a circle any other series (the
|
|
268
|
+
* series' `legendIcon`). A series is called by its `name`, or its `dataKey`
|
|
269
|
+
* without one. The plot leaves room for the legend, as it does for the axes,
|
|
270
|
+
* and the chart stays as big as it is.
|
|
271
|
+
*
|
|
272
|
+
* Along the bottom, by default, or the top, the items go in rows, centered,
|
|
273
|
+
* as many as they take. Up the right or the left side, they go in a column in
|
|
274
|
+
* the middle of the chart's height, at most 40% of its width wide, where a
|
|
275
|
+
* longer name wraps. Left and right are as the svg is drawn, in a page that
|
|
276
|
+
* runs right to left too, where the y axis stays on the left. A legend on a
|
|
277
|
+
* side leaves the plot no room on the server: its width is known only once
|
|
278
|
+
* the browser lays it out.
|
|
279
|
+
*
|
|
280
|
+
* It's a list to read, unless it's `toggleable`: then each item is a button
|
|
281
|
+
* that hides its series, or shows it again, and the chart fits its y axis to
|
|
282
|
+
* the series that are left. The state is the series' own `hidden`, to bind
|
|
283
|
+
* as `[(hidden)]`. A hidden series' item stays, grayed and struck through.
|
|
284
|
+
* In a toggleable legend it's marked `aria-pressed="false"` for screen
|
|
285
|
+
* readers; in a list to read, screen readers and the keyboard skip it, as the
|
|
286
|
+
* chart doesn't draw it.
|
|
287
|
+
*
|
|
288
|
+
* The legend's text takes the `color` around it, the chart's in a chart. The
|
|
289
|
+
* rest are CSS custom properties, to set anywhere above the legend:
|
|
290
|
+
*
|
|
291
|
+
* - `--mira-font-size`: the size of the text, `0.75rem` by default; the room
|
|
292
|
+
* around the text follows it;
|
|
293
|
+
* - `--mira-legend-inactive-color`: a hidden series' item,
|
|
294
|
+
* `--mira-axis-color` by default.
|
|
295
|
+
*
|
|
296
|
+
* For items that show something of your own, write their template inside, as
|
|
297
|
+
* an `<ng-template miraLegendItemContent>`, and import `MiraLegendItemContent`
|
|
298
|
+
* along with `MiraLegend`: without it, the template goes unnoticed, and the
|
|
299
|
+
* legend shows its own icon and name.
|
|
300
|
+
*
|
|
301
|
+
* Anywhere else on the page, name the chart with `for`. There the legend sits
|
|
302
|
+
* where the page puts it, as a block, and the chart leaves it no room; its
|
|
303
|
+
* `position` only picks its layout, rows for the top or the bottom, a column
|
|
304
|
+
* for a side. Its colors come from above it, as in a chart: set the custom
|
|
305
|
+
* properties above both to change them alike.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```html
|
|
309
|
+
* <mira-line-chart [data]="day">
|
|
310
|
+
* <mira-x-axis dataKey="hour" />
|
|
311
|
+
* <mira-y-axis />
|
|
312
|
+
* <mira-line dataKey="solar" name="Solar" stroke="#d97706" />
|
|
313
|
+
* <mira-line dataKey="usage" name="Usage" stroke="#3b82f6" />
|
|
314
|
+
* <mira-legend position="right" toggleable />
|
|
315
|
+
* </mira-line-chart>
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
318
|
+
* ```html
|
|
319
|
+
* <header>
|
|
320
|
+
* <h2>A sunny day</h2>
|
|
321
|
+
* <mira-legend [for]="chart" />
|
|
322
|
+
* </header>
|
|
323
|
+
* <mira-line-chart #chart [data]="day">…</mira-line-chart>
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
declare class MiraLegend {
|
|
327
|
+
#private;
|
|
328
|
+
/** The edge of the chart the legend sits along: `'bottom'` by default. */
|
|
329
|
+
readonly position: _angular_core.InputSignal<LegendPosition>;
|
|
330
|
+
/**
|
|
331
|
+
* Whether a click on an item, or Enter or Space on it, hides its series or
|
|
332
|
+
* shows it again. Off by default: the legend is then a list to read.
|
|
333
|
+
*/
|
|
334
|
+
readonly toggleable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
335
|
+
/**
|
|
336
|
+
* The chart whose series the legend lists, for a legend out of it: give
|
|
337
|
+
* the chart a reference, `<mira-line-chart #chart>`, and name it,
|
|
338
|
+
* `<mira-legend [for]="chart" />`. Unset, the chart the legend is in. With
|
|
339
|
+
* no chart, as while a chart named through a query is in an `@if` that's
|
|
340
|
+
* off, the legend lists nothing.
|
|
341
|
+
*/
|
|
342
|
+
readonly for: _angular_core.InputSignal<MiraCartesianChart | undefined>;
|
|
343
|
+
/**
|
|
344
|
+
* The room the legend takes from the chart along its edge, in px: its
|
|
345
|
+
* height along the top or the bottom, its width up a side, as the browser
|
|
346
|
+
* last laid it out there. Until then, a row's height along the top or the
|
|
347
|
+
* bottom, and none on a side.
|
|
348
|
+
*
|
|
349
|
+
* @internal
|
|
350
|
+
*/
|
|
351
|
+
readonly room: _angular_core.Signal<number>;
|
|
352
|
+
protected readonly placement: _angular_core.Signal<LegendPosition | null>;
|
|
353
|
+
protected readonly layout: _angular_core.Signal<"rows" | "column">;
|
|
354
|
+
protected readonly entries: _angular_core.Signal<{
|
|
355
|
+
series: MiraSeries;
|
|
356
|
+
item: LegendItem;
|
|
357
|
+
}[]>;
|
|
358
|
+
protected readonly template: _angular_core.Signal<TemplateRef<any> | undefined>;
|
|
359
|
+
/** @internal */
|
|
360
|
+
constructor();
|
|
361
|
+
protected toggle(series: MiraSeries): void;
|
|
362
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MiraLegend, never>;
|
|
363
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MiraLegend, "mira-legend", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; "toggleable": { "alias": "toggleable"; "required": false; "isSignal": true; }; "for": { "alias": "for"; "required": false; "isSignal": true; }; }, {}, ["template"], never, true, never>;
|
|
364
|
+
}
|
|
365
|
+
|
|
163
366
|
/**
|
|
164
367
|
* The category axis under the plot: a tick per datum, labelled with the
|
|
165
368
|
* datum's value under `dataKey`. Its line runs at zero, where values rise and
|
|
@@ -189,8 +392,8 @@ declare class MiraXAxis extends MiraChartLayer {
|
|
|
189
392
|
|
|
190
393
|
/**
|
|
191
394
|
* The value axis left of the plot. It fits the values of every series in the
|
|
192
|
-
* chart, and zero, rounded out to round ticks. The ticks
|
|
193
|
-
* the app's locale (`LOCALE_ID`).
|
|
395
|
+
* chart that isn't hidden, and zero, rounded out to round ticks. The ticks
|
|
396
|
+
* read as numbers in the app's locale (`LOCALE_ID`).
|
|
194
397
|
*
|
|
195
398
|
* @example
|
|
196
399
|
* ```html
|
|
@@ -217,16 +420,12 @@ declare class MiraYAxis extends MiraChartLayer {
|
|
|
217
420
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MiraYAxis, "mira-y-axis", never, { "width": { "alias": "width"; "required": false; "isSignal": true; }; "tickCount": { "alias": "tickCount"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
218
421
|
}
|
|
219
422
|
|
|
220
|
-
type Size = {
|
|
221
|
-
readonly width: number;
|
|
222
|
-
readonly height: number;
|
|
223
|
-
};
|
|
224
423
|
/**
|
|
225
424
|
* What every chart with an x and a y axis has, whatever its series: data, a
|
|
226
425
|
* size, a margin, the plot area they leave, a y scale that fits the values of
|
|
227
|
-
* its series, a label for each datum, and the pointer and the datum
|
|
228
|
-
* Nothing about a kind of chart: a line chart extends it with a
|
|
229
|
-
* datum along x, and a bar chart with a band per datum.
|
|
426
|
+
* its visible series, a label for each datum, and the pointer and the datum
|
|
427
|
+
* under it. Nothing about a kind of chart: a line chart extends it with a
|
|
428
|
+
* point per datum along x, and a bar chart with a band per datum.
|
|
230
429
|
*
|
|
231
430
|
* Inject it in a layer of your own ({@link MiraChartLayer}) to draw where the
|
|
232
431
|
* series are, or in a component of your own that shows something in HTML:
|
|
@@ -268,8 +467,11 @@ declare abstract class MiraCartesianChart implements CartesianContext {
|
|
|
268
467
|
/** What the chart shows, for screen readers. */
|
|
269
468
|
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
270
469
|
/** The size the chart draws at, in px: its inputs, or its container's. */
|
|
271
|
-
readonly size: Signal<
|
|
272
|
-
/**
|
|
470
|
+
readonly size: Signal<ChartSize>;
|
|
471
|
+
/**
|
|
472
|
+
* Where the series are drawn: the chart less its margin, its axes and its
|
|
473
|
+
* legend.
|
|
474
|
+
*/
|
|
273
475
|
readonly plot: Signal<PlotArea>;
|
|
274
476
|
/** Maps a value to its y. */
|
|
275
477
|
readonly yScale: Signal<(value: number) => number>;
|
|
@@ -299,25 +501,31 @@ declare abstract class MiraCartesianChart implements CartesianContext {
|
|
|
299
501
|
* label; or null while the pointer is off the plot.
|
|
300
502
|
*/
|
|
301
503
|
readonly active: Signal<ActiveDatum | null>;
|
|
504
|
+
/** The series, of whatever kind, in the order they're written, hidden too. */
|
|
505
|
+
readonly series: Signal<readonly MiraSeries[]>;
|
|
302
506
|
/**
|
|
303
|
-
* The series
|
|
304
|
-
* fits
|
|
507
|
+
* The series that aren't hidden, in the order they're written: the y axis
|
|
508
|
+
* fits their values, and the tooltip shows them.
|
|
305
509
|
*/
|
|
306
|
-
readonly
|
|
510
|
+
readonly visibleSeries: Signal<readonly MiraSeries[]>;
|
|
307
511
|
/** The x of each datum, in the order of the data: the kind of chart's call. */
|
|
308
512
|
abstract readonly xPositions: Signal<readonly number[]>;
|
|
309
|
-
/**
|
|
513
|
+
/** The chart's layers, in the order they're written. */
|
|
310
514
|
protected readonly layers: Signal<readonly MiraChartLayer[]>;
|
|
515
|
+
/** What the chart draws: its layers, less the hidden series. */
|
|
516
|
+
protected readonly drawnLayers: Signal<readonly MiraChartLayer[]>;
|
|
311
517
|
/** The chart's axes, if it has them: the plot leaves room for them. */
|
|
312
518
|
protected readonly xAxis: Signal<MiraXAxis | undefined>;
|
|
313
519
|
protected readonly yAxis: Signal<MiraYAxis | undefined>;
|
|
520
|
+
/** The chart's legend, if it has one: the plot leaves room for it too. */
|
|
521
|
+
protected readonly legend: Signal<MiraLegend | undefined>;
|
|
314
522
|
/** The chart's svg, where the pointer is tracked. */
|
|
315
523
|
protected readonly svg: Signal<ElementRef<SVGSVGElement>>;
|
|
316
524
|
protected readonly viewBox: Signal<string>;
|
|
317
525
|
/** @internal */
|
|
318
526
|
constructor();
|
|
319
527
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MiraCartesianChart, never>;
|
|
320
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MiraCartesianChart, never, never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "margin": { "alias": "margin"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, ["series", "layers", "xAxis", "yAxis"], never, true, never>;
|
|
528
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MiraCartesianChart, never, never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "margin": { "alias": "margin"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, ["series", "layers", "xAxis", "yAxis", "legend"], never, true, never>;
|
|
321
529
|
}
|
|
322
530
|
|
|
323
531
|
/**
|
|
@@ -391,8 +599,9 @@ type TooltipItem = {
|
|
|
391
599
|
*/
|
|
392
600
|
type TooltipContext = {
|
|
393
601
|
/**
|
|
394
|
-
* A value for each series that has one at the datum, in the order
|
|
395
|
-
* series are written: the rows of the tooltip's own box.
|
|
602
|
+
* A value for each visible series that has one at the datum, in the order
|
|
603
|
+
* the series are written: the rows of the tooltip's own box. Never empty:
|
|
604
|
+
* where no series has a value, the tooltip doesn't show.
|
|
396
605
|
*/
|
|
397
606
|
readonly $implicit: readonly TooltipItem[];
|
|
398
607
|
/** The datum's label along x: the title of the tooltip's own box. */
|
|
@@ -408,10 +617,11 @@ type TooltipContext = {
|
|
|
408
617
|
};
|
|
409
618
|
/**
|
|
410
619
|
* Marks a template of your own for `<mira-tooltip>`. It replaces the whole
|
|
411
|
-
* box, border and background too; the tooltip still places it and shows it
|
|
412
|
-
* while
|
|
413
|
-
* typed: `let-items` holds a `TooltipItem`
|
|
414
|
-
* the datum, and `label`, `datum` and
|
|
620
|
+
* box, border and background too; the tooltip still places it, and shows it
|
|
621
|
+
* while the datum under the pointer has a value in a visible series. Its
|
|
622
|
+
* context is a `TooltipContext`, and typed: `let-items` holds a `TooltipItem`
|
|
623
|
+
* for each visible series with a value at the datum, and `label`, `datum` and
|
|
624
|
+
* `index` describe the datum.
|
|
415
625
|
*
|
|
416
626
|
* @example
|
|
417
627
|
* ```html
|
|
@@ -439,10 +649,11 @@ declare class MiraTooltipContent {
|
|
|
439
649
|
}
|
|
440
650
|
/**
|
|
441
651
|
* Shows the values at the datum under the pointer, in a box beside it: the
|
|
442
|
-
* datum's label along x, then a row for each series with a value
|
|
443
|
-
* the order the series are written. A row has the series' color, its
|
|
444
|
-
* the value, as a number in the app's locale (`LOCALE_ID`), with
|
|
445
|
-
* decimals at most, or three digits of its own below 1: 0.0004 rather
|
|
652
|
+
* datum's label along x, then a row for each visible series with a value
|
|
653
|
+
* there, in the order the series are written. A row has the series' color, its
|
|
654
|
+
* name and the value, as a number in the app's locale (`LOCALE_ID`), with
|
|
655
|
+
* three decimals at most, or three digits of its own below 1: 0.0004 rather
|
|
656
|
+
* than 0. Where no visible series has a value, the tooltip doesn't show.
|
|
446
657
|
*
|
|
447
658
|
* The box goes past the datum, or past the edge of its band in a chart with
|
|
448
659
|
* bands: on its right where it fits, else on its left. It follows the pointer
|
|
@@ -450,9 +661,11 @@ declare class MiraTooltipContent {
|
|
|
450
661
|
* side, it's pressed onto the plot, over the datum; a box bigger than the
|
|
451
662
|
* plot starts at its edge and runs past it.
|
|
452
663
|
*
|
|
453
|
-
* The box's text takes the chart's `color`.
|
|
664
|
+
* The box's text takes the chart's `color`. The rest are CSS custom
|
|
454
665
|
* properties, to set anywhere above the tooltip:
|
|
455
666
|
*
|
|
667
|
+
* - `--mira-font-size`: the size of the text, `0.75rem` by default; the room
|
|
668
|
+
* around the text follows it;
|
|
456
669
|
* - `--mira-tooltip-background`: the box, the chart's `--mira-background` by
|
|
457
670
|
* default;
|
|
458
671
|
* - `--mira-tooltip-border-color`: its border, the chart's
|
|
@@ -541,8 +754,10 @@ declare class MiraLine extends MiraSeries {
|
|
|
541
754
|
* On by default.
|
|
542
755
|
*/
|
|
543
756
|
readonly activeDot: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
544
|
-
/** The line's color, for the tooltip. Set it with `stroke`. */
|
|
757
|
+
/** The line's color, for the tooltip and the legend. Set it with `stroke`. */
|
|
545
758
|
readonly color: Signal<string>;
|
|
759
|
+
/** A stretch of line marks the line in the legend. */
|
|
760
|
+
readonly legendIcon: LegendIcon;
|
|
546
761
|
protected readonly path: Signal<string>;
|
|
547
762
|
protected readonly dots: Signal<Point[]>;
|
|
548
763
|
protected readonly activePoint: Signal<Point | null>;
|
|
@@ -580,9 +795,10 @@ declare class MiraBarChart extends MiraCartesianChart implements Required<Cartes
|
|
|
580
795
|
* A series of bars: a bar for each datum of the chart's data, from zero to
|
|
581
796
|
* the datum's value under `dataKey`, up for a value above zero and down for
|
|
582
797
|
* one below. Write one per key: the bars of several share each band, side by
|
|
583
|
-
* side in the order they're written
|
|
584
|
-
*
|
|
585
|
-
* a band per datum, such as
|
|
798
|
+
* side in the order they're written, and a hidden one leaves its room to the
|
|
799
|
+
* others. A datum with no number under the key has no bar, and leaves its
|
|
800
|
+
* place in the band empty. It goes in a chart with a band per datum, such as
|
|
801
|
+
* `<mira-bar-chart>`.
|
|
586
802
|
*
|
|
587
803
|
* @example
|
|
588
804
|
* ```html
|
|
@@ -594,8 +810,10 @@ declare class MiraBar extends MiraSeries {
|
|
|
594
810
|
#private;
|
|
595
811
|
/** The color of the bars, `#3182bd` by default. */
|
|
596
812
|
readonly fill: _angular_core.InputSignal<string>;
|
|
597
|
-
/** The bars' color, for the tooltip. Set it with `fill`. */
|
|
813
|
+
/** The bars' color, for the tooltip and the legend. Set it with `fill`. */
|
|
598
814
|
readonly color: Signal<string>;
|
|
815
|
+
/** A square marks the bars in the legend. */
|
|
816
|
+
readonly legendIcon: LegendIcon;
|
|
599
817
|
protected readonly bars: Signal<{
|
|
600
818
|
index: number;
|
|
601
819
|
x: number;
|
|
@@ -607,5 +825,5 @@ declare class MiraBar extends MiraSeries {
|
|
|
607
825
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MiraBar, "mira-bar", never, { "fill": { "alias": "fill"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
608
826
|
}
|
|
609
827
|
|
|
610
|
-
export { MiraBar, MiraBarChart, MiraCartesianChart, MiraCartesianGrid, MiraChartLayer, MiraCursor, MiraLine, MiraLineChart, MiraSeries, MiraTooltip, MiraTooltipContent, MiraXAxis, MiraYAxis };
|
|
611
|
-
export type { ActiveDatum, ChartDatum, ChartMargin, LineCurve, PlotArea, Point, Tick, TooltipContext, TooltipItem };
|
|
828
|
+
export { MiraBar, MiraBarChart, MiraCartesianChart, MiraCartesianGrid, MiraChartLayer, MiraCursor, MiraLegend, MiraLegendItemContent, MiraLine, MiraLineChart, MiraSeries, MiraTooltip, MiraTooltipContent, MiraXAxis, MiraYAxis };
|
|
829
|
+
export type { ActiveDatum, ChartDatum, ChartMargin, ChartSize, LegendIcon, LegendItem, LegendItemContext, LegendPosition, LineCurve, PlotArea, Point, Tick, TooltipContext, TooltipItem };
|
package/package.json
CHANGED