@pioneer-code/pioneer-charts 22.2.12 → 22.2.14
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/pioneer-code-pioneer-charts.mjs +608 -233
- package/fesm2022/pioneer-code-pioneer-charts.mjs.map +1 -1
- package/package.json +12 -3
- package/scss/pioneer-charts.scss +12 -1
- package/themes/pioneer-charts.css +9 -0
- package/themes/pioneer-charts.min.css +1 -1
- package/types/pioneer-code-pioneer-charts.d.ts +133 -613
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import * as rxjs from 'rxjs';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { TemplateRef, ElementRef, Signal } from '@angular/core';
|
|
4
|
-
import { AxisDomain, AxisScale } from 'd3-axis';
|
|
5
|
-
import * as d3_selection from 'd3-selection';
|
|
6
|
-
import { Selection, BaseType } from 'd3-selection';
|
|
7
1
|
import * as _pioneer_code_pioneer_charts from '@pioneer-code/pioneer-charts';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { TemplateRef, ElementRef } from '@angular/core';
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* Base configuration for all charts.
|
|
@@ -31,6 +27,12 @@ declare class PcacChartConfig {
|
|
|
31
27
|
* initializer still applies to anything constructed via `new`.
|
|
32
28
|
*/
|
|
33
29
|
heightFull?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* What the chart shows, for screen readers - e.g. `'Sales by month, 2026'`. The chart's `<svg>` is
|
|
32
|
+
* announced as one image with this name; when it isn't set, the chart's type is used (`'Bar
|
|
33
|
+
* chart'`, `'Pie chart'`, ...). Optional for the same reason as `heightFull`.
|
|
34
|
+
*/
|
|
35
|
+
ariaLabel?: string;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Up to three short labels placed along an axis by position rather than by value: `min` at its
|
|
@@ -153,44 +155,6 @@ declare class PcacAxisConfig {
|
|
|
153
155
|
domainMin?: number | string;
|
|
154
156
|
domainMax?: number | string;
|
|
155
157
|
}
|
|
156
|
-
/**
|
|
157
|
-
* The `PcacChartMargin` type lives here rather than in chart.ts so the axis builder can take
|
|
158
|
-
* one without importing the class module that imports it back.
|
|
159
|
-
*/
|
|
160
|
-
interface PcacChartMargin {
|
|
161
|
-
top: number;
|
|
162
|
-
right: number;
|
|
163
|
-
bottom: number;
|
|
164
|
-
left: number;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* `PcacAxisConfig` with every default applied - what builders work with, so they never have to
|
|
168
|
-
* null-check. `tickSize`, `label`, `subLabels` and the `*Color` fields stay optional: "not set"
|
|
169
|
-
* is itself the meaningful default (no marks, no labels, the theme's colors). The color fields
|
|
170
|
-
* are picked up by name, so a new one needs only its declaration on the class.
|
|
171
|
-
*/
|
|
172
|
-
type PcacOptionalAxisFields = 'tickSize' | 'label' | 'subLabels' | Extract<keyof PcacAxisConfig, `${string}Color`>;
|
|
173
|
-
type PcacResolvedAxisConfig = Required<Omit<PcacAxisConfig, PcacOptionalAxisFields>> & Pick<PcacAxisConfig, PcacOptionalAxisFields>;
|
|
174
|
-
/** True if `axis` has at least one sub label to draw (an empty `subLabels` object counts as none). */
|
|
175
|
-
declare function hasAxisSubLabels(axis: PcacAxisConfig | undefined): boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Room reserved in a margin for an axis `label`: the theme's 12px label plus a gap from the tick
|
|
178
|
-
* labels. Reserved on the side the label sits on (`bottom` for x, `left` for y), and taken out
|
|
179
|
-
* of the plot area, the same way a longer tick is. Change together with `.pcac-axis-label`.
|
|
180
|
-
*/
|
|
181
|
-
declare const PCAC_AXIS_LABEL_SPACE = 18;
|
|
182
|
-
/** Likewise for a row of `subLabels`: the theme's 11px text plus a gap (`.pcac-axis-sub-label`). */
|
|
183
|
-
declare const PCAC_AXIS_SUB_LABEL_SPACE = 16;
|
|
184
|
-
/**
|
|
185
|
-
* Total margin an axis's `label` and `subLabels` take on its side. `PcacChart` reserves it and
|
|
186
|
-
* the axis builder places the text by it, so the two stay in step.
|
|
187
|
-
*/
|
|
188
|
-
declare function axisLabelSpace(axis: PcacAxisConfig | undefined): number;
|
|
189
|
-
/**
|
|
190
|
-
* @param showGridDefault what `showGrid` resolves to when the consumer left it unset - each chart
|
|
191
|
-
* passes `true` for the axis whose grid it has always drawn and `false` for the other.
|
|
192
|
-
*/
|
|
193
|
-
declare function resolveAxisConfig(axis?: PcacAxisConfig, showGridDefault?: boolean): PcacResolvedAxisConfig;
|
|
194
158
|
/**
|
|
195
159
|
* Base configuration for every chart that has an x and y axis (bar, line, area, plot - not pie).
|
|
196
160
|
*/
|
|
@@ -201,6 +165,12 @@ declare class PcacAxisChartConfig extends PcacChartConfig {
|
|
|
201
165
|
declare class PcacData {
|
|
202
166
|
key: string | number | null;
|
|
203
167
|
value: string | number | null;
|
|
168
|
+
/**
|
|
169
|
+
* Hides the item while keeping its place in the color order, so a `<pcac-legend>` can toggle it
|
|
170
|
+
* without the other items changing color. A line/area/plot series draws no line, area, points or
|
|
171
|
+
* hover effects; a bar (or every bar of a group) is drawn at zero size, keeping its slot; a pie
|
|
172
|
+
* slice takes no angle.
|
|
173
|
+
*/
|
|
204
174
|
hide: boolean;
|
|
205
175
|
data: PcacData[];
|
|
206
176
|
/**
|
|
@@ -251,9 +221,8 @@ declare enum PcacFormatEnum {
|
|
|
251
221
|
DateTime = "dateTime",
|
|
252
222
|
Fahrenheit = "fahrenheit",
|
|
253
223
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* e.g. 0 = 12am, 1 = 1am, 13 = 1pm, 23 = 11pm
|
|
224
|
+
* Hours of the day, 0-24, labelled on a 12 hour clock: 0 = 12am, 1 = 1am, 13 = 1pm, 24 = 12am.
|
|
225
|
+
* A value between hours shows its minutes (2.5 = 2:30am).
|
|
257
226
|
*/
|
|
258
227
|
OneDayHours = "oneDayHours"
|
|
259
228
|
}
|
|
@@ -268,146 +237,6 @@ declare class PcacBarHorizontalChartColorOverrideConfig {
|
|
|
268
237
|
colors: string[];
|
|
269
238
|
}
|
|
270
239
|
|
|
271
|
-
/**
|
|
272
|
-
* Generic over each axis's own domain type (e.g. `number` for a value axis's `ScaleLinear`,
|
|
273
|
-
* `string` for a category axis's `ScaleBand`) rather than `any`, since the two axes on a chart
|
|
274
|
-
* routinely have different domain types and each real D3 scale already satisfies `AxisScale`
|
|
275
|
-
* structurally - no widening needed at the type level.
|
|
276
|
-
*/
|
|
277
|
-
interface IPcacAxisBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {
|
|
278
|
-
svg: Selection<SVGGElement, unknown, BaseType, unknown>;
|
|
279
|
-
/** Plot area size - the axes' own lengths - and the chart's margins, which position a `label`. */
|
|
280
|
-
width: number;
|
|
281
|
-
height: number;
|
|
282
|
-
margin: PcacChartMargin;
|
|
283
|
-
xScale: AxisScale<XDomain>;
|
|
284
|
-
yScale: AxisScale<YDomain>;
|
|
285
|
-
/**
|
|
286
|
-
* The chart's per-axis settings, defaults already applied (`resolveAxisConfig()`). `hide` skips
|
|
287
|
-
* the axis entirely. `tickSize` is D3's `tickSizeInner`; left undefined, D3's default of 6
|
|
288
|
-
* applies to the geometry - but the theme hides tick marks unless the axis group carries
|
|
289
|
-
* `pcac-axis-tick-marks`, which is added exactly when a size is given, so an undefined size
|
|
290
|
-
* means "no visible marks, labels where they've always been". `0` is a legitimate value (no
|
|
291
|
-
* marks, labels hugging the axis), hence the `!== undefined` checks below. `showLine` adds
|
|
292
|
-
* `pcac-axis-line`, which un-hides D3's `.domain` path the same way. The domain path keeps
|
|
293
|
-
* D3's default 6px outer end-caps (`tickSizeOuter`), so it reads as a bracket rather than a
|
|
294
|
-
* bare rule; that's D3's standard look and is left as-is. `label` and `subLabels` are drawn
|
|
295
|
-
* inside the axis group (so they're raised and non-interactive along with it) - see `drawLabels`.
|
|
296
|
-
* `format` picks the tick label format; `None` leaves D3's default. The `*Color` fields are
|
|
297
|
-
* applied by `applyColors`.
|
|
298
|
-
*/
|
|
299
|
-
xAxis: PcacResolvedAxisConfig;
|
|
300
|
-
yAxis: PcacResolvedAxisConfig;
|
|
301
|
-
}
|
|
302
|
-
declare class PcacAxisBuilder {
|
|
303
|
-
drawAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
|
|
304
|
-
/**
|
|
305
|
-
* Moves both axis groups to the end of the chart's `<g>`, so they paint over everything drawn
|
|
306
|
-
* since `drawAxis()`. Axes are drawn first (so scales and margins are settled before content),
|
|
307
|
-
* which leaves anything sitting at x = 0 - a line chart's first segment and dot, an area's fill,
|
|
308
|
-
* a horizontal bar chart's bars - painting over the y axis line. Builders call this after the
|
|
309
|
-
* content that should sit *under* the axes, and draw anything that should stay on top (the
|
|
310
|
-
* line/area/plot charts' dots) afterwards. Safe to sit above the hover/zoom overlay rects too,
|
|
311
|
-
* because the groups are `pointer-events: none` (set where each group is appended).
|
|
312
|
-
*/
|
|
313
|
-
raiseAxes(svg: Selection<SVGGElement, unknown, BaseType, unknown>): void;
|
|
314
|
-
drawYAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
|
|
315
|
-
drawXAxis<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacAxisBuilderConfig<XDomain, YDomain>): void;
|
|
316
|
-
/**
|
|
317
|
-
* The axis `label` and `subLabels`. Both are placed by two distances: along the axis (0 at its
|
|
318
|
-
* start, `length` at its end - for the y axis, 0 is the bottom) and out from it, toward the
|
|
319
|
-
* chart's edge. The label goes at the very edge (`outer`, i.e. the margin), the sub-label row
|
|
320
|
-
* `PCAC_AXIS_LABEL_SPACE` inside that when there's a label. For the y axis the text is rotated
|
|
321
|
-
* to read bottom-to-top, which swaps the two: after `rotate(-90)` x runs up the axis (so the
|
|
322
|
-
* bottom is x = -length) and y runs left. `fill` is set explicitly because d3-axis puts
|
|
323
|
-
* `fill="none"` on the group; its own tick text does the same.
|
|
324
|
-
*/
|
|
325
|
-
private drawLabels;
|
|
326
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PcacAxisBuilder, never>;
|
|
327
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Generic over each axis's own domain type, same rationale as `IPcacAxisBuilderConfig`.
|
|
332
|
-
*/
|
|
333
|
-
interface IPcacGridBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomain extends AxisDomain = AxisDomain> {
|
|
334
|
-
svg: Selection<SVGGElement, unknown, BaseType, unknown>;
|
|
335
|
-
/**
|
|
336
|
-
* Required for horizontal grid
|
|
337
|
-
*/
|
|
338
|
-
width: number;
|
|
339
|
-
/**
|
|
340
|
-
* Required for vertical grid
|
|
341
|
-
*/
|
|
342
|
-
height: number;
|
|
343
|
-
xScale: AxisScale<XDomain>;
|
|
344
|
-
yScale: AxisScale<YDomain>;
|
|
345
|
-
/**
|
|
346
|
-
* Tick count hint for a continuous scale (D3's `ticks(n)`); a category (band) scale ignores it
|
|
347
|
-
* and gets one line per category.
|
|
348
|
-
*/
|
|
349
|
-
numberOfTicks: number;
|
|
350
|
-
/**
|
|
351
|
-
* Line color (`PcacAxisConfig.gridColor`), set on the grid group as `--pcac-grid-color` for the
|
|
352
|
-
* theme's `.pcac-grid-rule line` rule to read; unset means the theme's color. See the axis
|
|
353
|
-
* builder's `applyColors` for why a custom property.
|
|
354
|
-
*/
|
|
355
|
-
color?: string;
|
|
356
|
-
}
|
|
357
|
-
declare class PcacGridBuilder {
|
|
358
|
-
/**
|
|
359
|
-
* Vertical lines, one per x-axis tick (or category), running the plot's full height. The group
|
|
360
|
-
* is classed `pcac-grid-vertical` (the horizontal one `pcac-grid-horizontal`) so a chart can
|
|
361
|
-
* find and redraw just one grid - the line/area/plot charts do on zoom, when an axis's ticks move.
|
|
362
|
-
*/
|
|
363
|
-
drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
|
|
364
|
-
/**
|
|
365
|
-
* Horizontal lines, one per y-axis tick (or category), running the plot's full width.
|
|
366
|
-
*/
|
|
367
|
-
drawHorizontalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
|
|
368
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PcacGridBuilder, never>;
|
|
369
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
declare class PcacColorService {
|
|
373
|
-
private primary;
|
|
374
|
-
private primaryLight;
|
|
375
|
-
private success;
|
|
376
|
-
private danger;
|
|
377
|
-
private warning;
|
|
378
|
-
private orange;
|
|
379
|
-
private blue;
|
|
380
|
-
private scale;
|
|
381
|
-
private alert;
|
|
382
|
-
/**
|
|
383
|
-
* Get a scale of colors dynamically
|
|
384
|
-
* @param numberOfNodes Number of items in dynamically build collection of colors
|
|
385
|
-
*/
|
|
386
|
-
getColorScale(numberOfNodes: number): string[];
|
|
387
|
-
getAlert(): string;
|
|
388
|
-
/**
|
|
389
|
-
* Set the scale that charts use to set colors of data[x] on the UI.
|
|
390
|
-
* @param colors A collection of hex values
|
|
391
|
-
*/
|
|
392
|
-
setScale(colors: string[]): void;
|
|
393
|
-
setPrimary(color: string): void;
|
|
394
|
-
setPrimaryLight(color: string): void;
|
|
395
|
-
setSuccess(color: string): void;
|
|
396
|
-
setDanger(color: string): void;
|
|
397
|
-
setOrange(color: string): void;
|
|
398
|
-
setBlue(color: string): void;
|
|
399
|
-
setAlert(color: string): void;
|
|
400
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PcacColorService, never>;
|
|
401
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
declare class PcacTransitionService {
|
|
405
|
-
private transitionDuration;
|
|
406
|
-
getTransitionDuration(): number;
|
|
407
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PcacTransitionService, never>;
|
|
408
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
240
|
/**
|
|
412
241
|
* A datum drawn at the same coordinate as the hovered one (see `PcacTooltipContext.coincident`),
|
|
413
242
|
* located the same way the context locates `$implicit`: `parent` is the series it belongs to,
|
|
@@ -508,342 +337,24 @@ declare class PcacTooltipDirective {
|
|
|
508
337
|
* `<ng-template>`, so `point.value` etc. are checked against `PcacData` under strictTemplates.
|
|
509
338
|
*/
|
|
510
339
|
static ngTemplateContextGuard(_dir: PcacTooltipDirective, _ctx: unknown): _ctx is PcacTooltipContext;
|
|
511
|
-
static ɵfac:
|
|
512
|
-
static ɵdir:
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
declare class PcacTooltipBuilder {
|
|
516
|
-
private appRef;
|
|
517
|
-
/**
|
|
518
|
-
* One tooltip element shared by every chart on the page, appended to `<body>` so it can float
|
|
519
|
-
* over anything. It's only ever a positioning shell: the default look (`.pcac-d3-tooltip-default`)
|
|
520
|
-
* is toggled on when the library renders its own key/value content and off when a consumer's
|
|
521
|
-
* `<ng-template pcacTooltip>` is rendered into it instead, so a custom template owns the whole box.
|
|
522
|
-
*/
|
|
523
|
-
tooltip: d3_selection.Selection<HTMLDivElement, unknown, HTMLElement, any>;
|
|
524
|
-
/**
|
|
525
|
-
* The consumer template currently rendered into the shell, if any. Created on the first show
|
|
526
|
-
* of a hover and torn down in `hideTooltip()` - not kept around between hovers - so a view is
|
|
527
|
-
* never left holding onto a declaring component that has since been destroyed (e.g. after a
|
|
528
|
-
* route change). While it lives, repeated `mousemove`s just update its context in place.
|
|
529
|
-
*/
|
|
530
|
-
private view;
|
|
531
|
-
private viewTemplate;
|
|
532
|
-
/** Space left between the tooltip and whatever it's placed next to (the cursor or an anchor). */
|
|
533
|
-
static readonly GAP = 8;
|
|
534
|
-
/**
|
|
535
|
-
* Shows the tooltip for a hovered datum. Renders `template` when the chart has one projected;
|
|
536
|
-
* otherwise falls back to the default key/value content, formatted per `valueFormat`/`keyFormat`.
|
|
537
|
-
* Placed beside `anchor` when one is given (see `positionBeside`), else above the event's position.
|
|
538
|
-
*/
|
|
539
|
-
showTooltip(event: MouseEvent, template: TemplateRef<PcacTooltipContext> | undefined, context: PcacTooltipContext, valueFormat?: PcacFormatEnum, keyFormat?: PcacFormatEnum, anchor?: Element | null): void;
|
|
540
|
-
/**
|
|
541
|
-
* @deprecated Builders should call `PcacChart.showTooltip()`, which routes through a chart's
|
|
542
|
-
* projected `pcacTooltip` template. This only ever renders the default content.
|
|
543
|
-
*/
|
|
544
|
-
showBarTooltip(event: MouseEvent, data: PcacData, valueFormat?: PcacFormatEnum, keyFormat?: PcacFormatEnum): void;
|
|
545
|
-
hideTooltip(): void;
|
|
546
|
-
private renderDefault;
|
|
547
|
-
private renderTemplate;
|
|
548
|
-
private destroyView;
|
|
549
|
-
/**
|
|
550
|
-
* Shows the (already rendered) shell at the page's top-left so it can be measured. Left where the
|
|
551
|
-
* last hover put it, a shell near the right edge would be squeezed by its containing block and
|
|
552
|
-
* measure narrower (wrapped) than the content really is once it's moved somewhere with room.
|
|
553
|
-
*/
|
|
554
|
-
private measurable;
|
|
555
|
-
/**
|
|
556
|
-
* Centers the tooltip horizontally on the cursor and sits it just above. Measured from the real
|
|
557
|
-
* box rather than fixed offsets so it works for content of any size.
|
|
558
|
-
*/
|
|
559
|
-
private positionAbove;
|
|
560
|
-
/**
|
|
561
|
-
* Places the tooltip diagonally off one corner of `anchor`'s rendered box, so it never covers
|
|
562
|
-
* the anchor itself (e.g. a point's image). Prefers above-right - the tooltip's bottom-left
|
|
563
|
-
* corner at the anchor's top-right - and flips each axis independently when the tooltip wouldn't
|
|
564
|
-
* fit in the viewport that way: to the left when there's no room on the right, below when there's
|
|
565
|
-
* no room above. When neither side of an axis fits, it takes whichever side has more room.
|
|
566
|
-
*/
|
|
567
|
-
private positionBeside;
|
|
568
|
-
private getBarTipData;
|
|
569
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PcacTooltipBuilder, never>;
|
|
570
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Everything `showTooltip()` needs beyond the hovered datum itself. `parent`/`isThreshold` feed
|
|
575
|
-
* the consumer template's context; the formats only apply to the default (no template) content.
|
|
576
|
-
*/
|
|
577
|
-
interface PcacTooltipOptions {
|
|
578
|
-
/** See `PcacTooltipContext.index`. Required so no hover site can forget to supply it. */
|
|
579
|
-
index: number;
|
|
580
|
-
parent?: PcacData | null;
|
|
581
|
-
/** See `PcacTooltipContext.parentIndex`. Defaults to `null`, matching `parent`'s default. */
|
|
582
|
-
parentIndex?: number | null;
|
|
583
|
-
isThreshold?: boolean;
|
|
584
|
-
/** See `PcacTooltipContext.coincident`. Defaults to none. */
|
|
585
|
-
coincident?: PcacTooltipCoincident[];
|
|
586
|
-
valueFormat?: PcacFormatEnum;
|
|
587
|
-
keyFormat?: PcacFormatEnum;
|
|
588
|
-
/**
|
|
589
|
-
* The element the tooltip is placed beside instead of above the cursor: off one of its corners,
|
|
590
|
-
* whichever fits in the viewport (see `PcacTooltipBuilder.positionBeside`), so it never covers it.
|
|
591
|
-
*/
|
|
592
|
-
anchor?: Element | null;
|
|
593
|
-
}
|
|
594
|
-
declare class PcacChart {
|
|
595
|
-
axisBuilder: PcacAxisBuilder;
|
|
596
|
-
gridBuilder: PcacGridBuilder;
|
|
597
|
-
transitionService: PcacTransitionService;
|
|
598
|
-
tooltipBuilder: PcacTooltipBuilder;
|
|
599
|
-
colorService: PcacColorService;
|
|
600
|
-
/** D3's own `tickSizeInner` default, which the default `margin` below is sized around. */
|
|
601
|
-
static readonly DEFAULT_TICK_SIZE = 6;
|
|
602
|
-
/** See `PCAC_AXIS_LABEL_SPACE` / `PCAC_AXIS_SUB_LABEL_SPACE` in chart.model.ts. */
|
|
603
|
-
static readonly AXIS_LABEL_SPACE = 18;
|
|
604
|
-
static readonly AXIS_SUB_LABEL_SPACE = 16;
|
|
605
|
-
margin: PcacChartMargin;
|
|
606
|
-
private readonly defaultMargin;
|
|
607
|
-
/**
|
|
608
|
-
* The current build's per-axis settings with defaults applied, set by `initializeAxisState()`.
|
|
609
|
-
* Builders read these (not the raw `config.xAxis`) everywhere: drawing the axes, choosing
|
|
610
|
-
* whether to draw a grid, how many grid lines, and so on. Pie has no axes and never sets them.
|
|
611
|
-
*/
|
|
612
|
-
xAxis: PcacResolvedAxisConfig;
|
|
613
|
-
yAxis: PcacResolvedAxisConfig;
|
|
614
|
-
svg: Selection<SVGGElement, unknown, BaseType, unknown>;
|
|
615
|
-
width: number;
|
|
616
|
-
height: number;
|
|
617
|
-
colors: string[];
|
|
618
|
-
startData: PcacData[];
|
|
619
|
-
/**
|
|
620
|
-
* Raw, unadjusted container width measured by the last successful `initializeChartState()`
|
|
621
|
-
* call, or `null` if none has succeeded yet. Deliberately tracked separately from `width`:
|
|
622
|
-
* some builders (e.g. bar-horizontal-chart's `setHorizontalMarginsBasedOnContent`) recompute
|
|
623
|
-
* `width`/`margin.left` mid-build from measured axis-label sizes, so `width` alone isn't a
|
|
624
|
-
* stable basis for "did the container itself resize" — the raw container measurement is.
|
|
625
|
-
*/
|
|
626
|
-
private lastContainerWidth;
|
|
627
|
-
/**
|
|
628
|
-
* Raw container height measured by the last successful `initializeChartState()` call, and
|
|
629
|
-
* whether that build was running with `heightFull` on. Only consulted by `containerSizeChanged`
|
|
630
|
-
* when it was: without `heightFull` the container's height is driven *by* the chart's own SVG
|
|
631
|
-
* height, so comparing it would report "changed" every time the chart itself grew or shrank.
|
|
632
|
-
*/
|
|
633
|
-
private lastContainerHeight;
|
|
634
|
-
private lastHeightFull;
|
|
635
|
-
/**
|
|
636
|
-
* How much the vertical margins have grown this build beyond their defaults - for tick marks
|
|
637
|
-
* and axis labels (`initializeAxisState()`; negative when a short tick took some away) and for
|
|
638
|
-
* content that hangs past the plot's edge (`reserveEdgeSpace()`). `resolveHeight()` subtracts
|
|
639
|
-
* it from the plot height so the SVG's total height doesn't change with any of them. Reset
|
|
640
|
-
* alongside the margins.
|
|
641
|
-
*/
|
|
642
|
-
private reservedHeight;
|
|
643
|
-
/**
|
|
644
|
-
* Resolves the consumer's projected `<ng-template pcacTooltip>`, if any. Each chart component
|
|
645
|
-
* points this at its own `contentChild(PcacTooltipDirective)` query. It's a getter rather than
|
|
646
|
-
* a captured value so it's read lazily, at hover time, from inside a D3 listener: reading the
|
|
647
|
-
* query signal in the component's build effect instead would make the effect depend on it and
|
|
648
|
-
* rebuild the whole chart (restarting its entry animation) whenever the query resolves.
|
|
649
|
-
*/
|
|
650
|
-
tooltipTemplate: () => TemplateRef<PcacTooltipContext> | undefined;
|
|
651
|
-
/**
|
|
652
|
-
* Puts `margin` back to its defaults. `initializeAxisState()` calls this first thing, before any
|
|
653
|
-
* per-build adjustment (hidden axes giving sides back, tick sizes growing them, label widths
|
|
654
|
-
* measured into `margin.left`): `margin` lives on this per-chart instance and so persists
|
|
655
|
-
* between builds, and without a reset an adjustment made for one config silently carries into
|
|
656
|
-
* the next - e.g. axes drawn with no room after `hide` flips back to false.
|
|
657
|
-
*/
|
|
658
|
-
resetMargin(): void;
|
|
659
|
-
/**
|
|
660
|
-
* Resolves the config's `xAxis`/`yAxis` onto this chart and sets the margins up for them. Axis
|
|
661
|
-
* charts call this at the top of `buildChart()`, on their own copy of the config (it rewrites
|
|
662
|
-
* `config.height` for hidden axes), before `initializeChartState()` measures the plot area.
|
|
663
|
-
* In order:
|
|
664
|
-
*
|
|
665
|
-
* 1. `resetMargin()`.
|
|
666
|
-
* 2. Tick marks: room for a non-default `tickSize` is reserved on each axis that will actually
|
|
667
|
-
* be drawn (`reserveTickSizeMargins`).
|
|
668
|
-
* 3. Labels: `AXIS_LABEL_SPACE` is added to `bottom` / `left` for an axis with a `label`, and
|
|
669
|
-
* `AXIS_SUB_LABEL_SPACE` for one with any `subLabels` (see `axisLabelSpace`), again only if
|
|
670
|
-
* the axis will be drawn.
|
|
671
|
-
* 4. Hidden axes: an axis with `hide` gives its margins back to the plot. The y axis owns
|
|
672
|
-
* `left` and `top` (the top margin is only there so the topmost y label isn't clipped), the
|
|
673
|
-
* x axis `bottom` and `right` (likewise for the rightmost x label). Each reclaimed vertical
|
|
674
|
-
* margin is added onto `config.height` so the SVG's total height stays what the consumer
|
|
675
|
-
* configured; horizontally `initializeChartState()` picks the change up on its own.
|
|
676
|
-
*
|
|
677
|
-
* @param defaultGrid the axis whose grid this chart draws when the consumer hasn't said
|
|
678
|
-
* (`PcacAxisConfig.showGrid`): `'y'` for horizontal lines, `'x'` for vertical.
|
|
679
|
-
* @param hiddenAxisMargin what a hidden axis's sides shrink to, rather than 0. The
|
|
680
|
-
* line/area/plot charts keep 8px so a dot on the edge of the plot isn't clipped by the SVG.
|
|
681
|
-
*/
|
|
682
|
-
initializeAxisState(config: PcacAxisChartConfig, defaultGrid: 'x' | 'y', hiddenAxisMargin?: number): void;
|
|
683
|
-
/**
|
|
684
|
-
* The `PcacAxisBuilder` config for this chart's current state - everything but the scales is
|
|
685
|
-
* already on the instance. Builders pass the result to `drawAxis()` (or `drawXAxis()` with a
|
|
686
|
-
* rescaled x, on zoom).
|
|
687
|
-
*/
|
|
688
|
-
axisBuilderConfig<XDomain extends AxisDomain, YDomain extends AxisDomain>(xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>): IPcacAxisBuilderConfig<XDomain, YDomain>;
|
|
689
|
-
/**
|
|
690
|
-
* Draws whichever grids the resolved axes ask for: vertical lines from the x axis's ticks,
|
|
691
|
-
* horizontal from the y's (`PcacAxisConfig.showGrid`). `which` restricts it to one axis - the
|
|
692
|
-
* line/area/plot charts redraw just a zoomed axis's grid against its rescaled scale on zoom.
|
|
693
|
-
*/
|
|
694
|
-
drawGrids<XDomain extends AxisDomain, YDomain extends AxisDomain>(xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>, which?: 'x' | 'y' | 'both'): void;
|
|
695
|
-
/**
|
|
696
|
-
* Makes room in the margins for tick marks longer (or shorter) than D3's default. The default
|
|
697
|
-
* margins are sized around that default (`DEFAULT_TICK_SIZE`), and D3 places each tick label at
|
|
698
|
-
* tick length + padding, so a longer tick pushes its labels outward by exactly the difference -
|
|
699
|
-
* into space the margin doesn't have unless it grows by the same amount. Growing the margin here,
|
|
700
|
-
* *before* `initializeChartState()` measures the plot area, is what makes the chart shrink to fit
|
|
701
|
-
* its labels rather than pushing them off the edge of the SVG. A shorter tick hands the
|
|
702
|
-
* difference back to the plot area the same way.
|
|
703
|
-
*
|
|
704
|
-
* Horizontally that happens on its own: `initializeChartState()` derives `width` from the
|
|
705
|
-
* container minus the margins. Vertically it doesn't - `config.height` is the plot area, and
|
|
706
|
-
* the SVG is that plus the margins - so a taller bottom margin would grow the SVG instead. The
|
|
707
|
-
* delta is therefore also remembered in `reservedHeight` and taken back out of the plot
|
|
708
|
-
* height by `resolveHeight()`, keeping the chart's total footprint where the consumer put it.
|
|
709
|
-
*
|
|
710
|
-
* Called by `initializeAxisState()` right after `resetMargin()`, for the axes that will be
|
|
711
|
-
* drawn. Only the axis a tick size is given for is affected; `undefined` leaves that margin
|
|
712
|
-
* alone.
|
|
713
|
-
* @param xTickSize `tickSizeInner` for the bottom (x) axis, which lives in `margin.bottom`
|
|
714
|
-
* @param yTickSize `tickSizeInner` for the left (y) axis, which lives in `margin.left`
|
|
715
|
-
*/
|
|
716
|
-
reserveTickSizeMargins(xTickSize?: number, yTickSize?: number): void;
|
|
717
|
-
/**
|
|
718
|
-
* Makes sure each given margin is at least that big, for content drawn at the very edge of the
|
|
719
|
-
* plot area that reaches past it - a point image on the line/area/plot charts, say, whose box
|
|
720
|
-
* is centered on a point at the top of the y domain and so hangs half of itself above the plot.
|
|
721
|
-
* Those charts already widen their clip-path to let such a point through; this is what stops
|
|
722
|
-
* the `<svg>` itself from cutting it off, the SVG being only the plot area plus the margins.
|
|
723
|
-
*
|
|
724
|
-
* "At least", not "add": the default margins, and any tick / label room already reserved in
|
|
725
|
-
* them, may well cover it already (`margin.left` is 40 by default), and adding on top of that
|
|
726
|
-
* would give up plot area for nothing. Vertical growth is taken out of the plot height the same
|
|
727
|
-
* way `reserveTickSizeMargins()`'s is, so the SVG's total height stays what the consumer
|
|
728
|
-
* configured; horizontally `initializeChartState()` picks the change up on its own. A side
|
|
729
|
-
* left `undefined` is untouched.
|
|
730
|
-
*
|
|
731
|
-
* Call after `initializeAxisState()` (which resets the margins) and before
|
|
732
|
-
* `initializeChartState()` (which measures the plot area against them).
|
|
733
|
-
*/
|
|
734
|
-
reserveEdgeSpace(space: Partial<PcacChartMargin>): void;
|
|
735
|
-
/**
|
|
736
|
-
* Shows the tooltip for a hovered datum, through the chart's `pcacTooltip` template when one is
|
|
737
|
-
* projected and the default key/value content otherwise. Every builder's hover handler should
|
|
738
|
-
* go through here rather than `tooltipBuilder` directly so the template is honored everywhere.
|
|
739
|
-
*/
|
|
740
|
-
showTooltip(event: MouseEvent, data: PcacData, options: PcacTooltipOptions): void;
|
|
741
|
-
hideTooltip(): void;
|
|
742
|
-
/**
|
|
743
|
-
* Prior to building a chart, we need to initialize the state of the chart.
|
|
744
|
-
*
|
|
745
|
-
* Returns `false` (and leaves `width`/`height`/`colors` untouched) if the container hasn't
|
|
746
|
-
* been laid out yet, so its `clientWidth` measures 0 — this happens when a chart mounts
|
|
747
|
-
* already holding data (e.g. behind a loading gate) and its first `ngOnChanges` fires before
|
|
748
|
-
* the browser has committed layout for its own just-created DOM node. Callers should bail out
|
|
749
|
-
* of their build on `false` rather than proceeding with a degenerate width; `PcacChartResizeService`
|
|
750
|
-
* (wired up by every chart component) retries the build once the container has a real size.
|
|
751
|
-
* @param chartElm Reference to SVG on dom
|
|
752
|
-
* @param config Chart specific configuration
|
|
753
|
-
*/
|
|
754
|
-
initializeChartState(chartElm: ElementRef, config: PcacChartConfig): boolean;
|
|
755
|
-
/**
|
|
756
|
-
* `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it
|
|
757
|
-
* becomes a floor instead: the chart fills its container, and only falls back to `config.height`
|
|
758
|
-
* when the container is shorter than that (or has no definite height of its own to fill - see
|
|
759
|
-
* `PcacChartConfig.heightFull`, where an auto-height container measures ~0 here and the
|
|
760
|
-
* `Math.max` keeps the configured height).
|
|
761
|
-
*
|
|
762
|
-
* Note this deliberately subtracts the margins, so it's the *total* SVG that ends up matching
|
|
763
|
-
* the container: `buildContainer()` adds `margin.top`/`margin.bottom` back on top of `height`
|
|
764
|
-
* when sizing the `<svg>`, so filling without this would overflow the container by exactly the
|
|
765
|
-
* vertical margins.
|
|
766
|
-
* @param container The chart's container element (the `<svg>`'s parent)
|
|
767
|
-
* @param config Chart specific configuration
|
|
768
|
-
*/
|
|
769
|
-
private resolveHeight;
|
|
770
|
-
/**
|
|
771
|
-
* True if the container's current raw layout width differs from the one measured by the last
|
|
772
|
-
* successful build, or if no successful build has happened yet. For a `heightFull` chart, a
|
|
773
|
-
* change in the container's height counts too - that's the whole size the chart is tracking.
|
|
774
|
-
*
|
|
775
|
-
* `PcacChartResizeService`'s `ResizeObserver` is guaranteed to fire once as soon as it starts
|
|
776
|
-
* observing — that's what lets a chart recover from the 0-width race described on
|
|
777
|
-
* `initializeChartState`, but it also means that "routine" first callback usually lands
|
|
778
|
-
* moments after `ngOnChanges` already built successfully at the same width. Without this
|
|
779
|
-
* check, that redundant callback would restart the chart's enter transition mid-animation for
|
|
780
|
-
* no visual change. Only `ngOnChanges` (which reacts to data, not size) should skip this check.
|
|
781
|
-
* @param chartElm Reference to SVG on dom
|
|
782
|
-
*/
|
|
783
|
-
containerSizeChanged(chartElm: ElementRef): boolean;
|
|
784
|
-
/**
|
|
785
|
-
* 1) Set the width and height of the SVG
|
|
786
|
-
* 2) Add a group and translate it to state of {{center}} option
|
|
787
|
-
* @param chartElm Reference to SVG on dom
|
|
788
|
-
* @param center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
|
|
789
|
-
*/
|
|
790
|
-
buildContainer(chartElm: ElementRef, center?: boolean): void;
|
|
791
|
-
/**
|
|
792
|
-
* Most charts share a default margin(s) state.
|
|
793
|
-
* In some cases, that state needs to be calculated based on the content that resides in that margin.
|
|
794
|
-
* For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
|
|
795
|
-
* chart axis construction.
|
|
796
|
-
*
|
|
797
|
-
* Measures with the y axis's own `tickSize` (the measured box spans the tick line as well as
|
|
798
|
-
* the label, so measuring at a different length would put the labels off by the difference)
|
|
799
|
-
* and adds its `axisLabelSpace()` back on top, since the measurement replaces whatever
|
|
800
|
-
* `initializeAxisState()` reserved for the label / sub labels.
|
|
801
|
-
* @param chartElm Reference to SVG on dom
|
|
802
|
-
* @param yScale D3 scale transformation object (d3.ScaleBand)
|
|
803
|
-
*/
|
|
804
|
-
setHorizontalMarginsBasedOnContent<Domain extends AxisDomain>(chartElm: ElementRef, yScale: AxisScale<Domain>): void;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* Provided per-component (see PcacBarHorizontalChartComponent's `providers`), not root-scoped:
|
|
809
|
-
* this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,
|
|
810
|
-
* height, colors, svg). A root singleton would be shared and clobbered by every
|
|
811
|
-
* <pcac-bar-horizontal-chart> rendered at once.
|
|
812
|
-
*/
|
|
813
|
-
declare class BarHorizontalChartBuilder extends PcacChart {
|
|
814
|
-
private xScale;
|
|
815
|
-
private yScaleStacked;
|
|
816
|
-
private yScaleGrouped;
|
|
817
|
-
private barClickedSource;
|
|
818
|
-
private config;
|
|
819
|
-
barClicked$: rxjs.Observable<PcacData>;
|
|
820
|
-
buildChart(chartElm: ElementRef, config: PcacBarHorizontalChartConfig): void;
|
|
821
|
-
private buildScales;
|
|
822
|
-
private drawChart;
|
|
823
|
-
private addGroups;
|
|
824
|
-
private drawBarsPerGroup;
|
|
825
|
-
private drawThresholdAcrossChart;
|
|
826
|
-
private drawThresholdsPerGroup;
|
|
827
|
-
private drawThresholdsPerBarInGroup;
|
|
828
|
-
private applyPreTransitionThresholdStyles;
|
|
829
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BarHorizontalChartBuilder, never>;
|
|
830
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
340
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacTooltipDirective, never>;
|
|
341
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<PcacTooltipDirective, "ng-template[pcacTooltip]", never, {}, {}, never, never, true, never>;
|
|
831
342
|
}
|
|
832
343
|
|
|
833
344
|
declare class PcacBarHorizontalChartComponent {
|
|
834
345
|
private chartBuilder;
|
|
835
|
-
readonly config:
|
|
836
|
-
readonly chartElm:
|
|
837
|
-
readonly barClicked:
|
|
346
|
+
readonly config: _angular_core.InputSignal<PcacBarHorizontalChartConfig>;
|
|
347
|
+
readonly chartElm: _angular_core.Signal<ElementRef<any>>;
|
|
348
|
+
readonly barClicked: _angular_core.OutputRef<_pioneer_code_pioneer_charts.PcacData>;
|
|
838
349
|
/**
|
|
839
350
|
* Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the
|
|
840
351
|
* default tooltip when present (see PcacTooltipDirective).
|
|
841
352
|
*/
|
|
842
|
-
readonly tooltipTemplate:
|
|
353
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
843
354
|
constructor();
|
|
844
355
|
buildChart(): void;
|
|
845
|
-
static ɵfac:
|
|
846
|
-
static ɵcmp:
|
|
356
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacBarHorizontalChartComponent, never>;
|
|
357
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacBarHorizontalChartComponent, "pcac-bar-horizontal-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "barClicked": "barClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
847
358
|
}
|
|
848
359
|
|
|
849
360
|
declare class PcacBarVerticalChartConfig extends PcacAxisChartConfig {
|
|
@@ -856,70 +367,63 @@ declare class PcacBarVerticalChartColorOverrideConfig {
|
|
|
856
367
|
colors: string[];
|
|
857
368
|
}
|
|
858
369
|
|
|
859
|
-
/**
|
|
860
|
-
* Provided per-component (see PcacBarVerticalChartComponent's `providers`), not root-scoped:
|
|
861
|
-
* this builder extends PcacChart, which holds mutable per-chart-instance state (margin, width,
|
|
862
|
-
* height, colors, svg). A root singleton would be shared and clobbered by every
|
|
863
|
-
* <pcac-bar-vertical-chart> rendered at once.
|
|
864
|
-
*/
|
|
865
|
-
declare class BarVerticalChartBuilder extends PcacChart {
|
|
866
|
-
private xScaleStacked;
|
|
867
|
-
private xScaleGrouped;
|
|
868
|
-
private yScale;
|
|
869
|
-
private barClickedSource;
|
|
870
|
-
barClicked$: rxjs.Observable<PcacData>;
|
|
871
|
-
buildChart(chartElm: ElementRef, config: PcacBarVerticalChartConfig): void;
|
|
872
|
-
private buildScales;
|
|
873
|
-
private drawChart;
|
|
874
|
-
private addGroups;
|
|
875
|
-
private drawBarsPerGroup;
|
|
876
|
-
private drawThresholdAcrossChart;
|
|
877
|
-
private drawThresholdsPerGroup;
|
|
878
|
-
private drawThresholdsPerBarInGroup;
|
|
879
|
-
private applyPreTransitionThresholdStyles;
|
|
880
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BarVerticalChartBuilder, never>;
|
|
881
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
370
|
declare class PcacBarVerticalChartComponent {
|
|
885
371
|
private chartBuilder;
|
|
886
|
-
readonly config:
|
|
887
|
-
readonly chartElm:
|
|
888
|
-
readonly barClicked:
|
|
372
|
+
readonly config: _angular_core.InputSignal<PcacBarVerticalChartConfig>;
|
|
373
|
+
readonly chartElm: _angular_core.Signal<ElementRef<any>>;
|
|
374
|
+
readonly barClicked: _angular_core.OutputRef<_pioneer_code_pioneer_charts.PcacData>;
|
|
889
375
|
/**
|
|
890
376
|
* Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the
|
|
891
377
|
* default tooltip when present (see PcacTooltipDirective).
|
|
892
378
|
*/
|
|
893
|
-
readonly tooltipTemplate:
|
|
379
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
894
380
|
constructor();
|
|
895
381
|
buildChart(): void;
|
|
896
|
-
static ɵfac:
|
|
897
|
-
static ɵcmp:
|
|
382
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacBarVerticalChartComponent, never>;
|
|
383
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacBarVerticalChartComponent, "pcac-bar-vertical-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "barClicked": "barClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
898
384
|
}
|
|
899
385
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
386
|
+
declare class PcacColorService {
|
|
387
|
+
private primary;
|
|
388
|
+
private primaryLight;
|
|
389
|
+
private success;
|
|
390
|
+
private danger;
|
|
391
|
+
private warning;
|
|
392
|
+
private orange;
|
|
393
|
+
private blue;
|
|
394
|
+
private alert;
|
|
395
|
+
/** A consumer's own scale from `setScale()`; replaces the default palette while set. */
|
|
396
|
+
private customScale;
|
|
397
|
+
/**
|
|
398
|
+
* The palette charts cycle through: the `setScale()` one when given, else the default colors
|
|
399
|
+
* built from the current fields - so a setter like `setSuccess()` changes the charts drawn after
|
|
400
|
+
* it, rather than a copy of the colors taken when the service was created.
|
|
401
|
+
*/
|
|
402
|
+
private get scale();
|
|
403
|
+
/**
|
|
404
|
+
* Get a scale of colors dynamically
|
|
405
|
+
* @param numberOfNodes Number of items in dynamically build collection of colors
|
|
406
|
+
*/
|
|
407
|
+
getColorScale(numberOfNodes: number): string[];
|
|
408
|
+
getAlert(): string;
|
|
914
409
|
/**
|
|
915
|
-
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
410
|
+
* Set the scale that charts use to set colors of data[x] on the UI, in place of the default
|
|
411
|
+
* palette (and of the individual color setters below, which only shape the default). An empty
|
|
412
|
+
* array goes back to the default palette rather than leaving charts with no colors.
|
|
413
|
+
* @param colors A collection of hex values
|
|
919
414
|
*/
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
415
|
+
setScale(colors: string[]): void;
|
|
416
|
+
/** @deprecated No chart reads the primary color; it isn't part of the palette. */
|
|
417
|
+
setPrimary(color: string): void;
|
|
418
|
+
setPrimaryLight(color: string): void;
|
|
419
|
+
setSuccess(color: string): void;
|
|
420
|
+
setDanger(color: string): void;
|
|
421
|
+
setWarning(color: string): void;
|
|
422
|
+
setOrange(color: string): void;
|
|
423
|
+
setBlue(color: string): void;
|
|
424
|
+
setAlert(color: string): void;
|
|
425
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacColorService, never>;
|
|
426
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
|
|
923
427
|
}
|
|
924
428
|
|
|
925
429
|
declare class PcacLegendConfigItem {
|
|
@@ -933,12 +437,12 @@ declare class PcacLegendConfig {
|
|
|
933
437
|
}
|
|
934
438
|
declare class PcacLegend {
|
|
935
439
|
readonly colorService: PcacColorService;
|
|
936
|
-
config:
|
|
937
|
-
itemClicked:
|
|
938
|
-
colorScale:
|
|
440
|
+
config: _angular_core.ModelSignal<PcacLegendConfig>;
|
|
441
|
+
itemClicked: _angular_core.OutputEmitterRef<PcacLegendConfigItem[]>;
|
|
442
|
+
colorScale: _angular_core.Signal<string[]>;
|
|
939
443
|
onItemClicked(index: number): void;
|
|
940
|
-
static ɵfac:
|
|
941
|
-
static ɵcmp:
|
|
444
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacLegend, never>;
|
|
445
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacLegend, "pcac-legend", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "config": "configChange"; "itemClicked": "itemClicked"; }, never, never, true, never>;
|
|
942
446
|
}
|
|
943
447
|
|
|
944
448
|
declare enum PcacLineAreaPlotChartConfigType {
|
|
@@ -1080,89 +584,105 @@ declare class PcacPlotChartConfig extends PcacLineAreaChartConfig {
|
|
|
1080
584
|
}
|
|
1081
585
|
|
|
1082
586
|
declare class PcacPlotChart {
|
|
1083
|
-
readonly config:
|
|
587
|
+
readonly config: _angular_core.InputSignal<PcacPlotChartConfig>;
|
|
1084
588
|
readonly types: typeof PcacLineAreaPlotChartConfigType;
|
|
1085
|
-
readonly dotClicked:
|
|
589
|
+
readonly dotClicked: _angular_core.OutputEmitterRef<PcacData>;
|
|
1086
590
|
/**
|
|
1087
591
|
* Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
|
|
1088
592
|
* inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).
|
|
1089
593
|
*/
|
|
1090
|
-
readonly tooltipTemplate:
|
|
1091
|
-
static ɵfac:
|
|
1092
|
-
static ɵcmp:
|
|
594
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
595
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacPlotChart, never>;
|
|
596
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacPlotChart, "pcac-plot-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "dotClicked": "dotClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
1093
597
|
}
|
|
1094
598
|
|
|
1095
599
|
declare class PcacLineChartConfig extends PcacLineAreaChartConfig {
|
|
1096
600
|
}
|
|
1097
601
|
|
|
1098
602
|
declare class PcacLineChart {
|
|
1099
|
-
readonly config:
|
|
603
|
+
readonly config: _angular_core.InputSignal<PcacLineChartConfig>;
|
|
1100
604
|
readonly types: typeof PcacLineAreaPlotChartConfigType;
|
|
1101
|
-
readonly dotClicked:
|
|
605
|
+
readonly dotClicked: _angular_core.OutputEmitterRef<PcacData>;
|
|
1102
606
|
/**
|
|
1103
607
|
* Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
|
|
1104
608
|
* inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).
|
|
1105
609
|
*/
|
|
1106
|
-
readonly tooltipTemplate:
|
|
1107
|
-
static ɵfac:
|
|
1108
|
-
static ɵcmp:
|
|
610
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
611
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacLineChart, never>;
|
|
612
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacLineChart, "pcac-line-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "dotClicked": "dotClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
1109
613
|
}
|
|
1110
614
|
|
|
1111
615
|
declare class PcacAreaChartConfig extends PcacLineAreaChartConfig {
|
|
1112
616
|
}
|
|
1113
617
|
|
|
1114
618
|
declare class PcacAreaChart {
|
|
1115
|
-
readonly config:
|
|
619
|
+
readonly config: _angular_core.InputSignal<PcacAreaChartConfig>;
|
|
1116
620
|
readonly types: typeof PcacLineAreaPlotChartConfigType;
|
|
1117
|
-
readonly dotClicked:
|
|
621
|
+
readonly dotClicked: _angular_core.OutputEmitterRef<PcacData>;
|
|
1118
622
|
/**
|
|
1119
623
|
* Optional consumer `<ng-template pcacTooltip>` projected into this element, forwarded to the
|
|
1120
624
|
* inner chart (see PcacLineAreaChartComponent.tooltipTemplate for why it can't query it itself).
|
|
1121
625
|
*/
|
|
1122
|
-
readonly tooltipTemplate:
|
|
1123
|
-
static ɵfac:
|
|
1124
|
-
static ɵcmp:
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
declare class PcacPieChartConfig extends PcacChartConfig {
|
|
626
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
627
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacAreaChart, never>;
|
|
628
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacAreaChart, "pcac-area-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "dotClicked": "dotClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
1128
629
|
}
|
|
1129
630
|
|
|
1130
631
|
/**
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
* height, colors, svg). A root singleton would be shared and clobbered by every
|
|
1134
|
-
* <pcac-pie-chart> rendered at once.
|
|
632
|
+
* Turns the pie into a donut: slices drawn as a ring around an empty center, which can hold a
|
|
633
|
+
* short label - typically the total the slices add up to.
|
|
1135
634
|
*/
|
|
1136
|
-
declare class
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
635
|
+
declare class PcacPieDonutConfig {
|
|
636
|
+
/**
|
|
637
|
+
* Radius of the hole as a fraction of the pie's radius, from 0 (a plain pie) to 0.9. Values
|
|
638
|
+
* outside that range are clamped.
|
|
639
|
+
*/
|
|
640
|
+
innerRadius: number;
|
|
641
|
+
/**
|
|
642
|
+
* Large text centered in the hole, e.g. `'67'`. Sized to the hole and shrunk to fit across it;
|
|
643
|
+
* left out if it would have to go below 8px. Not drawn when not set.
|
|
644
|
+
*/
|
|
645
|
+
label?: string;
|
|
646
|
+
/** Smaller line under `label`, e.g. `'balls'`, fitted the same way. Not drawn when not set. */
|
|
647
|
+
subLabel?: string;
|
|
648
|
+
/**
|
|
649
|
+
* `label` color, any CSS color; theme default `$gray-800`. Applied as
|
|
650
|
+
* `--pcac-pie-center-label-color` on the chart's `.pcac-pie-center` group, so a stylesheet can
|
|
651
|
+
* set it on an ancestor instead (a config value wins).
|
|
652
|
+
*/
|
|
653
|
+
labelColor?: string;
|
|
654
|
+
/** `subLabel` color, likewise (`--pcac-pie-center-sub-label-color`); theme default `$gray-600`. */
|
|
655
|
+
subLabelColor?: string;
|
|
656
|
+
}
|
|
657
|
+
declare class PcacPieChartConfig extends PcacChartConfig {
|
|
658
|
+
/**
|
|
659
|
+
* Draw the pie as a donut. Off when not set; `{}` turns it on with every `PcacPieDonutConfig`
|
|
660
|
+
* default. Slices, hover and `sliceClicked` behave the same either way.
|
|
661
|
+
*/
|
|
662
|
+
donut?: Partial<PcacPieDonutConfig>;
|
|
663
|
+
/**
|
|
664
|
+
* Slice colors, any CSS color, in data order - the first slice takes the first color - in place
|
|
665
|
+
* of the theme palette. Repeated when there are more slices than colors. Omitted or empty, the
|
|
666
|
+
* theme palette is used. Match a `<pcac-legend>` to it with each item's `colorOverride`.
|
|
667
|
+
*/
|
|
668
|
+
colorOverride?: string[];
|
|
1149
669
|
}
|
|
1150
670
|
|
|
1151
671
|
declare class PcacPieChartComponent {
|
|
1152
672
|
private chartBuilder;
|
|
1153
|
-
readonly config:
|
|
1154
|
-
readonly chartElm:
|
|
1155
|
-
readonly sliceClicked:
|
|
673
|
+
readonly config: _angular_core.InputSignal<PcacPieChartConfig>;
|
|
674
|
+
readonly chartElm: _angular_core.Signal<ElementRef<any>>;
|
|
675
|
+
readonly sliceClicked: _angular_core.OutputRef<_pioneer_code_pioneer_charts.PcacData>;
|
|
1156
676
|
/**
|
|
1157
677
|
* Optional consumer `<ng-template pcacTooltip>` projected into this element; replaces the
|
|
1158
678
|
* default tooltip when present (see PcacTooltipDirective).
|
|
1159
679
|
*/
|
|
1160
|
-
readonly tooltipTemplate:
|
|
680
|
+
readonly tooltipTemplate: _angular_core.Signal<PcacTooltipDirective | undefined>;
|
|
1161
681
|
constructor();
|
|
1162
682
|
buildChart(): void;
|
|
1163
|
-
static ɵfac:
|
|
1164
|
-
static ɵcmp:
|
|
683
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PcacPieChartComponent, never>;
|
|
684
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PcacPieChartComponent, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
|
|
1165
685
|
}
|
|
1166
686
|
|
|
1167
|
-
export {
|
|
1168
|
-
export type {
|
|
687
|
+
export { PcacAreaChart, PcacAreaChartConfig, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChartConfig, PcacColorService, PcacData, PcacDataRange, PcacFormatEnum, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPieDonutConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointFanOutConfig, PcacPointImageConfig, PcacPointRangeConfig, PcacPointRangeShow, PcacPointRangeStyle, PcacRangeBounds, PcacTooltipDirective };
|
|
688
|
+
export type { PcacTooltipCoincident, PcacTooltipContext };
|