@pioneer-code/pioneer-charts 22.2.5 → 22.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/pioneer-code-pioneer-charts.mjs +435 -29
- package/fesm2022/pioneer-code-pioneer-charts.mjs.map +1 -1
- package/package.json +1 -1
- package/scss/core/theme/imports.scss +3 -1
- package/scss/pioneer-charts.scss +25 -8
- package/scss/plot-line-area-chart/plot-line-area-chart.component.scss +76 -3
- package/themes/pioneer-charts.css +13 -6
- package/themes/pioneer-charts.min.css +1 -1
- package/types/pioneer-code-pioneer-charts.d.ts +126 -8
|
@@ -56,6 +56,11 @@ class PcacAxisSubLabels {
|
|
|
56
56
|
* Every field is optional so an object-literal / JSON config can give just the ones it cares
|
|
57
57
|
* about (or omit the axis entirely); the initializers apply to anything built with `new`, and
|
|
58
58
|
* `resolveAxisConfig()` fills the rest in for builders.
|
|
59
|
+
*
|
|
60
|
+
* The `*Color` fields each color one part of this axis, with any CSS color. Unset, the part keeps
|
|
61
|
+
* the theme's color. A color never turns a part on - it only shows once the part is drawn. Each
|
|
62
|
+
* is applied to the axis as the CSS custom property named on the field, so a stylesheet can set
|
|
63
|
+
* the same property on any ancestor instead; a config value wins.
|
|
59
64
|
*/
|
|
60
65
|
class PcacAxisConfig {
|
|
61
66
|
/**
|
|
@@ -73,6 +78,11 @@ class PcacAxisConfig {
|
|
|
73
78
|
* default.
|
|
74
79
|
*/
|
|
75
80
|
showGrid;
|
|
81
|
+
/**
|
|
82
|
+
* Grid line color (`--pcac-grid-color`), shown while this axis's grid is drawn - see `showGrid`.
|
|
83
|
+
* Theme default `$gray-200`.
|
|
84
|
+
*/
|
|
85
|
+
gridColor;
|
|
76
86
|
/**
|
|
77
87
|
* Requested number of ticks (D3's `ticks()` hint, so the actual count can differ slightly) -
|
|
78
88
|
* also the number of grid lines for this axis. Ignored by a category (band) axis, which has one
|
|
@@ -90,12 +100,26 @@ class PcacAxisConfig {
|
|
|
90
100
|
* (`.pcac-axis-tick-marks .tick line`, `$gray-900`, the same as the axis line).
|
|
91
101
|
*/
|
|
92
102
|
tickSize;
|
|
103
|
+
/**
|
|
104
|
+
* Tick mark color (`--pcac-axis-tick-color`), shown once `tickSize` has turned the marks on.
|
|
105
|
+
* Theme default `$gray-900`.
|
|
106
|
+
*/
|
|
107
|
+
tickColor;
|
|
108
|
+
/**
|
|
109
|
+
* Tick label color (`--pcac-axis-tick-label-color`) - the values along the axis. Default is the
|
|
110
|
+
* page's text color (`currentColor`), as d3-axis has always drawn them.
|
|
111
|
+
*/
|
|
112
|
+
tickLabelColor;
|
|
93
113
|
/**
|
|
94
114
|
* Draw a solid line along the axis itself (the full length of the axis, with D3's short
|
|
95
115
|
* end-caps). Off by default, as the theme has always hidden it. Color comes from the theme
|
|
96
116
|
* (`.pcac-axis-line .domain`, `$gray-900`).
|
|
97
117
|
*/
|
|
98
118
|
showLine = false;
|
|
119
|
+
/**
|
|
120
|
+
* Axis line color (`--pcac-axis-line-color`), shown with `showLine` on. Theme default `$gray-900`.
|
|
121
|
+
*/
|
|
122
|
+
lineColor;
|
|
99
123
|
/**
|
|
100
124
|
* A title for the whole axis (e.g. "Revenue ($)"), drawn centered along it just inside the
|
|
101
125
|
* chart's edge: below the tick labels for the x axis, rotated to read bottom-to-top left of
|
|
@@ -104,6 +128,8 @@ class PcacAxisConfig {
|
|
|
104
128
|
* by the theme's `.pcac-axis-label` rule.
|
|
105
129
|
*/
|
|
106
130
|
label;
|
|
131
|
+
/** `label` color (`--pcac-axis-label-color`). Theme default `$gray-700`. */
|
|
132
|
+
labelColor;
|
|
107
133
|
/**
|
|
108
134
|
* Min / mid / max sub labels (e.g. "Low" / "Medium" / "High") in their own row just outside the
|
|
109
135
|
* tick labels, and inside the `label` if there is one: `min` left-aligned at the axis's start,
|
|
@@ -113,6 +139,8 @@ class PcacAxisConfig {
|
|
|
113
139
|
* hidden axis. Styled by the theme's `.pcac-axis-sub-label` rule.
|
|
114
140
|
*/
|
|
115
141
|
subLabels;
|
|
142
|
+
/** `subLabels` color, all three (`--pcac-axis-sub-label-color`). Theme default `$gray-600`. */
|
|
143
|
+
subLabelColor;
|
|
116
144
|
/**
|
|
117
145
|
* How the values along this axis are interpreted and shown - the tick labels, and the value
|
|
118
146
|
* (`yAxis`) or key (`xAxis`) in the default tooltip. On the line/area/plot charts the x axis's
|
|
@@ -159,14 +187,14 @@ function axisLabelSpace(axis) {
|
|
|
159
187
|
*/
|
|
160
188
|
function resolveAxisConfig(axis, showGridDefault = false) {
|
|
161
189
|
const defaults = new PcacAxisConfig();
|
|
190
|
+
// The optional fields (see `PcacOptionalAxisFields`) pass through as given; only the ones with
|
|
191
|
+
// a default are spelled out.
|
|
162
192
|
return {
|
|
193
|
+
...axis,
|
|
163
194
|
hide: axis?.hide ?? defaults.hide,
|
|
164
195
|
showGrid: axis?.showGrid ?? showGridDefault,
|
|
165
196
|
ticks: axis?.ticks ?? defaults.ticks,
|
|
166
|
-
tickSize: axis?.tickSize,
|
|
167
197
|
showLine: axis?.showLine ?? defaults.showLine,
|
|
168
|
-
label: axis?.label,
|
|
169
|
-
subLabels: axis?.subLabels,
|
|
170
198
|
format: axis?.format ?? defaults.format,
|
|
171
199
|
domainMin: axis?.domainMin ?? defaults.domainMin,
|
|
172
200
|
domainMax: axis?.domainMax ?? defaults.domainMax,
|
|
@@ -194,6 +222,34 @@ class PcacData {
|
|
|
194
222
|
* existing object-literal / JSON data doesn't have to declare it.
|
|
195
223
|
*/
|
|
196
224
|
image;
|
|
225
|
+
/**
|
|
226
|
+
* The span this point's `key` / `value` stands for, when the point is really the middle of a
|
|
227
|
+
* range: `x` for the key, `y` for the value, either or both. Currently honored by the
|
|
228
|
+
* line/area/plot charts only, on the innermost (point-level) `PcacData`, and only drawn when
|
|
229
|
+
* the chart config turns `pointRange` on (see `PcacPointRangeConfig`). Nothing is labeled on
|
|
230
|
+
* the chart; a custom tooltip can read it off the point.
|
|
231
|
+
*
|
|
232
|
+
* Optional for the same reason as `image`.
|
|
233
|
+
*/
|
|
234
|
+
range;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* One side of a `PcacDataRange`. `min` above `max` is read as the other way round; `min` equal to
|
|
238
|
+
* `max` (or either missing) as no range on that axis.
|
|
239
|
+
*/
|
|
240
|
+
class PcacRangeBounds {
|
|
241
|
+
min;
|
|
242
|
+
max;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* `PcacData.range`. `x` is read the way the point's `key` is, per the chart's `xAxis.format`: a
|
|
246
|
+
* number for `Decimal`, anything `new Date()` accepts for `DateTime`, and for every index-based
|
|
247
|
+
* format a (possibly fractional) index - `{ min: 2.5, max: 3.5 }` is half a slot either side of
|
|
248
|
+
* the fourth point. `y` is on the value axis.
|
|
249
|
+
*/
|
|
250
|
+
class PcacDataRange {
|
|
251
|
+
x;
|
|
252
|
+
y;
|
|
197
253
|
}
|
|
198
254
|
var PcacFormatEnum;
|
|
199
255
|
(function (PcacFormatEnum) {
|
|
@@ -254,7 +310,8 @@ class PcacAxisBuilder {
|
|
|
254
310
|
.attr('pointer-events', 'none')
|
|
255
311
|
.classed('pcac-axis-tick-marks', config.yAxis.tickSize !== undefined)
|
|
256
312
|
.classed('pcac-axis-line', config.yAxis.showLine)
|
|
257
|
-
.call(yAxis)
|
|
313
|
+
.call(yAxis)
|
|
314
|
+
.call(applyColors, config.yAxis);
|
|
258
315
|
this.drawLabels(group, config.yAxis, { length: config.height, outer: config.margin.left, vertical: true });
|
|
259
316
|
}
|
|
260
317
|
drawXAxis(config) {
|
|
@@ -293,7 +350,8 @@ class PcacAxisBuilder {
|
|
|
293
350
|
.classed('pcac-axis-tick-marks', config.xAxis.tickSize !== undefined)
|
|
294
351
|
.classed('pcac-axis-line', config.xAxis.showLine)
|
|
295
352
|
.attr('transform', 'translate(0,' + config.height + ')')
|
|
296
|
-
.call(xAxis)
|
|
353
|
+
.call(xAxis)
|
|
354
|
+
.call(applyColors, config.xAxis);
|
|
297
355
|
this.drawLabels(group, config.xAxis, { length: config.width, outer: config.margin.bottom, vertical: false });
|
|
298
356
|
}
|
|
299
357
|
/**
|
|
@@ -340,6 +398,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
340
398
|
providedIn: 'root',
|
|
341
399
|
}]
|
|
342
400
|
}] });
|
|
401
|
+
/**
|
|
402
|
+
* Sets the axis's `*Color` fields on its group as CSS custom properties, which the theme reads
|
|
403
|
+
* with its own color as the fallback (`var(--pcac-axis-tick-color, ...)`). Custom properties
|
|
404
|
+
* rather than inline `stroke`/`fill` on the elements: the theme still decides what is drawn (a
|
|
405
|
+
* color never un-hides marks or the line), the property reaches everything d3-axis draws in the
|
|
406
|
+
* group, and a stylesheet can set the same property on any ancestor. An unset field sets nothing.
|
|
407
|
+
*/
|
|
408
|
+
function applyColors(group, axis) {
|
|
409
|
+
group
|
|
410
|
+
.style('--pcac-axis-tick-color', () => axis.tickColor ?? null)
|
|
411
|
+
.style('--pcac-axis-tick-label-color', () => axis.tickLabelColor ?? null)
|
|
412
|
+
.style('--pcac-axis-line-color', () => axis.lineColor ?? null)
|
|
413
|
+
.style('--pcac-axis-label-color', () => axis.labelColor ?? null)
|
|
414
|
+
.style('--pcac-axis-sub-label-color', () => axis.subLabelColor ?? null);
|
|
415
|
+
}
|
|
343
416
|
/**
|
|
344
417
|
* Tick labels for a `Decimal` axis: SI-prefixed (`1.5k`), with the precision taken from the
|
|
345
418
|
* scale's own tick step rather than fixed. A fixed two significant digits (`.2s`) is fine for a
|
|
@@ -373,6 +446,7 @@ class PcacGridBuilder {
|
|
|
373
446
|
drawVerticalGrid(config) {
|
|
374
447
|
config.svg.append('g')
|
|
375
448
|
.attr('class', 'pcac-grid pcac-grid-vertical')
|
|
449
|
+
.style('--pcac-grid-color', () => config.color ?? null)
|
|
376
450
|
.selectAll('g.rule')
|
|
377
451
|
.data(gridLines(config.xScale, config.numberOfTicks))
|
|
378
452
|
.enter().append('svg:g')
|
|
@@ -389,6 +463,7 @@ class PcacGridBuilder {
|
|
|
389
463
|
drawHorizontalGrid(config) {
|
|
390
464
|
config.svg.append('g')
|
|
391
465
|
.attr('class', 'pcac-grid pcac-grid-horizontal')
|
|
466
|
+
.style('--pcac-grid-color', () => config.color ?? null)
|
|
392
467
|
.selectAll('g.pcac-grid-rule')
|
|
393
468
|
.data(gridLines(config.yScale, config.numberOfTicks))
|
|
394
469
|
.enter().append('svg:g')
|
|
@@ -432,12 +507,12 @@ class PcacColorService {
|
|
|
432
507
|
* @param numberOfNodes Number of items in dynamically build collection of colors
|
|
433
508
|
*/
|
|
434
509
|
getColorScale(numberOfNodes) {
|
|
435
|
-
const
|
|
510
|
+
const palette = [];
|
|
436
511
|
for (let i = 0; i < numberOfNodes; i++) {
|
|
437
512
|
const mark = i % this.scale.length;
|
|
438
|
-
|
|
513
|
+
palette.push(this.scale[mark]);
|
|
439
514
|
}
|
|
440
|
-
return
|
|
515
|
+
return palette;
|
|
441
516
|
}
|
|
442
517
|
getAlert() {
|
|
443
518
|
return this.alert;
|
|
@@ -772,10 +847,10 @@ class PcacChart {
|
|
|
772
847
|
drawGrids(xScale, yScale, which = 'both') {
|
|
773
848
|
const base = { svg: this.svg, width: this.width, height: this.height, xScale, yScale };
|
|
774
849
|
if (which !== 'y' && this.xAxis.showGrid) {
|
|
775
|
-
this.gridBuilder.drawVerticalGrid({ ...base, numberOfTicks: this.xAxis.ticks });
|
|
850
|
+
this.gridBuilder.drawVerticalGrid({ ...base, numberOfTicks: this.xAxis.ticks, color: this.xAxis.gridColor });
|
|
776
851
|
}
|
|
777
852
|
if (which !== 'x' && this.yAxis.showGrid) {
|
|
778
|
-
this.gridBuilder.drawHorizontalGrid({ ...base, numberOfTicks: this.yAxis.ticks });
|
|
853
|
+
this.gridBuilder.drawHorizontalGrid({ ...base, numberOfTicks: this.yAxis.ticks, color: this.yAxis.gridColor });
|
|
779
854
|
}
|
|
780
855
|
}
|
|
781
856
|
/**
|
|
@@ -1788,6 +1863,47 @@ class PcacPointImageConfig {
|
|
|
1788
1863
|
maxWidth = 16;
|
|
1789
1864
|
maxHeight = 16;
|
|
1790
1865
|
}
|
|
1866
|
+
/** How a point's `range` is drawn (see `PcacPointRangeConfig.style`). */
|
|
1867
|
+
var PcacPointRangeStyle;
|
|
1868
|
+
(function (PcacPointRangeStyle) {
|
|
1869
|
+
/** Error bars: a line across each range, capped at both ends. */
|
|
1870
|
+
PcacPointRangeStyle["Whiskers"] = "whiskers";
|
|
1871
|
+
/** A rectangle spanning the x range by the y range; a thin strip when only one is set. */
|
|
1872
|
+
PcacPointRangeStyle["Box"] = "box";
|
|
1873
|
+
/**
|
|
1874
|
+
* A fill strongest at the point's value and fading out to the range's edges: an oval glow
|
|
1875
|
+
* with both ranges (brightest on the value, even off-center), a fading bar with one.
|
|
1876
|
+
*/
|
|
1877
|
+
PcacPointRangeStyle["Fade"] = "fade";
|
|
1878
|
+
})(PcacPointRangeStyle || (PcacPointRangeStyle = {}));
|
|
1879
|
+
/** When a point's `range` shows (see `PcacPointRangeConfig.show`). */
|
|
1880
|
+
var PcacPointRangeShow;
|
|
1881
|
+
(function (PcacPointRangeShow) {
|
|
1882
|
+
/** Only the hovered point's range. */
|
|
1883
|
+
PcacPointRangeShow["Hover"] = "hover";
|
|
1884
|
+
/** Every range at `faintOpacity`, the hovered point's at full strength. */
|
|
1885
|
+
PcacPointRangeShow["Faint"] = "faint";
|
|
1886
|
+
/** Every range at full strength; the others dim while a point is hovered. */
|
|
1887
|
+
PcacPointRangeShow["Always"] = "always";
|
|
1888
|
+
})(PcacPointRangeShow || (PcacPointRangeShow = {}));
|
|
1889
|
+
/**
|
|
1890
|
+
* Drawing for `PcacData.range` on the line/area/plot charts. Ranges sit above the lines/areas and
|
|
1891
|
+
* below the points, on the point's true coordinate (a fanned-out point's range stays on its
|
|
1892
|
+
* anchor), clipped to the plot area and following zoom. The chart draws no numbers for them; a
|
|
1893
|
+
* custom tooltip gets the point, `range` included.
|
|
1894
|
+
*/
|
|
1895
|
+
class PcacPointRangeConfig {
|
|
1896
|
+
style = PcacPointRangeStyle.Whiskers;
|
|
1897
|
+
show = PcacPointRangeShow.Faint;
|
|
1898
|
+
/** Opacity of the ranges at rest under `show: Faint`, 0 - 1. */
|
|
1899
|
+
faintOpacity = 0.2;
|
|
1900
|
+
/**
|
|
1901
|
+
* Any CSS color for every range on the chart. Unset, each takes its series' color. Applied as
|
|
1902
|
+
* `--pcac-point-range-color` on the chart's `.point-ranges` group, so a stylesheet can set it
|
|
1903
|
+
* on an ancestor instead (a config value wins).
|
|
1904
|
+
*/
|
|
1905
|
+
color;
|
|
1906
|
+
}
|
|
1791
1907
|
/**
|
|
1792
1908
|
* The axes' `format` and `domainMin`/`domainMax` (`PcacAxisConfig`) do more here than on the bar
|
|
1793
1909
|
* charts. `yAxis.domainMin`/`domainMax` are the y scale's domain (default 0..100). `xAxis.format`
|
|
@@ -1816,6 +1932,11 @@ class PcacLineAreaChartConfig extends PcacAxisChartConfig {
|
|
|
1816
1932
|
* on their data still gets a sensibly-sized result.
|
|
1817
1933
|
*/
|
|
1818
1934
|
pointImage;
|
|
1935
|
+
/**
|
|
1936
|
+
* Draw each point's `range` (see `PcacData.range`). Off when not set; `{}` turns it on with
|
|
1937
|
+
* every `PcacPointRangeConfig` default. Points without a `range` draw nothing extra.
|
|
1938
|
+
*/
|
|
1939
|
+
pointRange;
|
|
1819
1940
|
}
|
|
1820
1941
|
|
|
1821
1942
|
/**
|
|
@@ -1983,20 +2104,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
1983
2104
|
class PcacPointFanOutConfig {
|
|
1984
2105
|
/**
|
|
1985
2106
|
* Ring radius in px, the same for every group. When not set, each group gets the smallest
|
|
1986
|
-
* radius at which its
|
|
2107
|
+
* radius at which its neighbors sit `gap` px apart - so a pair barely moves while a group of
|
|
1987
2108
|
* five spreads as far as it has to.
|
|
1988
2109
|
*/
|
|
1989
2110
|
radius;
|
|
1990
2111
|
/**
|
|
1991
|
-
* Space between
|
|
2112
|
+
* Space between neighboring points on the ring, in px, when `radius` is not set. Measured
|
|
1992
2113
|
* between their image boxes (or hovered dots), not their centers.
|
|
1993
2114
|
*/
|
|
1994
2115
|
gap = 4;
|
|
1995
2116
|
/**
|
|
1996
2117
|
* Draw a dot at the shared coordinate - the value the group's points actually have - with a
|
|
1997
|
-
* spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules
|
|
2118
|
+
* spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules,
|
|
2119
|
+
* whose colors `anchorColor` / `spokeColor` override.
|
|
1998
2120
|
*/
|
|
1999
2121
|
showAnchor = true;
|
|
2122
|
+
/**
|
|
2123
|
+
* Spoke color, any CSS color; theme default `$gray-400`. Applied as `--pcac-fan-out-spoke-color`
|
|
2124
|
+
* on the chart's `.fan-outs` group, so a stylesheet can set it on an ancestor instead (a config
|
|
2125
|
+
* value wins). Needs `showAnchor`.
|
|
2126
|
+
*/
|
|
2127
|
+
spokeColor;
|
|
2128
|
+
/** Anchor dot color, likewise (`--pcac-fan-out-anchor-color`); theme default `$gray-600`. */
|
|
2129
|
+
anchorColor;
|
|
2000
2130
|
}
|
|
2001
2131
|
class PcacPlotChartConfig extends PcacLineAreaChartConfig {
|
|
2002
2132
|
/**
|
|
@@ -2114,6 +2244,161 @@ function buildZoomBehavior(width, height, zoomedFn) {
|
|
|
2114
2244
|
.on("zoom", zoomedFn);
|
|
2115
2245
|
}
|
|
2116
2246
|
|
|
2247
|
+
/** Half the length of a whisker's end cap, in px. */
|
|
2248
|
+
const RANGE_CAP = 5;
|
|
2249
|
+
/** How thick a box is drawn along an axis the point has no range on, in px. */
|
|
2250
|
+
const RANGE_STRIP = 4;
|
|
2251
|
+
/** How thick a fade is drawn along an axis the point has no range on, in px. */
|
|
2252
|
+
const RANGE_FADE_BAR = 10;
|
|
2253
|
+
/**
|
|
2254
|
+
* Where an x range bound lands, read the way `getXFormat` reads a key: a date for `DateTime`, a
|
|
2255
|
+
* number for `Decimal`, and a (possibly fractional) index for every index-based format. `NaN`
|
|
2256
|
+
* for anything that doesn't parse.
|
|
2257
|
+
*/
|
|
2258
|
+
function xBound(value, format, scales) {
|
|
2259
|
+
if (value === null || value === undefined || value === '') {
|
|
2260
|
+
return NaN;
|
|
2261
|
+
}
|
|
2262
|
+
if (format === PcacFormatEnum.DateTime) {
|
|
2263
|
+
return scales.x(new Date(value));
|
|
2264
|
+
}
|
|
2265
|
+
return scales.x(Number(value));
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Sorts a pair of pixel bounds, or returns nothing if either isn't a real number - or if they're
|
|
2269
|
+
* the same, since a range that doesn't span anything has nothing to draw (whiskers would be a
|
|
2270
|
+
* stray pair of caps, a box or fade zero-sized).
|
|
2271
|
+
*/
|
|
2272
|
+
function span(a, b) {
|
|
2273
|
+
if (!Number.isFinite(a) || !Number.isFinite(b) || a === b) {
|
|
2274
|
+
return undefined;
|
|
2275
|
+
}
|
|
2276
|
+
return a <= b ? [a, b] : [b, a];
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* `d`'s range at these scales, drawn around `(cx, cy)` - the point's true coordinate - or `null`
|
|
2280
|
+
* when it has no range on either axis that can be placed.
|
|
2281
|
+
*/
|
|
2282
|
+
function rangeExtent(d, cx, cy, format, scales) {
|
|
2283
|
+
const range = d.range;
|
|
2284
|
+
if (!range) {
|
|
2285
|
+
return null;
|
|
2286
|
+
}
|
|
2287
|
+
const xs = range.x ? span(xBound(range.x.min, format, scales), xBound(range.x.max, format, scales)) : undefined;
|
|
2288
|
+
const ys = range.y ? span(scales.y(Number(range.y.min)), scales.y(Number(range.y.max))) : undefined;
|
|
2289
|
+
if (!xs && !ys) {
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
const extent = { cx, cy };
|
|
2293
|
+
if (xs) {
|
|
2294
|
+
[extent.x0, extent.x1] = xs;
|
|
2295
|
+
}
|
|
2296
|
+
if (ys) {
|
|
2297
|
+
[extent.y0, extent.y1] = ys;
|
|
2298
|
+
}
|
|
2299
|
+
return extent;
|
|
2300
|
+
}
|
|
2301
|
+
/**
|
|
2302
|
+
* Where the point sits within its range's box, as 0 - 1 fractions: the fade's brightest spot.
|
|
2303
|
+
* An axis without a range has the point in the middle.
|
|
2304
|
+
*/
|
|
2305
|
+
function rangeFocus(extent) {
|
|
2306
|
+
const fraction = (v, lo, hi) => lo === undefined || hi === undefined || hi === lo ? 0.5 : Math.min(1, Math.max(0, (v - lo) / (hi - lo)));
|
|
2307
|
+
return { fx: fraction(extent.cx, extent.x0, extent.x1), fy: fraction(extent.cy, extent.y0, extent.y1) };
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* (Re)draws one point's range into `group`, in plot coordinates, replacing whatever was there -
|
|
2311
|
+
* the same call serves the first draw and every zoom. `gradientId` must be unique in the page;
|
|
2312
|
+
* only the fade uses it. Colors, stroke widths and opacity all come from the theme (see
|
|
2313
|
+
* plot-line-area-chart.component.scss), so nothing here depends on the series.
|
|
2314
|
+
*/
|
|
2315
|
+
function drawRange(group, extent, style, gradientId) {
|
|
2316
|
+
group.selectAll('*').remove();
|
|
2317
|
+
const { cx, cy, x0, x1, y0, y1 } = extent;
|
|
2318
|
+
switch (style) {
|
|
2319
|
+
case PcacPointRangeStyle.Box: {
|
|
2320
|
+
const left = x0 ?? cx - RANGE_STRIP / 2;
|
|
2321
|
+
const right = x1 ?? cx + RANGE_STRIP / 2;
|
|
2322
|
+
const top = y0 ?? cy - RANGE_STRIP / 2;
|
|
2323
|
+
const bottom = y1 ?? cy + RANGE_STRIP / 2;
|
|
2324
|
+
group.append('rect')
|
|
2325
|
+
.attr('class', 'point-range-box')
|
|
2326
|
+
.attr('x', left)
|
|
2327
|
+
.attr('y', top)
|
|
2328
|
+
.attr('width', right - left)
|
|
2329
|
+
.attr('height', bottom - top)
|
|
2330
|
+
.attr('rx', 2);
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
case PcacPointRangeStyle.Fade: {
|
|
2334
|
+
const { fx, fy } = rangeFocus(extent);
|
|
2335
|
+
const stops = (gradient, offsets) => {
|
|
2336
|
+
for (const [offset, opacity] of offsets) {
|
|
2337
|
+
gradient.append('stop')
|
|
2338
|
+
.attr('class', 'point-range-stop')
|
|
2339
|
+
.attr('offset', offset)
|
|
2340
|
+
.attr('stop-opacity', opacity);
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
// The gradient lives inside the point's own group, not the chart's <defs>, so its stops
|
|
2344
|
+
// inherit the color custom properties set on the series group above it. Sized in
|
|
2345
|
+
// objectBoundingBox units, so the brightest spot stays on the point as zoom stretches it.
|
|
2346
|
+
const defs = group.append('defs');
|
|
2347
|
+
if (x0 !== undefined && x1 !== undefined && y0 !== undefined && y1 !== undefined) {
|
|
2348
|
+
const gradient = defs.append('radialGradient')
|
|
2349
|
+
.attr('id', gradientId)
|
|
2350
|
+
.attr('cx', 0.5).attr('cy', 0.5).attr('r', 0.5)
|
|
2351
|
+
.attr('fx', fx).attr('fy', fy);
|
|
2352
|
+
stops(gradient, [[0, 0.8], [0.5, 0.35], [1, 0]]);
|
|
2353
|
+
group.append('ellipse')
|
|
2354
|
+
.attr('class', 'point-range-fade')
|
|
2355
|
+
.attr('cx', (x0 + x1) / 2)
|
|
2356
|
+
.attr('cy', (y0 + y1) / 2)
|
|
2357
|
+
.attr('rx', (x1 - x0) / 2)
|
|
2358
|
+
.attr('ry', (y1 - y0) / 2)
|
|
2359
|
+
.attr('fill', `url(#${gradientId})`);
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
const vertical = y0 !== undefined && y1 !== undefined;
|
|
2363
|
+
const gradient = defs.append('linearGradient')
|
|
2364
|
+
.attr('id', gradientId)
|
|
2365
|
+
.attr('x1', 0).attr('y1', 0)
|
|
2366
|
+
.attr('x2', vertical ? 0 : 1).attr('y2', vertical ? 1 : 0);
|
|
2367
|
+
stops(gradient, [[0, 0.05], [vertical ? fy : fx, 0.8], [1, 0.05]]);
|
|
2368
|
+
const left = x0 ?? cx - RANGE_FADE_BAR / 2;
|
|
2369
|
+
const right = x1 ?? cx + RANGE_FADE_BAR / 2;
|
|
2370
|
+
const top = y0 ?? cy - RANGE_FADE_BAR / 2;
|
|
2371
|
+
const bottom = y1 ?? cy + RANGE_FADE_BAR / 2;
|
|
2372
|
+
group.append('rect')
|
|
2373
|
+
.attr('class', 'point-range-fade')
|
|
2374
|
+
.attr('x', left)
|
|
2375
|
+
.attr('y', top)
|
|
2376
|
+
.attr('width', right - left)
|
|
2377
|
+
.attr('height', bottom - top)
|
|
2378
|
+
.attr('rx', RANGE_FADE_BAR / 2)
|
|
2379
|
+
.attr('fill', `url(#${gradientId})`);
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
default: {
|
|
2383
|
+
// Whiskers
|
|
2384
|
+
const line = (xa, ya, xb, yb, cls) => group.append('line')
|
|
2385
|
+
.attr('class', cls)
|
|
2386
|
+
.attr('x1', xa).attr('y1', ya)
|
|
2387
|
+
.attr('x2', xb).attr('y2', yb);
|
|
2388
|
+
if (y0 !== undefined && y1 !== undefined) {
|
|
2389
|
+
line(cx, y0, cx, y1, 'point-range-whisker');
|
|
2390
|
+
line(cx - RANGE_CAP, y0, cx + RANGE_CAP, y0, 'point-range-cap');
|
|
2391
|
+
line(cx - RANGE_CAP, y1, cx + RANGE_CAP, y1, 'point-range-cap');
|
|
2392
|
+
}
|
|
2393
|
+
if (x0 !== undefined && x1 !== undefined) {
|
|
2394
|
+
line(x0, cy, x1, cy, 'point-range-whisker');
|
|
2395
|
+
line(x0, cy - RANGE_CAP, x0, cy + RANGE_CAP, 'point-range-cap');
|
|
2396
|
+
line(x1, cy - RANGE_CAP, x1, cy + RANGE_CAP, 'point-range-cap');
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2117
2402
|
/**
|
|
2118
2403
|
* Finds every set of points that share a coordinate across all of the chart's visible series.
|
|
2119
2404
|
* Coincidence is decided from the data rather than from scaled pixels, so this can run before
|
|
@@ -2159,7 +2444,7 @@ function xPositionKey(xFormat, data, index) {
|
|
|
2159
2444
|
}
|
|
2160
2445
|
/**
|
|
2161
2446
|
* The smallest ring radius at which `count` marks of `size` px sit `gap` px apart from their
|
|
2162
|
-
*
|
|
2447
|
+
* neighbors: the chord between adjacent ring positions is `2r sin(π/n)`, so solve it for
|
|
2163
2448
|
* `size + gap`. A pair (n = 2) lands `size + gap` apart along a diameter, as expected.
|
|
2164
2449
|
*/
|
|
2165
2450
|
function fanOutRadius(count, size, gap) {
|
|
@@ -2230,6 +2515,17 @@ function clamp(value, min, max) {
|
|
|
2230
2515
|
*/
|
|
2231
2516
|
/** Half the theme's 2px line stroke: how far the lines/areas/fan-outs clip-path reaches past the plot. */
|
|
2232
2517
|
const PLOT_CLIP_ALLOWANCE = 1;
|
|
2518
|
+
/**
|
|
2519
|
+
* Names for the dot's transitions. d3 lets only one transition *per name* run on an element: a
|
|
2520
|
+
* new one cancels the old. The enter rise (`cy`) keeps the default name; the hover grow/shrink
|
|
2521
|
+
* and the entry's size-in (`r`) each get their own, so hovering a dot while the chart is still
|
|
2522
|
+
* animating in no longer cancels its rise and strands it short of its value. Hover interrupts
|
|
2523
|
+
* the size-in explicitly instead, since both tween `r`.
|
|
2524
|
+
*/
|
|
2525
|
+
const DOT_GROW_TRANSITION = 'pcac-dot-grow';
|
|
2526
|
+
const DOT_HOVER_TRANSITION = 'pcac-dot-hover';
|
|
2527
|
+
/** See `revealAfterEntry`. */
|
|
2528
|
+
const REVEAL_TRANSITION = 'pcac-reveal';
|
|
2233
2529
|
class PlaChartBuilder extends PcacChart {
|
|
2234
2530
|
effectsBuilder = inject(PlaChartEffectsBuilder);
|
|
2235
2531
|
scales;
|
|
@@ -2270,6 +2566,10 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2270
2566
|
fanOutOffsets = new Map();
|
|
2271
2567
|
/** The `.point` group under the cursor, between its mouseover and mouseout (see `leavePoint`). */
|
|
2272
2568
|
hoveredPoint = null;
|
|
2569
|
+
/** `config.pointRange` with its defaults applied, or `null` while ranges are off. */
|
|
2570
|
+
pointRange = null;
|
|
2571
|
+
/** Each drawn range's `.point-range` group, by its point, so hover can find the one to focus. */
|
|
2572
|
+
rangeGroupOf = new Map();
|
|
2273
2573
|
dotClicked$ = this.dotClickedSource.asObservable();
|
|
2274
2574
|
buildChart(chartElm, config, type) {
|
|
2275
2575
|
if (!config?.data?.length) {
|
|
@@ -2289,6 +2589,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2289
2589
|
this.initializeAxisState(this.config, 'y', 8);
|
|
2290
2590
|
this.resolvePointLayout(type);
|
|
2291
2591
|
this.reservePointSpace();
|
|
2592
|
+
this.pointRange = this.config.pointRange ? { ...new PcacPointRangeConfig(), ...this.config.pointRange } : null;
|
|
2292
2593
|
if (!this.initializeChartState(chartElm, this.config)) {
|
|
2293
2594
|
return;
|
|
2294
2595
|
}
|
|
@@ -2356,8 +2657,12 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2356
2657
|
if (this.config.enableEffects) {
|
|
2357
2658
|
this.effectsBuilder.updateScales(newX, newY);
|
|
2358
2659
|
}
|
|
2660
|
+
// Ranges are drawn in plot coordinates rather than hung off a translate, so every one is
|
|
2661
|
+
// redrawn against the zoomed scales.
|
|
2662
|
+
this.updatePointRanges(zoomedScales);
|
|
2359
2663
|
// Redrawing an axis appends it at the end of the group, above the dots; put them back
|
|
2360
2664
|
// on top so a point on the baseline isn't covered (see drawChart's draw order).
|
|
2665
|
+
this.svg.selectAll('.point-ranges').raise();
|
|
2361
2666
|
this.svg.selectAll('.fan-outs').raise();
|
|
2362
2667
|
this.svg.selectAll('.dots').raise();
|
|
2363
2668
|
});
|
|
@@ -2384,8 +2689,10 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2384
2689
|
}
|
|
2385
2690
|
// Axes above the lines/areas (so an axis line isn't covered by a series sitting at x = 0),
|
|
2386
2691
|
// but the dots above the axes: a point on the baseline or the y axis stays whole. Fan-out
|
|
2387
|
-
// spokes go between the two so they run underneath the points they lead to
|
|
2692
|
+
// spokes go between the two so they run underneath the points they lead to, and point
|
|
2693
|
+
// ranges under those.
|
|
2388
2694
|
this.axisBuilder.raiseAxes(this.svg);
|
|
2695
|
+
this.drawPointRanges();
|
|
2389
2696
|
this.drawFanOuts();
|
|
2390
2697
|
this.drawDots(config);
|
|
2391
2698
|
}
|
|
@@ -2536,6 +2843,80 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2536
2843
|
.duration(this.transitionService.getTransitionDuration())
|
|
2537
2844
|
.attr('d', this.areaGenerator);
|
|
2538
2845
|
}
|
|
2846
|
+
/**
|
|
2847
|
+
* Draws one `<g class="point-ranges">` holding a group per series and, inside it, a
|
|
2848
|
+
* `<g class="point-range">` per point that has a `range` - only while `pointRange` is on. Clipped
|
|
2849
|
+
* to the plot area and deaf to the pointer, so it never gets in the way of hover or zoom. When
|
|
2850
|
+
* each range shows is entirely the theme's business, driven by classes: `pcac-range-<show>` on
|
|
2851
|
+
* the outer group sets the resting opacity, and hover (`focusPointRange`) marks the hovered
|
|
2852
|
+
* point's range `is-focused` and the outer group `has-focus`. The colors are custom properties
|
|
2853
|
+
* - the series' own on its group, `color` (when set) on the outer one, which wins - see
|
|
2854
|
+
* plot-line-area-chart.component.scss.
|
|
2855
|
+
*/
|
|
2856
|
+
drawPointRanges() {
|
|
2857
|
+
this.rangeGroupOf = new Map();
|
|
2858
|
+
if (!this.pointRange) {
|
|
2859
|
+
return;
|
|
2860
|
+
}
|
|
2861
|
+
const { show, faintOpacity, color } = this.pointRange;
|
|
2862
|
+
const layer = this.svg.append('g')
|
|
2863
|
+
.attr('class', `point-ranges pcac-range-${show}`)
|
|
2864
|
+
.attr('clip-path', `url(#${this.plotClipPathId})`)
|
|
2865
|
+
.attr('pointer-events', 'none')
|
|
2866
|
+
.style('--pcac-point-range-color', () => color ?? null)
|
|
2867
|
+
.style('--pcac-point-range-faint-opacity', () => faintOpacity);
|
|
2868
|
+
this.config.data.forEach((series, seriesIndex) => {
|
|
2869
|
+
const seriesGroup = layer.append('g')
|
|
2870
|
+
.attr('class', 'point-range-series')
|
|
2871
|
+
.style('--pcac-point-range-series-color', () => this.colors[seriesIndex])
|
|
2872
|
+
.style('display', () => series.hide ? 'none' : null);
|
|
2873
|
+
series.data.forEach((point) => {
|
|
2874
|
+
if (point.range) {
|
|
2875
|
+
this.rangeGroupOf.set(point, seriesGroup.append('g').attr('class', 'point-range').node());
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
});
|
|
2879
|
+
this.updatePointRanges(this.scales);
|
|
2880
|
+
this.revealAfterEntry(layer);
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Draws every range against `scales`, around its point's true coordinate - a fanned-out point's
|
|
2884
|
+
* range stays on the anchor, not on the ring. A range with nothing placeable is left empty.
|
|
2885
|
+
*/
|
|
2886
|
+
updatePointRanges(scales) {
|
|
2887
|
+
if (!this.pointRange) {
|
|
2888
|
+
return;
|
|
2889
|
+
}
|
|
2890
|
+
const style = this.pointRange.style;
|
|
2891
|
+
this.config.data.forEach((series, seriesIndex) => {
|
|
2892
|
+
series.data.forEach((point, index) => {
|
|
2893
|
+
const node = this.rangeGroupOf.get(point);
|
|
2894
|
+
if (!node) {
|
|
2895
|
+
return;
|
|
2896
|
+
}
|
|
2897
|
+
const group = select$1(node);
|
|
2898
|
+
const { x, y } = this.pointPosition(point, index, scales);
|
|
2899
|
+
const extent = rangeExtent(point, x, y, this.xAxis.format, scales);
|
|
2900
|
+
if (!extent) {
|
|
2901
|
+
group.selectAll('*').remove();
|
|
2902
|
+
return;
|
|
2903
|
+
}
|
|
2904
|
+
drawRange(group, extent, style, `${this.plotClipPathId}-range-${seriesIndex}-${index}`);
|
|
2905
|
+
});
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
/** Brings `d`'s range forward (see `drawPointRanges`), or with `null` puts every range back to rest. */
|
|
2909
|
+
focusPointRange(d) {
|
|
2910
|
+
if (!this.pointRange || !this.svg) {
|
|
2911
|
+
return;
|
|
2912
|
+
}
|
|
2913
|
+
this.svg.selectAll('.point-range.is-focused').classed('is-focused', false);
|
|
2914
|
+
const node = d ? this.rangeGroupOf.get(d) : undefined;
|
|
2915
|
+
if (node) {
|
|
2916
|
+
select$1(node).classed('is-focused', true);
|
|
2917
|
+
}
|
|
2918
|
+
this.svg.select('.point-ranges').classed('has-focus', !!node);
|
|
2919
|
+
}
|
|
2539
2920
|
/**
|
|
2540
2921
|
* Draws one `<g class="fan-outs">` holding a `<g class="fan-out">` per group of coincident
|
|
2541
2922
|
* points: a spoke from the shared coordinate to where each member is drawn, and an anchor dot
|
|
@@ -2543,15 +2924,20 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2543
2924
|
* the true coordinate (unlike a point group, which also carries its ring's shift - see
|
|
2544
2925
|
* `pointTransform`), so zoom moves it the same way and everything inside is relative to the
|
|
2545
2926
|
* coordinate; each spoke ends where its member is actually drawn, ring offset plus shift. It
|
|
2546
|
-
* fades in over the points' own entry transition.
|
|
2927
|
+
* fades in over the points' own entry transition. `spokeColor` / `anchorColor` go on the outer
|
|
2928
|
+
* group as custom properties for the theme's `.fan-out-spoke` / `.fan-out-anchor` rules (see
|
|
2929
|
+
* the axis builder's `applyColors`).
|
|
2547
2930
|
*/
|
|
2548
2931
|
drawFanOuts() {
|
|
2549
2932
|
if (!this.fanOut?.showAnchor || this.coincidentGroups.length === 0) {
|
|
2550
2933
|
return;
|
|
2551
2934
|
}
|
|
2935
|
+
const { spokeColor, anchorColor } = this.fanOut;
|
|
2552
2936
|
const groups = this.svg.append('g')
|
|
2553
2937
|
.attr('class', 'fan-outs')
|
|
2554
2938
|
.attr('clip-path', `url(#${this.plotClipPathId})`)
|
|
2939
|
+
.style('--pcac-fan-out-spoke-color', () => spokeColor ?? null)
|
|
2940
|
+
.style('--pcac-fan-out-anchor-color', () => anchorColor ?? null)
|
|
2555
2941
|
.selectAll('.fan-out')
|
|
2556
2942
|
.data(this.coincidentGroups)
|
|
2557
2943
|
.enter().append('g')
|
|
@@ -2568,9 +2954,20 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2568
2954
|
groups.append('circle')
|
|
2569
2955
|
.attr('class', 'fan-out-anchor')
|
|
2570
2956
|
.attr('r', 3);
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2957
|
+
this.revealAfterEntry(groups);
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Keeps `selection` hidden while the points rise in from the baseline, then fades it in. For
|
|
2961
|
+
* the guides drawn around the points (fan-out spokes and anchors, point ranges): they're drawn
|
|
2962
|
+
* where the points end up, so showing them during the rise has them pointing at empty space.
|
|
2963
|
+
* Its own transition name so that nothing else animating the same element cancels it.
|
|
2964
|
+
*/
|
|
2965
|
+
revealAfterEntry(selection) {
|
|
2966
|
+
const duration = this.transitionService.getTransitionDuration();
|
|
2967
|
+
selection.attr('opacity', 0)
|
|
2968
|
+
.transition(REVEAL_TRANSITION)
|
|
2969
|
+
.delay(duration)
|
|
2970
|
+
.duration(duration / 3)
|
|
2574
2971
|
.attr('opacity', 1);
|
|
2575
2972
|
}
|
|
2576
2973
|
/**
|
|
@@ -2604,6 +3001,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2604
3001
|
.attr('display', (d, i) => this.pointDisplay(d, i, this.scales))
|
|
2605
3002
|
.on('mouseover', function (event, d) {
|
|
2606
3003
|
self.hoveredPoint = this;
|
|
3004
|
+
self.focusPointRange(d);
|
|
2607
3005
|
// `d` is the very element bound from `series.data` above, so identity lookup is exact.
|
|
2608
3006
|
self.showTooltip(event, d, {
|
|
2609
3007
|
index: series.data.indexOf(d),
|
|
@@ -2613,9 +3011,12 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2613
3011
|
valueFormat: self.yAxis.format,
|
|
2614
3012
|
keyFormat: self.xAxis.format,
|
|
2615
3013
|
});
|
|
2616
|
-
// No-op for an image point (no circle inside to grow).
|
|
3014
|
+
// No-op for an image point (no circle inside to grow). Its own transition name, so it
|
|
3015
|
+
// runs alongside the enter rise rather than cancelling it (see DOT_HOVER_TRANSITION);
|
|
3016
|
+
// it only takes over the entry's size tween, which it would otherwise fight over `r`.
|
|
2617
3017
|
select$1(this).select('.dot')
|
|
2618
|
-
.
|
|
3018
|
+
.interrupt(DOT_GROW_TRANSITION)
|
|
3019
|
+
.transition(DOT_HOVER_TRANSITION)
|
|
2619
3020
|
.duration(duration / 3)
|
|
2620
3021
|
.attr('r', 6)
|
|
2621
3022
|
.attr('fill', self.colors[index]);
|
|
@@ -2631,9 +3032,11 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2631
3032
|
.attr('cx', (d) => this.offsetOf(d).dx)
|
|
2632
3033
|
.attr('cy', rise)
|
|
2633
3034
|
.attr('fill', '#fff')
|
|
2634
|
-
.transition()
|
|
3035
|
+
.call((dots) => dots.transition()
|
|
3036
|
+
.duration(duration)
|
|
3037
|
+
.attr('cy', (d) => this.offsetOf(d).dy))
|
|
3038
|
+
.transition(DOT_GROW_TRANSITION)
|
|
2635
3039
|
.duration(duration)
|
|
2636
|
-
.attr('cy', (d) => this.offsetOf(d).dy)
|
|
2637
3040
|
.attr('r', 4);
|
|
2638
3041
|
// `preserveAspectRatio="xMidYMid meet"` is what does the "resize to fit" - the image is
|
|
2639
3042
|
// scaled uniformly to fit inside the maxWidth x maxHeight box and centered within it, so
|
|
@@ -2666,8 +3069,10 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2666
3069
|
const point = this.hoveredPoint;
|
|
2667
3070
|
this.hoveredPoint = null;
|
|
2668
3071
|
this.hideTooltip();
|
|
3072
|
+
this.focusPointRange(null);
|
|
2669
3073
|
select$1(point).select('.dot')
|
|
2670
|
-
.
|
|
3074
|
+
.interrupt(DOT_GROW_TRANSITION)
|
|
3075
|
+
.transition(DOT_HOVER_TRANSITION)
|
|
2671
3076
|
.duration(this.transitionService.getTransitionDuration() / 3)
|
|
2672
3077
|
.attr('r', 4)
|
|
2673
3078
|
.attr('fill', '#fff');
|
|
@@ -2713,7 +3118,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2713
3118
|
const offset = this.offsetOf(d);
|
|
2714
3119
|
return { x: x + offset.dx, y: y + offset.dy };
|
|
2715
3120
|
}
|
|
2716
|
-
/** A fan-out sits on its members' true coordinate,
|
|
3121
|
+
/** A fan-out sits on its members' true coordinate, with no shift applied; any member locates it. */
|
|
2717
3122
|
fanOutTransform(group, scales) {
|
|
2718
3123
|
const { data, index } = group.members[0];
|
|
2719
3124
|
const { x, y } = this.pointPosition(data, index, scales);
|
|
@@ -2804,11 +3209,11 @@ class PcacLineAreaChartComponent {
|
|
|
2804
3209
|
}
|
|
2805
3210
|
}
|
|
2806
3211
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineAreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2807
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", type: PcacLineAreaChartComponent, isStandalone: true, selector: "pcac-line-area-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, tooltipTemplate: { classPropertyName: "tooltipTemplate", publicName: "tooltipTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dotClicked: "dotClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, providers: [PlaChartBuilder, PlaChartEffectsBuilder], viewQueries: [{ propertyName: "chartElm", first: true, predicate: ["chart"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .fan-out-spoke{stroke
|
|
3212
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", type: PcacLineAreaChartComponent, isStandalone: true, selector: "pcac-line-area-chart", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, tooltipTemplate: { classPropertyName: "tooltipTemplate", publicName: "tooltipTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dotClicked: "dotClicked" }, host: { properties: { "class.pcac-height-full": "config().heightFull" } }, providers: [PlaChartBuilder, PlaChartEffectsBuilder], viewQueries: [{ propertyName: "chartElm", first: true, predicate: ["chart"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .fan-out-spoke{stroke:var(--pcac-fan-out-spoke-color, #ced4da);stroke-width:1px}.pcac-line-area-chart .fan-out-anchor{fill:var(--pcac-fan-out-anchor-color, #6c757d)}.pcac-line-area-chart .point-ranges .point-range-series{--pcac-point-range-resolved-color: var(--pcac-point-range-color, var(--pcac-point-range-series-color))}.pcac-line-area-chart .point-ranges .point-range{opacity:var(--pcac-point-range-resting-opacity, 1);transition:opacity .15s ease-out}.pcac-line-area-chart .point-ranges .point-range.is-focused{opacity:1}.pcac-line-area-chart .point-ranges.pcac-range-hover{--pcac-point-range-resting-opacity: 0}.pcac-line-area-chart .point-ranges.pcac-range-faint{--pcac-point-range-resting-opacity: var(--pcac-point-range-faint-opacity, .2)}.pcac-line-area-chart .point-ranges.pcac-range-always.has-focus .point-range:not(.is-focused){opacity:.5}.pcac-line-area-chart .point-ranges .point-range-whisker,.pcac-line-area-chart .point-ranges .point-range-cap{stroke:var(--pcac-point-range-resolved-color);stroke-width:1.25px}.pcac-line-area-chart .point-ranges .point-range-box{fill:var(--pcac-point-range-resolved-color);fill-opacity:.1;stroke:var(--pcac-point-range-resolved-color);stroke-opacity:.7;stroke-width:1.25px}.pcac-line-area-chart .point-ranges .point-range-stop{stop-color:var(--pcac-point-range-resolved-color)}.pcac-line-area-chart .point-ranges .is-focused .point-range-whisker,.pcac-line-area-chart .point-ranges .is-focused .point-range-cap,.pcac-line-area-chart .point-ranges .is-focused .point-range-box{stroke-width:1.75px}.pcac-line-area-chart .point-ranges .is-focused .point-range-box{fill-opacity:.18}@media(prefers-reduced-motion:reduce){.pcac-line-area-chart .point-ranges .point-range{transition:none}}.pcac-line-area-chart .effects-canvas{fill:none}.pcac-line-area-chart .effect-line{stroke:#ced4da;stroke-width:1px;opacity:0}.pcac-line-area-chart .effect-circle{stroke-width:1px;fill:none;opacity:0}.pcac-line-area-chart .effect-text{font-size:11px;font-weight:700;fill:#343a40}pcac-line-chart.pcac-height-full,pcac-area-chart.pcac-height-full,pcac-plot-chart.pcac-height-full,pcac-line-area-chart.pcac-height-full{display:block;height:100%}pcac-line-area-chart.pcac-height-full .pcac-line-area-chart{height:100%}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
2808
3213
|
}
|
|
2809
3214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineAreaChartComponent, decorators: [{
|
|
2810
3215
|
type: Component,
|
|
2811
|
-
args: [{ selector: 'pcac-line-area-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, encapsulation: ViewEncapsulation.None, providers: [PlaChartBuilder, PlaChartEffectsBuilder], template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .fan-out-spoke{stroke
|
|
3216
|
+
args: [{ selector: 'pcac-line-area-chart', host: { '[class.pcac-height-full]': 'config().heightFull' }, encapsulation: ViewEncapsulation.None, providers: [PlaChartBuilder, PlaChartEffectsBuilder], template: "<section class=\"pcac-line-area-chart\">\n <svg #chart></svg>\n</section>\n\n", styles: [".pcac-line-area-chart svg{width:100%;display:block}.pcac-line-area-chart .dot{stroke-width:2px}.pcac-line-area-chart .fan-out-spoke{stroke:var(--pcac-fan-out-spoke-color, #ced4da);stroke-width:1px}.pcac-line-area-chart .fan-out-anchor{fill:var(--pcac-fan-out-anchor-color, #6c757d)}.pcac-line-area-chart .point-ranges .point-range-series{--pcac-point-range-resolved-color: var(--pcac-point-range-color, var(--pcac-point-range-series-color))}.pcac-line-area-chart .point-ranges .point-range{opacity:var(--pcac-point-range-resting-opacity, 1);transition:opacity .15s ease-out}.pcac-line-area-chart .point-ranges .point-range.is-focused{opacity:1}.pcac-line-area-chart .point-ranges.pcac-range-hover{--pcac-point-range-resting-opacity: 0}.pcac-line-area-chart .point-ranges.pcac-range-faint{--pcac-point-range-resting-opacity: var(--pcac-point-range-faint-opacity, .2)}.pcac-line-area-chart .point-ranges.pcac-range-always.has-focus .point-range:not(.is-focused){opacity:.5}.pcac-line-area-chart .point-ranges .point-range-whisker,.pcac-line-area-chart .point-ranges .point-range-cap{stroke:var(--pcac-point-range-resolved-color);stroke-width:1.25px}.pcac-line-area-chart .point-ranges .point-range-box{fill:var(--pcac-point-range-resolved-color);fill-opacity:.1;stroke:var(--pcac-point-range-resolved-color);stroke-opacity:.7;stroke-width:1.25px}.pcac-line-area-chart .point-ranges .point-range-stop{stop-color:var(--pcac-point-range-resolved-color)}.pcac-line-area-chart .point-ranges .is-focused .point-range-whisker,.pcac-line-area-chart .point-ranges .is-focused .point-range-cap,.pcac-line-area-chart .point-ranges .is-focused .point-range-box{stroke-width:1.75px}.pcac-line-area-chart .point-ranges .is-focused .point-range-box{fill-opacity:.18}@media(prefers-reduced-motion:reduce){.pcac-line-area-chart .point-ranges .point-range{transition:none}}.pcac-line-area-chart .effects-canvas{fill:none}.pcac-line-area-chart .effect-line{stroke:#ced4da;stroke-width:1px;opacity:0}.pcac-line-area-chart .effect-circle{stroke-width:1px;fill:none;opacity:0}.pcac-line-area-chart .effect-text{font-size:11px;font-weight:700;fill:#343a40}pcac-line-chart.pcac-height-full,pcac-area-chart.pcac-height-full,pcac-plot-chart.pcac-height-full,pcac-line-area-chart.pcac-height-full{display:block;height:100%}pcac-line-area-chart.pcac-height-full .pcac-line-area-chart{height:100%}\n"] }]
|
|
2812
3217
|
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], chartElm: [{ type: i0.ViewChild, args: ['chart', { isSignal: true }] }], dotClicked: [{ type: i0.Output, args: ["dotClicked"] }], tooltipTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipTemplate", required: false }] }] } });
|
|
2813
3218
|
|
|
2814
3219
|
class PcacPlotChart {
|
|
@@ -2879,7 +3284,8 @@ class PcacAreaChartConfig extends PcacLineAreaChartConfig {
|
|
|
2879
3284
|
// export * from './plot-line-area-chart.model';
|
|
2880
3285
|
// The rest of that model stays internal (the shared PcacLineAreaChartConfig is reached through
|
|
2881
3286
|
// the per-chart PcacLineChartConfig/PcacAreaChartConfig/PcacPlotChartConfig subclasses), but
|
|
2882
|
-
// the point-image
|
|
3287
|
+
// the point-image and point-range types are part of those configs' public shape, so they're
|
|
3288
|
+
// exported alone.
|
|
2883
3289
|
|
|
2884
3290
|
/**
|
|
2885
3291
|
* Provided per-component (see PcacPieChartComponent's `providers`), not root-scoped:
|
|
@@ -3030,5 +3436,5 @@ class PcacPieChartConfig extends PcacChartConfig {
|
|
|
3030
3436
|
* Generated bundle index. Do not edit.
|
|
3031
3437
|
*/
|
|
3032
3438
|
|
|
3033
|
-
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 };
|
|
3439
|
+
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 };
|
|
3034
3440
|
//# sourceMappingURL=pioneer-code-pioneer-charts.mjs.map
|