@pioneer-code/pioneer-charts 22.2.1 → 22.2.3

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/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/PioneerCode/pioneer-charts.git"
24
24
  },
25
- "version": "22.2.1",
25
+ "version": "22.2.3",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
28
  "@angular/common": "^22.1.0",
@@ -10,6 +10,18 @@
10
10
  stroke-width: 2px;
11
11
  }
12
12
 
13
+ // The plot chart's `pointFanOut` anchors (see PcacPointFanOutConfig.showAnchor): a spoke from
14
+ // the shared coordinate to each fanned-out point, and a dot on the coordinate itself. Quiet
15
+ // grays, like the grid, so they read as guides rather than data.
16
+ .fan-out-spoke {
17
+ stroke: imports.$gray-400;
18
+ stroke-width: 1px;
19
+ }
20
+
21
+ .fan-out-anchor {
22
+ fill: imports.$gray-600;
23
+ }
24
+
13
25
  .effects-canvas {
14
26
  fill: none;
15
27
  }
@@ -292,8 +292,8 @@ interface IPcacGridBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomai
292
292
  declare class PcacGridBuilder {
293
293
  /**
294
294
  * Vertical lines, one per x-axis tick (or category), running the plot's full height. The group
295
- * is classed `pcac-grid-vertical` so a chart can find and redraw just this grid - the
296
- * line/area/plot charts do on zoom, when the x ticks move.
295
+ * is classed `pcac-grid-vertical` (the horizontal one `pcac-grid-horizontal`) so a chart can
296
+ * find and redraw just one grid - the line/area/plot charts do on zoom, when an axis's ticks move.
297
297
  */
298
298
  drawVerticalGrid<XDomain extends AxisDomain, YDomain extends AxisDomain>(config: IPcacGridBuilderConfig<XDomain, YDomain>): void;
299
299
  /**
@@ -343,6 +343,17 @@ declare class PcacTransitionService {
343
343
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
344
344
  }
345
345
 
346
+ /**
347
+ * A datum drawn at the same coordinate as the hovered one (see `PcacTooltipContext.coincident`),
348
+ * located the same way the context locates `$implicit`: `parent` is the series it belongs to,
349
+ * `index` its position in `parent.data`, `parentIndex` the series' position in the chart's `data`.
350
+ */
351
+ interface PcacTooltipCoincident {
352
+ data: PcacData;
353
+ parent: PcacData;
354
+ index: number;
355
+ parentIndex: number;
356
+ }
346
357
  /**
347
358
  * Template context handed to a consumer's `<ng-template pcacTooltip>` each time a tooltip is shown.
348
359
  */
@@ -380,6 +391,14 @@ interface PcacTooltipContext {
380
391
  * Position of `parent` in the chart's top-level `data`; `null` whenever `parent` is.
381
392
  */
382
393
  parentIndex: number | null;
394
+ /**
395
+ * Every *other* datum drawn at exactly the same coordinate as `$implicit`, in data order, so a
396
+ * template can list who else is at the hovered point. Set by the line, area and plot charts,
397
+ * whether or not the plot chart's `pointFanOut` has spread the points apart (without it, the
398
+ * hovered point is the only one of them visible, which makes this list all the more useful).
399
+ * Empty on the other charts and whenever nothing shares the point.
400
+ */
401
+ coincident: PcacTooltipCoincident[];
383
402
  }
384
403
  /**
385
404
  * Marks an `<ng-template>` projected into any chart component as that chart's tooltip. When
@@ -405,6 +424,17 @@ interface PcacTooltipContext {
405
424
  * <div class="my-tooltip">{{ orders[g!][i].customer }}: {{ point.value | number }}</div>
406
425
  * </ng-template>
407
426
  * ```
427
+ *
428
+ * `coincident` lists the other points at the hovered coordinate, each located the same way:
429
+ *
430
+ * ```html
431
+ * <ng-template pcacTooltip let-point let-others="coincident">
432
+ * <div class="my-tooltip">
433
+ * {{ point.key }}, {{ point.value }}
434
+ * @for (other of others; track other.parentIndex) { <div>Also here: {{ other.parent.key }}</div> }
435
+ * </div>
436
+ * </ng-template>
437
+ * ```
408
438
  */
409
439
  declare class PcacTooltipDirective {
410
440
  readonly templateRef: TemplateRef<PcacTooltipContext>;
@@ -470,6 +500,8 @@ interface PcacTooltipOptions {
470
500
  /** See `PcacTooltipContext.parentIndex`. Defaults to `null`, matching `parent`'s default. */
471
501
  parentIndex?: number | null;
472
502
  isThreshold?: boolean;
503
+ /** See `PcacTooltipContext.coincident`. Defaults to none. */
504
+ coincident?: PcacTooltipCoincident[];
473
505
  valueFormat?: PcacFormatEnum;
474
506
  keyFormat?: PcacFormatEnum;
475
507
  }
@@ -571,7 +603,7 @@ declare class PcacChart {
571
603
  /**
572
604
  * Draws whichever grids the resolved axes ask for: vertical lines from the x axis's ticks,
573
605
  * horizontal from the y's (`PcacAxisConfig.showGrid`). `which` restricts it to one axis - the
574
- * line/area/plot charts redraw just the x grid against the rescaled x on zoom.
606
+ * line/area/plot charts redraw just a zoomed axis's grid against its rescaled scale on zoom.
575
607
  */
576
608
  drawGrids<XDomain extends AxisDomain, YDomain extends AxisDomain>(xScale: AxisScale<XDomain>, yScale: AxisScale<YDomain>, which?: 'x' | 'y' | 'both'): void;
577
609
  /**
@@ -848,7 +880,13 @@ declare class PcacPointImageConfig {
848
880
  */
849
881
  declare class PcacLineAreaChartConfig extends PcacAxisChartConfig {
850
882
  enableEffects: boolean;
851
- enableZoom: boolean;
883
+ /**
884
+ * Zoom and pan along the x / y axis (scroll / pinch to zoom 1x-10x, drag to pan, never leaving
885
+ * the original domain). Either, or both, can be on. A gesture is always two-dimensional, so with
886
+ * only one enabled the other axis simply stays put. Both off by default.
887
+ */
888
+ enableZoomX: boolean;
889
+ enableZoomY: boolean;
852
890
  /**
853
891
  * Hex color codes to override the default colors
854
892
  */
@@ -861,7 +899,42 @@ declare class PcacLineAreaChartConfig extends PcacAxisChartConfig {
861
899
  pointImage?: Partial<PcacPointImageConfig>;
862
900
  }
863
901
 
902
+ /**
903
+ * How the plot chart spreads out points that share a coordinate (see
904
+ * `PcacPlotChartConfig.pointFanOut`). Each group of coincident points is placed evenly around
905
+ * a ring centered on the shared coordinate, starting at 12 o'clock and going clockwise in data
906
+ * order (series order, then point order), so every point stays visible and hoverable.
907
+ */
908
+ declare class PcacPointFanOutConfig {
909
+ /**
910
+ * Ring radius in px, the same for every group. When not set, each group gets the smallest
911
+ * radius at which its neighbours sit `gap` px apart - so a pair barely moves while a group of
912
+ * five spreads as far as it has to.
913
+ */
914
+ radius?: number;
915
+ /**
916
+ * Space between neighbouring points on the ring, in px, when `radius` is not set. Measured
917
+ * between their image boxes (or hovered dots), not their centers.
918
+ */
919
+ gap: number;
920
+ /**
921
+ * Draw a dot at the shared coordinate - the value the group's points actually have - with a
922
+ * spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules.
923
+ */
924
+ showAnchor: boolean;
925
+ }
864
926
  declare class PcacPlotChartConfig extends PcacLineAreaChartConfig {
927
+ /**
928
+ * Spread points that share a coordinate around it instead of drawing them on top of one
929
+ * another (where only the last series' point shows, and only it can be hovered). Off when not
930
+ * set; `{}` turns it on with every `PcacPointFanOutConfig` default. The fanned points keep
931
+ * their true value in the tooltip, and the hovered point's tooltip context lists the others at
932
+ * its coordinate in `coincident` (see `PcacTooltipContext`).
933
+ *
934
+ * Plot chart only: a line or area chart's points are joined in series order, so moving one
935
+ * would kink the line.
936
+ */
937
+ pointFanOut?: Partial<PcacPointFanOutConfig>;
865
938
  }
866
939
 
867
940
  declare class PcacPlotChart {
@@ -949,5 +1022,5 @@ declare class PcacPieChartComponent {
949
1022
  static ɵcmp: i0.ɵɵComponentDeclaration<PcacPieChartComponent, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
950
1023
  }
951
1024
 
952
- export { BarHorizontalChartBuilder, BarVerticalChartBuilder, PCAC_AXIS_LABEL_SPACE, PCAC_AXIS_SUB_LABEL_SPACE, PcacAreaChart, PcacAreaChartConfig, PcacAxisBuilder, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChart, PcacChartConfig, PcacChartResizeService, PcacColorService, PcacData, PcacFormatEnum, PcacGridBuilder, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointImageConfig, PcacTooltipBuilder, PcacTooltipDirective, PcacTransitionService, PieChartBuilder, axisLabelSpace, hasAxisSubLabels, resolveAxisConfig };
953
- export type { IPcacAxisBuilderConfig, IPcacGridBuilderConfig, PcacChartMargin, PcacResolvedAxisConfig, PcacTooltipContext, PcacTooltipOptions };
1025
+ export { BarHorizontalChartBuilder, BarVerticalChartBuilder, PCAC_AXIS_LABEL_SPACE, PCAC_AXIS_SUB_LABEL_SPACE, PcacAreaChart, PcacAreaChartConfig, PcacAxisBuilder, PcacAxisChartConfig, PcacAxisConfig, PcacAxisSubLabels, PcacBarHorizontalChartColorOverrideConfig, PcacBarHorizontalChartComponent, PcacBarHorizontalChartConfig, PcacBarVerticalChartColorOverrideConfig, PcacBarVerticalChartComponent, PcacBarVerticalChartConfig, PcacChart, PcacChartConfig, PcacChartResizeService, PcacColorService, PcacData, PcacFormatEnum, PcacGridBuilder, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointFanOutConfig, PcacPointImageConfig, PcacTooltipBuilder, PcacTooltipDirective, PcacTransitionService, PieChartBuilder, axisLabelSpace, hasAxisSubLabels, resolveAxisConfig };
1026
+ export type { IPcacAxisBuilderConfig, IPcacGridBuilderConfig, PcacChartMargin, PcacResolvedAxisConfig, PcacTooltipCoincident, PcacTooltipContext, PcacTooltipOptions };