@pioneer-code/pioneer-charts 22.2.7 → 22.2.11

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.7",
25
+ "version": "22.2.11",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
28
  "@angular/common": "^22.1.0",
@@ -23,6 +23,78 @@
23
23
  fill: var(--pcac-fan-out-anchor-color, #{imports.$gray-600});
24
24
  }
25
25
 
26
+ // `pointRange` (see PcacPointRangeConfig): each point's `range`, drawn by the builder into a
27
+ // `.point-range` group per point, a `.point-range-series` group per series, and one
28
+ // `.point-ranges` group for the chart. Color is the config's `color` when set
29
+ // (`--pcac-point-range-color`, on `.point-ranges`, or a stylesheet's on any ancestor), else the
30
+ // series' own (`--pcac-point-range-series-color`, which the builder sets on each series group).
31
+ // The `pcac-range-<show>` class picks how strongly a range shows at rest; hover marks one
32
+ // `.is-focused` and the chart's `.point-ranges` `.has-focus`.
33
+ .point-ranges {
34
+ // Resolved on the series group, not here: a `var()` in a custom property is substituted where
35
+ // it's declared, and the series color only exists from the series group down.
36
+ .point-range-series {
37
+ --pcac-point-range-resolved-color: var(--pcac-point-range-color, var(--pcac-point-range-series-color));
38
+ }
39
+
40
+ .point-range {
41
+ opacity: var(--pcac-point-range-resting-opacity, 1);
42
+ transition: opacity 150ms ease-out;
43
+ }
44
+
45
+ .point-range.is-focused {
46
+ opacity: 1;
47
+ }
48
+
49
+ &.pcac-range-hover {
50
+ --pcac-point-range-resting-opacity: 0;
51
+ }
52
+
53
+ &.pcac-range-faint {
54
+ --pcac-point-range-resting-opacity: var(--pcac-point-range-faint-opacity, 0.2);
55
+ }
56
+
57
+ &.pcac-range-always.has-focus .point-range:not(.is-focused) {
58
+ opacity: 0.5;
59
+ }
60
+
61
+ .point-range-whisker,
62
+ .point-range-cap {
63
+ stroke: var(--pcac-point-range-resolved-color);
64
+ stroke-width: 1.25px;
65
+ }
66
+
67
+ .point-range-box {
68
+ fill: var(--pcac-point-range-resolved-color);
69
+ fill-opacity: 0.1;
70
+ stroke: var(--pcac-point-range-resolved-color);
71
+ stroke-opacity: 0.7;
72
+ stroke-width: 1.25px;
73
+ }
74
+
75
+ .point-range-stop {
76
+ stop-color: var(--pcac-point-range-resolved-color);
77
+ }
78
+
79
+ .is-focused {
80
+ .point-range-whisker,
81
+ .point-range-cap,
82
+ .point-range-box {
83
+ stroke-width: 1.75px;
84
+ }
85
+
86
+ .point-range-box {
87
+ fill-opacity: 0.18;
88
+ }
89
+ }
90
+
91
+ @media (prefers-reduced-motion: reduce) {
92
+ .point-range {
93
+ transition: none;
94
+ }
95
+ }
96
+ }
97
+
26
98
  .effects-canvas {
27
99
  fill: none;
28
100
  }
@@ -213,6 +213,34 @@ declare class PcacData {
213
213
  * existing object-literal / JSON data doesn't have to declare it.
214
214
  */
215
215
  image?: string;
216
+ /**
217
+ * The span this point's `key` / `value` stands for, when the point is really the middle of a
218
+ * range: `x` for the key, `y` for the value, either or both. Currently honored by the
219
+ * line/area/plot charts only, on the innermost (point-level) `PcacData`, and only drawn when
220
+ * the chart config turns `pointRange` on (see `PcacPointRangeConfig`). Nothing is labeled on
221
+ * the chart; a custom tooltip can read it off the point.
222
+ *
223
+ * Optional for the same reason as `image`.
224
+ */
225
+ range?: PcacDataRange;
226
+ }
227
+ /**
228
+ * One side of a `PcacDataRange`. `min` above `max` is read as the other way round; `min` equal to
229
+ * `max` (or either missing) as no range on that axis.
230
+ */
231
+ declare class PcacRangeBounds<T> {
232
+ min: T;
233
+ max: T;
234
+ }
235
+ /**
236
+ * `PcacData.range`. `x` is read the way the point's `key` is, per the chart's `xAxis.format`: a
237
+ * number for `Decimal`, anything `new Date()` accepts for `DateTime`, and for every index-based
238
+ * format a (possibly fractional) index - `{ min: 2.5, max: 3.5 }` is half a slot either side of
239
+ * the fourth point. `y` is on the value axis.
240
+ */
241
+ declare class PcacDataRange {
242
+ x?: PcacRangeBounds<number | string>;
243
+ y?: PcacRangeBounds<number>;
216
244
  }
