@pioneer-code/pioneer-charts 22.2.4 → 22.2.7
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 +121 -35
- 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 +4 -3
- package/themes/pioneer-charts.css +13 -6
- package/themes/pioneer-charts.min.css +1 -1
- package/types/pioneer-code-pioneer-charts.d.ts +53 -7
|
@@ -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,
|
|
@@ -254,7 +282,8 @@ class PcacAxisBuilder {
|
|
|
254
282
|
.attr('pointer-events', 'none')
|
|
255
283
|
.classed('pcac-axis-tick-marks', config.yAxis.tickSize !== undefined)
|
|
256
284
|
.classed('pcac-axis-line', config.yAxis.showLine)
|
|
257
|
-
.call(yAxis)
|
|
285
|
+
.call(yAxis)
|
|
286
|
+
.call(applyColors, config.yAxis);
|
|
258
287
|
this.drawLabels(group, config.yAxis, { length: config.height, outer: config.margin.left, vertical: true });
|
|
259
288
|
}
|
|
260
289
|
drawXAxis(config) {
|
|
@@ -293,7 +322,8 @@ class PcacAxisBuilder {
|
|
|
293
322
|
.classed('pcac-axis-tick-marks', config.xAxis.tickSize !== undefined)
|
|
294
323
|
.classed('pcac-axis-line', config.xAxis.showLine)
|
|
295
324
|
.attr('transform', 'translate(0,' + config.height + ')')
|
|
296
|
-
.call(xAxis)
|
|
325
|
+
.call(xAxis)
|
|
326
|
+
.call(applyColors, config.xAxis);
|
|
297
327
|
this.drawLabels(group, config.xAxis, { length: config.width, outer: config.margin.bottom, vertical: false });
|
|
298
328
|
}
|
|
299
329
|
/**
|
|
@@ -340,6 +370,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
340
370
|
providedIn: 'root',
|
|
341
371
|
}]
|
|
342
372
|
}] });
|
|
373
|
+
/**
|
|
374
|
+
* Sets the axis's `*Color` fields on its group as CSS custom properties, which the theme reads
|
|
375
|
+
* with its own color as the fallback (`var(--pcac-axis-tick-color, ...)`). Custom properties
|
|
376
|
+
* rather than inline `stroke`/`fill` on the elements: the theme still decides what is drawn (a
|
|
377
|
+
* color never un-hides marks or the line), the property reaches everything d3-axis draws in the
|
|
378
|
+
* group, and a stylesheet can set the same property on any ancestor. An unset field sets nothing.
|
|
379
|
+
*/
|
|
380
|
+
function applyColors(group, axis) {
|
|
381
|
+
group
|
|
382
|
+
.style('--pcac-axis-tick-color', () => axis.tickColor ?? null)
|
|
383
|
+
.style('--pcac-axis-tick-label-color', () => axis.tickLabelColor ?? null)
|
|
384
|
+
.style('--pcac-axis-line-color', () => axis.lineColor ?? null)
|
|
385
|
+
.style('--pcac-axis-label-color', () => axis.labelColor ?? null)
|
|
386
|
+
.style('--pcac-axis-sub-label-color', () => axis.subLabelColor ?? null);
|
|
387
|
+
}
|
|
343
388
|
/**
|
|
344
389
|
* Tick labels for a `Decimal` axis: SI-prefixed (`1.5k`), with the precision taken from the
|
|
345
390
|
* scale's own tick step rather than fixed. A fixed two significant digits (`.2s`) is fine for a
|
|
@@ -373,6 +418,7 @@ class PcacGridBuilder {
|
|
|
373
418
|
drawVerticalGrid(config) {
|
|
374
419
|
config.svg.append('g')
|
|
375
420
|
.attr('class', 'pcac-grid pcac-grid-vertical')
|
|
421
|
+
.style('--pcac-grid-color', () => config.color ?? null)
|
|
376
422
|
.selectAll('g.rule')
|
|
377
423
|
.data(gridLines(config.xScale, config.numberOfTicks))
|
|
378
424
|
.enter().append('svg:g')
|
|
@@ -389,6 +435,7 @@ class PcacGridBuilder {
|
|
|
389
435
|
drawHorizontalGrid(config) {
|
|
390
436
|
config.svg.append('g')
|
|
391
437
|
.attr('class', 'pcac-grid pcac-grid-horizontal')
|
|
438
|
+
.style('--pcac-grid-color', () => config.color ?? null)
|
|
392
439
|
.selectAll('g.pcac-grid-rule')
|
|
393
440
|
.data(gridLines(config.yScale, config.numberOfTicks))
|
|
394
441
|
.enter().append('svg:g')
|
|
@@ -432,12 +479,12 @@ class PcacColorService {
|
|
|
432
479
|
* @param numberOfNodes Number of items in dynamically build collection of colors
|
|
433
480
|
*/
|
|
434
481
|
getColorScale(numberOfNodes) {
|
|
435
|
-
const
|
|
482
|
+
const palette = [];
|
|
436
483
|
for (let i = 0; i < numberOfNodes; i++) {
|
|
437
484
|
const mark = i % this.scale.length;
|
|
438
|
-
|
|
485
|
+
palette.push(this.scale[mark]);
|
|
439
486
|
}
|
|
440
|
-
return
|
|
487
|
+
return palette;
|
|
441
488
|
}
|
|
442
489
|
getAlert() {
|
|
443
490
|
return this.alert;
|
|
@@ -772,10 +819,10 @@ class PcacChart {
|
|
|
772
819
|
drawGrids(xScale, yScale, which = 'both') {
|
|
773
820
|
const base = { svg: this.svg, width: this.width, height: this.height, xScale, yScale };
|
|
774
821
|
if (which !== 'y' && this.xAxis.showGrid) {
|
|
775
|
-
this.gridBuilder.drawVerticalGrid({ ...base, numberOfTicks: this.xAxis.ticks });
|
|
822
|
+
this.gridBuilder.drawVerticalGrid({ ...base, numberOfTicks: this.xAxis.ticks, color: this.xAxis.gridColor });
|
|
776
823
|
}
|
|
777
824
|
if (which !== 'x' && this.yAxis.showGrid) {
|
|
778
|
-
this.gridBuilder.drawHorizontalGrid({ ...base, numberOfTicks: this.yAxis.ticks });
|
|
825
|
+
this.gridBuilder.drawHorizontalGrid({ ...base, numberOfTicks: this.yAxis.ticks, color: this.yAxis.gridColor });
|
|
779
826
|
}
|
|
780
827
|
}
|
|
781
828
|
/**
|
|
@@ -1983,20 +2030,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
1983
2030
|
class PcacPointFanOutConfig {
|
|
1984
2031
|
/**
|
|
1985
2032
|
* Ring radius in px, the same for every group. When not set, each group gets the smallest
|
|
1986
|
-
* radius at which its
|
|
2033
|
+
* radius at which its neighbors sit `gap` px apart - so a pair barely moves while a group of
|
|
1987
2034
|
* five spreads as far as it has to.
|
|
1988
2035
|
*/
|
|
1989
2036
|
radius;
|
|
1990
2037
|
/**
|
|
1991
|
-
* Space between
|
|
2038
|
+
* Space between neighboring points on the ring, in px, when `radius` is not set. Measured
|
|
1992
2039
|
* between their image boxes (or hovered dots), not their centers.
|
|
1993
2040
|
*/
|
|
1994
2041
|
gap = 4;
|
|
1995
2042
|
/**
|
|
1996
2043
|
* 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
|
|
2044
|
+
* spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules,
|
|
2045
|
+
* whose colors `anchorColor` / `spokeColor` override.
|
|
1998
2046
|
*/
|
|
1999
2047
|
showAnchor = true;
|
|
2048
|
+
/**
|
|
2049
|
+
* Spoke color, any CSS color; theme default `$gray-400`. Applied as `--pcac-fan-out-spoke-color`
|
|
2050
|
+
* on the chart's `.fan-outs` group, so a stylesheet can set it on an ancestor instead (a config
|
|
2051
|
+
* value wins). Needs `showAnchor`.
|
|
2052
|
+
*/
|
|
2053
|
+
spokeColor;
|
|
2054
|
+
/** Anchor dot color, likewise (`--pcac-fan-out-anchor-color`); theme default `$gray-600`. */
|
|
2055
|
+
anchorColor;
|
|
2000
2056
|
}
|
|
2001
2057
|
class PcacPlotChartConfig extends PcacLineAreaChartConfig {
|
|
2002
2058
|
/**
|
|
@@ -2159,7 +2215,7 @@ function xPositionKey(xFormat, data, index) {
|
|
|
2159
2215
|
}
|
|
2160
2216
|
/**
|
|
2161
2217
|
* The smallest ring radius at which `count` marks of `size` px sit `gap` px apart from their
|
|
2162
|
-
*
|
|
2218
|
+
* neighbors: the chord between adjacent ring positions is `2r sin(π/n)`, so solve it for
|
|
2163
2219
|
* `size + gap`. A pair (n = 2) lands `size + gap` apart along a diameter, as expected.
|
|
2164
2220
|
*/
|
|
2165
2221
|
function fanOutRadius(count, size, gap) {
|
|
@@ -2268,11 +2324,16 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2268
2324
|
coincidentOf = new Map();
|
|
2269
2325
|
fanOut = null;
|
|
2270
2326
|
fanOutOffsets = new Map();
|
|
2327
|
+
/** The `.point` group under the cursor, between its mouseover and mouseout (see `leavePoint`). */
|
|
2328
|
+
hoveredPoint = null;
|
|
2271
2329
|
dotClicked$ = this.dotClickedSource.asObservable();
|
|
2272
2330
|
buildChart(chartElm, config, type) {
|
|
2273
2331
|
if (!config?.data?.length) {
|
|
2274
2332
|
return;
|
|
2275
2333
|
}
|
|
2334
|
+
// A rebuild throws the hovered point away with everything else, and a removed element gets
|
|
2335
|
+
// no mouseout, so its tooltip is closed here (see `leavePoint`).
|
|
2336
|
+
this.leavePoint();
|
|
2276
2337
|
this.config = JSON.parse(JSON.stringify(config));
|
|
2277
2338
|
this.startData = range(this.config.data[0].data.length).map(() => ({
|
|
2278
2339
|
key: '',
|
|
@@ -2298,6 +2359,11 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2298
2359
|
this.areaGenerator = buildAreaGenerator(this.xAxis.format, this.scales, this.height);
|
|
2299
2360
|
if (this.zoomEnabled) {
|
|
2300
2361
|
this.zoomBehavior = buildZoomBehavior(this.width, this.height, (event) => {
|
|
2362
|
+
// Zoom moves the points, not the mouse: the hovered one slides out from under a still
|
|
2363
|
+
// cursor (or is hidden outright, see `pointDisplay`), and either way the browser never
|
|
2364
|
+
// sends it a mouseout - its tooltip would stay up, and its dot stay grown, until the
|
|
2365
|
+
// cursor happened to cross it again. So the hover is ended here, on every zoom event.
|
|
2366
|
+
this.leavePoint();
|
|
2301
2367
|
// A d3 zoom transform is always two-dimensional; only the enabled axes follow it and the
|
|
2302
2368
|
// other keeps its original scale, so that component of the gesture is simply ignored.
|
|
2303
2369
|
const newX = this.config.enableZoomX ? event.transform.rescaleX(this.scales.x) : this.scales.x;
|
|
@@ -2459,9 +2525,17 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2459
2525
|
attachZoomBehavior() {
|
|
2460
2526
|
if (!this.zoomEnabled)
|
|
2461
2527
|
return;
|
|
2462
|
-
//
|
|
2528
|
+
// A transparent rect so the empty plot area is a hit target too: a `<g>` has no area of its
|
|
2529
|
+
// own, so wheel/drag only reaches it through something painted. The rect is only ever that -
|
|
2530
|
+
// the behavior is attached once, to the group, and the rect's events bubble up to it. It used
|
|
2531
|
+
// to be `.call()`ed on both, and d3-zoom keeps its transform per element (`__zoom`): a wheel
|
|
2532
|
+
// over a point never passes through the rect (a sibling of the `.dots`, not an ancestor), so
|
|
2533
|
+
// only the group's transform advanced, and once the point had slid out from under the cursor
|
|
2534
|
+
// the next tick hit the rect - whose handler redrew from its own stale, near-identity
|
|
2535
|
+
// transform before the group's redrew from the real one, every tick, flickering the chart
|
|
2536
|
+
// between the two.
|
|
2463
2537
|
//
|
|
2464
|
-
// d3's `ZoomBehavior<Element, unknown>` vs. our concretely-typed `Selection<
|
|
2538
|
+
// d3's `ZoomBehavior<Element, unknown>` vs. our concretely-typed `Selection<SVGGElement, ...>`
|
|
2465
2539
|
// is a known D3+TS typings friction point: `.call()` structurally compares nested generic Selection
|
|
2466
2540
|
// methods (`.merge()`, `.select()`, ...) and those never line up across two different concrete element
|
|
2467
2541
|
// types, even though a zoom behavior works on any element at runtime. Narrow, local `any` escape hatch.
|
|
@@ -2469,13 +2543,8 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2469
2543
|
.attr('width', this.width)
|
|
2470
2544
|
.attr('height', this.height)
|
|
2471
2545
|
.attr('fill', 'none')
|
|
2472
|
-
.attr('pointer-events', 'all')
|
|
2473
|
-
|
|
2474
|
-
.transition()
|
|
2475
|
-
.duration(750);
|
|
2476
|
-
this.svg.call(this.zoomBehavior)
|
|
2477
|
-
.transition()
|
|
2478
|
-
.duration(750);
|
|
2546
|
+
.attr('pointer-events', 'all');
|
|
2547
|
+
this.svg.call(this.zoomBehavior);
|
|
2479
2548
|
}
|
|
2480
2549
|
drawLineArea(config, type) {
|
|
2481
2550
|
for (let i = 0; i < config.data.length; i++) {
|
|
@@ -2530,15 +2599,20 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2530
2599
|
* the true coordinate (unlike a point group, which also carries its ring's shift - see
|
|
2531
2600
|
* `pointTransform`), so zoom moves it the same way and everything inside is relative to the
|
|
2532
2601
|
* coordinate; each spoke ends where its member is actually drawn, ring offset plus shift. It
|
|
2533
|
-
* fades in over the points' own entry transition.
|
|
2602
|
+
* fades in over the points' own entry transition. `spokeColor` / `anchorColor` go on the outer
|
|
2603
|
+
* group as custom properties for the theme's `.fan-out-spoke` / `.fan-out-anchor` rules (see
|
|
2604
|
+
* the axis builder's `applyColors`).
|
|
2534
2605
|
*/
|
|
2535
2606
|
drawFanOuts() {
|
|
2536
2607
|
if (!this.fanOut?.showAnchor || this.coincidentGroups.length === 0) {
|
|
2537
2608
|
return;
|
|
2538
2609
|
}
|
|
2610
|
+
const { spokeColor, anchorColor } = this.fanOut;
|
|
2539
2611
|
const groups = this.svg.append('g')
|
|
2540
2612
|
.attr('class', 'fan-outs')
|
|
2541
2613
|
.attr('clip-path', `url(#${this.plotClipPathId})`)
|
|
2614
|
+
.style('--pcac-fan-out-spoke-color', () => spokeColor ?? null)
|
|
2615
|
+
.style('--pcac-fan-out-anchor-color', () => anchorColor ?? null)
|
|
2542
2616
|
.selectAll('.fan-out')
|
|
2543
2617
|
.data(this.coincidentGroups)
|
|
2544
2618
|
.enter().append('g')
|
|
@@ -2590,6 +2664,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2590
2664
|
.attr('transform', (d, i) => this.pointTransform(d, i, this.scales))
|
|
2591
2665
|
.attr('display', (d, i) => this.pointDisplay(d, i, this.scales))
|
|
2592
2666
|
.on('mouseover', function (event, d) {
|
|
2667
|
+
self.hoveredPoint = this;
|
|
2593
2668
|
// `d` is the very element bound from `series.data` above, so identity lookup is exact.
|
|
2594
2669
|
self.showTooltip(event, d, {
|
|
2595
2670
|
index: series.data.indexOf(d),
|
|
@@ -2606,14 +2681,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2606
2681
|
.attr('r', 6)
|
|
2607
2682
|
.attr('fill', self.colors[index]);
|
|
2608
2683
|
})
|
|
2609
|
-
.on('mouseout',
|
|
2610
|
-
self.hideTooltip();
|
|
2611
|
-
select$1(this).select('.dot')
|
|
2612
|
-
.transition()
|
|
2613
|
-
.duration(duration / 3)
|
|
2614
|
-
.attr('r', 4)
|
|
2615
|
-
.attr('fill', '#fff');
|
|
2616
|
-
})
|
|
2684
|
+
.on('mouseout', () => this.leavePoint())
|
|
2617
2685
|
.on('click', (_event, d) => {
|
|
2618
2686
|
this.dotClickedSource.next(d);
|
|
2619
2687
|
});
|
|
@@ -2647,6 +2715,24 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2647
2715
|
.attr('y', (d) => -maxHeight / 2 + this.offsetOf(d).dy);
|
|
2648
2716
|
}
|
|
2649
2717
|
}
|
|
2718
|
+
/**
|
|
2719
|
+
* Ends the current hover, if there is one: hides the tooltip and shrinks the dot back. Shared by
|
|
2720
|
+
* the point's own mouseout and the zoom handler, which has to end a hover the browser won't
|
|
2721
|
+
* (the point moves, the cursor doesn't - see `buildChart`'s zoom callback).
|
|
2722
|
+
*/
|
|
2723
|
+
leavePoint() {
|
|
2724
|
+
if (!this.hoveredPoint) {
|
|
2725
|
+
return;
|
|
2726
|
+
}
|
|
2727
|
+
const point = this.hoveredPoint;
|
|
2728
|
+
this.hoveredPoint = null;
|
|
2729
|
+
this.hideTooltip();
|
|
2730
|
+
select$1(point).select('.dot')
|
|
2731
|
+
.transition()
|
|
2732
|
+
.duration(this.transitionService.getTransitionDuration() / 3)
|
|
2733
|
+
.attr('r', 4)
|
|
2734
|
+
.attr('fill', '#fff');
|
|
2735
|
+
}
|
|
2650
2736
|
/**
|
|
2651
2737
|
* Where a point's group goes: its true coordinate, plus - for a fanned-out point - however far
|
|
2652
2738
|
* its ring had to be shifted to stay inside the plot area at these scales. The shift is on the
|
|
@@ -2688,7 +2774,7 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2688
2774
|
const offset = this.offsetOf(d);
|
|
2689
2775
|
return { x: x + offset.dx, y: y + offset.dy };
|
|
2690
2776
|
}
|
|
2691
|
-
/** A fan-out sits on its members' true coordinate,
|
|
2777
|
+
/** A fan-out sits on its members' true coordinate, with no shift applied; any member locates it. */
|
|
2692
2778
|
fanOutTransform(group, scales) {
|
|
2693
2779
|
const { data, index } = group.members[0];
|
|
2694
2780
|
const { x, y } = this.pointPosition(data, index, scales);
|
|
@@ -2779,11 +2865,11 @@ class PcacLineAreaChartComponent {
|
|
|
2779
2865
|
}
|
|
2780
2866
|
}
|
|
2781
2867
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineAreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2782
|
-
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
|
|
2868
|
+
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 .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 });
|
|
2783
2869
|
}
|
|
2784
2870
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PcacLineAreaChartComponent, decorators: [{
|
|
2785
2871
|
type: Component,
|
|
2786
|
-
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
|
|
2872
|
+
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 .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"] }]
|
|
2787
2873
|
}], 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 }] }] } });
|
|
2788
2874
|
|
|
2789
2875
|
class PcacPlotChart {
|