217
245
  declare enum PcacFormatEnum {
218
246
  None = "none",
@@ -501,12 +529,14 @@ declare class PcacTooltipBuilder {
501
529
  */
502
530
  private view;
503
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;
504
534
  /**
505
- * Shows the tooltip for a hovered datum at the event's position. Renders `template` when the
506
- * chart has one projected; otherwise falls back to the default key/value content, formatted per
507
- * `valueFormat`/`keyFormat`.
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.
508
538
  */
509
- showTooltip(event: MouseEvent, template: TemplateRef<PcacTooltipContext> | undefined, context: PcacTooltipContext, valueFormat?: PcacFormatEnum, keyFormat?: PcacFormatEnum): void;
539
+ showTooltip(event: MouseEvent, template: TemplateRef<PcacTooltipContext> | undefined, context: PcacTooltipContext, valueFormat?: PcacFormatEnum, keyFormat?: PcacFormatEnum, anchor?: Element | null): void;
510
540
  /**
511
541
  * @deprecated Builders should call `PcacChart.showTooltip()`, which routes through a chart's
512
542
  * projected `pcacTooltip` template. This only ever renders the default content.
@@ -517,10 +547,24 @@ declare class PcacTooltipBuilder {
517
547
  private renderTemplate;
518
548
  private destroyView;
519
549
  /**
520
- * Centers the (already rendered) tooltip horizontally on the cursor and sits it just above.
521
- * Measured from the real box rather than fixed offsets so it works for content of any size.
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.
522
558
  */
523
- private position;
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;
524
568
  private getBarTipData;
525
569
  static ɵfac: i0.ɵɵFactoryDeclaration<PcacTooltipBuilder, never>;
526
570
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
@@ -541,6 +585,11 @@ interface PcacTooltipOptions {
541
585
  coincident?: PcacTooltipCoincident[];
542
586
  valueFormat?: PcacFormatEnum;
543
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;
544
593
  }
545
594
  declare class PcacChart {
546
595
  axisBuilder: PcacAxisBuilder;
@@ -906,6 +955,45 @@ declare class PcacPointImageConfig {
906
955
  maxWidth: number;
907
956
  maxHeight: number;
908
957
  }
958
+ /** How a point's `range` is drawn (see `PcacPointRangeConfig.style`). */
959
+ declare enum PcacPointRangeStyle {
960
+ /** Error bars: a line across each range, capped at both ends. */
961
+ Whiskers = "whiskers",
962
+ /** A rectangle spanning the x range by the y range; a thin strip when only one is set. */
963
+ Box = "box",
964
+ /**
965
+ * A fill strongest at the point's value and fading out to the range's edges: an oval glow
966
+ * with both ranges (brightest on the value, even off-center), a fading bar with one.
967
+ */
968
+ Fade = "fade"
969
+ }
970
+ /** When a point's `range` shows (see `PcacPointRangeConfig.show`). */
971
+ declare enum PcacPointRangeShow {
972
+ /** Only the hovered point's range. */
973
+ Hover = "hover",
974
+ /** Every range at `faintOpacity`, the hovered point's at full strength. */
975
+ Faint = "faint",
976
+ /** Every range at full strength; the others dim while a point is hovered. */
977
+ Always = "always"
978
+ }
979
+ /**
980
+ * Drawing for `PcacData.range` on the line/area/plot charts. Ranges sit above the lines/areas and
981
+ * below the points, on the point's true coordinate (a fanned-out point's range stays on its
982
+ * anchor), clipped to the plot area and following zoom. The chart draws no numbers for them; a
983
+ * custom tooltip gets the point, `range` included.
984
+ */
985
+ declare class PcacPointRangeConfig {
986
+ style: PcacPointRangeStyle;
987
+ show: PcacPointRangeShow;
988
+ /** Opacity of the ranges at rest under `show: Faint`, 0 - 1. */
989
+ faintOpacity: number;
990
+ /**
991
+ * Any CSS color for every range on the chart. Unset, each takes its series' color. Applied as
992
+ * `--pcac-point-range-color` on the chart's `.point-ranges` group, so a stylesheet can set it
993
+ * on an ancestor instead (a config value wins).
994
+ */
995
+ color?: string;
996
+ }
909
997
  /**
910
998
  * The axes' `format` and `domainMin`/`domainMax` (`PcacAxisConfig`) do more here than on the bar
911
999
  * charts. `yAxis.domainMin`/`domainMax` are the y scale's domain (default 0..100). `xAxis.format`
@@ -934,6 +1022,11 @@ declare class PcacLineAreaChartConfig extends PcacAxisChartConfig {
934
1022
  * on their data still gets a sensibly-sized result.
935
1023
  */
936
1024
  pointImage?: Partial<PcacPointImageConfig>;
1025
+ /**
1026
+ * Draw each point's `range` (see `PcacData.range`). Off when not set; `{}` turns it on with
1027
+ * every `PcacPointRangeConfig` default. Points without a `range` draw nothing extra.
1028
+ */
1029
+ pointRange?: Partial<PcacPointRangeConfig>;
937
1030
  }
938
1031
 
939
1032
  /**
@@ -1070,5 +1163,5 @@ declare class PcacPieChartComponent {
1070
1163
  static ɵcmp: i0.ɵɵComponentDeclaration<PcacPieChartComponent, "pcac-pie-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "sliceClicked": "sliceClicked"; }, ["tooltipTemplate"], never, true, never>;
1071
1164
  }
1072
1165
 
1073
- 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 };
1166
+ 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, PcacDataRange, PcacFormatEnum, PcacGridBuilder, PcacLegend, PcacLegendConfig, PcacLegendConfigItem, PcacLineChart, PcacLineChartConfig, PcacPieChartComponent, PcacPieChartConfig, PcacPlotChart, PcacPlotChartConfig, PcacPointFanOutConfig, PcacPointImageConfig, PcacPointRangeConfig, PcacPointRangeShow, PcacPointRangeStyle, PcacRangeBounds, PcacTooltipBuilder, PcacTooltipDirective, PcacTransitionService, PieChartBuilder, axisLabelSpace, hasAxisSubLabels, resolveAxisConfig };
1074
1167
  export type { IPcacAxisBuilderConfig, IPcacGridBuilderConfig, PcacChartMargin, PcacResolvedAxisConfig, PcacTooltipCoincident, PcacTooltipContext, PcacTooltipOptions };