@nova-ui/charts 12.0.13 → 12.0.14-3714
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -35
- package/bundles/nova-ui-charts.umd.js +1217 -566
- package/bundles/nova-ui-charts.umd.js.map +1 -1
- package/core/chart-assists/chart-assist.d.ts +9 -9
- package/core/chart.d.ts +1 -1
- package/core/plugins/chart-donut-content-plugin.d.ts +2 -2
- package/esm2015/chart/chart.component.js +14 -6
- package/esm2015/chart-collection/chart-collection-id.directive.js +4 -2
- package/esm2015/chart-collection/chart-collection.service.js +1 -1
- package/esm2015/chart-donut-content/chart-donut-content.component.js +7 -6
- package/esm2015/chart-marker/chart-marker.component.js +14 -7
- package/esm2015/chart-popover/chart-popover.component.js +4 -3
- package/esm2015/chart-tooltips/chart-tooltip.component.js +4 -6
- package/esm2015/chart-tooltips/chart-tooltip.directive.js +3 -3
- package/esm2015/chart-tooltips/chart-tooltips.component.js +17 -12
- package/esm2015/charts.module.js +4 -12
- package/esm2015/constants.js +1 -1
- package/esm2015/core/chart-assists/chart-assist.js +52 -33
- package/esm2015/core/chart-assists/spark-chart-assist.js +13 -6
- package/esm2015/core/chart-assists/types.js +1 -1
- package/esm2015/core/chart-collection.js +15 -5
- package/esm2015/core/chart.js +19 -13
- package/esm2015/core/common/chart-plugin.js +1 -1
- package/esm2015/core/common/data-manager.js +11 -9
- package/esm2015/core/common/data-series.js +3 -2
- package/esm2015/core/common/event-bus.js +1 -1
- package/esm2015/core/common/lasagna.js +10 -7
- package/esm2015/core/common/mouse-interactive-area.js +21 -7
- package/esm2015/core/common/palette/chart-palette.js +5 -2
- package/esm2015/core/common/palette/mapped-value-provider.js +2 -3
- package/esm2015/core/common/palette/markers/path-marker.js +4 -4
- package/esm2015/core/common/palette/markers/svg-marker.js +4 -2
- package/esm2015/core/common/palette/palettes.js +5 -7
- package/esm2015/core/common/palette/processed-color-provider.js +1 -1
- package/esm2015/core/common/palette/sequential-chart-marker-provider.js +1 -1
- package/esm2015/core/common/palette/sequential-color-provider.js +1 -1
- package/esm2015/core/common/palette/sequential-value-provider.js +1 -1
- package/esm2015/core/common/palette/text-color-provider.js +4 -2
- package/esm2015/core/common/render-engine.js +46 -30
- package/esm2015/core/common/renderer.js +9 -9
- package/esm2015/core/common/scales/band-scale.js +12 -7
- package/esm2015/core/common/scales/domain-calculation/automatic-domain.js +9 -4
- package/esm2015/core/common/scales/domain-calculation/domain-with-auxiliary-series.js +1 -1
- package/esm2015/core/common/scales/domain-calculation/domain-with-ticks.js +1 -1
- package/esm2015/core/common/scales/domain-calculation/merge-domains.js +10 -6
- package/esm2015/core/common/scales/formatters/datetime-formatter.js +14 -6
- package/esm2015/core/common/scales/helpers/convert.js +3 -2
- package/esm2015/core/common/scales/helpers/invert.js +1 -1
- package/esm2015/core/common/scales/helpers/is-in-range.js +2 -2
- package/esm2015/core/common/scales/linear-scale.js +2 -2
- package/esm2015/core/common/scales/noop-scale.js +1 -1
- package/esm2015/core/common/scales/point-scale.js +6 -3
- package/esm2015/core/common/scales/scale.js +1 -1
- package/esm2015/core/common/scales/time-interval-scale.js +19 -8
- package/esm2015/core/common/scales/time-scale.js +5 -3
- package/esm2015/core/common/scales/types.js +1 -1
- package/esm2015/core/common/types.js +1 -1
- package/esm2015/core/common/utility.service.js +22 -18
- package/esm2015/core/grid/config/bar-grid-config.js +1 -1
- package/esm2015/core/grid/config/bar-horizontal-grid-config.js +1 -1
- package/esm2015/core/grid/config/bar-status-grid-config.js +1 -1
- package/esm2015/core/grid/config/border-config.js +1 -1
- package/esm2015/core/grid/config/grid-config.js +1 -1
- package/esm2015/core/grid/config/linear-gauge-grid-config-fn.js +2 -2
- package/esm2015/core/grid/config/spark-chart-grid-config.js +1 -1
- package/esm2015/core/grid/config/xy-grid-config.js +1 -1
- package/esm2015/core/grid/default-text-overflow-handler.js +17 -6
- package/esm2015/core/grid/grid.js +42 -30
- package/esm2015/core/grid/radial-grid.js +9 -6
- package/esm2015/core/grid/types.js +1 -1
- package/esm2015/core/grid/xy-grid.js +164 -67
- package/esm2015/core/plugins/chart-donut-content-plugin.js +14 -8
- package/esm2015/core/plugins/chart-popover-plugin.js +19 -9
- package/esm2015/core/plugins/gauge/donut-gauge-labels-plugin.js +21 -10
- package/esm2015/core/plugins/gauge/linear-gauge-labels-plugin.js +31 -14
- package/esm2015/core/plugins/interaction/interaction-label-plugin.js +44 -21
- package/esm2015/core/plugins/interaction/interaction-line-plugin.js +27 -14
- package/esm2015/core/plugins/mouse-interactive-area-plugin.js +39 -11
- package/esm2015/core/plugins/radial-popover-plugin.js +10 -6
- package/esm2015/core/plugins/render-engine-plugin.js +28 -10
- package/esm2015/core/plugins/tooltips/bar-tooltips-plugin.js +1 -1
- package/esm2015/core/plugins/tooltips/chart-tooltips-plugin.js +41 -19
- package/esm2015/core/plugins/tooltips/radial-tooltips-plugin.js +10 -8
- package/esm2015/core/plugins/zoom-plugin.js +32 -15
- package/esm2015/core/types.js +1 -1
- package/esm2015/gauge/gauge-util.js +64 -21
- package/esm2015/gauge/types.js +1 -1
- package/esm2015/legend/legend-series/legend-series.component.js +10 -7
- package/esm2015/legend/legend-tile/basic-legend-tile/basic-legend-tile.component.js +2 -2
- package/esm2015/legend/legend-tile/rich-legend-tile/rich-legend-tile.component.js +7 -4
- package/esm2015/legend/legend.component.js +4 -4
- package/esm2015/legend/types.js +1 -1
- package/esm2015/renderers/accessors/noop-accessors.js +1 -1
- package/esm2015/renderers/accessors/rectangle-accessors.js +2 -3
- package/esm2015/renderers/area/area-accessors.js +2 -2
- package/esm2015/renderers/area/area-grid.js +1 -1
- package/esm2015/renderers/area/area-renderer.js +32 -12
- package/esm2015/renderers/area/stacked-area-accessors.js +1 -1
- package/esm2015/renderers/area/stacked-area-preprocessor.js +5 -2
- package/esm2015/renderers/area/stacked-percentage-area-preprocessor.js +1 -1
- package/esm2015/renderers/bar/accessors/bar-accessors-fn.js +2 -2
- package/esm2015/renderers/bar/accessors/bar-accessors.js +3 -3
- package/esm2015/renderers/bar/accessors/horizontal-bar-accessors.js +4 -2
- package/esm2015/renderers/bar/accessors/status-accessors-fn.js +1 -1
- package/esm2015/renderers/bar/accessors/status-accessors.js +1 -1
- package/esm2015/renderers/bar/accessors/vertical-bar-accessors.js +4 -2
- package/esm2015/renderers/bar/bar-grid.js +4 -2
- package/esm2015/renderers/bar/bar-renderer.js +58 -26
- package/esm2015/renderers/bar/bar-scales.js +1 -1
- package/esm2015/renderers/bar/highlight-strategies/bar-highlight-strategy.js +31 -16
- package/esm2015/renderers/bar/highlight-strategies/bar-series-highlight-strategy.js +9 -7
- package/esm2015/renderers/bar/linear-gauge-thresholds-renderer.js +15 -8
- package/esm2015/renderers/bar/preprocessor-utils.js +1 -1
- package/esm2015/renderers/bar/stacked-preprocessor.js +3 -2
- package/esm2015/renderers/line/calculate-missing-data.js +1 -1
- package/esm2015/renderers/line/interaction-strategies/line-select-series-interaction-strategy.js +19 -12
- package/esm2015/renderers/line/line-accessors.js +2 -2
- package/esm2015/renderers/line/line-renderer.js +27 -15
- package/esm2015/renderers/marker-utils.js +37 -17
- package/esm2015/renderers/noop-renderer.js +3 -5
- package/esm2015/renderers/radial/accessors/radial-accessors.js +2 -2
- package/esm2015/renderers/radial/gauge/donut-gauge-rendering-util.js +1 -1
- package/esm2015/renderers/radial/gauge/donut-gauge-thresholds-renderer.js +7 -5
- package/esm2015/renderers/radial/pie-renderer.js +2 -3
- package/esm2015/renderers/radial/radial-preprocessor.js +8 -6
- package/esm2015/renderers/radial/radial-renderer.js +32 -16
- package/esm2015/renderers/radial/radial-scales.js +2 -2
- package/esm2015/renderers/side-indicator-renderer.js +16 -13
- package/esm2015/renderers/types.js +1 -1
- package/esm2015/renderers/xy-renderer.js +1 -1
- package/esm2015/thresholds/thresholds-service.js +55 -31
- package/esm2015/thresholds/thresholds-summary-grid-config.js +1 -1
- package/esm2015/thresholds/thresholds-top-grid-config.js +1 -1
- package/fesm2015/nova-ui-charts.js +1282 -632
- package/fesm2015/nova-ui-charts.js.map +1 -1
- package/gauge/types.d.ts +2 -2
- package/nova-ui-charts.metadata.json +1 -1
- package/package.json +2 -2
- package/sdk/atoms/chart/atoms/chart.atom.js +12 -8
- package/sdk/atoms/chart/atoms/chart.atom.js.map +1 -1
- package/sdk/atoms/chart/atoms/lasagna.atom.js +2 -2
- package/sdk/atoms/chart/atoms/lasagna.atom.js.map +1 -1
- package/sdk/atoms/chart/atoms/line-series.atom.js +4 -4
- package/sdk/atoms/chart/atoms/line-series.atom.js.map +1 -1
- package/sdk/atoms/chart/atoms/marker.atom.js +4 -1
- package/sdk/atoms/chart/atoms/marker.atom.js.map +1 -1
- package/sdk/atoms/chart/atoms/radial-series.atom.js +3 -3
- package/sdk/atoms/chart/atoms/radial-series.atom.js.map +1 -1
- package/sdk/atoms/chart/atoms/status-bar-data-point.atom.js +3 -1
- package/sdk/atoms/chart/atoms/status-bar-data-point.atom.js.map +1 -1
- package/sdk/atoms/chart/atoms/threshold-series.atom.js.map +1 -1
- package/sdk/atoms/chart/boosters/donut-chart-content.booster.js +3 -1
- package/sdk/atoms/chart/boosters/donut-chart-content.booster.js.map +1 -1
- package/sdk/atoms/chart/boosters/interactive.booster.js +3 -1
- package/sdk/atoms/chart/boosters/interactive.booster.js.map +1 -1
- package/sdk/atoms/chart/boosters/zoom.booster.js +4 -7
- package/sdk/atoms/chart/boosters/zoom.booster.js.map +1 -1
- package/sdk/atoms/chart/line-chart-test.po.js.map +1 -1
- package/sdk/atoms/chart/spark-chart-test.po.js.map +1 -1
- package/sdk/atoms/chart/status-chart.atom.js +2 -1
- package/sdk/atoms/chart/status-chart.atom.js.map +1 -1
- package/sdk/atoms/chart/test.po.js.map +1 -1
- package/sdk/atoms/chart/thresholds-summary-test.po.js.map +1 -1
- package/sdk/atoms/chart/time-frame-bar-test.po.js.map +1 -1
- package/sdk/atoms/legend/legend-series.atom.js +7 -3
- package/sdk/atoms/legend/legend-series.atom.js.map +1 -1
- package/sdk/atoms/legend/legend.atom.js.map +1 -1
- package/sdk/atoms/legend/rich-legend-tile.atom.js +3 -1
- package/sdk/atoms/legend/rich-legend-tile.atom.js.map +1 -1
- package/sdk/less/nui-charts.less +5 -5
- package/sdk/locale/messages.en.xlf +52 -50
|
@@ -55,7 +55,7 @@ class ChartTooltipComponent {
|
|
|
55
55
|
ChartTooltipComponent.decorators = [
|
|
56
56
|
{ type: Component, args: [{
|
|
57
57
|
selector: "nui-chart-tooltip",
|
|
58
|
-
template: "<div>\n <div @tooltip class
|
|
58
|
+
template: "<div>\n <div @tooltip class=\"nui-chart-tooltip px-2 py-1 nui-text-small\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n </div>\n</div>\n",
|
|
59
59
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
60
60
|
animations: [
|
|
61
61
|
trigger("tooltip", [
|
|
@@ -63,9 +63,7 @@ ChartTooltipComponent.decorators = [
|
|
|
63
63
|
style({ opacity: 0 }),
|
|
64
64
|
animate(300, style({ opacity: 1 })),
|
|
65
65
|
]),
|
|
66
|
-
transition(":leave", [
|
|
67
|
-
animate(300, style({ opacity: 0 })),
|
|
68
|
-
]),
|
|
66
|
+
transition(":leave", [animate(300, style({ opacity: 0 }))]),
|
|
69
67
|
]),
|
|
70
68
|
],
|
|
71
69
|
styles: [":host{display:block;pointer-events:none}.nui-chart-tooltip{background-color:var(--nui-color-bg-inverse,#111);color:var(--nui-color-text-inverse,#fff);line-height:normal}\n"]
|
|
@@ -269,24 +267,21 @@ class Renderer {
|
|
|
269
267
|
* @param {number} dataPointIndex index of the highlighted point within the data series (pass -1 to remove the highlight marker)
|
|
270
268
|
* @param {Subject<IRendererEventPayload>} rendererSubject A subject to optionally invoke for emitting events regarding a data point
|
|
271
269
|
*/
|
|
272
|
-
highlightDataPoint(renderSeries, dataPointIndex, rendererSubject) {
|
|
273
|
-
}
|
|
270
|
+
highlightDataPoint(renderSeries, dataPointIndex, rendererSubject) { }
|
|
274
271
|
/**
|
|
275
272
|
* Set the RenderState of the target data series
|
|
276
273
|
*
|
|
277
274
|
* @param {IRenderContainers} renderContainers the render containers of the series
|
|
278
275
|
* @param {RenderState} state The new state for the target series
|
|
279
276
|
*/
|
|
280
|
-
setSeriesState(renderContainers, state) {
|
|
281
|
-
}
|
|
277
|
+
setSeriesState(renderContainers, state) { }
|
|
282
278
|
/**
|
|
283
279
|
* Set the RenderState of the target data point
|
|
284
280
|
*
|
|
285
281
|
* @param {D3Selection} target the target data point
|
|
286
282
|
* @param {RenderState} state The new state for the target data point
|
|
287
283
|
*/
|
|
288
|
-
setDataPointState(target, state) {
|
|
289
|
-
}
|
|
284
|
+
setDataPointState(target, state) { }
|
|
290
285
|
/**
|
|
291
286
|
* Calculate domain for data filtered by given filterScales
|
|
292
287
|
*
|
|
@@ -321,7 +316,10 @@ class Renderer {
|
|
|
321
316
|
if (!data || data.length === 0) {
|
|
322
317
|
return EMPTY_CONTINUOUS_DOMAIN;
|
|
323
318
|
}
|
|
324
|
-
return extent(data, (datum, index, arr) => {
|
|
319
|
+
return extent(data, (datum, index, arr) => {
|
|
320
|
+
var _a, _b;
|
|
321
|
+
return (_b = (_a = dataSeries.accessors.data) === null || _a === void 0 ? void 0 : _a[scaleName]) === null || _b === void 0 ? void 0 : _b.call(_a, datum, index, Array.from(arr), dataSeries);
|
|
322
|
+
});
|
|
325
323
|
}
|
|
326
324
|
/**
|
|
327
325
|
* Filters given dataset by domain of provided scale
|
|
@@ -440,10 +438,10 @@ class RadialRenderer extends Renderer {
|
|
|
440
438
|
return separateArc(d);
|
|
441
439
|
};
|
|
442
440
|
this.segmentWidth = this.getSegmentWidth(renderSeries);
|
|
443
|
-
const g = dataContainer.selectAll("path.arc")
|
|
444
|
-
.data(data);
|
|
441
|
+
const g = dataContainer.selectAll("path.arc").data(data);
|
|
445
442
|
g.exit().remove();
|
|
446
|
-
g.enter()
|
|
443
|
+
g.enter()
|
|
444
|
+
.append("path")
|
|
447
445
|
.attr("class", "arc pointer-events nui-chart--path__outline")
|
|
448
446
|
.style("stroke-width", this.config.strokeWidth)
|
|
449
447
|
.style("cursor", this.config.cursor)
|
|
@@ -469,9 +467,9 @@ class RadialRenderer extends Renderer {
|
|
|
469
467
|
.attr("d", arcGenerator)
|
|
470
468
|
.attr("fill", (d, i) => {
|
|
471
469
|
var _a, _b;
|
|
472
|
-
return accessors.data.color
|
|
473
|
-
accessors.data.color(d.data, i, data, renderSeries.dataSeries)
|
|
474
|
-
(_b = (_a = accessors.series).color) === null || _b === void 0 ? void 0 : _b.call(_a, renderSeries.dataSeries.id, renderSeries.dataSeries);
|
|
470
|
+
return accessors.data.color
|
|
471
|
+
? accessors.data.color(d.data, i, data, renderSeries.dataSeries)
|
|
472
|
+
: (_b = (_a = accessors.series).color) === null || _b === void 0 ? void 0 : _b.call(_a, renderSeries.dataSeries.id, renderSeries.dataSeries);
|
|
475
473
|
});
|
|
476
474
|
}
|
|
477
475
|
/** See {@link Renderer#getDataPointPosition} */
|
|
@@ -490,22 +488,30 @@ class RadialRenderer extends Renderer {
|
|
|
490
488
|
};
|
|
491
489
|
}
|
|
492
490
|
getInnerRadius(range, index) {
|
|
493
|
-
if (isUndefined(this.segmentWidth) ||
|
|
491
|
+
if (isUndefined(this.segmentWidth) ||
|
|
492
|
+
isUndefined(this.config.annularPadding)) {
|
|
494
493
|
throw new Error("Can't compute inner radius");
|
|
495
494
|
}
|
|
496
|
-
const calculatedRadius =
|
|
495
|
+
const calculatedRadius = range[1] -
|
|
496
|
+
range[0] -
|
|
497
|
+
this.segmentWidth -
|
|
498
|
+
index * (this.config.annularPadding + this.segmentWidth);
|
|
497
499
|
return calculatedRadius >= 0 ? calculatedRadius : 0;
|
|
498
500
|
}
|
|
499
501
|
getOuterRadius(range, index) {
|
|
500
|
-
if (isUndefined(this.segmentWidth) ||
|
|
502
|
+
if (isUndefined(this.segmentWidth) ||
|
|
503
|
+
isUndefined(this.config.annularPadding)) {
|
|
501
504
|
throw new Error("Can't compute outer radius");
|
|
502
505
|
}
|
|
503
|
-
const calculatedRadius =
|
|
506
|
+
const calculatedRadius = range[1] -
|
|
507
|
+
range[0] -
|
|
508
|
+
index * (this.config.annularPadding + this.segmentWidth);
|
|
504
509
|
return calculatedRadius >= 0 ? calculatedRadius : 0;
|
|
505
510
|
}
|
|
506
511
|
getArc(range, generatedArc, index) {
|
|
507
512
|
const innerRadius = this.getInnerRadius(range, index);
|
|
508
|
-
return generatedArc
|
|
513
|
+
return generatedArc
|
|
514
|
+
.outerRadius(this.getOuterRadius(range, index))
|
|
509
515
|
.innerRadius(innerRadius);
|
|
510
516
|
}
|
|
511
517
|
getSegmentWidth(renderSeries) {
|
|
@@ -513,7 +519,9 @@ class RadialRenderer extends Renderer {
|
|
|
513
519
|
return this.config.annularWidth;
|
|
514
520
|
}
|
|
515
521
|
else {
|
|
516
|
-
return Math.min((renderSeries.scales.r.range()[1] -
|
|
522
|
+
return Math.min((renderSeries.scales.r.range()[1] -
|
|
523
|
+
renderSeries.scales.r.range()[0]) *
|
|
524
|
+
this.config.annularGrowth, this.config.maxThickness);
|
|
517
525
|
}
|
|
518
526
|
}
|
|
519
527
|
emitDataPointHighlight(renderSeries, data, i, rendererSubject) {
|
|
@@ -526,10 +534,16 @@ class RadialRenderer extends Renderer {
|
|
|
526
534
|
position: position,
|
|
527
535
|
};
|
|
528
536
|
if (this.config.enableSeriesHighlighting) {
|
|
529
|
-
rendererSubject.next({
|
|
537
|
+
rendererSubject.next({
|
|
538
|
+
eventName: HIGHLIGHT_SERIES_EVENT,
|
|
539
|
+
data: dataPoint,
|
|
540
|
+
});
|
|
530
541
|
}
|
|
531
542
|
if (this.config.enableDataPointHighlighting) {
|
|
532
|
-
rendererSubject.next({
|
|
543
|
+
rendererSubject.next({
|
|
544
|
+
eventName: HIGHLIGHT_DATA_POINT_EVENT,
|
|
545
|
+
data: dataPoint,
|
|
546
|
+
});
|
|
533
547
|
}
|
|
534
548
|
// we're emitting this event manually, because it's not triggered by mouse interactive area in this case
|
|
535
549
|
rendererSubject.next({
|
|
@@ -553,8 +567,8 @@ class ChartPlugin {
|
|
|
553
567
|
}
|
|
554
568
|
|
|
555
569
|
/**
|
|
556
|
-
* This plugin calculates new size and position for content inside donut chart
|
|
557
|
-
*/
|
|
570
|
+
* This plugin calculates new size and position for content inside donut chart
|
|
571
|
+
*/
|
|
558
572
|
class ChartDonutContentPlugin extends ChartPlugin {
|
|
559
573
|
constructor() {
|
|
560
574
|
super(...arguments);
|
|
@@ -569,8 +583,11 @@ class ChartDonutContentPlugin extends ChartPlugin {
|
|
|
569
583
|
};
|
|
570
584
|
}
|
|
571
585
|
updateDimensions() {
|
|
572
|
-
const radius = this.chart
|
|
573
|
-
|
|
586
|
+
const radius = this.chart
|
|
587
|
+
.getDataManager()
|
|
588
|
+
.chartSeriesSet.reduce((prev, current) => {
|
|
589
|
+
if (current.renderer instanceof RadialRenderer &&
|
|
590
|
+
!isUndefined(prev)) {
|
|
574
591
|
return Math.min(prev, current.renderer.getInnerRadius(current.scales.r.range(), current.data.length - 1));
|
|
575
592
|
}
|
|
576
593
|
return prev;
|
|
@@ -585,10 +602,13 @@ class ChartDonutContentPlugin extends ChartPlugin {
|
|
|
585
602
|
this.contentPositionUpdateSubject.complete();
|
|
586
603
|
}
|
|
587
604
|
getContentPosition(areaSize) {
|
|
588
|
-
const basics = [
|
|
605
|
+
const basics = [
|
|
606
|
+
this.chart.getGrid().config().dimension.outerHeight() / 2,
|
|
607
|
+
this.chart.getGrid().config().dimension.outerWidth() / 2,
|
|
608
|
+
];
|
|
589
609
|
return {
|
|
590
|
-
top: basics[0] -
|
|
591
|
-
left: basics[1] -
|
|
610
|
+
top: basics[0] - areaSize / Math.sqrt(2),
|
|
611
|
+
left: basics[1] - areaSize / Math.sqrt(2),
|
|
592
612
|
width: areaSize * Math.sqrt(2),
|
|
593
613
|
height: areaSize * Math.sqrt(2),
|
|
594
614
|
};
|
|
@@ -600,9 +620,10 @@ class ChartDonutContentComponent {
|
|
|
600
620
|
var _a;
|
|
601
621
|
if (changes.plugin) {
|
|
602
622
|
(_a = this.contentPositionUpdateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
603
|
-
this.contentPositionUpdateSubscription =
|
|
604
|
-
this.contentPosition
|
|
605
|
-
|
|
623
|
+
this.contentPositionUpdateSubscription =
|
|
624
|
+
this.plugin.contentPositionUpdateSubject.subscribe((contentPosition) => {
|
|
625
|
+
this.contentPosition = contentPosition;
|
|
626
|
+
});
|
|
606
627
|
this.plugin.chart.updateDimensions();
|
|
607
628
|
}
|
|
608
629
|
}
|
|
@@ -615,7 +636,7 @@ class ChartDonutContentComponent {
|
|
|
615
636
|
ChartDonutContentComponent.decorators = [
|
|
616
637
|
{ type: Component, args: [{
|
|
617
638
|
selector: "nui-chart-donut-content",
|
|
618
|
-
template: "<div
|
|
639
|
+
template: "<div\n *ngIf=\"plugin && contentPosition\"\n class=\"nui-chart-donut-content d-flex justify-content-center align-items-center text-center\"\n [style.top.px]=\"contentPosition.top\"\n [style.left.px]=\"contentPosition.left\"\n [style.height.px]=\"contentPosition.height\"\n [style.width.px]=\"contentPosition.width\"\n>\n <ng-content></ng-content>\n</div>\n",
|
|
619
640
|
styles: [".nui-chart-donut-content{position:absolute;pointer-events:auto;width:100%;height:100%;overflow:hidden;text-overflow:ellipsis}\n"]
|
|
620
641
|
},] }
|
|
621
642
|
];
|
|
@@ -627,34 +648,40 @@ ChartDonutContentComponent.propDecorators = {
|
|
|
627
648
|
const TOOLTIP_POSITION_OFFSET = 10;
|
|
628
649
|
/** @ignore
|
|
629
650
|
* Used for charts where tooltips should be placed aside of some vertical line */
|
|
630
|
-
const getVerticalSetup = (offset) => [
|
|
651
|
+
const getVerticalSetup = (offset) => [
|
|
652
|
+
{
|
|
631
653
|
originX: "end",
|
|
632
654
|
originY: "top",
|
|
633
655
|
overlayX: "start",
|
|
634
656
|
overlayY: "center",
|
|
635
657
|
offsetX: offset,
|
|
636
|
-
},
|
|
658
|
+
},
|
|
659
|
+
{
|
|
637
660
|
originX: "start",
|
|
638
661
|
originY: "center",
|
|
639
662
|
overlayX: "end",
|
|
640
663
|
overlayY: "center",
|
|
641
664
|
offsetX: -offset,
|
|
642
|
-
}
|
|
665
|
+
},
|
|
666
|
+
];
|
|
643
667
|
/** @ignore
|
|
644
668
|
* Used for charts where tooltips should be placed aligned to some horizontal line (as Horizontal Bar Charts) */
|
|
645
|
-
const getHorizontalSetup = (offset) => [
|
|
669
|
+
const getHorizontalSetup = (offset) => [
|
|
670
|
+
{
|
|
646
671
|
originX: "end",
|
|
647
672
|
originY: "top",
|
|
648
673
|
overlayX: "center",
|
|
649
674
|
overlayY: "bottom",
|
|
650
675
|
offsetY: -offset,
|
|
651
|
-
},
|
|
676
|
+
},
|
|
677
|
+
{
|
|
652
678
|
originX: "end",
|
|
653
679
|
originY: "bottom",
|
|
654
680
|
overlayX: "center",
|
|
655
681
|
overlayY: "top",
|
|
656
682
|
offsetY: offset,
|
|
657
|
-
}
|
|
683
|
+
},
|
|
684
|
+
];
|
|
658
685
|
/**
|
|
659
686
|
* This plugin listens to the INTERACTION_DATA_POINTS_EVENT and transforms received data into tooltips inputs.
|
|
660
687
|
* The actual tooltips are handled by the ChartTooltipsComponent.
|
|
@@ -689,22 +716,30 @@ class ChartTooltipsPlugin extends ChartPlugin {
|
|
|
689
716
|
}
|
|
690
717
|
}
|
|
691
718
|
initialize() {
|
|
692
|
-
this.chart
|
|
719
|
+
this.chart
|
|
720
|
+
.getEventBus()
|
|
721
|
+
.getStream(INTERACTION_DATA_POINTS_EVENT)
|
|
693
722
|
.pipe(takeUntil(this.destroy$))
|
|
694
723
|
.subscribe((event) => {
|
|
695
|
-
if (event.data.interactionType === InteractionType.MouseMove &&
|
|
724
|
+
if (event.data.interactionType === InteractionType.MouseMove &&
|
|
725
|
+
this.isChartInView) {
|
|
696
726
|
const dataPoints = event.data.dataPoints;
|
|
697
727
|
this.processHighlightedDataPoints(dataPoints);
|
|
698
728
|
}
|
|
699
729
|
});
|
|
700
|
-
this.chart
|
|
730
|
+
this.chart
|
|
731
|
+
.getEventBus()
|
|
732
|
+
.getStream(SERIES_STATE_CHANGE_EVENT)
|
|
701
733
|
.pipe(takeUntil(this.destroy$))
|
|
702
734
|
.subscribe((event) => {
|
|
703
|
-
event.data.forEach(series => {
|
|
704
|
-
this.seriesVisibilityMap[series.seriesId] =
|
|
735
|
+
event.data.forEach((series) => {
|
|
736
|
+
this.seriesVisibilityMap[series.seriesId] =
|
|
737
|
+
series.state !== RenderState.hidden;
|
|
705
738
|
});
|
|
706
739
|
});
|
|
707
|
-
this.chart
|
|
740
|
+
this.chart
|
|
741
|
+
.getEventBus()
|
|
742
|
+
.getStream(CHART_VIEW_STATUS_EVENT)
|
|
708
743
|
.pipe(takeUntil(this.destroy$))
|
|
709
744
|
.subscribe((event) => {
|
|
710
745
|
this.isChartInView = event.data.isChartInView;
|
|
@@ -719,7 +754,9 @@ class ChartTooltipsPlugin extends ChartPlugin {
|
|
|
719
754
|
}
|
|
720
755
|
processHighlightedDataPoints(dataPoints) {
|
|
721
756
|
var _a, _b;
|
|
722
|
-
const validDataPoints = pickBy(dataPoints, (d) => d.index >= 0 &&
|
|
757
|
+
const validDataPoints = pickBy(dataPoints, (d) => d.index >= 0 &&
|
|
758
|
+
d.position &&
|
|
759
|
+
this.seriesVisibilityMap[d.seriesId] !== false);
|
|
723
760
|
if (values(validDataPoints).length === 0) {
|
|
724
761
|
this.hideSubject.next();
|
|
725
762
|
return;
|
|
@@ -735,9 +772,11 @@ class ChartTooltipsPlugin extends ChartPlugin {
|
|
|
735
772
|
x: bbox.left - offsetParentBbox.left,
|
|
736
773
|
y: bbox.top - offsetParentBbox.top,
|
|
737
774
|
};
|
|
738
|
-
each(Object.keys(this.dataPoints), seriesId => {
|
|
775
|
+
each(Object.keys(this.dataPoints), (seriesId) => {
|
|
739
776
|
const dataPoint = this.dataPoints[seriesId];
|
|
740
|
-
const chartSeries = this.chart
|
|
777
|
+
const chartSeries = this.chart
|
|
778
|
+
.getDataManager()
|
|
779
|
+
.getChartSeries(dataPoint.seriesId);
|
|
741
780
|
const tooltipRelativePosition = this.getTooltipPosition(dataPoint, chartSeries);
|
|
742
781
|
this.dataPointPositions[seriesId] = this.getAbsolutePosition(tooltipRelativePosition, chartPosition);
|
|
743
782
|
});
|
|
@@ -769,8 +808,12 @@ class ChartTooltipsPlugin extends ChartPlugin {
|
|
|
769
808
|
*/
|
|
770
809
|
getAbsolutePosition(relativePosition, chartPosition) {
|
|
771
810
|
return Object.assign({}, relativePosition, {
|
|
772
|
-
x: chartPosition.x +
|
|
773
|
-
|
|
811
|
+
x: chartPosition.x +
|
|
812
|
+
this.chart.getGrid().config().dimension.margin.left +
|
|
813
|
+
relativePosition.x,
|
|
814
|
+
y: chartPosition.y +
|
|
815
|
+
this.chart.getGrid().config().dimension.margin.top +
|
|
816
|
+
relativePosition.y,
|
|
774
817
|
});
|
|
775
818
|
}
|
|
776
819
|
}
|
|
@@ -791,8 +834,12 @@ class ChartTooltipsComponent {
|
|
|
791
834
|
return;
|
|
792
835
|
}
|
|
793
836
|
this.unsubscribe$.next();
|
|
794
|
-
this.plugin.showSubject
|
|
795
|
-
|
|
837
|
+
this.plugin.showSubject
|
|
838
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
839
|
+
.subscribe(() => this.handleOpen());
|
|
840
|
+
this.plugin.hideSubject
|
|
841
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
842
|
+
.subscribe(() => this.handleClose());
|
|
796
843
|
}
|
|
797
844
|
ngOnDestroy() {
|
|
798
845
|
this.unsubscribe$.next();
|
|
@@ -804,7 +851,7 @@ class ChartTooltipsComponent {
|
|
|
804
851
|
handleOpen() {
|
|
805
852
|
this.changeDetector.detectChanges();
|
|
806
853
|
const currentTooltipDirectivesIndex = {};
|
|
807
|
-
this.tooltips.forEach(tooltip => {
|
|
854
|
+
this.tooltips.forEach((tooltip) => {
|
|
808
855
|
var _a;
|
|
809
856
|
// this is how we identify which series does the tooltip belong to
|
|
810
857
|
const seriesId = (_a = tooltip.elementRef.nativeElement.getAttribute("series-id")) !== null && _a !== void 0 ? _a : undefined;
|
|
@@ -849,7 +896,7 @@ class ChartTooltipsComponent {
|
|
|
849
896
|
avoidTooltipCollisions() {
|
|
850
897
|
// extracted tooltip positions from tooltip directives
|
|
851
898
|
const tooltipPositions = {};
|
|
852
|
-
this.tooltips.forEach(tooltip => {
|
|
899
|
+
this.tooltips.forEach((tooltip) => {
|
|
853
900
|
var _a;
|
|
854
901
|
const element = tooltip.getOverlayElement();
|
|
855
902
|
// this is how we identify which series does the tooltip belong to
|
|
@@ -878,7 +925,7 @@ class ChartTooltipsComponent {
|
|
|
878
925
|
* @param tooltipPositions
|
|
879
926
|
*/
|
|
880
927
|
startSimulation(tooltipIndex, tooltipPositions) {
|
|
881
|
-
const nodes = Object.keys(tooltipPositions).map(seriesId => {
|
|
928
|
+
const nodes = Object.keys(tooltipPositions).map((seriesId) => {
|
|
882
929
|
const position = tooltipPositions[seriesId];
|
|
883
930
|
if (isNil(position.height) || isNil(position.width)) {
|
|
884
931
|
throw new Error("Position height or width are not defined");
|
|
@@ -887,7 +934,9 @@ class ChartTooltipsComponent {
|
|
|
887
934
|
seriesId: seriesId,
|
|
888
935
|
x: position.x,
|
|
889
936
|
y: position.y,
|
|
890
|
-
radius: this.isVertical()
|
|
937
|
+
radius: this.isVertical()
|
|
938
|
+
? position.height / 2
|
|
939
|
+
: position.width / 2,
|
|
891
940
|
};
|
|
892
941
|
if (this.isVertical()) {
|
|
893
942
|
props.fx = position.x;
|
|
@@ -907,8 +956,7 @@ class ChartTooltipsComponent {
|
|
|
907
956
|
simulation.on("tick", () => {
|
|
908
957
|
each(nodes, (node) => {
|
|
909
958
|
const tooltip = tooltipIndex[node.seriesId];
|
|
910
|
-
select(tooltip.getOverlayElement())
|
|
911
|
-
.style(this.isVertical() ? "top" : "left", (this.isVertical() ? node.y : node.x) + "px");
|
|
959
|
+
select(tooltip.getOverlayElement()).style(this.isVertical() ? "top" : "left", (this.isVertical() ? node.y : node.x) + "px");
|
|
912
960
|
});
|
|
913
961
|
});
|
|
914
962
|
return simulation;
|
|
@@ -920,7 +968,7 @@ class ChartTooltipsComponent {
|
|
|
920
968
|
ChartTooltipsComponent.decorators = [
|
|
921
969
|
{ type: Component, args: [{
|
|
922
970
|
selector: "nui-chart-tooltips",
|
|
923
|
-
template: "<div *ngIf=\"plugin && plugin.dataPoints\">\n <div *ngFor=\"let item of plugin.dataPoints | keyvalue; trackBy: trackByFn\">\n <ng-template #tooltipTemplate>\n <ng-container
|
|
971
|
+
template: "<div *ngIf=\"plugin && plugin.dataPoints\">\n <div *ngFor=\"let item of plugin.dataPoints | keyvalue; trackBy: trackByFn\">\n <ng-template #tooltipTemplate>\n <ng-container\n *ngTemplateOutlet=\"template; context: { dataPoint: item.value }\"\n ></ng-container>\n </ng-template>\n\n <div\n nuiChartTooltip\n *ngIf=\"plugin.dataPointPositions[item.key]\"\n [attr.series-id]=\"item.key\"\n [template]=\"tooltipTemplate\"\n [openRemoteControl]=\"openTooltips\"\n [closeRemoteControl]=\"closeTooltips\"\n [positions]=\"plugin.dataPointPositions[item.key].overlayPositions\"\n class=\"chart-tooltips__popover\"\n [style.left.px]=\"plugin.dataPointPositions[item.key].x\"\n [style.top.px]=\"plugin.dataPointPositions[item.key].y\"\n [style.height.px]=\"plugin.dataPointPositions[item.key].height\"\n [style.width.px]=\"plugin.dataPointPositions[item.key].width\"\n ></div>\n </div>\n</div>\n",
|
|
924
972
|
styles: [".chart-tooltips__popover{position:absolute;pointer-events:none}\n"]
|
|
925
973
|
},] }
|
|
926
974
|
];
|
|
@@ -965,11 +1013,18 @@ class ChartPopoverPlugin extends ChartPlugin {
|
|
|
965
1013
|
this.config = defaultsDeep(this.config, this.DEFAULT_CONFIG);
|
|
966
1014
|
}
|
|
967
1015
|
initialize() {
|
|
968
|
-
this.chart
|
|
1016
|
+
this.chart
|
|
1017
|
+
.getEventBus()
|
|
1018
|
+
.getStream(this.config.eventStreamId)
|
|
1019
|
+
.pipe(takeUntil(this.destroy$))
|
|
1020
|
+
.subscribe((event) => {
|
|
969
1021
|
var _a;
|
|
970
1022
|
if (event.data.interactionType === this.config.interactionType) {
|
|
971
1023
|
// here we handle data either of type IInteractionDataPointsEvent or IInteractionDataPointEvent
|
|
972
|
-
const dataPoints = (_a = event.data
|
|
1024
|
+
const dataPoints = (_a = event.data
|
|
1025
|
+
.dataPoints) !== null && _a !== void 0 ? _a : {
|
|
1026
|
+
[event.data.dataPoint.seriesId]: event.data.dataPoint,
|
|
1027
|
+
};
|
|
973
1028
|
this.processDataPoints(dataPoints);
|
|
974
1029
|
}
|
|
975
1030
|
});
|
|
@@ -995,16 +1050,19 @@ class ChartPopoverPlugin extends ChartPlugin {
|
|
|
995
1050
|
if (!chartElement) {
|
|
996
1051
|
throw new Error("Chart parent node is not defined");
|
|
997
1052
|
}
|
|
998
|
-
const dataPointsLeft = Math.min(...valuesArray.map(d => d.position.x));
|
|
999
|
-
const left = chartElement.offsetLeft +
|
|
1000
|
-
|
|
1053
|
+
const dataPointsLeft = Math.min(...valuesArray.map((d) => d.position.x));
|
|
1054
|
+
const left = chartElement.offsetLeft +
|
|
1055
|
+
this.chart.getGrid().config().dimension.margin.left +
|
|
1056
|
+
dataPointsLeft;
|
|
1057
|
+
const top = chartElement.offsetTop +
|
|
1058
|
+
this.chart.getGrid().config().dimension.margin.top;
|
|
1001
1059
|
// area for popovers is enlarged to cover the whole chart (top to bottom),
|
|
1002
1060
|
// so that we avoid collision of chart visualization and popover (by UX request)
|
|
1003
1061
|
return {
|
|
1004
1062
|
top: top,
|
|
1005
1063
|
left: left,
|
|
1006
1064
|
height: chartElement.offsetHeight,
|
|
1007
|
-
width: Math.max(...valuesArray.map(d => d.position.x + (d.position.width || 0))) - dataPointsLeft,
|
|
1065
|
+
width: Math.max(...valuesArray.map((d) => d.position.x + (d.position.width || 0))) - dataPointsLeft,
|
|
1008
1066
|
};
|
|
1009
1067
|
}
|
|
1010
1068
|
processDataPoints(dataPoints) {
|
|
@@ -1064,7 +1122,8 @@ class ChartPopoverComponent {
|
|
|
1064
1122
|
(_a = this.popover) === null || _a === void 0 ? void 0 : _a.resetSize();
|
|
1065
1123
|
// calculating a width offset to position the popover's host element at the midpoint of the popover target
|
|
1066
1124
|
const widthOffset = position.width / 2;
|
|
1067
|
-
this.element.nativeElement.style.left =
|
|
1125
|
+
this.element.nativeElement.style.left =
|
|
1126
|
+
position.left + widthOffset + "px";
|
|
1068
1127
|
this.element.nativeElement.style.top = position.top + "px";
|
|
1069
1128
|
(_b = this.popover) === null || _b === void 0 ? void 0 : _b.updatePosition();
|
|
1070
1129
|
this.update.next((_c = this.plugin) === null || _c === void 0 ? void 0 : _c.dataPoints);
|
|
@@ -1074,7 +1133,7 @@ class ChartPopoverComponent {
|
|
|
1074
1133
|
ChartPopoverComponent.decorators = [
|
|
1075
1134
|
{ type: Component, args: [{
|
|
1076
1135
|
selector: "nui-chart-popover",
|
|
1077
|
-
template: "<div *ngIf=\"plugin && plugin.dataPoints\">\n <nui-popover
|
|
1136
|
+
template: "<div *ngIf=\"plugin && plugin.dataPoints\">\n <nui-popover\n class=\"chart-popover__popover\"\n trigger=\"openPopoverSubject\"\n placement=\"top\"\n [unlimited]=\"true\"\n [template]=\"popoverTemplate\"\n [openPopover]=\"plugin.openPopoverSubject\"\n [closePopover]=\"plugin.closePopoverSubject\"\n [hasPadding]=\"false\"\n [container]=\"element.nativeElement\"\n [style.height.px]=\"plugin.popoverTargetPosition.height\"\n [withGrowAfterOpen]=\"true\"\n >\n </nui-popover>\n\n <ng-template #popoverTemplate>\n <ng-container\n *ngTemplateOutlet=\"\n template;\n context: { dataPoints: plugin.dataPoints }\n \"\n ></ng-container>\n </ng-template>\n</div>\n",
|
|
1078
1137
|
styles: [":host{position:absolute}.chart-popover__popover{position:absolute;pointer-events:none}\n"]
|
|
1079
1138
|
},] }
|
|
1080
1139
|
];
|
|
@@ -1109,7 +1168,9 @@ class ChartMarkerComponent {
|
|
|
1109
1168
|
if (changes["color"]) {
|
|
1110
1169
|
this.marker.setColor(this.color);
|
|
1111
1170
|
}
|
|
1112
|
-
if (this.marker &&
|
|
1171
|
+
if (this.marker &&
|
|
1172
|
+
this.marker.getSvg &&
|
|
1173
|
+
isFunction(this.marker.getSvg)) {
|
|
1113
1174
|
this.svg.next(this.marker.getSvg());
|
|
1114
1175
|
}
|
|
1115
1176
|
}
|
|
@@ -1127,10 +1188,15 @@ class ChartMarkerComponent {
|
|
|
1127
1188
|
svgContainerElement.insertAdjacentHTML("beforeend", svg);
|
|
1128
1189
|
setTimeout(() => {
|
|
1129
1190
|
const clientRect = svgContainerElement.getBBox();
|
|
1130
|
-
this.viewBox =
|
|
1131
|
-
`${clientRect.
|
|
1132
|
-
|
|
1133
|
-
this.
|
|
1191
|
+
this.viewBox =
|
|
1192
|
+
`${clientRect.x - SVG_PADDING} ${clientRect.y - SVG_PADDING} ` +
|
|
1193
|
+
`${clientRect.width + 2 * SVG_PADDING} ${clientRect.height + 2 * SVG_PADDING}`;
|
|
1194
|
+
this.width =
|
|
1195
|
+
Math.min(clientRect.width + 2 * SVG_PADDING, this.maxSize) +
|
|
1196
|
+
"px";
|
|
1197
|
+
this.height =
|
|
1198
|
+
Math.min(clientRect.height + 2 * SVG_PADDING, this.maxSize) +
|
|
1199
|
+
"px";
|
|
1134
1200
|
this.changeDetector.markForCheck();
|
|
1135
1201
|
});
|
|
1136
1202
|
}
|
|
@@ -1183,7 +1249,12 @@ class ChartCollection {
|
|
|
1183
1249
|
*
|
|
1184
1250
|
* @type {[string]}
|
|
1185
1251
|
*/
|
|
1186
|
-
this.events = [
|
|
1252
|
+
this.events = [
|
|
1253
|
+
INTERACTION_VALUES_EVENT,
|
|
1254
|
+
INTERACTION_COORDINATES_EVENT,
|
|
1255
|
+
MOUSE_ACTIVE_EVENT,
|
|
1256
|
+
REFRESH_EVENT,
|
|
1257
|
+
];
|
|
1187
1258
|
this.charts = {};
|
|
1188
1259
|
this.subscriptions = {};
|
|
1189
1260
|
}
|
|
@@ -1238,12 +1309,17 @@ class ChartCollection {
|
|
|
1238
1309
|
initializeEventBus() {
|
|
1239
1310
|
this.eventBus = new EventBus();
|
|
1240
1311
|
for (const event of this.events) {
|
|
1241
|
-
this.eventBus
|
|
1312
|
+
this.eventBus
|
|
1313
|
+
.getStream(event)
|
|
1314
|
+
.subscribe((e) => {
|
|
1242
1315
|
for (const i of Object.keys(this.charts)) {
|
|
1243
1316
|
if (i !== e.chartIndex) {
|
|
1244
1317
|
// setting this flag prevents the event from looping infinitely
|
|
1245
1318
|
e.event.broadcast = true;
|
|
1246
|
-
this.charts[i]
|
|
1319
|
+
this.charts[i]
|
|
1320
|
+
.getEventBus()
|
|
1321
|
+
.getStream(event)
|
|
1322
|
+
.next(e.event);
|
|
1247
1323
|
}
|
|
1248
1324
|
}
|
|
1249
1325
|
});
|
|
@@ -1313,7 +1389,9 @@ class ChartCollectionIdDirective {
|
|
|
1313
1389
|
this.chartCollectionService = chartCollectionService;
|
|
1314
1390
|
}
|
|
1315
1391
|
ngAfterViewInit() {
|
|
1316
|
-
this.chartCollectionService
|
|
1392
|
+
this.chartCollectionService
|
|
1393
|
+
.getChartCollection(this.collectionId)
|
|
1394
|
+
.addChart(this.chartComponent.chart);
|
|
1317
1395
|
}
|
|
1318
1396
|
}
|
|
1319
1397
|
ChartCollectionIdDirective.decorators = [
|
|
@@ -1340,8 +1418,13 @@ class ChartComponent {
|
|
|
1340
1418
|
};
|
|
1341
1419
|
this.intersectionObserverCallback = (entries, observer) => {
|
|
1342
1420
|
// Since we're only listening for intersection changes for one target (the chart itself), the 'entries' argument always has just one element.
|
|
1343
|
-
const data = {
|
|
1344
|
-
|
|
1421
|
+
const data = {
|
|
1422
|
+
isChartInView: entries[0].isIntersecting,
|
|
1423
|
+
};
|
|
1424
|
+
this.chart
|
|
1425
|
+
.getEventBus()
|
|
1426
|
+
.getStream(CHART_VIEW_STATUS_EVENT)
|
|
1427
|
+
.next({ data });
|
|
1345
1428
|
};
|
|
1346
1429
|
}
|
|
1347
1430
|
ngOnInit() {
|
|
@@ -1361,7 +1444,10 @@ class ChartComponent {
|
|
|
1361
1444
|
}
|
|
1362
1445
|
}
|
|
1363
1446
|
ngAfterContentInit() {
|
|
1364
|
-
this.chart
|
|
1447
|
+
this.chart
|
|
1448
|
+
.getEventBus()
|
|
1449
|
+
.getStream(REFRESH_EVENT)
|
|
1450
|
+
.subscribe(() => {
|
|
1365
1451
|
this.chart.updateDimensions();
|
|
1366
1452
|
});
|
|
1367
1453
|
}
|
|
@@ -1371,7 +1457,7 @@ class ChartComponent {
|
|
|
1371
1457
|
// This was suggested here https://github.com/angular/zone.js/issues/1011
|
|
1372
1458
|
this.ngZone.run(() => this.resizeHandler());
|
|
1373
1459
|
});
|
|
1374
|
-
this.ngZone.runOutsideAngular(() => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(
|
|
1460
|
+
this.ngZone.runOutsideAngular(() => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.elRef.nativeElement); });
|
|
1375
1461
|
}
|
|
1376
1462
|
ngOnDestroy() {
|
|
1377
1463
|
var _a, _b, _c;
|
|
@@ -1439,8 +1525,8 @@ LegendComponent.decorators = [
|
|
|
1439
1525
|
{ type: Component, args: [{
|
|
1440
1526
|
selector: "nui-legend",
|
|
1441
1527
|
// eslint-disable-next-line
|
|
1442
|
-
host: {
|
|
1443
|
-
template: "<div
|
|
1528
|
+
host: { class: "d-inline-block" },
|
|
1529
|
+
template: "<div\n class=\"nui-legend d-flex flex-wrap\"\n [class.flex-column]=\"orientation === 'vertical'\"\n>\n <ng-content></ng-content>\n</div>\n",
|
|
1444
1530
|
encapsulation: ViewEncapsulation.Emulated
|
|
1445
1531
|
},] }
|
|
1446
1532
|
];
|
|
@@ -1511,11 +1597,12 @@ class LegendSeriesComponent {
|
|
|
1511
1597
|
ngAfterContentInit() {
|
|
1512
1598
|
var _a;
|
|
1513
1599
|
if (this.legend) {
|
|
1514
|
-
this.legend.activeChanged.subscribe((active) => this._active = active);
|
|
1600
|
+
this.legend.activeChanged.subscribe((active) => (this._active = active));
|
|
1515
1601
|
this.icon = this.icon || this.legend.seriesIcon;
|
|
1516
1602
|
this._active = this.legend.active;
|
|
1517
1603
|
this.interactive = (_a = this.interactive) !== null && _a !== void 0 ? _a : this.legend.interactive;
|
|
1518
|
-
this.isHorizontalClassApplied =
|
|
1604
|
+
this.isHorizontalClassApplied =
|
|
1605
|
+
this.legend.orientation === LegendOrientation.horizontal;
|
|
1519
1606
|
}
|
|
1520
1607
|
}
|
|
1521
1608
|
/**
|
|
@@ -1530,21 +1617,23 @@ class LegendSeriesComponent {
|
|
|
1530
1617
|
* @returns boolean indicating whether the series has a primary or secondary description
|
|
1531
1618
|
*/
|
|
1532
1619
|
hasInputDescription() {
|
|
1533
|
-
return !isEmpty(this.descriptionPrimary) ||
|
|
1620
|
+
return (!isEmpty(this.descriptionPrimary) ||
|
|
1621
|
+
!isEmpty(this.descriptionSecondary));
|
|
1534
1622
|
}
|
|
1535
1623
|
/**
|
|
1536
1624
|
* @returns boolean indicating whether the series has a projected description
|
|
1537
1625
|
*/
|
|
1538
1626
|
hasProjectedDescription() {
|
|
1539
|
-
return !!this.projectedDescription &&
|
|
1627
|
+
return (!!this.projectedDescription &&
|
|
1628
|
+
this.projectedDescription.nativeElement.children.length !== 0);
|
|
1540
1629
|
}
|
|
1541
1630
|
}
|
|
1542
1631
|
LegendSeriesComponent.decorators = [
|
|
1543
1632
|
{ type: Component, args: [{
|
|
1544
1633
|
// eslint-disable-next-line
|
|
1545
|
-
host: {
|
|
1634
|
+
host: { class: LEGEND_SERIES_CLASS_NAME },
|
|
1546
1635
|
selector: "nui-legend-series",
|
|
1547
|
-
template: "<div
|
|
1636
|
+
template: "<div\n class=\"d-flex\"\n [ngClass]=\"['nui-legend-series--state-' + seriesRenderState]\"\n [class.nui-legend-series--deselected]=\"!isSelected\"\n>\n <div class=\"nui-legend-series__tile-wrapper\">\n <div class=\"nui-legend-series__tile\">\n <ng-content></ng-content>\n </div>\n <div\n class=\"nui-legend-series__checkbox-wrapper\"\n [class.nui-legend-series__checkbox--checked]=\"isSelected\"\n >\n <div class=\"nui-legend-series__checkbox-mark\">\n <i class=\"nui-legend-series__checkbox-glyph\"></i>\n </div>\n </div>\n </div>\n <div\n *ngIf=\"hasInputDescription(); else descriptionTemplate\"\n class=\"description-container nui-text-small d-flex flex-column justify-content-center\"\n >\n <div\n *ngIf=\"!!descriptionPrimary\"\n class=\"description description-primary\"\n [title]=\"descriptionPrimary\"\n >\n {{ descriptionPrimary }}\n </div>\n <div\n *ngIf=\"!!descriptionSecondary\"\n class=\"description description-secondary\"\n [title]=\"descriptionSecondary\"\n >\n {{ descriptionSecondary }}\n </div>\n </div>\n</div>\n<ng-template #descriptionTemplate>\n <div class=\"d-flex\" #projectedDescription>\n <ng-content select=\"[description]\"></ng-content>\n </div>\n</ng-template>\n",
|
|
1548
1637
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1549
1638
|
},] }
|
|
1550
1639
|
];
|
|
@@ -1588,12 +1677,15 @@ class RichLegendTileComponent {
|
|
|
1588
1677
|
ngAfterContentInit() {
|
|
1589
1678
|
if (this.legend) {
|
|
1590
1679
|
this.unitLabel = this.unitLabel || this.legend.seriesUnitLabel;
|
|
1591
|
-
this.backgroundColor =
|
|
1680
|
+
this.backgroundColor =
|
|
1681
|
+
this.backgroundColor || this.legend.seriesColor || "white";
|
|
1592
1682
|
}
|
|
1593
1683
|
}
|
|
1594
1684
|
ngAfterViewInit() {
|
|
1595
1685
|
if (this.legendSeries) {
|
|
1596
|
-
this.seriesHasAdditionalContent =
|
|
1686
|
+
this.seriesHasAdditionalContent =
|
|
1687
|
+
this.legendSeries.hasInputDescription() ||
|
|
1688
|
+
this.legendSeries.hasProjectedDescription();
|
|
1597
1689
|
this.changeDetector.detectChanges();
|
|
1598
1690
|
}
|
|
1599
1691
|
}
|
|
@@ -1607,7 +1699,7 @@ class RichLegendTileComponent {
|
|
|
1607
1699
|
RichLegendTileComponent.decorators = [
|
|
1608
1700
|
{ type: Component, args: [{
|
|
1609
1701
|
selector: "nui-rich-legend-tile",
|
|
1610
|
-
template: "<div
|
|
1702
|
+
template: "<div\n class=\"nui-rich-legend-tile\"\n [class.nui-rich-legend-tile--has-point-marker]=\"\n rightEdge.children.length > 0\n \"\n [class.nui-rich-legend-tile--series-has-additional-content]=\"\n seriesHasAdditionalContent\n \"\n>\n <div\n class=\"nui-rich-legend-tile__tilebox d-flex justify-content-center align-items-end flex-column\"\n [ngStyle]=\"{ 'background-color': backgroundColor }\"\n [style.color]=\"color\"\n >\n <div\n *ngIf=\"hasInputValue(); else projectedTopContent\"\n class=\"nui-rich-legend-tile__tilebox-value nui-rich-legend-tile__ellipsified\"\n >\n {{ value }}\n </div>\n <div\n *ngIf=\"hasInputUnitLabel(); else projectedBottomContent\"\n class=\"nui-rich-legend-tile__tilebox-unit nui-rich-legend-tile__ellipsified\"\n >\n {{ unitLabel }}\n </div>\n <ng-content></ng-content>\n </div>\n <div class=\"nui-rich-legend-tile__icon\" #icon>\n <ng-content select=\"[leftEdge]\"></ng-content>\n </div>\n <div class=\"nui-rich-legend-tile__point-marker\" #rightEdge>\n <ng-content select=\"[rightEdge]\"></ng-content>\n </div>\n</div>\n<ng-template #projectedTopContent>\n <ng-content select=\"[top]\"></ng-content>\n</ng-template>\n<ng-template #projectedBottomContent>\n <ng-content select=\"[bottom]\"></ng-content>\n</ng-template>\n",
|
|
1611
1703
|
encapsulation: ViewEncapsulation.Emulated,
|
|
1612
1704
|
styles: [".nui-rich-legend-tile{position:relative;width:60px;height:100%;line-height:18px}.nui-rich-legend-tile :empty{display:none}.nui-rich-legend-tile__tilebox{width:100%;height:100%;padding:0 5px;background-color:var(--nui-color-bg-light,#fff)}.nui-rich-legend-tile__ellipsified{max-width:100%;overflow:hidden;text-overflow:ellipsis}.nui-rich-legend-tile__tilebox-value{text-align:right;font-weight:600}.nui-rich-legend-tile__tilebox-value:not(:last-child){margin-bottom:-3px}.nui-rich-legend-tile__tilebox-unit{text-align:right;font-size:11px}.nui-rich-legend-tile__tilebox-unit:not(:first-child){margin-top:-3px}.nui-rich-legend-tile__point-marker,.nui-rich-legend-tile__icon{position:absolute;line-height:0;top:50%;pointer-events:none}.nui-rich-legend-tile__point-marker{right:0;transform:translate(50%,-50%)}.nui-rich-legend-tile__icon{left:0;transform:translate(-50%,-50%)}.nui-rich-legend-tile--has-point-marker.nui-rich-legend-tile--series-has-additional-content{margin-right:5px}.nui-rich-legend-tile--has-point-marker .nui-rich-legend-tile__tilebox{padding-right:7px}\n"]
|
|
1613
1705
|
},] }
|
|
@@ -1712,7 +1804,9 @@ class TextColorProvider extends ProcessedColorProvider {
|
|
|
1712
1804
|
const rgbInput = rgb(color);
|
|
1713
1805
|
const ratioToLight = this.getContrastRatio(rgbInput, rgb(colorDefinitions.light));
|
|
1714
1806
|
const ratioToDark = this.getContrastRatio(rgbInput, rgb(colorDefinitions.dark));
|
|
1715
|
-
return ratioToDark > ratioToLight
|
|
1807
|
+
return ratioToDark > ratioToLight
|
|
1808
|
+
? colorDefinitions.dark
|
|
1809
|
+
: colorDefinitions.light;
|
|
1716
1810
|
});
|
|
1717
1811
|
}
|
|
1718
1812
|
/**
|
|
@@ -1765,7 +1859,10 @@ class ChartPalette {
|
|
|
1765
1859
|
else {
|
|
1766
1860
|
this._standardColors = colors;
|
|
1767
1861
|
}
|
|
1768
|
-
this._textColors = new TextColorProvider(this.standardColors, {
|
|
1862
|
+
this._textColors = new TextColorProvider(this.standardColors, {
|
|
1863
|
+
light: "white",
|
|
1864
|
+
dark: "black",
|
|
1865
|
+
}); // TODO: oops!
|
|
1769
1866
|
this._backgroundColors = new ProcessedColorProvider(this.standardColors, (c) => {
|
|
1770
1867
|
const color = getColorValueByName(c);
|
|
1771
1868
|
const rgbColor = rgb(color);
|
|
@@ -1795,7 +1892,9 @@ class SvgMarker {
|
|
|
1795
1892
|
return this.styledSvg || this.svg;
|
|
1796
1893
|
}
|
|
1797
1894
|
setColor(color) {
|
|
1798
|
-
this.styledSvg = isUndefined(color)
|
|
1895
|
+
this.styledSvg = isUndefined(color)
|
|
1896
|
+
? color
|
|
1897
|
+
: `<g fill="${color}">${this.svg}</g>`;
|
|
1799
1898
|
}
|
|
1800
1899
|
}
|
|
1801
1900
|
|
|
@@ -1918,15 +2017,13 @@ const emptyShapes = [
|
|
|
1918
2017
|
"m0 4-4-8 8.001 0-4.001 8zm0-3.354 1.573-3.146-3.145 0 1.572 3.146z",
|
|
1919
2018
|
"m0-1.951-2.237 1.626.855 2.63 2.766 0 .855-2.63-2.237-1.626zm0-1.854 4.001 2.907-1.528 4.703-4.945 0-1.528-4.703 4.001-2.907z", // pentagon empty
|
|
1920
2019
|
];
|
|
1921
|
-
const ɵ1$1 = s => `<path class="nui-chart--path__outline" d="${s}"></path>`, ɵ2$1 = (s, i) => `<path class="nui-chart--path__outline-fill" stroke="none" d="${regularShapes[i]}"></path>
|
|
1922
|
-
<path class="nui-chart--path__outline" d="${s}"></path>`, ɵ0$1 = s => new SvgMarker(s);
|
|
2020
|
+
const ɵ1$1 = (s) => `<path class="nui-chart--path__outline" d="${s}"></path>`, ɵ2$1 = (s, i) => `<path class="nui-chart--path__outline-fill" stroke="none" d="${regularShapes[i]}"></path>
|
|
2021
|
+
<path class="nui-chart--path__outline" d="${s}"></path>`, ɵ0$1 = (s) => new SvgMarker(s);
|
|
1923
2022
|
/* eslint-enable max-len */
|
|
1924
2023
|
/** Default chart marker set */
|
|
1925
2024
|
const CHART_MARKERS = [
|
|
1926
|
-
...regularShapes
|
|
1927
|
-
|
|
1928
|
-
...emptyShapes
|
|
1929
|
-
.map(ɵ2$1),
|
|
2025
|
+
...regularShapes.map(ɵ1$1),
|
|
2026
|
+
...emptyShapes.map(ɵ2$1),
|
|
1930
2027
|
].map(ɵ0$1);
|
|
1931
2028
|
|
|
1932
2029
|
/**
|
|
@@ -1974,8 +2071,7 @@ class AreaAccessors {
|
|
|
1974
2071
|
}
|
|
1975
2072
|
|
|
1976
2073
|
class RectangleAccessors {
|
|
1977
|
-
constructor() {
|
|
1978
|
-
}
|
|
2074
|
+
constructor() { }
|
|
1979
2075
|
}
|
|
1980
2076
|
|
|
1981
2077
|
class BarAccessors extends RectangleAccessors {
|
|
@@ -2044,7 +2140,9 @@ class BarAccessors extends RectangleAccessors {
|
|
|
2044
2140
|
class HorizontalBarAccessors extends BarAccessors {
|
|
2045
2141
|
constructor(colorProvider, markerProvider) {
|
|
2046
2142
|
super(colorProvider, markerProvider);
|
|
2047
|
-
this.data = Object.assign(Object.assign({}, this.data), { startX: (d, i, s, ds) => this.data.start(d, i, s, ds), endX: (d, i, s, ds) => this.data.end(d, i, s, ds), startY: (d, i, s, ds) => this.data.category(d, i, s, ds), endY: (d, i, s, ds) => this.data.category(d, i, s, ds), thicknessY: (d, i, s, ds) => this.data.thickness
|
|
2143
|
+
this.data = Object.assign(Object.assign({}, this.data), { startX: (d, i, s, ds) => this.data.start(d, i, s, ds), endX: (d, i, s, ds) => this.data.end(d, i, s, ds), startY: (d, i, s, ds) => this.data.category(d, i, s, ds), endY: (d, i, s, ds) => this.data.category(d, i, s, ds), thicknessY: (d, i, s, ds) => this.data.thickness
|
|
2144
|
+
? this.data.thickness(d, i, s, ds)
|
|
2145
|
+
: undefined });
|
|
2048
2146
|
}
|
|
2049
2147
|
}
|
|
2050
2148
|
|
|
@@ -2096,7 +2194,8 @@ function convert(scale, value, position = BAND_CENTER, levels = Number.MAX_VALUE
|
|
|
2096
2194
|
if (values.length === 1 || !bandScale.innerScale || levels <= 1) {
|
|
2097
2195
|
return bandScale.convert(values[0], position);
|
|
2098
2196
|
}
|
|
2099
|
-
return bandScale.convert(values[0], 0) +
|
|
2197
|
+
return (bandScale.convert(values[0], 0) +
|
|
2198
|
+
convert(bandScale.innerScale, values.slice(1), position, levels - 1));
|
|
2100
2199
|
}
|
|
2101
2200
|
|
|
2102
2201
|
function invert(scale, coordinate) {
|
|
@@ -2138,20 +2237,22 @@ class UtilityService {
|
|
|
2138
2237
|
}
|
|
2139
2238
|
const valueAccessor = UtilityService.getValueAccessor(accessor, haystack[0]);
|
|
2140
2239
|
if (typeof needle === "string") {
|
|
2141
|
-
return haystack.findIndex(straw => valueAccessor(straw, 0) === needle);
|
|
2240
|
+
return haystack.findIndex((straw) => valueAccessor(straw, 0) === needle);
|
|
2142
2241
|
}
|
|
2143
2242
|
let closestDataIndex = this.findNearestIndex(haystack, needle, accessor);
|
|
2144
2243
|
// Compensate for bisect
|
|
2145
|
-
closestDataIndex =
|
|
2244
|
+
closestDataIndex =
|
|
2245
|
+
closestDataIndex > 0 ? closestDataIndex - 1 : closestDataIndex;
|
|
2146
2246
|
// Ensure inbounds reference if right end of data
|
|
2147
|
-
closestDataIndex =
|
|
2148
|
-
|
|
2149
|
-
|
|
2247
|
+
closestDataIndex =
|
|
2248
|
+
closestDataIndex >= haystack.length - 1 && haystack.length !== 1
|
|
2249
|
+
? haystack.length - 2
|
|
2250
|
+
: closestDataIndex;
|
|
2150
2251
|
const indexIncrement = UtilityService.getCloser(valueAccessor(haystack[closestDataIndex], closestDataIndex), valueAccessor(haystack[closestDataIndex + 1], closestDataIndex + 1), needle);
|
|
2151
2252
|
return closestDataIndex + indexIncrement;
|
|
2152
2253
|
}
|
|
2153
2254
|
static getCloser(a, b, test) {
|
|
2154
|
-
return
|
|
2255
|
+
return Math.abs(test - a) <= Math.abs(test - b) ? 0 : 1;
|
|
2155
2256
|
}
|
|
2156
2257
|
/**
|
|
2157
2258
|
* Clamps given value to range
|
|
@@ -2176,7 +2277,7 @@ class UtilityService {
|
|
|
2176
2277
|
const r = (dt + Math.random() * 16) % 16 | 0;
|
|
2177
2278
|
dt = Math.floor(dt / 16);
|
|
2178
2279
|
// eslint-disable-next-line
|
|
2179
|
-
return (c === "x" ? r : (r & 0x3 | 0x8)
|
|
2280
|
+
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
|
2180
2281
|
});
|
|
2181
2282
|
return uuid;
|
|
2182
2283
|
}
|
|
@@ -2210,15 +2311,17 @@ class UtilityService {
|
|
|
2210
2311
|
if (
|
|
2211
2312
|
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
|
|
2212
2313
|
// U+007F, […]
|
|
2213
|
-
(codeUnit >= 0x0001 && codeUnit <=
|
|
2314
|
+
(codeUnit >= 0x0001 && codeUnit <= 0x001f) ||
|
|
2315
|
+
codeUnit === 0x007f ||
|
|
2214
2316
|
// If the character is the first character and is in the range [0-9]
|
|
2215
2317
|
// (U+0030 to U+0039), […]
|
|
2216
2318
|
(index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
2217
2319
|
// If the character is the second character and is in the range [0-9]
|
|
2218
2320
|
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
|
|
2219
2321
|
(index === 1 &&
|
|
2220
|
-
codeUnit >= 0x0030 &&
|
|
2221
|
-
|
|
2322
|
+
codeUnit >= 0x0030 &&
|
|
2323
|
+
codeUnit <= 0x0039 &&
|
|
2324
|
+
firstCodeUnit === 0x002d)) {
|
|
2222
2325
|
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
|
|
2223
2326
|
result += "\\" + codeUnit.toString(16) + " ";
|
|
2224
2327
|
continue;
|
|
@@ -2228,7 +2331,7 @@ class UtilityService {
|
|
|
2228
2331
|
// there is no second character, […]
|
|
2229
2332
|
index === 0 &&
|
|
2230
2333
|
length === 1 &&
|
|
2231
|
-
codeUnit ===
|
|
2334
|
+
codeUnit === 0x002d) {
|
|
2232
2335
|
result += "\\" + sstring.charAt(index);
|
|
2233
2336
|
continue;
|
|
2234
2337
|
}
|
|
@@ -2237,11 +2340,11 @@ class UtilityService {
|
|
|
2237
2340
|
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
|
|
2238
2341
|
// U+005A), or [a-z] (U+0061 to U+007A), […]
|
|
2239
2342
|
if (codeUnit >= 0x0080 ||
|
|
2240
|
-
codeUnit ===
|
|
2241
|
-
codeUnit ===
|
|
2242
|
-
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
|
|
2243
|
-
codeUnit >= 0x0041 && codeUnit <=
|
|
2244
|
-
codeUnit >= 0x0061 && codeUnit <=
|
|
2343
|
+
codeUnit === 0x002d ||
|
|
2344
|
+
codeUnit === 0x005f ||
|
|
2345
|
+
(codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
|
|
2346
|
+
(codeUnit >= 0x0041 && codeUnit <= 0x005a) ||
|
|
2347
|
+
(codeUnit >= 0x0061 && codeUnit <= 0x007a)) {
|
|
2245
2348
|
// the character itself
|
|
2246
2349
|
result += sstring.charAt(index);
|
|
2247
2350
|
continue;
|
|
@@ -2264,7 +2367,7 @@ class UtilityService {
|
|
|
2264
2367
|
while (low < high) {
|
|
2265
2368
|
// eslint-disable-next-line no-bitwise
|
|
2266
2369
|
const mid = (low + high) >>> 1, computed = selector(haystack[mid], mid);
|
|
2267
|
-
if (computed !== null &&
|
|
2370
|
+
if (computed !== null && computed < needle) {
|
|
2268
2371
|
low = mid + 1;
|
|
2269
2372
|
}
|
|
2270
2373
|
else {
|
|
@@ -2379,17 +2482,26 @@ class BarRenderer extends XYRenderer {
|
|
|
2379
2482
|
// TODO: This is tricky: we should not draw anything for hidden data
|
|
2380
2483
|
// (seriesOffset will be undefined and this means we should provide empty array to d3).
|
|
2381
2484
|
// TODO fix this
|
|
2382
|
-
const bars = target
|
|
2485
|
+
const bars = target
|
|
2486
|
+
.selectAll(`g.${this.barContainerClass}`)
|
|
2487
|
+
.data(dataSeries.data);
|
|
2383
2488
|
bars.exit().remove();
|
|
2384
|
-
const barContainers = bars
|
|
2489
|
+
const barContainers = bars
|
|
2490
|
+
.enter()
|
|
2385
2491
|
.append("g")
|
|
2386
2492
|
.classed(this.barContainerClass, true);
|
|
2387
|
-
barContainers.append("rect")
|
|
2388
|
-
.on("click", (d, i) => {
|
|
2493
|
+
barContainers.append("rect").on("click", (d, i) => {
|
|
2389
2494
|
this.emitBarClick(renderSeries, d, i, rendererSubject);
|
|
2390
2495
|
});
|
|
2391
|
-
const getCssClass = (d, i) => {
|
|
2392
|
-
|
|
2496
|
+
const getCssClass = (d, i) => {
|
|
2497
|
+
var _a;
|
|
2498
|
+
return (typeof ((_a = accessors.data) === null || _a === void 0 ? void 0 : _a.cssClass) !== "undefined" &&
|
|
2499
|
+
" " +
|
|
2500
|
+
accessors.data.cssClass(d, i, dataSeries.data, dataSeries)) ||
|
|
2501
|
+
"";
|
|
2502
|
+
};
|
|
2503
|
+
barContainers
|
|
2504
|
+
.merge(bars)
|
|
2393
2505
|
.property(generatedAttrs, (d, i) => attrsGenerator(d, i)) // This saves attrsGenerator() output to local d3 variable generatedAttrs
|
|
2394
2506
|
.select("rect")
|
|
2395
2507
|
// eslint-disable-next-line max-len
|
|
@@ -2398,8 +2510,9 @@ class BarRenderer extends XYRenderer {
|
|
|
2398
2510
|
.style("stroke-width", (_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.strokeWidth) !== null && _c !== void 0 ? _c : "")
|
|
2399
2511
|
.style("fill", (d, i) => {
|
|
2400
2512
|
var _a, _b;
|
|
2401
|
-
return accessors.data.color
|
|
2402
|
-
|
|
2513
|
+
return accessors.data.color
|
|
2514
|
+
? accessors.data.color(d, i, dataSeries.data, dataSeries)
|
|
2515
|
+
: (_b = (_a = accessors.series).color) === null || _b === void 0 ? void 0 : _b.call(_a, dataSeries.id, dataSeries);
|
|
2403
2516
|
})
|
|
2404
2517
|
.attrs(function () {
|
|
2405
2518
|
// @ts-ignore: Suppressing shadowed this and implicit any type error
|
|
@@ -2408,19 +2521,22 @@ class BarRenderer extends XYRenderer {
|
|
|
2408
2521
|
.select("rect")
|
|
2409
2522
|
.style("fill", (d, i) => {
|
|
2410
2523
|
var _a, _b;
|
|
2411
|
-
return accessors.data.color
|
|
2412
|
-
|
|
2524
|
+
return accessors.data.color
|
|
2525
|
+
? accessors.data.color(d, i, dataSeries.data, dataSeries)
|
|
2526
|
+
: (_b = (_a = accessors.series).color) === null || _b === void 0 ? void 0 : _b.call(_a, dataSeries.id, dataSeries);
|
|
2413
2527
|
})
|
|
2414
2528
|
.attrs(generatedAttrs.get); // TODO: find a way to convert to ValueMap<>
|
|
2415
2529
|
if (accessors.data.marker) {
|
|
2416
|
-
barContainers.append("g")
|
|
2417
|
-
|
|
2418
|
-
|
|
2530
|
+
barContainers.append("g").classed("bar-icon", true);
|
|
2531
|
+
barContainers
|
|
2532
|
+
.merge(bars)
|
|
2419
2533
|
.select("g.bar-icon")
|
|
2420
2534
|
.html(function (d, i) {
|
|
2421
2535
|
var _a, _b;
|
|
2422
2536
|
const barSize = generatedAttrs.get(this);
|
|
2423
|
-
if (!barSize ||
|
|
2537
|
+
if (!barSize ||
|
|
2538
|
+
isUndefined(barSize === null || barSize === void 0 ? void 0 : barSize.height) ||
|
|
2539
|
+
isUndefined(barSize === null || barSize === void 0 ? void 0 : barSize.width)) {
|
|
2424
2540
|
throw new Error("barSize is undefined");
|
|
2425
2541
|
}
|
|
2426
2542
|
const minBarSide = Math.min(barSize.height, barSize.width) - 1;
|
|
@@ -2430,7 +2546,9 @@ class BarRenderer extends XYRenderer {
|
|
|
2430
2546
|
})
|
|
2431
2547
|
.attr("transform", function () {
|
|
2432
2548
|
const barAttrs = generatedAttrs.get(this);
|
|
2433
|
-
if (!barAttrs ||
|
|
2549
|
+
if (!barAttrs ||
|
|
2550
|
+
isUndefined(barAttrs === null || barAttrs === void 0 ? void 0 : barAttrs.height) ||
|
|
2551
|
+
isUndefined(barAttrs === null || barAttrs === void 0 ? void 0 : barAttrs.width)) {
|
|
2434
2552
|
throw new Error("barAttrs is undefined");
|
|
2435
2553
|
}
|
|
2436
2554
|
return `translate(${barAttrs.x + barAttrs.width / 2}, ${barAttrs.y + barAttrs.height / 2})`;
|
|
@@ -2460,7 +2578,9 @@ class BarRenderer extends XYRenderer {
|
|
|
2460
2578
|
dataSeries: renderSeries.dataSeries,
|
|
2461
2579
|
index: i,
|
|
2462
2580
|
data: data,
|
|
2463
|
-
position: data
|
|
2581
|
+
position: data
|
|
2582
|
+
? this.getDataPointPosition(renderSeries.dataSeries, i, renderSeries.scales)
|
|
2583
|
+
: undefined,
|
|
2464
2584
|
};
|
|
2465
2585
|
}
|
|
2466
2586
|
filterDataByDomain(data) {
|
|
@@ -2469,16 +2589,21 @@ class BarRenderer extends XYRenderer {
|
|
|
2469
2589
|
getDomain(data, dataSeries, scaleKey, scale) {
|
|
2470
2590
|
const accessors = dataSeries.accessors.data;
|
|
2471
2591
|
const accessorSuffix = scaleKey.toUpperCase();
|
|
2472
|
-
const accessor = (name) => (d, i, arr) => {
|
|
2592
|
+
const accessor = (name) => (d, i, arr) => {
|
|
2593
|
+
var _a;
|
|
2594
|
+
return (_a = accessors[name + accessorSuffix]) === null || _a === void 0 ? void 0 : _a.call(accessors, d, i, Array.from(arr), dataSeries);
|
|
2595
|
+
};
|
|
2473
2596
|
if (scale.isContinuous()) {
|
|
2474
|
-
return !data || data.length === 0
|
|
2597
|
+
return !data || data.length === 0
|
|
2598
|
+
? EMPTY_CONTINUOUS_DOMAIN
|
|
2599
|
+
: [min(data, accessor("start")), max(data, accessor("end"))];
|
|
2475
2600
|
}
|
|
2476
2601
|
else {
|
|
2477
2602
|
const values = data && data.length > 0 ? data.map(accessor("start")) : [];
|
|
2478
|
-
const maxLength = Math.max(...values.map(d => isArray(d) ? d.length : -1));
|
|
2603
|
+
const maxLength = Math.max(...values.map((d) => (isArray(d) ? d.length : -1)));
|
|
2479
2604
|
if (maxLength >= 0) {
|
|
2480
2605
|
return Array.from(Array(maxLength)).map((e, i) => {
|
|
2481
|
-
const scalesDomains = values.map(d => i < d.length ? d[i] : []);
|
|
2606
|
+
const scalesDomains = values.map((d) => i < d.length ? d[i] : []);
|
|
2482
2607
|
return uniq(flatten(scalesDomains));
|
|
2483
2608
|
});
|
|
2484
2609
|
}
|
|
@@ -2488,7 +2613,10 @@ class BarRenderer extends XYRenderer {
|
|
|
2488
2613
|
}
|
|
2489
2614
|
}
|
|
2490
2615
|
emitBarClick(renderSeries, data, i, rendererSubject) {
|
|
2491
|
-
rendererSubject.next({
|
|
2616
|
+
rendererSubject.next({
|
|
2617
|
+
eventName: SELECT_DATA_POINT_EVENT,
|
|
2618
|
+
data: this.getDataPoint(renderSeries, data, i),
|
|
2619
|
+
});
|
|
2492
2620
|
}
|
|
2493
2621
|
/**
|
|
2494
2622
|
* Returns function to generate attributes to draw bar from dataSeries that typically comes from preprocessor with help of accessors that
|
|
@@ -2502,7 +2630,12 @@ class BarRenderer extends XYRenderer {
|
|
|
2502
2630
|
return (d, i) => {
|
|
2503
2631
|
const x = this.getDimensions(accessors, d, i, dataSeries, scales.x, "X");
|
|
2504
2632
|
const y = this.getDimensions(accessors, d, i, dataSeries, scales.y, "Y");
|
|
2505
|
-
return {
|
|
2633
|
+
return {
|
|
2634
|
+
x: x.start,
|
|
2635
|
+
width: x.thickness,
|
|
2636
|
+
y: y.start,
|
|
2637
|
+
height: y.thickness,
|
|
2638
|
+
};
|
|
2506
2639
|
};
|
|
2507
2640
|
}
|
|
2508
2641
|
getDimensions(accessors, d, i, dataSeries, scale, accessorSuffix) {
|
|
@@ -2516,7 +2649,9 @@ class BarRenderer extends XYRenderer {
|
|
|
2516
2649
|
if (!startAccessor) {
|
|
2517
2650
|
throw new Error("Can't compute dimensions");
|
|
2518
2651
|
}
|
|
2519
|
-
start =
|
|
2652
|
+
start =
|
|
2653
|
+
convert(scale, startAccessor(d, i, dataSeries.data, dataSeries), 0.5) -
|
|
2654
|
+
thickness / 2;
|
|
2520
2655
|
}
|
|
2521
2656
|
else {
|
|
2522
2657
|
if (!startAccessor || !endAccessor) {
|
|
@@ -2631,7 +2766,7 @@ class LineAccessors extends XYAccessors {
|
|
|
2631
2766
|
* @param px
|
|
2632
2767
|
*/
|
|
2633
2768
|
function isInRange(scale, px) {
|
|
2634
|
-
const r = scale.range().map(a => a);
|
|
2769
|
+
const r = scale.range().map((a) => a);
|
|
2635
2770
|
const min = Math.min(r[0], r[1]);
|
|
2636
2771
|
const max = Math.max(r[0], r[1]);
|
|
2637
2772
|
return px >= min && px <= max;
|
|
@@ -2661,13 +2796,15 @@ class MarkerUtils {
|
|
|
2661
2796
|
dataPointIndex = dataSeries.data.length - 1;
|
|
2662
2797
|
}
|
|
2663
2798
|
const dataPoint = dataSeries.data[dataPointIndex];
|
|
2664
|
-
if (!((_a = accessors.data) === null || _a === void 0 ? void 0 : _a.x) || !
|
|
2799
|
+
if (!((_a = accessors.data) === null || _a === void 0 ? void 0 : _a.x) || !accessors.data.y) {
|
|
2665
2800
|
throw new Error("Color or marker are undefined");
|
|
2666
2801
|
}
|
|
2667
2802
|
const x = scales.x.convert(accessors.data.x(dataPoint, dataPointIndex, dataSeries.data, dataSeries));
|
|
2668
2803
|
const y = scales.y.convert(accessors.data.y(dataPoint, dataPointIndex, dataSeries.data, dataSeries));
|
|
2669
|
-
if (typeof x !== "undefined" &&
|
|
2670
|
-
|
|
2804
|
+
if (typeof x !== "undefined" &&
|
|
2805
|
+
typeof y !== "undefined" &&
|
|
2806
|
+
isInRange(scales.x, x) &&
|
|
2807
|
+
isInRange(scales.y, y)) {
|
|
2671
2808
|
const seriesId = dataSeries.id;
|
|
2672
2809
|
const dataPointInfo = {
|
|
2673
2810
|
index: dataPointIndex,
|
|
@@ -2691,19 +2828,26 @@ class MarkerUtils {
|
|
|
2691
2828
|
const xCoord = (_a = dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.position) === null || _a === void 0 ? void 0 : _a.x;
|
|
2692
2829
|
const yCoord = (_b = dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.position) === null || _b === void 0 ? void 0 : _b.y;
|
|
2693
2830
|
const attrs = {
|
|
2694
|
-
|
|
2695
|
-
|
|
2831
|
+
transform: `translate(${xCoord}, ${yCoord})`,
|
|
2832
|
+
cursor: "crosshair",
|
|
2696
2833
|
};
|
|
2697
2834
|
const getPointerEventsClass = () => `${markerInteractionConfig.enabled ? " pointer-events" : ""}`;
|
|
2698
|
-
const getPointerEventsClickClass = () => `${markerInteractionConfig.enabled &&
|
|
2835
|
+
const getPointerEventsClickClass = () => `${markerInteractionConfig.enabled &&
|
|
2836
|
+
markerInteractionConfig.clickable
|
|
2837
|
+
? " pointer-events-click"
|
|
2838
|
+
: ""}`;
|
|
2699
2839
|
if (markerTarget.empty()) {
|
|
2700
|
-
markerTarget = target
|
|
2840
|
+
markerTarget = target
|
|
2841
|
+
.append("g")
|
|
2701
2842
|
.classed(`${className}${getPointerEventsClass()}${getPointerEventsClickClass()}`, true);
|
|
2702
2843
|
}
|
|
2703
2844
|
marker.setColor(color);
|
|
2704
2845
|
markerTarget.attrs(attrs);
|
|
2705
2846
|
markerTarget.on("mouseenter", () => {
|
|
2706
|
-
dataPointSubject.next({
|
|
2847
|
+
dataPointSubject.next({
|
|
2848
|
+
eventName: INTERACTION_DATA_POINT_EVENT,
|
|
2849
|
+
data: { interactionType: InteractionType.Hover, dataPoint },
|
|
2850
|
+
});
|
|
2707
2851
|
});
|
|
2708
2852
|
markerTarget.on("mouseleave", () => {
|
|
2709
2853
|
dataPointSubject.next({
|
|
@@ -2715,20 +2859,31 @@ class MarkerUtils {
|
|
|
2715
2859
|
});
|
|
2716
2860
|
});
|
|
2717
2861
|
markerTarget.on("click", () => {
|
|
2718
|
-
dataPointSubject.next({
|
|
2862
|
+
dataPointSubject.next({
|
|
2863
|
+
eventName: INTERACTION_DATA_POINT_EVENT,
|
|
2864
|
+
data: { interactionType: InteractionType.Click, dataPoint },
|
|
2865
|
+
});
|
|
2719
2866
|
});
|
|
2720
|
-
if (!markerTarget
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2867
|
+
if (!markerTarget
|
|
2868
|
+
.selectAll("g > *")
|
|
2869
|
+
.size() &&
|
|
2870
|
+
markerTarget.node()) {
|
|
2871
|
+
(_c = markerTarget
|
|
2872
|
+
.node()) === null || _c === void 0 ? void 0 : _c.appendChild(UtilService.getSvgFromString(marker.getSvg()));
|
|
2873
|
+
markerTarget
|
|
2874
|
+
.select("path")
|
|
2875
|
+
.classed(MarkerUtils.MARKER_PATH_CLASS, true);
|
|
2876
|
+
}
|
|
2877
|
+
const path = markerTarget
|
|
2878
|
+
.select("path")
|
|
2879
|
+
.node();
|
|
2725
2880
|
if (path && markerInteractionConfig.enabled) {
|
|
2726
2881
|
// Hack to accommodate existing Firefox hack in MouseInteractiveArea
|
|
2727
2882
|
const pathRect = path.getBoundingClientRect();
|
|
2728
2883
|
// 'x' in this case represents the absolute position of the left side of the marker
|
|
2729
|
-
path.setAttribute("x", Math.ceil(((
|
|
2884
|
+
path.setAttribute("x", Math.ceil(((_d = dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.position) === null || _d === void 0 ? void 0 : _d.x) - pathRect.width / 2).toString());
|
|
2730
2885
|
// 'y' in this case represents the absolute position of the top side of the marker
|
|
2731
|
-
path.setAttribute("y", Math.ceil(((
|
|
2886
|
+
path.setAttribute("y", Math.ceil(((_e = dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.position) === null || _e === void 0 ? void 0 : _e.y) - pathRect.height / 2).toString());
|
|
2732
2887
|
}
|
|
2733
2888
|
}
|
|
2734
2889
|
static removeMarker(target, className = MarkerUtils.DEFAULT_MARKER_CONTAINER_CLASS) {
|
|
@@ -2780,15 +2935,16 @@ class LineRenderer extends XYRenderer {
|
|
|
2780
2935
|
const strokeValue = (_b = (_a = renderSeries.dataSeries.accessors.series).color) === null || _b === void 0 ? void 0 : _b.call(_a, renderSeries.dataSeries.id, renderSeries.dataSeries);
|
|
2781
2936
|
let path = target.select("path.main");
|
|
2782
2937
|
if (path.empty()) {
|
|
2783
|
-
path = target
|
|
2938
|
+
path = target
|
|
2939
|
+
.append("path")
|
|
2784
2940
|
.classed("main", true)
|
|
2785
2941
|
// Assigning null value to match ValueMap<GElement, Datum> D3's signature
|
|
2786
2942
|
.attrs({
|
|
2787
|
-
|
|
2943
|
+
stroke: strokeValue !== null && strokeValue !== void 0 ? strokeValue : null,
|
|
2788
2944
|
"stroke-width": (_c = this.config.strokeWidth) !== null && _c !== void 0 ? _c : null,
|
|
2789
2945
|
"stroke-dasharray": (_d = this.config.strokeStyle) !== null && _d !== void 0 ? _d : null,
|
|
2790
2946
|
"stroke-linecap": (_e = this.config.strokeLinecap) !== null && _e !== void 0 ? _e : null,
|
|
2791
|
-
|
|
2947
|
+
fill: "none",
|
|
2792
2948
|
});
|
|
2793
2949
|
}
|
|
2794
2950
|
this.drawLine(renderSeries, path);
|
|
@@ -2803,7 +2959,8 @@ class LineRenderer extends XYRenderer {
|
|
|
2803
2959
|
*/
|
|
2804
2960
|
isInfiniteLineData(renderSeries) {
|
|
2805
2961
|
const dataSeries = renderSeries.dataSeries;
|
|
2806
|
-
return dataSeries.data.length === 1 &&
|
|
2962
|
+
return (dataSeries.data.length === 1 &&
|
|
2963
|
+
typeof dataSeries.accessors.data.x(dataSeries.data[0], 0, dataSeries.data, dataSeries) === "undefined");
|
|
2807
2964
|
}
|
|
2808
2965
|
/**
|
|
2809
2966
|
* Renders the line in prepared <path> element
|
|
@@ -2850,8 +3007,10 @@ class LineRenderer extends XYRenderer {
|
|
|
2850
3007
|
const accessors = dataSeries.accessors;
|
|
2851
3008
|
let warned = false;
|
|
2852
3009
|
const validatedData = dataSeries.data.filter((d, i) => {
|
|
2853
|
-
const valid = typeof accessors.data.x(d, i, dataSeries.data, dataSeries) !==
|
|
2854
|
-
|
|
3010
|
+
const valid = typeof accessors.data.x(d, i, dataSeries.data, dataSeries) !==
|
|
3011
|
+
"undefined" &&
|
|
3012
|
+
typeof accessors.data.y(d, i, dataSeries.data, dataSeries) !==
|
|
3013
|
+
"undefined";
|
|
2855
3014
|
if (!valid && !warned) {
|
|
2856
3015
|
console.warn("Data point", d, "was skipped as accessors didn't manage to extract any data.");
|
|
2857
3016
|
console.warn(" -> accessors.data.x:", accessors.data.x);
|
|
@@ -2866,7 +3025,9 @@ class LineRenderer extends XYRenderer {
|
|
|
2866
3025
|
const lineFunc = line()
|
|
2867
3026
|
.x((d, i) => renderSeries.scales.x.convert(accessors.data.x(d, i, dataSeries.data, dataSeries)))
|
|
2868
3027
|
.y((d, i) => renderSeries.scales.y.convert(accessors.data.y(d, i, dataSeries.data, dataSeries)))
|
|
2869
|
-
.defined((d, i) => accessors.data.defined
|
|
3028
|
+
.defined((d, i) => accessors.data.defined
|
|
3029
|
+
? accessors.data.defined(d, i, dataSeries.data, dataSeries)
|
|
3030
|
+
: true)
|
|
2870
3031
|
.curve(this.config.curveType);
|
|
2871
3032
|
path.attr("d", (_a = lineFunc(validatedData)) !== null && _a !== void 0 ? _a : "");
|
|
2872
3033
|
if (this.config.useEnhancedLineCaps) {
|
|
@@ -2888,23 +3049,29 @@ class LineRenderer extends XYRenderer {
|
|
|
2888
3049
|
if (!result) {
|
|
2889
3050
|
throw new Error("Line cannot be computed");
|
|
2890
3051
|
}
|
|
2891
|
-
path
|
|
2892
|
-
.attr("shape-rendering", "crispEdges")
|
|
2893
|
-
.attr("d", result);
|
|
3052
|
+
path.attr("shape-rendering", "crispEdges").attr("d", result);
|
|
2894
3053
|
}
|
|
2895
3054
|
updateLineCaps(validatedData, renderSeries, fill) {
|
|
2896
3055
|
var _a, _b, _c;
|
|
2897
3056
|
const dataSeries = renderSeries.dataSeries;
|
|
2898
3057
|
const accessors = dataSeries.accessors;
|
|
2899
|
-
const definedData = validatedData.filter((d, i) => {
|
|
3058
|
+
const definedData = validatedData.filter((d, i) => {
|
|
3059
|
+
var _a, _b;
|
|
3060
|
+
return ((_a = accessors === null || accessors === void 0 ? void 0 : accessors.data) === null || _a === void 0 ? void 0 : _a.defined)
|
|
3061
|
+
? (_b = accessors === null || accessors === void 0 ? void 0 : accessors.data) === null || _b === void 0 ? void 0 : _b.defined(d, i, dataSeries.data, dataSeries)
|
|
3062
|
+
: true;
|
|
3063
|
+
});
|
|
2900
3064
|
const updateCx = (d, i) => renderSeries.scales.x.convert(accessors.data.x(d, i, dataSeries.data, dataSeries));
|
|
2901
3065
|
const updateCy = (d, i) => renderSeries.scales.y.convert(accessors.data.y(d, i, dataSeries.data, dataSeries));
|
|
2902
3066
|
// use an unclipped layer to ensure the line caps on the left and right sides of the chart don't get clipped
|
|
2903
|
-
const lineCaps = renderSeries.containers[RenderLayerName.unclippedData]
|
|
3067
|
+
const lineCaps = renderSeries.containers[RenderLayerName.unclippedData]
|
|
3068
|
+
.selectAll(`.${LineRenderer.LINE_CAP_CLASS_NAME}`)
|
|
2904
3069
|
.data(definedData)
|
|
2905
3070
|
.attr("cx", updateCx)
|
|
2906
3071
|
.attr("cy", updateCy);
|
|
2907
|
-
lineCaps
|
|
3072
|
+
lineCaps
|
|
3073
|
+
.enter()
|
|
3074
|
+
.append("circle")
|
|
2908
3075
|
.attr("class", LineRenderer.LINE_CAP_CLASS_NAME)
|
|
2909
3076
|
.attr("r", (_a = this.config.enhancedLineCap) === null || _a === void 0 ? void 0 : _a.radius)
|
|
2910
3077
|
.attr("cx", updateCx)
|
|
@@ -2967,12 +3134,15 @@ class SideIndicatorRenderer extends XYRenderer {
|
|
|
2967
3134
|
const scales = renderSeries.scales;
|
|
2968
3135
|
const accessors = renderSeries.dataSeries.accessors;
|
|
2969
3136
|
let rect = target.select("rect");
|
|
2970
|
-
const isActive = dataSeries.data.length > 0
|
|
2971
|
-
accessors.data.active(dataSeries.data[0], 0, renderSeries.dataSeries.data, renderSeries.dataSeries)
|
|
2972
|
-
|
|
3137
|
+
const isActive = dataSeries.data.length > 0
|
|
3138
|
+
? accessors.data.active(dataSeries.data[0], 0, renderSeries.dataSeries.data, renderSeries.dataSeries)
|
|
3139
|
+
: false;
|
|
3140
|
+
const colorAccessor = !isActive && accessors.series.inactiveColor
|
|
3141
|
+
? accessors.series.inactiveColor
|
|
3142
|
+
: accessors.series.activeColor;
|
|
2973
3143
|
if (rect.empty()) {
|
|
2974
3144
|
rect = target.append("rect").attrs({
|
|
2975
|
-
|
|
3145
|
+
fill: colorAccessor(dataSeries.id, dataSeries),
|
|
2976
3146
|
});
|
|
2977
3147
|
if (!isActive && !accessors.series.inactiveColor) {
|
|
2978
3148
|
rect.style("filter", GRAYSCALE_FILTER);
|
|
@@ -2981,14 +3151,16 @@ class SideIndicatorRenderer extends XYRenderer {
|
|
|
2981
3151
|
const start = accessors.series.start(dataSeries.id, dataSeries);
|
|
2982
3152
|
const end = accessors.series.end(dataSeries.id, dataSeries);
|
|
2983
3153
|
const top = end == null ? 0 : scales.y.convert(end);
|
|
2984
|
-
const bottom = start == null
|
|
3154
|
+
const bottom = start == null
|
|
3155
|
+
? scales.y.range()[0]
|
|
3156
|
+
: Math.min(scales.y.range()[0], scales.y.convert(start));
|
|
2985
3157
|
const height = bottom - top;
|
|
2986
3158
|
const width = 2;
|
|
2987
3159
|
rect.attrs({
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3160
|
+
x: -width,
|
|
3161
|
+
y: top,
|
|
3162
|
+
height: height < 0 ? 0 : height,
|
|
3163
|
+
width: width,
|
|
2992
3164
|
});
|
|
2993
3165
|
}
|
|
2994
3166
|
/** See {@link Renderer#getDataPointIndex} */
|
|
@@ -2997,9 +3169,7 @@ class SideIndicatorRenderer extends XYRenderer {
|
|
|
2997
3169
|
}
|
|
2998
3170
|
/** See {@link Renderer#getRequiredLayers} */
|
|
2999
3171
|
getRequiredLayers() {
|
|
3000
|
-
return [
|
|
3001
|
-
STANDARD_RENDER_LAYERS[RenderLayerName.unclippedData],
|
|
3002
|
-
];
|
|
3172
|
+
return [STANDARD_RENDER_LAYERS[RenderLayerName.unclippedData]];
|
|
3003
3173
|
}
|
|
3004
3174
|
}
|
|
3005
3175
|
/** @deprecated As of Nova v9, use RenderLayerName.unclippedData enum value instead. Removal: NUI-5753 */
|
|
@@ -3031,7 +3201,7 @@ class ThresholdsService {
|
|
|
3031
3201
|
*/
|
|
3032
3202
|
injectThresholdsData(dataSeries, zones) {
|
|
3033
3203
|
const zoneIndexes = {};
|
|
3034
|
-
zones.forEach(z => z.entered = false);
|
|
3204
|
+
zones.forEach((z) => (z.entered = false));
|
|
3035
3205
|
for (let i = 0; i < dataSeries.data.length; i++) {
|
|
3036
3206
|
const d = dataSeries.data[i];
|
|
3037
3207
|
const x = dataSeries.accessors.data.x(d, i, dataSeries.data, dataSeries);
|
|
@@ -3061,7 +3231,8 @@ class ThresholdsService {
|
|
|
3061
3231
|
* @param rendererConfig The renderer's configuration
|
|
3062
3232
|
*/
|
|
3063
3233
|
getBackgrounds(sourceSeries, zones, scales, colorProvider, thicknessMap = {}, rendererConfig = cloneDeep(THRESHOLDS_MAIN_CHART_RENDERER_CONFIG)) {
|
|
3064
|
-
if (sourceSeries.data.length > 0 &&
|
|
3234
|
+
if (sourceSeries.data.length > 0 &&
|
|
3235
|
+
typeof sourceSeries.data[0].__thresholds === "undefined") {
|
|
3065
3236
|
this.loggerService.warn("Thresholds metadata is not defined on provided data series", sourceSeries);
|
|
3066
3237
|
}
|
|
3067
3238
|
let data;
|
|
@@ -3071,8 +3242,9 @@ class ThresholdsService {
|
|
|
3071
3242
|
data = cloneDeep(sourceSeries.data);
|
|
3072
3243
|
accessors.data.start = sourceSeries.accessors.data.x;
|
|
3073
3244
|
accessors.data.end = sourceSeries.accessors.data.x;
|
|
3074
|
-
accessors.data.color = (d) =>
|
|
3075
|
-
colorProvider.get(d.__thresholds.status)
|
|
3245
|
+
accessors.data.color = (d) => d.__thresholds && d.__thresholds.status
|
|
3246
|
+
? colorProvider.get(d.__thresholds.status)
|
|
3247
|
+
: "transparent";
|
|
3076
3248
|
accessors.data.thickness = (d) => thicknessMap[d.__thresholds.status];
|
|
3077
3249
|
}
|
|
3078
3250
|
else {
|
|
@@ -3104,16 +3276,25 @@ class ThresholdsService {
|
|
|
3104
3276
|
if (!p1 || !p2) {
|
|
3105
3277
|
throw new Error("p1 or p2 are undefined");
|
|
3106
3278
|
}
|
|
3107
|
-
const midPoint = {
|
|
3279
|
+
const midPoint = {
|
|
3280
|
+
x: (p1.x + p2.x) / 2,
|
|
3281
|
+
y: (p1.y + p2.y) / 2,
|
|
3282
|
+
};
|
|
3108
3283
|
const zone = this.getZoneByXY(zones, zoneIndexes, midPoint.x, midPoint.y);
|
|
3109
3284
|
if (zone) {
|
|
3110
3285
|
const lastBgPoint = backgroundData[backgroundData.length - 1];
|
|
3111
|
-
if (lastBgPoint &&
|
|
3286
|
+
if (lastBgPoint &&
|
|
3287
|
+
((_a = lastBgPoint.end) === null || _a === void 0 ? void 0 : _a.valueOf()) === p1.x &&
|
|
3288
|
+
lastBgPoint.status === zone.value) {
|
|
3112
3289
|
// Extend previous data point instead of creating a new one
|
|
3113
3290
|
lastBgPoint.end = new Date(p2.x);
|
|
3114
3291
|
}
|
|
3115
3292
|
else {
|
|
3116
|
-
backgroundData.push({
|
|
3293
|
+
backgroundData.push({
|
|
3294
|
+
status: zone.value,
|
|
3295
|
+
start: new Date(p1.x),
|
|
3296
|
+
end: new Date(p2.x),
|
|
3297
|
+
});
|
|
3117
3298
|
}
|
|
3118
3299
|
}
|
|
3119
3300
|
}
|
|
@@ -3135,12 +3316,20 @@ class ThresholdsService {
|
|
|
3135
3316
|
const d2 = sourceSeries.data[i + 1];
|
|
3136
3317
|
// calculate their positions
|
|
3137
3318
|
const xy1 = {
|
|
3138
|
-
x: sourceAccessors
|
|
3139
|
-
|
|
3319
|
+
x: sourceAccessors
|
|
3320
|
+
.x(d1, i, sourceSeries.data, sourceSeries)
|
|
3321
|
+
.valueOf(),
|
|
3322
|
+
y: sourceAccessors
|
|
3323
|
+
.y(d1, i, sourceSeries.data, sourceSeries)
|
|
3324
|
+
.valueOf(),
|
|
3140
3325
|
};
|
|
3141
3326
|
const xy2 = {
|
|
3142
|
-
x: sourceAccessors
|
|
3143
|
-
|
|
3327
|
+
x: sourceAccessors
|
|
3328
|
+
.x(d2, i + 1, sourceSeries.data, sourceSeries)
|
|
3329
|
+
.valueOf(),
|
|
3330
|
+
y: sourceAccessors
|
|
3331
|
+
.y(d2, i + 1, sourceSeries.data, sourceSeries)
|
|
3332
|
+
.valueOf(),
|
|
3144
3333
|
};
|
|
3145
3334
|
// try every zone to see if it's limits intersect the line between our two data points
|
|
3146
3335
|
for (let j = 0; j < zones.length; j++) {
|
|
@@ -3148,9 +3337,12 @@ class ThresholdsService {
|
|
|
3148
3337
|
// TODO: so far only works with constant thresholds
|
|
3149
3338
|
const zoneStartY = (_b = (_a = zone.accessors.data).start) === null || _b === void 0 ? void 0 : _b.call(_a, zone.data[0], 0, zone.data, zone);
|
|
3150
3339
|
const zoneEndY = (_d = (_c = zone.accessors.data).end) === null || _d === void 0 ? void 0 : _d.call(_c, zone.data[0], 0, zone.data, zone);
|
|
3151
|
-
const zoneCrossPoints = [
|
|
3152
|
-
|
|
3153
|
-
|
|
3340
|
+
const zoneCrossPoints = [
|
|
3341
|
+
zoneStartY,
|
|
3342
|
+
zoneEndY,
|
|
3343
|
+
]
|
|
3344
|
+
.map((y) => this.getCrossPointWithY(xy1, xy2, y)) // calculate cross points for both limits
|
|
3345
|
+
.filter((c) => c); // take only those that actually intersect
|
|
3154
3346
|
[xy1, xy2].forEach((xy) => {
|
|
3155
3347
|
if (xy.y === zoneStartY || xy.y === zoneEndY) {
|
|
3156
3348
|
xy.isZoneEdge = true;
|
|
@@ -3179,9 +3371,7 @@ class ThresholdsService {
|
|
|
3179
3371
|
return simpleZones.map((z, i) => ({
|
|
3180
3372
|
id: sourceSeries.id + "__" + z.status + "-" + i,
|
|
3181
3373
|
value: z.status,
|
|
3182
|
-
data: [
|
|
3183
|
-
{ start: z.start, end: z.end },
|
|
3184
|
-
],
|
|
3374
|
+
data: [{ start: z.start, end: z.end }],
|
|
3185
3375
|
scales: sourceSeries.scales,
|
|
3186
3376
|
accessors: areaAccessors,
|
|
3187
3377
|
}));
|
|
@@ -3192,14 +3382,15 @@ class ThresholdsService {
|
|
|
3192
3382
|
* @param zones Zones defined as data series with IAreaAccessors
|
|
3193
3383
|
*/
|
|
3194
3384
|
getThresholdLines(zones) {
|
|
3195
|
-
if (-1 === zones.findIndex(z => z.entered)) {
|
|
3385
|
+
if (-1 === zones.findIndex((z) => z.entered)) {
|
|
3196
3386
|
return [];
|
|
3197
3387
|
}
|
|
3198
3388
|
// TODO: works only for static thresholds
|
|
3199
3389
|
const limits = {};
|
|
3200
3390
|
function addLimitEntry(accessor, zone, zoneBoundary) {
|
|
3201
3391
|
const value = accessor(zone.data[0], 0, zone.data, zone);
|
|
3202
|
-
if (typeof value !== "undefined" &&
|
|
3392
|
+
if (typeof value !== "undefined" &&
|
|
3393
|
+
typeof limits[value] === "undefined") {
|
|
3203
3394
|
limits[value] = { series: zone, accessor, zoneBoundary };
|
|
3204
3395
|
}
|
|
3205
3396
|
}
|
|
@@ -3258,17 +3449,19 @@ class ThresholdsService {
|
|
|
3258
3449
|
x: thresholdTo.x - thresholdFrom.x,
|
|
3259
3450
|
y: thresholdTo.y - thresholdFrom.y,
|
|
3260
3451
|
};
|
|
3261
|
-
const s = (-dataShift.y * (dataFrom.x - thresholdFrom.x) +
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3452
|
+
const s = (-dataShift.y * (dataFrom.x - thresholdFrom.x) +
|
|
3453
|
+
dataShift.x * (dataFrom.y - thresholdFrom.y)) /
|
|
3454
|
+
(-thresholdShift.x * dataShift.y + dataShift.x * thresholdShift.y);
|
|
3455
|
+
const t = (thresholdShift.x * (dataFrom.y - thresholdFrom.y) -
|
|
3456
|
+
thresholdShift.y * (dataFrom.x - thresholdFrom.x)) /
|
|
3457
|
+
(-thresholdShift.x * dataShift.y + dataShift.x * thresholdShift.y);
|
|
3265
3458
|
if (!(s >= 0 && s <= 1 && t >= 0 && t <= 1)) {
|
|
3266
3459
|
// No cross point detected
|
|
3267
3460
|
return undefined;
|
|
3268
3461
|
}
|
|
3269
3462
|
return {
|
|
3270
|
-
x: dataFrom.x +
|
|
3271
|
-
y: dataFrom.y +
|
|
3463
|
+
x: dataFrom.x + t * dataShift.x,
|
|
3464
|
+
y: dataFrom.y + t * dataShift.y,
|
|
3272
3465
|
};
|
|
3273
3466
|
}
|
|
3274
3467
|
/**
|
|
@@ -3302,7 +3495,8 @@ class ThresholdsService {
|
|
|
3302
3495
|
return null;
|
|
3303
3496
|
}
|
|
3304
3497
|
moveZoneIndex(zoneIndex, zone, x) {
|
|
3305
|
-
while (zoneIndex < zone.data.length - 1 &&
|
|
3498
|
+
while (zoneIndex < zone.data.length - 1 &&
|
|
3499
|
+
zone.accessors.data.x(zone.data[zoneIndex + 1], zoneIndex + 1, zone.data, zone) < x) {
|
|
3306
3500
|
zoneIndex++;
|
|
3307
3501
|
}
|
|
3308
3502
|
return zoneIndex;
|
|
@@ -3320,7 +3514,7 @@ class ThresholdsService {
|
|
|
3320
3514
|
getSideIndicators(zones, scales, rendererConfig) {
|
|
3321
3515
|
const sideIndicators = [];
|
|
3322
3516
|
const renderer = new SideIndicatorRenderer(rendererConfig || cloneDeep(THRESHOLDS_MAIN_CHART_RENDERER_CONFIG));
|
|
3323
|
-
const indicatorsActive = -1 !== zones.findIndex(z => z.entered);
|
|
3517
|
+
const indicatorsActive = -1 !== zones.findIndex((z) => z.entered);
|
|
3324
3518
|
for (const z of zones) {
|
|
3325
3519
|
const sideIndicatorAccessors = new SideIndicatorAccessors();
|
|
3326
3520
|
sideIndicatorAccessors.series = {
|
|
@@ -3353,12 +3547,7 @@ class NuiChartsModule {
|
|
|
3353
3547
|
}
|
|
3354
3548
|
NuiChartsModule.decorators = [
|
|
3355
3549
|
{ type: NgModule, args: [{
|
|
3356
|
-
imports: [
|
|
3357
|
-
NuiCommonModule,
|
|
3358
|
-
NuiIconModule,
|
|
3359
|
-
NuiPopoverModule,
|
|
3360
|
-
OverlayModule,
|
|
3361
|
-
],
|
|
3550
|
+
imports: [NuiCommonModule, NuiIconModule, NuiPopoverModule, OverlayModule],
|
|
3362
3551
|
declarations: [
|
|
3363
3552
|
LegendComponent,
|
|
3364
3553
|
LegendSeriesComponent,
|
|
@@ -3387,10 +3576,7 @@ NuiChartsModule.decorators = [
|
|
|
3387
3576
|
ChartTooltipComponent,
|
|
3388
3577
|
ChartTooltipDirective,
|
|
3389
3578
|
],
|
|
3390
|
-
providers: [
|
|
3391
|
-
ChartCollectionService,
|
|
3392
|
-
ThresholdsService,
|
|
3393
|
-
],
|
|
3579
|
+
providers: [ChartCollectionService, ThresholdsService],
|
|
3394
3580
|
},] }
|
|
3395
3581
|
];
|
|
3396
3582
|
|
|
@@ -3474,7 +3660,9 @@ const GAUGE_THRESHOLD_LABEL_CLASS = "threshold-label";
|
|
|
3474
3660
|
class VerticalBarAccessors extends BarAccessors {
|
|
3475
3661
|
constructor(colorProvider, markerProvider) {
|
|
3476
3662
|
super(colorProvider, markerProvider);
|
|
3477
|
-
this.data = Object.assign(Object.assign({}, this.data), { startX: (d, i, s, ds) => this.data.category(d, i, s, ds), endX: (d, i, s, ds) => this.data.category(d, i, s, ds), thicknessX: (d, i, s, ds) => this.data.thickness
|
|
3663
|
+
this.data = Object.assign(Object.assign({}, this.data), { startX: (d, i, s, ds) => this.data.category(d, i, s, ds), endX: (d, i, s, ds) => this.data.category(d, i, s, ds), thicknessX: (d, i, s, ds) => this.data.thickness
|
|
3664
|
+
? this.data.thickness(d, i, s, ds)
|
|
3665
|
+
: undefined, startY: (d, i, s, ds) => this.data.start(d, i, s, ds), endY: (d, i, s, ds) => this.data.end(d, i, s, ds) });
|
|
3478
3666
|
}
|
|
3479
3667
|
}
|
|
3480
3668
|
|
|
@@ -3486,17 +3674,21 @@ class VerticalBarAccessors extends BarAccessors {
|
|
|
3486
3674
|
*/
|
|
3487
3675
|
function mergeDomains(domains, scale) {
|
|
3488
3676
|
if (scale.isContinuous()) {
|
|
3489
|
-
const nonEmptyDomains = domains.filter(d => d !== EMPTY_CONTINUOUS_DOMAIN);
|
|
3677
|
+
const nonEmptyDomains = domains.filter((d) => d !== EMPTY_CONTINUOUS_DOMAIN);
|
|
3490
3678
|
if (nonEmptyDomains.length === 0) {
|
|
3491
3679
|
return EMPTY_CONTINUOUS_DOMAIN;
|
|
3492
3680
|
}
|
|
3493
|
-
const domainMin = min(nonEmptyDomains
|
|
3494
|
-
|
|
3681
|
+
const domainMin = min(nonEmptyDomains
|
|
3682
|
+
.filter((e) => typeof e[0] !== undefined)
|
|
3683
|
+
.map((e) => e[0]));
|
|
3684
|
+
const domainMax = max(nonEmptyDomains
|
|
3685
|
+
.filter((e) => typeof e[1] !== undefined)
|
|
3686
|
+
.map((e) => e[1]));
|
|
3495
3687
|
return [domainMin, domainMax];
|
|
3496
3688
|
}
|
|
3497
|
-
const maxLength = Math.max(...domains.map(d => d.length));
|
|
3689
|
+
const maxLength = Math.max(...domains.map((d) => d.length));
|
|
3498
3690
|
return Array.from(Array(maxLength)).map((e, i) => {
|
|
3499
|
-
const scalesDomains = domains.map(d => i < d.length ? d[i] : []);
|
|
3691
|
+
const scalesDomains = domains.map((d) => (i < d.length ? d[i] : []));
|
|
3500
3692
|
return uniq(flatten(scalesDomains));
|
|
3501
3693
|
});
|
|
3502
3694
|
}
|
|
@@ -3533,11 +3725,13 @@ function getFixedDomains(chartSeriesSet, scaleId) {
|
|
|
3533
3725
|
*/
|
|
3534
3726
|
const getAutomaticDomain = (chartSeriesSet, scaleKey, scale) => {
|
|
3535
3727
|
const fixedDomains = getFixedDomains(chartSeriesSet, scaleKey);
|
|
3536
|
-
const domains = chartSeriesSet.map(cs => {
|
|
3728
|
+
const domains = chartSeriesSet.map((cs) => {
|
|
3537
3729
|
// find fixed, continuous scales that are referenced by this series
|
|
3538
3730
|
const filterScales = Object.keys(fixedDomains).reduce((result, next) => {
|
|
3539
3731
|
const seriesScale = cs.scales[next];
|
|
3540
|
-
if (seriesScale &&
|
|
3732
|
+
if (seriesScale &&
|
|
3733
|
+
seriesScale.isContinuous() &&
|
|
3734
|
+
indexOf(fixedDomains[next], seriesScale) !== -1) {
|
|
3541
3735
|
result[next] = seriesScale;
|
|
3542
3736
|
}
|
|
3543
3737
|
return result;
|
|
@@ -3555,7 +3749,10 @@ const getAutomaticDomain = (chartSeriesSet, scaleKey, scale) => {
|
|
|
3555
3749
|
*/
|
|
3556
3750
|
const getAutomaticDomainWithIncludedInterval = (interval) => (chartSeriesSet, scaleId, scale) => {
|
|
3557
3751
|
const automaticDomain = getAutomaticDomain(chartSeriesSet, scaleId, scale);
|
|
3558
|
-
return [
|
|
3752
|
+
return [
|
|
3753
|
+
Math.min(automaticDomain[0], interval[0]),
|
|
3754
|
+
Math.max(automaticDomain[1], interval[1]),
|
|
3755
|
+
];
|
|
3559
3756
|
};
|
|
3560
3757
|
|
|
3561
3758
|
class Scale {
|
|
@@ -3618,7 +3815,7 @@ class Scale {
|
|
|
3618
3815
|
class LinearScale extends Scale {
|
|
3619
3816
|
constructor(id) {
|
|
3620
3817
|
super(id);
|
|
3621
|
-
this.formatters.tick = value => value === null || value === void 0 ? void 0 : value.toLocaleString();
|
|
3818
|
+
this.formatters.tick = (value) => value === null || value === void 0 ? void 0 : value.toLocaleString();
|
|
3622
3819
|
}
|
|
3623
3820
|
createD3Scale() {
|
|
3624
3821
|
return scaleLinear();
|
|
@@ -3680,7 +3877,9 @@ class BandScale extends Scale {
|
|
|
3680
3877
|
else {
|
|
3681
3878
|
// bisector needs to have values sorted in natural order, so we reverse the domain first ...
|
|
3682
3879
|
const rangeMidPoints = this.getRangeMidPoints(domain.map((d, i) => this._d3Scale(domain[domain.length - 1 - i /* ... here ... */])));
|
|
3683
|
-
return domain[domain.length -
|
|
3880
|
+
return domain[domain.length -
|
|
3881
|
+
1 -
|
|
3882
|
+
bisect(rangeMidPoints, coordinate) /* ... and reverse it back here */];
|
|
3684
3883
|
}
|
|
3685
3884
|
}
|
|
3686
3885
|
range(range) {
|
|
@@ -3731,15 +3930,16 @@ class BandScale extends Scale {
|
|
|
3731
3930
|
* Please note the fact that bandScale._d3Scale.step() returns step size without outer paddings!
|
|
3732
3931
|
*/
|
|
3733
3932
|
step() {
|
|
3734
|
-
return this.domain().length
|
|
3933
|
+
return this.domain().length
|
|
3934
|
+
? Math.abs(this.range()[1] - this.range()[0]) / this.domain().length
|
|
3935
|
+
: 0;
|
|
3735
3936
|
}
|
|
3736
3937
|
/**
|
|
3737
3938
|
* Creates linear scale with domain and range that are equal to current scale's range
|
|
3738
3939
|
*/
|
|
3739
3940
|
copyToLinear() {
|
|
3740
3941
|
const scale = new LinearScale();
|
|
3741
|
-
scale.domain(this.range())
|
|
3742
|
-
.range(this.range());
|
|
3942
|
+
scale.domain(this.range()).range(this.range());
|
|
3743
3943
|
return scale;
|
|
3744
3944
|
}
|
|
3745
3945
|
/**
|
|
@@ -3760,8 +3960,10 @@ class BandScale extends Scale {
|
|
|
3760
3960
|
return false;
|
|
3761
3961
|
}
|
|
3762
3962
|
getRangeMidPoints(coords) {
|
|
3763
|
-
return coords
|
|
3764
|
-
.
|
|
3963
|
+
return coords
|
|
3964
|
+
.slice(1)
|
|
3965
|
+
.map((d) => d -
|
|
3966
|
+
(this._d3Scale.step() * this._d3Scale.paddingInner()) / 2);
|
|
3765
3967
|
}
|
|
3766
3968
|
}
|
|
3767
3969
|
|
|
@@ -3824,23 +4026,30 @@ class LinearGaugeThresholdsRenderer extends BarRenderer {
|
|
|
3824
4026
|
// last value in the thresholds series is the max value of the gauge (needed by RadialGaugeThresholdsRenderer).
|
|
3825
4027
|
// removing this value to avoid rendering a marker for it
|
|
3826
4028
|
data.pop();
|
|
3827
|
-
const markerSelection = dataContainer
|
|
4029
|
+
const markerSelection = dataContainer
|
|
4030
|
+
.selectAll(`circle.${GAUGE_THRESHOLD_MARKER_CLASS}`)
|
|
4031
|
+
.data(data);
|
|
3828
4032
|
markerSelection.exit().remove();
|
|
3829
|
-
markerSelection
|
|
4033
|
+
markerSelection
|
|
4034
|
+
.enter()
|
|
3830
4035
|
.append("circle")
|
|
3831
4036
|
.attr("class", GAUGE_THRESHOLD_MARKER_CLASS)
|
|
3832
4037
|
.merge(markerSelection)
|
|
3833
|
-
.attr("cx", (d, i) => {
|
|
3834
|
-
|
|
4038
|
+
.attr("cx", (d, i) => {
|
|
4039
|
+
var _a, _b;
|
|
4040
|
+
return renderSeries.scales.x.convert((_b = (_a = accessors === null || accessors === void 0 ? void 0 : accessors.data) === null || _a === void 0 ? void 0 : _a.endX) === null || _b === void 0 ? void 0 : _b.call(_a, d, i, dataSeries.data, dataSeries));
|
|
4041
|
+
})
|
|
4042
|
+
.attr("cy", (d, i) => {
|
|
4043
|
+
var _a, _b;
|
|
4044
|
+
return renderSeries.scales.y.convert((_b = (_a = accessors === null || accessors === void 0 ? void 0 : accessors.data) === null || _a === void 0 ? void 0 : _a.endY) === null || _b === void 0 ? void 0 : _b.call(_a, d, i, dataSeries.data, dataSeries));
|
|
4045
|
+
})
|
|
3835
4046
|
.attr("r", this.config.markerRadius)
|
|
3836
4047
|
.style("fill", (d, i) => `var(--nui-color-${data[i].hit ? "text-light" : "icon-default"})`)
|
|
3837
4048
|
.style("stroke-width", 0);
|
|
3838
4049
|
}
|
|
3839
4050
|
/** See {@link Renderer#getRequiredLayers} */
|
|
3840
4051
|
getRequiredLayers() {
|
|
3841
|
-
return [
|
|
3842
|
-
STANDARD_RENDER_LAYERS[RenderLayerName.unclippedData],
|
|
3843
|
-
];
|
|
4052
|
+
return [STANDARD_RENDER_LAYERS[RenderLayerName.unclippedData]];
|
|
3844
4053
|
}
|
|
3845
4054
|
}
|
|
3846
4055
|
|
|
@@ -3848,7 +4057,7 @@ class RadialAccessors {
|
|
|
3848
4057
|
constructor(colorProvider = defaultColorProvider()) {
|
|
3849
4058
|
this.colorProvider = colorProvider;
|
|
3850
4059
|
this.data = {
|
|
3851
|
-
value: (d) => Number.isFinite(d) ? d : d.value,
|
|
4060
|
+
value: (d) => (Number.isFinite(d) ? d : d.value),
|
|
3852
4061
|
};
|
|
3853
4062
|
this.series = {
|
|
3854
4063
|
color: this.colorProvider ? this.colorProvider.get : undefined,
|
|
@@ -3927,15 +4136,17 @@ class DonutGaugeThresholdsRenderer extends RadialRenderer {
|
|
|
3927
4136
|
const markerGenerator = arc()
|
|
3928
4137
|
.outerRadius(this.getOuterRadius(renderSeries.scales.r.range(), 0))
|
|
3929
4138
|
.innerRadius(innerRadius >= 0 ? innerRadius : 0);
|
|
3930
|
-
const markerSelection = dataContainer
|
|
4139
|
+
const markerSelection = dataContainer
|
|
4140
|
+
.selectAll(`circle.${GAUGE_THRESHOLD_MARKER_CLASS}`)
|
|
3931
4141
|
.data(DonutGaugeRenderingUtil.generateThresholdArcData(data));
|
|
3932
4142
|
markerSelection.exit().remove();
|
|
3933
|
-
markerSelection
|
|
4143
|
+
markerSelection
|
|
4144
|
+
.enter()
|
|
3934
4145
|
.append("circle")
|
|
3935
4146
|
.attr("class", GAUGE_THRESHOLD_MARKER_CLASS)
|
|
3936
4147
|
.merge(markerSelection)
|
|
3937
|
-
.attr("cx", d => markerGenerator.centroid(d)[0])
|
|
3938
|
-
.attr("cy", d => markerGenerator.centroid(d)[1])
|
|
4148
|
+
.attr("cx", (d) => markerGenerator.centroid(d)[0])
|
|
4149
|
+
.attr("cy", (d) => markerGenerator.centroid(d)[1])
|
|
3939
4150
|
.attr("r", this.config.markerRadius)
|
|
3940
4151
|
.style("fill", (d, i) => `var(--nui-color-${data[i].hit ? "text-light" : "icon-default"})`)
|
|
3941
4152
|
.style("stroke-width", 0);
|
|
@@ -4013,7 +4224,10 @@ class ChartAssist {
|
|
|
4013
4224
|
this.toggleSeries = (seriesId, visible) => {
|
|
4014
4225
|
this.legendInteractionAssist.setGroupVisibility(seriesId, visible);
|
|
4015
4226
|
this.update(this.inputSeriesSet, false);
|
|
4016
|
-
this.chartAssistSubject.next({
|
|
4227
|
+
this.chartAssistSubject.next({
|
|
4228
|
+
type: ChartAssistEventType.ToggleSeries,
|
|
4229
|
+
payload: { seriesId, visible },
|
|
4230
|
+
});
|
|
4017
4231
|
};
|
|
4018
4232
|
/**
|
|
4019
4233
|
* Resets all visible series to default state
|
|
@@ -4021,7 +4235,10 @@ class ChartAssist {
|
|
|
4021
4235
|
this.resetVisibleSeries = () => {
|
|
4022
4236
|
this.legendInteractionAssist.resetSeries();
|
|
4023
4237
|
this.publishRenderStates();
|
|
4024
|
-
this.chartAssistSubject.next({
|
|
4238
|
+
this.chartAssistSubject.next({
|
|
4239
|
+
type: ChartAssistEventType.ResetVisibleSeries,
|
|
4240
|
+
payload: {},
|
|
4241
|
+
});
|
|
4025
4242
|
};
|
|
4026
4243
|
/**
|
|
4027
4244
|
* For series that are currently visible, emphasize the given series and deemphasizes all the other ones
|
|
@@ -4031,9 +4248,12 @@ class ChartAssist {
|
|
|
4031
4248
|
this.emphasizeSeries = (seriesId) => {
|
|
4032
4249
|
this.legendInteractionAssist.emphasizeSeries(seriesId);
|
|
4033
4250
|
this.publishRenderStates();
|
|
4034
|
-
this.chartAssistSubject.next({
|
|
4251
|
+
this.chartAssistSubject.next({
|
|
4252
|
+
type: ChartAssistEventType.EmphasizeSeries,
|
|
4253
|
+
payload: { seriesId },
|
|
4254
|
+
});
|
|
4035
4255
|
};
|
|
4036
|
-
this.getVisibleSeriesWithLegend = () => this.legendSeriesSet.filter(s => !this.isSeriesHidden(s.id));
|
|
4256
|
+
this.getVisibleSeriesWithLegend = () => this.legendSeriesSet.filter((s) => !this.isSeriesHidden(s.id));
|
|
4037
4257
|
this.configureChartEventSubscriptions(chart.getEventBus());
|
|
4038
4258
|
if (seriesProcessor) {
|
|
4039
4259
|
this.seriesProcessor = seriesProcessor;
|
|
@@ -4089,27 +4309,31 @@ class ChartAssist {
|
|
|
4089
4309
|
* @param chartSeries
|
|
4090
4310
|
*/
|
|
4091
4311
|
legendLabelData$(chartSeries) {
|
|
4092
|
-
const seriesHighlight$ = this.chart
|
|
4093
|
-
.
|
|
4312
|
+
const seriesHighlight$ = this.chart
|
|
4313
|
+
.getEventBus()
|
|
4314
|
+
.getStream(INTERACTION_DATA_POINTS_EVENT)
|
|
4315
|
+
.asObservable()
|
|
4316
|
+
.pipe(filter((event) => event.data.interactionType === InteractionType.MouseMove), map((event) => event.data.dataPoints[chartSeries.id]));
|
|
4094
4317
|
// if there is no highlightData, or index is "-1", we'll show the last value from series (if possible)
|
|
4095
4318
|
const highlightDataPresentPredicate = (highlightData) => highlightData && highlightData.index >= 0;
|
|
4096
|
-
return seriesHighlight
|
|
4097
|
-
.pipe(switchMap(highlightData => highlightDataPresentPredicate(highlightData)
|
|
4319
|
+
return seriesHighlight$.pipe(switchMap((highlightData) => highlightDataPresentPredicate(highlightData)
|
|
4098
4320
|
? of(highlightData.data)
|
|
4099
|
-
: of(
|
|
4321
|
+
: of(chartSeries.data && chartSeries.data.length
|
|
4322
|
+
? chartSeries.data[chartSeries.data.length - 1]
|
|
4323
|
+
: null)));
|
|
4100
4324
|
}
|
|
4101
4325
|
seriesProcessor(series) {
|
|
4102
4326
|
return series;
|
|
4103
4327
|
}
|
|
4104
4328
|
update(inputSeriesSet, updateLegend = true) {
|
|
4105
4329
|
this.inputSeriesSet = inputSeriesSet;
|
|
4106
|
-
const processedSeriesSet = this.seriesProcessor(inputSeriesSet.map(series => (Object.assign(Object.assign({}, series), { data: series.data || [] }))));
|
|
4107
|
-
this.legendSeriesSet = processedSeriesSet.filter(s => s.showInLegend || typeof s.showInLegend === "undefined");
|
|
4330
|
+
const processedSeriesSet = this.seriesProcessor(inputSeriesSet.map((series) => (Object.assign(Object.assign({}, series), { data: series.data || [] }))));
|
|
4331
|
+
this.legendSeriesSet = processedSeriesSet.filter((s) => s.showInLegend || typeof s.showInLegend === "undefined");
|
|
4108
4332
|
if (updateLegend) {
|
|
4109
4333
|
this.legendInteractionAssist.update(processedSeriesSet);
|
|
4110
4334
|
}
|
|
4111
4335
|
// add render states to the series for use in the chart
|
|
4112
|
-
const seriesSet = processedSeriesSet.map(s => {
|
|
4336
|
+
const seriesSet = processedSeriesSet.map((s) => {
|
|
4113
4337
|
var _a;
|
|
4114
4338
|
return Object.assign({ renderState: (_a = this.renderStatesIndex[s.id]) === null || _a === void 0 ? void 0 : _a.state }, s);
|
|
4115
4339
|
});
|
|
@@ -4123,15 +4347,15 @@ class ChartAssist {
|
|
|
4123
4347
|
return item.id;
|
|
4124
4348
|
}
|
|
4125
4349
|
/**
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4350
|
+
* Retrieves the display value for the highlighted data point on the specified series
|
|
4351
|
+
*
|
|
4352
|
+
* @param chartSeries The series containing the highlighted data point to get a label for
|
|
4353
|
+
* @param scaleKey The key for the scale potentially containing a formatter that can be used to format the label
|
|
4354
|
+
* @param formatterName The name of the formatter to use for formatting the label
|
|
4355
|
+
* @param dataAccessorKey The accessor key to use for accessing the data value if the accessor key differs from the scale key
|
|
4356
|
+
*
|
|
4357
|
+
* @returns The display value for the highlighted data point
|
|
4358
|
+
*/
|
|
4135
4359
|
getHighlightedValue(chartSeries, scaleKey, formatterName, dataAccessorKey) {
|
|
4136
4360
|
if (!this.highlightedDataPoints) {
|
|
4137
4361
|
return undefined;
|
|
@@ -4151,9 +4375,12 @@ class ChartAssist {
|
|
|
4151
4375
|
*/
|
|
4152
4376
|
syncWithChartAssist(chartAssist) {
|
|
4153
4377
|
this.getVisibleSeriesWithLegendBackup = this.getVisibleSeriesWithLegend;
|
|
4154
|
-
this.getVisibleSeriesWithLegend =
|
|
4155
|
-
|
|
4156
|
-
|
|
4378
|
+
this.getVisibleSeriesWithLegend =
|
|
4379
|
+
chartAssist.getVisibleSeriesWithLegend;
|
|
4380
|
+
this.syncSubscription = chartAssist.chartAssistSubject
|
|
4381
|
+
.pipe(takeUntil(chartAssist.chart.getEventBus().getStream(DESTROY_EVENT)))
|
|
4382
|
+
.subscribe((event) => {
|
|
4383
|
+
const args = Object.keys(event.payload).map((key) => event.payload[key]);
|
|
4157
4384
|
this.syncHandlerMap[event.type](...args);
|
|
4158
4385
|
});
|
|
4159
4386
|
}
|
|
@@ -4188,7 +4415,7 @@ class ChartAssist {
|
|
|
4188
4415
|
this.isLegendActive = data;
|
|
4189
4416
|
},
|
|
4190
4417
|
};
|
|
4191
|
-
each(Object.keys(eventHandlers), key => {
|
|
4418
|
+
each(Object.keys(eventHandlers), (key) => {
|
|
4192
4419
|
eventBus.getStream(key).subscribe((event) => {
|
|
4193
4420
|
eventHandlers[key](event.data);
|
|
4194
4421
|
if (this.onEvent) {
|
|
@@ -4209,12 +4436,13 @@ class LegendInteractionAssist {
|
|
|
4209
4436
|
}
|
|
4210
4437
|
update(seriesSet) {
|
|
4211
4438
|
this.seriesGroups = this.getSeriesGroups(seriesSet);
|
|
4212
|
-
this.seriesIndex = keyBy(seriesSet, s => s.id);
|
|
4439
|
+
this.seriesIndex = keyBy(seriesSet, (s) => s.id);
|
|
4213
4440
|
this.resetSeries();
|
|
4214
4441
|
// override render states
|
|
4215
|
-
for (const series of seriesSet.filter(s => s.renderState)) {
|
|
4216
|
-
this.renderStatesIndex[series.id] =
|
|
4217
|
-
|
|
4442
|
+
for (const series of seriesSet.filter((s) => s.renderState)) {
|
|
4443
|
+
this.renderStatesIndex[series.id] = new ChartAssistRenderStateData(series.id, series, series.renderState === RenderState.hidden
|
|
4444
|
+
? RenderState.default
|
|
4445
|
+
: series.renderState, series.renderState !== RenderState.hidden);
|
|
4218
4446
|
}
|
|
4219
4447
|
}
|
|
4220
4448
|
getSeriesStates() {
|
|
@@ -4228,7 +4456,7 @@ class LegendInteractionAssist {
|
|
|
4228
4456
|
const seriesGroups = {};
|
|
4229
4457
|
for (const s of seriesSet) {
|
|
4230
4458
|
const separatorIndex = s.id.indexOf("__");
|
|
4231
|
-
const parentId =
|
|
4459
|
+
const parentId = separatorIndex >= 0 ? s.id.substring(0, separatorIndex) : s.id;
|
|
4232
4460
|
if (!seriesGroups[parentId]) {
|
|
4233
4461
|
seriesGroups[parentId] = [];
|
|
4234
4462
|
}
|
|
@@ -4262,7 +4490,9 @@ class LegendInteractionAssist {
|
|
|
4262
4490
|
}
|
|
4263
4491
|
emphasizeSeries(seriesId) {
|
|
4264
4492
|
for (const group of Object.keys(this.seriesGroups)) {
|
|
4265
|
-
this.setGroupState(group, group === seriesId
|
|
4493
|
+
this.setGroupState(group, group === seriesId
|
|
4494
|
+
? RenderState.emphasized
|
|
4495
|
+
: RenderState.deemphasized);
|
|
4266
4496
|
}
|
|
4267
4497
|
}
|
|
4268
4498
|
resetSeries() {
|
|
@@ -4310,16 +4540,18 @@ function radialPreprocessor(seriesSet, isVisible) {
|
|
|
4310
4540
|
if (!seriesSet[0]) {
|
|
4311
4541
|
return seriesSet;
|
|
4312
4542
|
}
|
|
4313
|
-
const pieGenerator = pie()
|
|
4314
|
-
.sort(null);
|
|
4543
|
+
const pieGenerator = pie().sort(null);
|
|
4315
4544
|
const seriesNeededOnlyToKnowHowManyLayersDonutHas = seriesSet[0].data;
|
|
4316
4545
|
const rawArcDataForAllSeries = seriesNeededOnlyToKnowHowManyLayersDonutHas.reduce((accumulator, value) => {
|
|
4317
|
-
accumulator.push(seriesSet.map((s) => isVisible(s) && !s.excludeFromArcCalculation
|
|
4318
|
-
s.accessors.data.value(s.data[accumulator.length], accumulator.length, s.data, s)
|
|
4546
|
+
accumulator.push(seriesSet.map((s) => isVisible(s) && !s.excludeFromArcCalculation
|
|
4547
|
+
? s.accessors.data.value(s.data[accumulator.length], accumulator.length, s.data, s)
|
|
4548
|
+
: 0));
|
|
4319
4549
|
return accumulator;
|
|
4320
4550
|
}, []);
|
|
4321
4551
|
const pieData = rawArcDataForAllSeries.map((rawArcData) => pieGenerator(rawArcData));
|
|
4322
|
-
return seriesSet.map((s, index) => (Object.assign(Object.assign({}, s), { data: s.preprocess === false
|
|
4552
|
+
return seriesSet.map((s, index) => (Object.assign(Object.assign({}, s), { data: s.preprocess === false
|
|
4553
|
+
? s.data
|
|
4554
|
+
: pieData.map((d) => (Object.assign(Object.assign({}, d[index]), { data: s.data[0] }))) })));
|
|
4323
4555
|
}
|
|
4324
4556
|
function radial(chartSeriesSet) {
|
|
4325
4557
|
return radialPreprocessor(chartSeriesSet, (series) => !this.isSeriesHidden(series.id));
|
|
@@ -4363,7 +4595,8 @@ function stackedPreprocessor(chartSeriesSet, isVisible) {
|
|
|
4363
4595
|
const metadata = {};
|
|
4364
4596
|
const coef = isVisible(chartSeries) ? 1 : 0;
|
|
4365
4597
|
metadata.start = acc[i];
|
|
4366
|
-
acc[i] +=
|
|
4598
|
+
acc[i] +=
|
|
4599
|
+
(valueAccessor(datum, dataIndex[category], chartSeries.data, chartSeries) || 0) * coef;
|
|
4367
4600
|
metadata.end = acc[i];
|
|
4368
4601
|
datum["__bar"] = metadata;
|
|
4369
4602
|
reorderedData.push(datum);
|
|
@@ -4417,14 +4650,14 @@ class DataManager {
|
|
|
4417
4650
|
return this._scalesIndexById;
|
|
4418
4651
|
}
|
|
4419
4652
|
update(seriesSet) {
|
|
4420
|
-
const duplicateIds = filter$1(seriesSet.map(series => series.id), (val, i, iteratee) => includes(iteratee, val, i + 1));
|
|
4653
|
+
const duplicateIds = filter$1(seriesSet.map((series) => series.id), (val, i, iteratee) => includes(iteratee, val, i + 1));
|
|
4421
4654
|
if (duplicateIds.length > 0) {
|
|
4422
4655
|
console.warn("Series set contains duplicate IDs:", duplicateIds);
|
|
4423
4656
|
}
|
|
4424
4657
|
this._chartSeriesSet = seriesSet || [];
|
|
4425
4658
|
this.dataIndex = keyBy(this._chartSeriesSet, (s) => s.id);
|
|
4426
4659
|
this._scalesIndexByKey = this.buildScalesIndex(this._chartSeriesSet);
|
|
4427
|
-
this._scalesIndexById = keyBy(flatten(values(this._scalesIndexByKey).map(v => v.list)), s => s.id);
|
|
4660
|
+
this._scalesIndexById = keyBy(flatten(values(this._scalesIndexByKey).map((v) => v.list)), (s) => s.id);
|
|
4428
4661
|
}
|
|
4429
4662
|
getChartSeries(seriesId) {
|
|
4430
4663
|
return this.dataIndex[seriesId];
|
|
@@ -4436,9 +4669,11 @@ class DataManager {
|
|
|
4436
4669
|
}
|
|
4437
4670
|
if (scale.domainCalculator) {
|
|
4438
4671
|
const chartSeriesSet = this.chartSeriesSet
|
|
4439
|
-
.filter(cs => cs.scales[scaleKey] === scale &&
|
|
4440
|
-
.
|
|
4441
|
-
|
|
4672
|
+
.filter((cs) => cs.scales[scaleKey] === scale &&
|
|
4673
|
+
!cs.renderer.config.ignoreForDomainCalculation)
|
|
4674
|
+
.filter((c) => c.renderState !== RenderState.hidden);
|
|
4675
|
+
if (chartSeriesSet.length ||
|
|
4676
|
+
((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.configuration) === null || _b === void 0 ? void 0 : _b.updateDomainForEmptySeries)) {
|
|
4442
4677
|
const calculatedDomain = scale.domainCalculator(chartSeriesSet, scaleKey, scale);
|
|
4443
4678
|
domain(scale, calculatedDomain);
|
|
4444
4679
|
}
|
|
@@ -4446,8 +4681,8 @@ class DataManager {
|
|
|
4446
4681
|
}
|
|
4447
4682
|
buildScalesIndex(chartSeries) {
|
|
4448
4683
|
const scales = {};
|
|
4449
|
-
each(chartSeries, cs => {
|
|
4450
|
-
each(Object.keys(cs.scales), scaleKey => {
|
|
4684
|
+
each(chartSeries, (cs) => {
|
|
4685
|
+
each(Object.keys(cs.scales), (scaleKey) => {
|
|
4451
4686
|
const scale = cs.scales[scaleKey];
|
|
4452
4687
|
let indexEntry = scales[scaleKey];
|
|
4453
4688
|
if (!indexEntry) {
|
|
@@ -4467,7 +4702,7 @@ class DataManager {
|
|
|
4467
4702
|
}
|
|
4468
4703
|
updateScaleDomains() {
|
|
4469
4704
|
each(Object.keys(this._scalesIndexByKey), (scaleKey) => {
|
|
4470
|
-
each(this._scalesIndexByKey[scaleKey].list, scale => {
|
|
4705
|
+
each(this._scalesIndexByKey[scaleKey].list, (scale) => {
|
|
4471
4706
|
this.updateScaleDomain(scale, scaleKey);
|
|
4472
4707
|
});
|
|
4473
4708
|
});
|
|
@@ -4503,18 +4738,23 @@ class RenderEngine {
|
|
|
4503
4738
|
const scaleValidity = {};
|
|
4504
4739
|
each(this.dataManager.chartSeriesSet, (chartSeries) => {
|
|
4505
4740
|
const childContainers = this.getSeriesChildContainers(chartSeries.id);
|
|
4506
|
-
const areDomainsValid = -1 ===
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4741
|
+
const areDomainsValid = -1 ===
|
|
4742
|
+
Object.values(chartSeries.scales).findIndex((scale) => {
|
|
4743
|
+
if (typeof scaleValidity[scale.id] === "undefined") {
|
|
4744
|
+
const isValid = scale.isDomainValid();
|
|
4745
|
+
if (!isValid) {
|
|
4746
|
+
console.warn("Invalid scale domain detected for scale:", scale);
|
|
4747
|
+
}
|
|
4748
|
+
scaleValidity[scale.id] = isValid;
|
|
4511
4749
|
}
|
|
4512
|
-
scaleValidity[scale.id]
|
|
4513
|
-
}
|
|
4514
|
-
return !scaleValidity[scale.id];
|
|
4515
|
-
});
|
|
4750
|
+
return !scaleValidity[scale.id];
|
|
4751
|
+
});
|
|
4516
4752
|
if (areDomainsValid) {
|
|
4517
|
-
chartSeries.renderer.draw({
|
|
4753
|
+
chartSeries.renderer.draw({
|
|
4754
|
+
dataSeries: chartSeries,
|
|
4755
|
+
containers: childContainers,
|
|
4756
|
+
scales: chartSeries.scales,
|
|
4757
|
+
}, this.rendererSubject);
|
|
4518
4758
|
}
|
|
4519
4759
|
});
|
|
4520
4760
|
}
|
|
@@ -4537,7 +4777,7 @@ class RenderEngine {
|
|
|
4537
4777
|
let highlightChangeDetected = false;
|
|
4538
4778
|
const interactionDataPoints = this.dataManager.chartSeriesSet.reduce((result, chartSeries) => {
|
|
4539
4779
|
const chartValues = {};
|
|
4540
|
-
each(Object.keys(payload.values), scaleKey => {
|
|
4780
|
+
each(Object.keys(payload.values), (scaleKey) => {
|
|
4541
4781
|
const myScaleId = chartSeries.scales[scaleKey].id;
|
|
4542
4782
|
chartValues[scaleKey] = payload.values[scaleKey][myScaleId];
|
|
4543
4783
|
});
|
|
@@ -4555,8 +4795,10 @@ class RenderEngine {
|
|
|
4555
4795
|
};
|
|
4556
4796
|
if (payload.interactionType === InteractionType.MouseMove) {
|
|
4557
4797
|
const prevHighlight = this.highlightedDataPoints[chartSeries.id];
|
|
4558
|
-
if (!isUndefined(dataIndex) &&
|
|
4559
|
-
(
|
|
4798
|
+
if (!isUndefined(dataIndex) &&
|
|
4799
|
+
(isUndefined(prevHighlight) ||
|
|
4800
|
+
dataIndex === DATA_POINT_INTERACTION_RESET ||
|
|
4801
|
+
dataIndex !== prevHighlight.index)) {
|
|
4560
4802
|
highlightChangeDetected = true;
|
|
4561
4803
|
this.rendererSubject.next({
|
|
4562
4804
|
eventName: HIGHLIGHT_DATA_POINT_EVENT,
|
|
@@ -4568,8 +4810,12 @@ class RenderEngine {
|
|
|
4568
4810
|
result[chartSeries.id] = dataPoint;
|
|
4569
4811
|
return result;
|
|
4570
4812
|
}, {});
|
|
4571
|
-
if (payload.interactionType !== InteractionType.MouseMove ||
|
|
4572
|
-
|
|
4813
|
+
if (payload.interactionType !== InteractionType.MouseMove ||
|
|
4814
|
+
highlightChangeDetected) {
|
|
4815
|
+
this.interactionDataPointsSubject.next({
|
|
4816
|
+
interactionType: payload.interactionType,
|
|
4817
|
+
dataPoints: interactionDataPoints,
|
|
4818
|
+
});
|
|
4573
4819
|
}
|
|
4574
4820
|
if (highlightChangeDetected) {
|
|
4575
4821
|
this.highlightedDataPoints = interactionDataPoints;
|
|
@@ -4605,7 +4851,7 @@ class RenderEngine {
|
|
|
4605
4851
|
}
|
|
4606
4852
|
const childContainers = this.getSeriesChildContainers(seriesId);
|
|
4607
4853
|
const attrs = chartSeries.renderer.getContainerStateStyles(state);
|
|
4608
|
-
each(values(childContainers), cc => {
|
|
4854
|
+
each(values(childContainers), (cc) => {
|
|
4609
4855
|
cc.attrs(attrs);
|
|
4610
4856
|
});
|
|
4611
4857
|
chartSeries.renderer.setSeriesState(childContainers, state);
|
|
@@ -4621,9 +4867,10 @@ class RenderEngine {
|
|
|
4621
4867
|
}
|
|
4622
4868
|
buildLayerIndex(chartSeriesSet) {
|
|
4623
4869
|
const layerIndex = {};
|
|
4624
|
-
each(chartSeriesSet, chartSeries => {
|
|
4625
|
-
each(chartSeries.renderer.getRequiredLayers(), layerDef => {
|
|
4626
|
-
if (STANDARD_RENDER_LAYERS[layerDef.name] &&
|
|
4870
|
+
each(chartSeriesSet, (chartSeries) => {
|
|
4871
|
+
each(chartSeries.renderer.getRequiredLayers(), (layerDef) => {
|
|
4872
|
+
if (STANDARD_RENDER_LAYERS[layerDef.name] &&
|
|
4873
|
+
!isEqual(STANDARD_RENDER_LAYERS[layerDef.name], layerDef)) {
|
|
4627
4874
|
throw new Error(`Custom definition detected for render layer "${layerDef.name}". ` +
|
|
4628
4875
|
`Custom layers must use a name not already taken by the predefined layer set.`);
|
|
4629
4876
|
}
|
|
@@ -4641,7 +4888,7 @@ class RenderEngine {
|
|
|
4641
4888
|
return layerIndex;
|
|
4642
4889
|
}
|
|
4643
4890
|
removeUnusedLayers() {
|
|
4644
|
-
each(Object.keys(this.renderLayers), layerName => {
|
|
4891
|
+
each(Object.keys(this.renderLayers), (layerName) => {
|
|
4645
4892
|
if (!this.layerIndex[layerName]) {
|
|
4646
4893
|
this.lasagna.removeLayer(layerName);
|
|
4647
4894
|
delete this.renderLayers[layerName];
|
|
@@ -4649,29 +4896,33 @@ class RenderEngine {
|
|
|
4649
4896
|
});
|
|
4650
4897
|
}
|
|
4651
4898
|
addNeededLayers() {
|
|
4652
|
-
each(this.layerIndex, layerData => {
|
|
4899
|
+
each(this.layerIndex, (layerData) => {
|
|
4653
4900
|
if (!this.renderLayers[layerData.layerDefinition.name]) {
|
|
4654
|
-
this.renderLayers[layerData.layerDefinition.name] =
|
|
4901
|
+
this.renderLayers[layerData.layerDefinition.name] =
|
|
4902
|
+
this.lasagna.addLayer(layerData.layerDefinition);
|
|
4655
4903
|
}
|
|
4656
4904
|
});
|
|
4657
4905
|
}
|
|
4658
4906
|
updateLayerContents() {
|
|
4659
|
-
each(Object.keys(this.renderLayers), layerName => {
|
|
4907
|
+
each(Object.keys(this.renderLayers), (layerName) => {
|
|
4660
4908
|
const renderLayer = this.renderLayers[layerName];
|
|
4661
|
-
const containers = renderLayer
|
|
4909
|
+
const containers = renderLayer
|
|
4910
|
+
.selectAll("g.data-series-container")
|
|
4662
4911
|
.data(this.layerIndex[layerName].seriesUsing, (d) => d.id)
|
|
4663
4912
|
.order();
|
|
4664
|
-
containers
|
|
4913
|
+
containers
|
|
4914
|
+
.enter()
|
|
4915
|
+
.append("g")
|
|
4665
4916
|
.attrs({
|
|
4666
|
-
|
|
4667
|
-
|
|
4917
|
+
id: (d) => this.getChildContainerId(layerName, d.id),
|
|
4918
|
+
class: "data-series-container",
|
|
4668
4919
|
});
|
|
4669
4920
|
containers.exit().remove();
|
|
4670
4921
|
});
|
|
4671
4922
|
}
|
|
4672
4923
|
getSeriesChildContainers(seriesId) {
|
|
4673
4924
|
const childContainers = {};
|
|
4674
|
-
each(Object.keys(this.renderLayers), layerName => {
|
|
4925
|
+
each(Object.keys(this.renderLayers), (layerName) => {
|
|
4675
4926
|
const renderLayer = this.renderLayers[layerName];
|
|
4676
4927
|
childContainers[layerName] = renderLayer.selectAll(`#${layerName}-${UtilityService.cssEscape(seriesId)}`);
|
|
4677
4928
|
});
|
|
@@ -4692,26 +4943,44 @@ class RenderEnginePlugin extends ChartPlugin {
|
|
|
4692
4943
|
}
|
|
4693
4944
|
initialize() {
|
|
4694
4945
|
this.renderEngine = this.chart.getRenderEngine();
|
|
4695
|
-
this.chart
|
|
4946
|
+
this.chart
|
|
4947
|
+
.getEventBus()
|
|
4948
|
+
.getStream(INTERACTION_VALUES_EVENT)
|
|
4696
4949
|
.pipe(takeUntil(this.destroy$))
|
|
4697
4950
|
.subscribe((event) => {
|
|
4698
4951
|
this.lastInteractionValuesPayload = event.data;
|
|
4699
4952
|
if (this.isChartInView) {
|
|
4700
|
-
this.chart
|
|
4953
|
+
this.chart
|
|
4954
|
+
.getRenderEngine()
|
|
4955
|
+
.emitInteractionDataPoints(this.lastInteractionValuesPayload);
|
|
4701
4956
|
}
|
|
4702
4957
|
});
|
|
4703
|
-
this.renderEngine.interactionDataPointsSubject
|
|
4704
|
-
|
|
4958
|
+
this.renderEngine.interactionDataPointsSubject
|
|
4959
|
+
.pipe(takeUntil(this.destroy$))
|
|
4960
|
+
.subscribe((event) => {
|
|
4961
|
+
this.chart
|
|
4962
|
+
.getEventBus()
|
|
4963
|
+
.getStream(INTERACTION_DATA_POINTS_EVENT)
|
|
4964
|
+
.next({ data: event });
|
|
4705
4965
|
});
|
|
4706
|
-
this.renderEngine.rendererSubject
|
|
4707
|
-
|
|
4966
|
+
this.renderEngine.rendererSubject
|
|
4967
|
+
.pipe(takeUntil(this.destroy$))
|
|
4968
|
+
.subscribe((event) => {
|
|
4969
|
+
this.chart
|
|
4970
|
+
.getEventBus()
|
|
4971
|
+
.getStream(event.eventName)
|
|
4972
|
+
.next({ data: event.data });
|
|
4708
4973
|
});
|
|
4709
|
-
this.chart
|
|
4974
|
+
this.chart
|
|
4975
|
+
.getEventBus()
|
|
4976
|
+
.getStream(CHART_VIEW_STATUS_EVENT)
|
|
4710
4977
|
.pipe(takeUntil(this.destroy$))
|
|
4711
4978
|
.subscribe((event) => {
|
|
4712
4979
|
this.isChartInView = event.data.isChartInView;
|
|
4713
4980
|
if (this.isChartInView && this.lastInteractionValuesPayload) {
|
|
4714
|
-
this.chart
|
|
4981
|
+
this.chart
|
|
4982
|
+
.getRenderEngine()
|
|
4983
|
+
.emitInteractionDataPoints(this.lastInteractionValuesPayload);
|
|
4715
4984
|
}
|
|
4716
4985
|
});
|
|
4717
4986
|
}
|
|
@@ -4761,7 +5030,7 @@ class Chart {
|
|
|
4761
5030
|
this.plugins.push(plugin);
|
|
4762
5031
|
}
|
|
4763
5032
|
removePlugin(classRef) {
|
|
4764
|
-
const pluginIndex = this.plugins.findIndex(plugin => plugin instanceof classRef);
|
|
5033
|
+
const pluginIndex = this.plugins.findIndex((plugin) => plugin instanceof classRef);
|
|
4765
5034
|
if (-1 !== pluginIndex) {
|
|
4766
5035
|
this.plugins[pluginIndex].destroy();
|
|
4767
5036
|
this.plugins.splice(pluginIndex, 1);
|
|
@@ -4778,7 +5047,8 @@ class Chart {
|
|
|
4778
5047
|
}
|
|
4779
5048
|
}
|
|
4780
5049
|
hasPlugin(classRef) {
|
|
4781
|
-
return -1 !==
|
|
5050
|
+
return (-1 !==
|
|
5051
|
+
this.plugins.findIndex((plugin) => plugin instanceof classRef));
|
|
4782
5052
|
}
|
|
4783
5053
|
build(element) {
|
|
4784
5054
|
this.element = element;
|
|
@@ -4786,9 +5056,9 @@ class Chart {
|
|
|
4786
5056
|
this.target = select(this.element)
|
|
4787
5057
|
.append("svg")
|
|
4788
5058
|
.attrs({
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
5059
|
+
class: "nui-chart",
|
|
5060
|
+
height: "100%",
|
|
5061
|
+
width: "100%",
|
|
4792
5062
|
});
|
|
4793
5063
|
this.configureCssFilters();
|
|
4794
5064
|
this.buildGrid();
|
|
@@ -4803,11 +5073,14 @@ class Chart {
|
|
|
4803
5073
|
}
|
|
4804
5074
|
this.initialize();
|
|
4805
5075
|
const untilDestroy = () => takeUntil(this.getEventBus().getStream(DESTROY_EVENT));
|
|
4806
|
-
this.updateSubject
|
|
5076
|
+
this.updateSubject
|
|
5077
|
+
.pipe(untilDestroy())
|
|
4807
5078
|
.subscribe((d) => this.onUpdate(d));
|
|
4808
|
-
this.updateDimensionsSubject
|
|
5079
|
+
this.updateDimensionsSubject
|
|
5080
|
+
.pipe(untilDestroy())
|
|
4809
5081
|
.subscribe(() => this.onUpdateDimensions());
|
|
4810
|
-
this.seriesStatesSubject
|
|
5082
|
+
this.seriesStatesSubject
|
|
5083
|
+
.pipe(untilDestroy())
|
|
4811
5084
|
.subscribe((rs) => this.onSetSeriesStates(rs));
|
|
4812
5085
|
}
|
|
4813
5086
|
configureCssFilters() {
|
|
@@ -4844,20 +5117,22 @@ class Chart {
|
|
|
4844
5117
|
var _a;
|
|
4845
5118
|
this.eventBus.getStream(DESTROY_EVENT).next({ data: null });
|
|
4846
5119
|
this.eventBus.destroy();
|
|
4847
|
-
this.plugins.forEach(p => p.destroy());
|
|
5120
|
+
this.plugins.forEach((p) => p.destroy());
|
|
4848
5121
|
(_a = this.target) === null || _a === void 0 ? void 0 : _a.remove();
|
|
4849
5122
|
this.target = undefined;
|
|
4850
5123
|
}
|
|
4851
5124
|
setSeriesStates(renderStateData) {
|
|
4852
5125
|
this.seriesStatesSubject.next(renderStateData);
|
|
4853
|
-
this.eventBus
|
|
5126
|
+
this.eventBus
|
|
5127
|
+
.getStream(SERIES_STATE_CHANGE_EVENT)
|
|
5128
|
+
.next({ data: renderStateData });
|
|
4854
5129
|
}
|
|
4855
5130
|
onUpdate(seriesSet) {
|
|
4856
5131
|
this.dataManager.update(seriesSet);
|
|
4857
5132
|
this.grid.scales = this.dataManager.scalesIndexByKey;
|
|
4858
5133
|
this.dataManager.updateScaleDomains();
|
|
4859
5134
|
this.grid.updateRanges();
|
|
4860
|
-
this.plugins.forEach(p => p.update());
|
|
5135
|
+
this.plugins.forEach((p) => p.update());
|
|
4861
5136
|
}
|
|
4862
5137
|
onUpdateDimensions() {
|
|
4863
5138
|
const dimensionConfig = this.grid.config().dimension;
|
|
@@ -4871,7 +5146,7 @@ class Chart {
|
|
|
4871
5146
|
dimensions.width = this.element.clientWidth;
|
|
4872
5147
|
}
|
|
4873
5148
|
this.grid.updateDimensions(dimensions);
|
|
4874
|
-
this.plugins.forEach(p => p.updateDimensions());
|
|
5149
|
+
this.plugins.forEach((p) => p.updateDimensions());
|
|
4875
5150
|
}
|
|
4876
5151
|
updateTargetDimensions(dimensionConfig) {
|
|
4877
5152
|
var _a, _b;
|
|
@@ -4911,11 +5186,17 @@ class DonutGaugeLabelsPlugin extends ChartPlugin {
|
|
|
4911
5186
|
order: STANDARD_RENDER_LAYERS[RenderLayerName.data].order,
|
|
4912
5187
|
clipped: false,
|
|
4913
5188
|
});
|
|
4914
|
-
this.chart
|
|
5189
|
+
this.chart
|
|
5190
|
+
.getEventBus()
|
|
5191
|
+
.getStream(INTERACTION_DATA_POINTS_EVENT)
|
|
5192
|
+
.pipe(takeUntil(this.destroy$))
|
|
5193
|
+
.subscribe((event) => {
|
|
4915
5194
|
const gaugeThresholdLabelsGroup = this.lasagnaLayer.select(`.${GAUGE_LABELS_CONTAINER_CLASS}`);
|
|
4916
5195
|
if (!gaugeThresholdLabelsGroup.empty()) {
|
|
4917
5196
|
const dataPoints = event.data.dataPoints;
|
|
4918
|
-
const labelOpacity = Object.keys(dataPoints).find((key, index) => dataPoints[key].index === DATA_POINT_NOT_FOUND)
|
|
5197
|
+
const labelOpacity = Object.keys(dataPoints).find((key, index) => dataPoints[key].index === DATA_POINT_NOT_FOUND)
|
|
5198
|
+
? 0
|
|
5199
|
+
: 1;
|
|
4919
5200
|
gaugeThresholdLabelsGroup.style("opacity", labelOpacity);
|
|
4920
5201
|
}
|
|
4921
5202
|
});
|
|
@@ -4934,14 +5215,17 @@ class DonutGaugeLabelsPlugin extends ChartPlugin {
|
|
|
4934
5215
|
}
|
|
4935
5216
|
drawThresholdLabels() {
|
|
4936
5217
|
var _a, _b;
|
|
4937
|
-
const thresholdsSeries = this.chart
|
|
5218
|
+
const thresholdsSeries = this.chart
|
|
5219
|
+
.getDataManager()
|
|
5220
|
+
.chartSeriesSet.find((series) => series.renderer instanceof DonutGaugeThresholdsRenderer);
|
|
4938
5221
|
if (isUndefined(thresholdsSeries)) {
|
|
4939
5222
|
console.warn("Threshold series is undefined. As a result, threshold labels for the donut gauge will not be rendered.");
|
|
4940
5223
|
return;
|
|
4941
5224
|
}
|
|
4942
5225
|
let gaugeThresholdsLabelsGroup = this.lasagnaLayer.select(`.${GAUGE_LABELS_CONTAINER_CLASS}`);
|
|
4943
5226
|
if (gaugeThresholdsLabelsGroup.empty()) {
|
|
4944
|
-
gaugeThresholdsLabelsGroup = this.lasagnaLayer
|
|
5227
|
+
gaugeThresholdsLabelsGroup = this.lasagnaLayer
|
|
5228
|
+
.append("svg:g")
|
|
4945
5229
|
.attr("class", GAUGE_LABELS_CONTAINER_CLASS)
|
|
4946
5230
|
.style("opacity", 0);
|
|
4947
5231
|
}
|
|
@@ -4953,17 +5237,19 @@ class DonutGaugeLabelsPlugin extends ChartPlugin {
|
|
|
4953
5237
|
const labelGenerator = arc()
|
|
4954
5238
|
.outerRadius(labelRadius)
|
|
4955
5239
|
.innerRadius(labelRadius);
|
|
4956
|
-
const formatter = (_b = thresholdsSeries === null || thresholdsSeries === void 0 ? void 0 : thresholdsSeries.scales.r.formatters[this.config.formatterName]) !== null && _b !== void 0 ? _b : (d => d);
|
|
5240
|
+
const formatter = (_b = thresholdsSeries === null || thresholdsSeries === void 0 ? void 0 : thresholdsSeries.scales.r.formatters[this.config.formatterName]) !== null && _b !== void 0 ? _b : ((d) => d);
|
|
4957
5241
|
const data = cloneDeep(this.config.disableThresholdLabels ? [] : thresholdsSeries === null || thresholdsSeries === void 0 ? void 0 : thresholdsSeries.data);
|
|
4958
5242
|
if (isUndefined(data)) {
|
|
4959
5243
|
throw new Error("Gauge threshold series data is undefined");
|
|
4960
5244
|
}
|
|
4961
5245
|
// ensure the data is sorted in ascending order by value since we're using it to calculate circle arcs
|
|
4962
5246
|
data.sort((a, b) => a.value - b.value);
|
|
4963
|
-
const labelSelection = gaugeThresholdsLabelsGroup
|
|
5247
|
+
const labelSelection = gaugeThresholdsLabelsGroup
|
|
5248
|
+
.selectAll(`text.${GAUGE_THRESHOLD_LABEL_CLASS}`)
|
|
4964
5249
|
.data(DonutGaugeRenderingUtil.generateThresholdArcData(data));
|
|
4965
5250
|
labelSelection.exit().remove();
|
|
4966
|
-
labelSelection
|
|
5251
|
+
labelSelection
|
|
5252
|
+
.enter()
|
|
4967
5253
|
.append("text")
|
|
4968
5254
|
.attr("class", GAUGE_THRESHOLD_LABEL_CLASS)
|
|
4969
5255
|
.merge(labelSelection)
|
|
@@ -5023,7 +5309,8 @@ class LinearGaugeLabelsPlugin extends ChartPlugin {
|
|
|
5023
5309
|
this.xTranslate = (d, i) => {
|
|
5024
5310
|
var _a, _b, _c, _d, _e;
|
|
5025
5311
|
if (this.isHorizontal) {
|
|
5026
|
-
const thresholdsSeries = this
|
|
5312
|
+
const thresholdsSeries = this
|
|
5313
|
+
.thresholdsSeries;
|
|
5027
5314
|
const value = (_d = (_c = (_b = (_a = this.thresholdsSeries) === null || _a === void 0 ? void 0 : _a.accessors) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.call(_c, d, i, thresholdsSeries === null || thresholdsSeries === void 0 ? void 0 : thresholdsSeries.data, thresholdsSeries);
|
|
5028
5315
|
return (_e = this.thresholdsSeries) === null || _e === void 0 ? void 0 : _e.scales.x.convert(value);
|
|
5029
5316
|
}
|
|
@@ -5034,7 +5321,8 @@ class LinearGaugeLabelsPlugin extends ChartPlugin {
|
|
|
5034
5321
|
if (this.isHorizontal) {
|
|
5035
5322
|
return this.getLabelOffset();
|
|
5036
5323
|
}
|
|
5037
|
-
const thresholdsSeries = this
|
|
5324
|
+
const thresholdsSeries = this
|
|
5325
|
+
.thresholdsSeries;
|
|
5038
5326
|
const value = (_d = (_c = (_b = (_a = this.thresholdsSeries) === null || _a === void 0 ? void 0 : _a.accessors) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.call(_c, d, i, thresholdsSeries === null || thresholdsSeries === void 0 ? void 0 : thresholdsSeries.data, thresholdsSeries);
|
|
5039
5327
|
return (_e = this.thresholdsSeries) === null || _e === void 0 ? void 0 : _e.scales.y.convert(value);
|
|
5040
5328
|
};
|
|
@@ -5046,7 +5334,11 @@ class LinearGaugeLabelsPlugin extends ChartPlugin {
|
|
|
5046
5334
|
order: STANDARD_RENDER_LAYERS[RenderLayerName.data].order,
|
|
5047
5335
|
clipped: false,
|
|
5048
5336
|
});
|
|
5049
|
-
this.chart
|
|
5337
|
+
this.chart
|
|
5338
|
+
.getEventBus()
|
|
5339
|
+
.getStream(MOUSE_ACTIVE_EVENT)
|
|
5340
|
+
.pipe(takeUntil(this.destroy$))
|
|
5341
|
+
.subscribe((event) => {
|
|
5050
5342
|
const gaugeThresholdLabelsGroup = this.lasagnaLayer.select(`.${GAUGE_LABELS_CONTAINER_CLASS}`);
|
|
5051
5343
|
if (!gaugeThresholdLabelsGroup.empty()) {
|
|
5052
5344
|
gaugeThresholdLabelsGroup.style("opacity", event.data ? 1 : 0);
|
|
@@ -5069,8 +5361,11 @@ class LinearGaugeLabelsPlugin extends ChartPlugin {
|
|
|
5069
5361
|
}
|
|
5070
5362
|
updateData() {
|
|
5071
5363
|
var _a;
|
|
5072
|
-
this.thresholdsSeries = this.chart
|
|
5073
|
-
|
|
5364
|
+
this.thresholdsSeries = this.chart
|
|
5365
|
+
.getDataManager()
|
|
5366
|
+
.chartSeriesSet.find((series) => series.id === GAUGE_THRESHOLD_MARKERS_SERIES_ID);
|
|
5367
|
+
this.isHorizontal =
|
|
5368
|
+
((_a = this.thresholdsSeries) === null || _a === void 0 ? void 0 : _a.scales.x) instanceof LinearScale;
|
|
5074
5369
|
}
|
|
5075
5370
|
drawThresholdLabels() {
|
|
5076
5371
|
var _a, _b, _c;
|
|
@@ -5080,21 +5375,27 @@ class LinearGaugeLabelsPlugin extends ChartPlugin {
|
|
|
5080
5375
|
}
|
|
5081
5376
|
let gaugeThresholdsLabelsGroup = this.lasagnaLayer.select(`.${GAUGE_LABELS_CONTAINER_CLASS}`);
|
|
5082
5377
|
if (gaugeThresholdsLabelsGroup.empty()) {
|
|
5083
|
-
gaugeThresholdsLabelsGroup = this.lasagnaLayer
|
|
5378
|
+
gaugeThresholdsLabelsGroup = this.lasagnaLayer
|
|
5379
|
+
.append("svg:g")
|
|
5084
5380
|
.attr("class", GAUGE_LABELS_CONTAINER_CLASS)
|
|
5085
5381
|
.style("opacity", 0);
|
|
5086
5382
|
}
|
|
5087
|
-
const data = cloneDeep(this.config.disableThresholdLabels
|
|
5383
|
+
const data = cloneDeep(this.config.disableThresholdLabels
|
|
5384
|
+
? []
|
|
5385
|
+
: (_a = this.thresholdsSeries) === null || _a === void 0 ? void 0 : _a.data);
|
|
5088
5386
|
if (isUndefined(data)) {
|
|
5089
5387
|
throw new Error("Gauge threshold series data is undefined");
|
|
5090
5388
|
}
|
|
5091
5389
|
// last value in the thresholds series is the max value of the gauge (needed by RadialGaugeThresholdsRenderer).
|
|
5092
5390
|
// removing this value to avoid rendering a label for it
|
|
5093
5391
|
data.pop();
|
|
5094
|
-
const formatter = (_c = (_b = this.thresholdsSeries) === null || _b === void 0 ? void 0 : _b.scales[this.isHorizontal ? "x" : "y"].formatters[this.config.formatterName]) !== null && _c !== void 0 ? _c : (d => d);
|
|
5095
|
-
const labelSelection = gaugeThresholdsLabelsGroup
|
|
5392
|
+
const formatter = (_c = (_b = this.thresholdsSeries) === null || _b === void 0 ? void 0 : _b.scales[this.isHorizontal ? "x" : "y"].formatters[this.config.formatterName]) !== null && _c !== void 0 ? _c : ((d) => d);
|
|
5393
|
+
const labelSelection = gaugeThresholdsLabelsGroup
|
|
5394
|
+
.selectAll(`text.${GAUGE_THRESHOLD_LABEL_CLASS}`)
|
|
5395
|
+
.data(data);
|
|
5096
5396
|
labelSelection.exit().remove();
|
|
5097
|
-
labelSelection
|
|
5397
|
+
labelSelection
|
|
5398
|
+
.enter()
|
|
5098
5399
|
.append("text")
|
|
5099
5400
|
.attr("class", GAUGE_THRESHOLD_LABEL_CLASS)
|
|
5100
5401
|
.merge(labelSelection)
|
|
@@ -5108,10 +5409,12 @@ class LinearGaugeLabelsPlugin extends ChartPlugin {
|
|
|
5108
5409
|
let labelStart = 0;
|
|
5109
5410
|
if (!this.config.flippedLabels) {
|
|
5110
5411
|
const gridDimensions = this.chart.getGrid().config().dimension;
|
|
5111
|
-
labelStart = this.isHorizontal
|
|
5412
|
+
labelStart = this.isHorizontal
|
|
5413
|
+
? gridDimensions.height()
|
|
5414
|
+
: gridDimensions.width();
|
|
5112
5415
|
}
|
|
5113
5416
|
let padding = this.config.padding;
|
|
5114
|
-
padding = this.config.flippedLabels ? -
|
|
5417
|
+
padding = this.config.flippedLabels ? -padding : padding;
|
|
5115
5418
|
return labelStart + padding;
|
|
5116
5419
|
}
|
|
5117
5420
|
getTextAnchor() {
|
|
@@ -5229,7 +5532,9 @@ class Lasagna {
|
|
|
5229
5532
|
constructor(target, clipPath) {
|
|
5230
5533
|
this.clipPath = clipPath;
|
|
5231
5534
|
this.layers = [];
|
|
5232
|
-
this.container = target
|
|
5535
|
+
this.container = target
|
|
5536
|
+
.append("g")
|
|
5537
|
+
.attr("class", `${Lasagna.CONTAINER_CLASS} pointer-events`);
|
|
5233
5538
|
}
|
|
5234
5539
|
addLayer(layer) {
|
|
5235
5540
|
this.layers = orderBy(this.layers.concat(layer), "order");
|
|
@@ -5251,18 +5556,19 @@ class Lasagna {
|
|
|
5251
5556
|
return this.container;
|
|
5252
5557
|
}
|
|
5253
5558
|
update() {
|
|
5254
|
-
const layerContainers = this.container
|
|
5559
|
+
const layerContainers = this.container
|
|
5560
|
+
.selectAll(`g.${Lasagna.LAYER_CLASS}`)
|
|
5255
5561
|
.data(this.layers, (d) => d.name)
|
|
5256
5562
|
.order();
|
|
5257
|
-
layerContainers
|
|
5563
|
+
layerContainers
|
|
5564
|
+
.enter()
|
|
5258
5565
|
.append("g")
|
|
5259
5566
|
.attrs({
|
|
5260
|
-
|
|
5567
|
+
class: (d) => `${Lasagna.LAYER_CLASS} ${Lasagna.LAYER_CLASS}-${d.name}`,
|
|
5261
5568
|
"clip-path": (d) => d.clipped ? `url(#${this.clipPath})` : "",
|
|
5262
5569
|
"pointer-events": "none",
|
|
5263
5570
|
});
|
|
5264
|
-
layerContainers.exit()
|
|
5265
|
-
.remove();
|
|
5571
|
+
layerContainers.exit().remove();
|
|
5266
5572
|
}
|
|
5267
5573
|
}
|
|
5268
5574
|
Lasagna.CONTAINER_CLASS = "lasagna-container";
|
|
@@ -5285,15 +5591,22 @@ class Grid {
|
|
|
5285
5591
|
const disableHeightCorrection = this.config().disableRenderAreaHeightCorrection;
|
|
5286
5592
|
const disableWidthCorrection = this.config().disableRenderAreaWidthCorrection;
|
|
5287
5593
|
const renderingAreaClipPathAttrs = {
|
|
5288
|
-
|
|
5289
|
-
|
|
5594
|
+
width: Math.max(0, d.width()),
|
|
5595
|
+
height: Math.max(0, d.height() +
|
|
5596
|
+
(disableHeightCorrection
|
|
5597
|
+
? 0
|
|
5598
|
+
: Grid.RENDER_AREA_HEIGHT_CORRECTION)),
|
|
5290
5599
|
};
|
|
5291
5600
|
if (!disableHeightCorrection) {
|
|
5292
|
-
renderingAreaClipPathAttrs["y"] =
|
|
5601
|
+
renderingAreaClipPathAttrs["y"] =
|
|
5602
|
+
-Grid.RENDER_AREA_HEIGHT_CORRECTION;
|
|
5293
5603
|
}
|
|
5294
5604
|
const renderingAreaAttrs = Object.assign(Object.assign({}, renderingAreaClipPathAttrs), {
|
|
5295
5605
|
// Width correction needed to prevent interaction gap between right side of grid and the edge of the rendering area
|
|
5296
|
-
|
|
5606
|
+
width: Math.max(0, d.width() -
|
|
5607
|
+
(disableWidthCorrection
|
|
5608
|
+
? 0
|
|
5609
|
+
: Grid.RENDER_AREA_WIDTH_CORRECTION)) });
|
|
5297
5610
|
this.renderingAreaClipPath.attrs(renderingAreaClipPathAttrs);
|
|
5298
5611
|
this.renderingArea.attrs(renderingAreaAttrs);
|
|
5299
5612
|
};
|
|
@@ -5336,9 +5649,8 @@ class Grid {
|
|
|
5336
5649
|
const config = new GridConfig();
|
|
5337
5650
|
this.config(config);
|
|
5338
5651
|
}
|
|
5339
|
-
this.container = this._target.append("g")
|
|
5340
|
-
.
|
|
5341
|
-
"class": Grid.GRID_CLASS_NAME,
|
|
5652
|
+
this.container = this._target.append("g").attrs({
|
|
5653
|
+
class: Grid.GRID_CLASS_NAME,
|
|
5342
5654
|
});
|
|
5343
5655
|
const clipPathId = Grid.RENDERING_AREA_CLIP_PATH_PREFIX + UtilityService.uuid();
|
|
5344
5656
|
// Asserting similar type to avoid refactoring all the grids
|
|
@@ -5419,7 +5731,8 @@ class Grid {
|
|
|
5419
5731
|
var _a;
|
|
5420
5732
|
// We're creating even invisible borders and updating visibility afterwards
|
|
5421
5733
|
if (borderConfigs[side]) {
|
|
5422
|
-
borders[side] =
|
|
5734
|
+
borders[side] =
|
|
5735
|
+
(_a = this.createBorder(container, borderConfigs[side])) !== null && _a !== void 0 ? _a : undefined;
|
|
5423
5736
|
}
|
|
5424
5737
|
});
|
|
5425
5738
|
return borders;
|
|
@@ -5432,7 +5745,8 @@ class Grid {
|
|
|
5432
5745
|
* @returns {D3Selection} The grid's rendering area
|
|
5433
5746
|
*/
|
|
5434
5747
|
buildRenderingArea(clipPathId) {
|
|
5435
|
-
this.renderingAreaClipPath = this._target
|
|
5748
|
+
this.renderingAreaClipPath = this._target
|
|
5749
|
+
.append("clipPath")
|
|
5436
5750
|
.attr("id", clipPathId)
|
|
5437
5751
|
.append("rect");
|
|
5438
5752
|
const renderingAreaContainer = this.lasagna.addLayer({
|
|
@@ -5440,10 +5754,9 @@ class Grid {
|
|
|
5440
5754
|
order: -1,
|
|
5441
5755
|
clipped: true,
|
|
5442
5756
|
});
|
|
5443
|
-
return renderingAreaContainer.append("rect")
|
|
5444
|
-
.attrs({
|
|
5757
|
+
return renderingAreaContainer.append("rect").attrs({
|
|
5445
5758
|
"pointer-events": "all",
|
|
5446
|
-
|
|
5759
|
+
fill: "transparent",
|
|
5447
5760
|
});
|
|
5448
5761
|
}
|
|
5449
5762
|
/**
|
|
@@ -5455,7 +5768,8 @@ class Grid {
|
|
|
5455
5768
|
* @returns {SVGElement} The created border
|
|
5456
5769
|
*/
|
|
5457
5770
|
createBorder(container, config) {
|
|
5458
|
-
const border = container
|
|
5771
|
+
const border = container
|
|
5772
|
+
.append("line")
|
|
5459
5773
|
.attr("class", config.className || Grid.DEFAULT_BORDER_CLASS_NAME);
|
|
5460
5774
|
if (config.width) {
|
|
5461
5775
|
// use style instead of attr to override css style
|
|
@@ -5476,10 +5790,11 @@ class Grid {
|
|
|
5476
5790
|
}
|
|
5477
5791
|
select(this.borders.bottom)
|
|
5478
5792
|
.attrs({
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5793
|
+
x1: 0,
|
|
5794
|
+
y1: this.config().dimension.height() - borderMidpoint,
|
|
5795
|
+
x2: this.config().dimension.width() +
|
|
5796
|
+
Grid.TICK_DIMENSION_CORRECTION,
|
|
5797
|
+
y2: this.config().dimension.height() - borderMidpoint,
|
|
5483
5798
|
})
|
|
5484
5799
|
.classed("hidden", !((_a = this._config.borders.bottom) === null || _a === void 0 ? void 0 : _a.visible));
|
|
5485
5800
|
}
|
|
@@ -5494,30 +5809,33 @@ class Grid {
|
|
|
5494
5809
|
if (this.borders.top) {
|
|
5495
5810
|
select(this.borders.top)
|
|
5496
5811
|
.attrs({
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5812
|
+
x1: 0,
|
|
5813
|
+
y1: borderMidpoint,
|
|
5814
|
+
x2: this.config().dimension.width() +
|
|
5815
|
+
Grid.TICK_DIMENSION_CORRECTION,
|
|
5816
|
+
y2: borderMidpoint,
|
|
5501
5817
|
})
|
|
5502
5818
|
.classed("hidden", !((_a = this._config.borders.top) === null || _a === void 0 ? void 0 : _a.visible));
|
|
5503
5819
|
}
|
|
5504
5820
|
if (this.borders.right) {
|
|
5505
5821
|
select(this.borders.right)
|
|
5506
5822
|
.attrs({
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5823
|
+
x1: this.config().dimension.width() - borderMidpoint,
|
|
5824
|
+
y1: 0,
|
|
5825
|
+
x2: this.config().dimension.width() - borderMidpoint,
|
|
5826
|
+
y2: this.config().dimension.height() +
|
|
5827
|
+
Grid.TICK_DIMENSION_CORRECTION, // to get nice alignment with ticks
|
|
5511
5828
|
})
|
|
5512
5829
|
.classed("hidden", !((_b = this._config.borders.right) === null || _b === void 0 ? void 0 : _b.visible));
|
|
5513
5830
|
}
|
|
5514
5831
|
if (this.borders.left) {
|
|
5515
5832
|
select(this.borders.left)
|
|
5516
5833
|
.attrs({
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5834
|
+
x1: borderMidpoint,
|
|
5835
|
+
y1: 0,
|
|
5836
|
+
x2: borderMidpoint,
|
|
5837
|
+
y2: this.config().dimension.height() +
|
|
5838
|
+
Grid.TICK_DIMENSION_CORRECTION, // to get nice alignment with ticks
|
|
5521
5839
|
})
|
|
5522
5840
|
.classed("hidden", !((_c = this._config.borders.left) === null || _c === void 0 ? void 0 : _c.visible));
|
|
5523
5841
|
}
|
|
@@ -5547,9 +5865,9 @@ class RadialGrid extends Grid {
|
|
|
5547
5865
|
this.adjustRenderingArea = () => {
|
|
5548
5866
|
const d = this.config().dimension;
|
|
5549
5867
|
const attrs = {
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5868
|
+
width: d.outerWidth(),
|
|
5869
|
+
height: d.outerHeight(),
|
|
5870
|
+
transform: `translate(${-d.outerWidth() / 2}, ${-d.outerHeight() / 2})`,
|
|
5553
5871
|
};
|
|
5554
5872
|
this.renderingAreaClipPath.attrs(attrs);
|
|
5555
5873
|
this.renderingArea.attrs(attrs);
|
|
@@ -5572,7 +5890,10 @@ class RadialGrid extends Grid {
|
|
|
5572
5890
|
if (this.scales) {
|
|
5573
5891
|
const radiusScale = this.scales["r"];
|
|
5574
5892
|
if (radiusScale) {
|
|
5575
|
-
radiusScale.list[0].range([
|
|
5893
|
+
radiusScale.list[0].range([
|
|
5894
|
+
0,
|
|
5895
|
+
Math.min(dimensionConfig.width(), dimensionConfig.height()) / 2,
|
|
5896
|
+
]);
|
|
5576
5897
|
}
|
|
5577
5898
|
}
|
|
5578
5899
|
this.adjustRenderingArea();
|
|
@@ -5586,7 +5907,7 @@ class RadialGrid extends Grid {
|
|
|
5586
5907
|
}
|
|
5587
5908
|
recenter() {
|
|
5588
5909
|
this.container.attrs({
|
|
5589
|
-
|
|
5910
|
+
transform: `translate(${this.config().dimension.outerWidth() / 2},${this.config().dimension.outerHeight() / 2})`,
|
|
5590
5911
|
});
|
|
5591
5912
|
}
|
|
5592
5913
|
}
|
|
@@ -5606,7 +5927,10 @@ class MouseInteractiveArea {
|
|
|
5606
5927
|
this.interactiveArea = interactiveArea;
|
|
5607
5928
|
this.gridMargin = gridMargin;
|
|
5608
5929
|
this.active = new BehaviorSubject(false);
|
|
5609
|
-
this.interaction = new BehaviorSubject({
|
|
5930
|
+
this.interaction = new BehaviorSubject({
|
|
5931
|
+
type: InteractionType.Click,
|
|
5932
|
+
coordinates: { x: 0, y: 0 },
|
|
5933
|
+
});
|
|
5610
5934
|
this.isActive = false;
|
|
5611
5935
|
this.onMouseInteraction = (interactionType) => {
|
|
5612
5936
|
var _a, _b;
|
|
@@ -5624,22 +5948,32 @@ class MouseInteractiveArea {
|
|
|
5624
5948
|
// Note: Margin must be subtracted because of the transform that occurs in XYGrid.recalculateMargins
|
|
5625
5949
|
let calculatedX = x + event.offsetX - (((_a = this.gridMargin) === null || _a === void 0 ? void 0 : _a.left) || 0);
|
|
5626
5950
|
// clamp output to right or left side of interactive area if necessary
|
|
5627
|
-
calculatedX =
|
|
5951
|
+
calculatedX =
|
|
5952
|
+
calculatedX > interactiveAreaWidth
|
|
5953
|
+
? interactiveAreaWidth
|
|
5954
|
+
: calculatedX;
|
|
5628
5955
|
x = calculatedX < 0 ? 0 : calculatedX;
|
|
5629
5956
|
// Note: Margin must be subtracted because of the transform that occurs in XYGrid.recalculateMargins
|
|
5630
5957
|
let calculatedY = y + event.offsetY - (((_b = this.gridMargin) === null || _b === void 0 ? void 0 : _b.top) || 0);
|
|
5631
5958
|
// clamp output to top or bottom side of interactive area if necessary
|
|
5632
|
-
calculatedY =
|
|
5959
|
+
calculatedY =
|
|
5960
|
+
calculatedY > interactiveAreaHeight
|
|
5961
|
+
? interactiveAreaHeight
|
|
5962
|
+
: calculatedY;
|
|
5633
5963
|
y = calculatedY < 0 ? 0 : calculatedY;
|
|
5634
5964
|
}
|
|
5635
5965
|
else {
|
|
5636
5966
|
// this works in Chrome
|
|
5637
5967
|
const mouseOutput = mouse(event.currentTarget);
|
|
5638
5968
|
// clamp output to right or left side of interactive area if necessary
|
|
5639
|
-
const calculatedX = mouseOutput[0] > interactiveAreaWidth
|
|
5969
|
+
const calculatedX = mouseOutput[0] > interactiveAreaWidth
|
|
5970
|
+
? interactiveAreaWidth
|
|
5971
|
+
: mouseOutput[0];
|
|
5640
5972
|
x = calculatedX < 0 ? 0 : calculatedX;
|
|
5641
5973
|
// clamp output to top or bottom side of interactive area if necessary
|
|
5642
|
-
const calculatedY = mouseOutput[1] > interactiveAreaHeight
|
|
5974
|
+
const calculatedY = mouseOutput[1] > interactiveAreaHeight
|
|
5975
|
+
? interactiveAreaHeight
|
|
5976
|
+
: mouseOutput[1];
|
|
5643
5977
|
y = calculatedY < 0 ? 0 : calculatedY;
|
|
5644
5978
|
}
|
|
5645
5979
|
this.interaction.next({
|
|
@@ -5648,7 +5982,8 @@ class MouseInteractiveArea {
|
|
|
5648
5982
|
});
|
|
5649
5983
|
};
|
|
5650
5984
|
this.onMouseOver = () => {
|
|
5651
|
-
if (this.isActive ||
|
|
5985
|
+
if (this.isActive ||
|
|
5986
|
+
event.target.classList.contains(IGNORE_INTERACTION_CLASS)) {
|
|
5652
5987
|
return;
|
|
5653
5988
|
}
|
|
5654
5989
|
this.isActive = true;
|
|
@@ -5734,12 +6069,17 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5734
6069
|
this.destroy$ = new Subject();
|
|
5735
6070
|
}
|
|
5736
6071
|
initialize() {
|
|
5737
|
-
this.interactionLabelLayer = this.chart
|
|
6072
|
+
this.interactionLabelLayer = this.chart
|
|
6073
|
+
.getGrid()
|
|
6074
|
+
.getLasagna()
|
|
6075
|
+
.addLayer({
|
|
5738
6076
|
name: InteractionLabelPlugin.LAYER_NAME,
|
|
5739
6077
|
order: 901,
|
|
5740
6078
|
clipped: false,
|
|
5741
6079
|
});
|
|
5742
|
-
this.chart
|
|
6080
|
+
this.chart
|
|
6081
|
+
.getEventBus()
|
|
6082
|
+
.getStream(INTERACTION_VALUES_EVENT)
|
|
5743
6083
|
.pipe(takeUntil(this.destroy$))
|
|
5744
6084
|
.subscribe((event) => {
|
|
5745
6085
|
this.lastInteractionValuesPayload = event.data;
|
|
@@ -5747,7 +6087,9 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5747
6087
|
this.handleLabelUpdate();
|
|
5748
6088
|
}
|
|
5749
6089
|
});
|
|
5750
|
-
this.chart
|
|
6090
|
+
this.chart
|
|
6091
|
+
.getEventBus()
|
|
6092
|
+
.getStream(CHART_VIEW_STATUS_EVENT)
|
|
5751
6093
|
.pipe(takeUntil(this.destroy$))
|
|
5752
6094
|
.subscribe((event) => {
|
|
5753
6095
|
this.isChartInView = event.data.isChartInView;
|
|
@@ -5758,7 +6100,10 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5758
6100
|
}
|
|
5759
6101
|
handleLabelUpdate() {
|
|
5760
6102
|
const scales = this.chart.getGrid().scales;
|
|
5761
|
-
if (!this.areLabelUpdatesEnabled ||
|
|
6103
|
+
if (!this.areLabelUpdatesEnabled ||
|
|
6104
|
+
this.lastInteractionValuesPayload.interactionType !==
|
|
6105
|
+
InteractionType.MouseMove ||
|
|
6106
|
+
isEmpty(scales)) {
|
|
5762
6107
|
return;
|
|
5763
6108
|
}
|
|
5764
6109
|
const grid = this.chart.getGrid();
|
|
@@ -5766,7 +6111,9 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5766
6111
|
if (!xScale) {
|
|
5767
6112
|
throw new Error("xScale is not defined");
|
|
5768
6113
|
}
|
|
5769
|
-
const xValue = this.lastInteractionValuesPayload.values.x
|
|
6114
|
+
const xValue = this.lastInteractionValuesPayload.values.x
|
|
6115
|
+
? this.lastInteractionValuesPayload.values.x[xScale.id]
|
|
6116
|
+
: null;
|
|
5770
6117
|
this.updateLabel(xScale, isArray(xValue) ? xValue.slice(0, xValue.length - 1) : xValue);
|
|
5771
6118
|
}
|
|
5772
6119
|
updateLabel(scale, value) {
|
|
@@ -5778,49 +6125,60 @@ class InteractionLabelPlugin extends ChartPlugin {
|
|
|
5778
6125
|
interactionLabel.remove();
|
|
5779
6126
|
return;
|
|
5780
6127
|
}
|
|
5781
|
-
const formatter = scale.formatters[this.formatterName] ||
|
|
6128
|
+
const formatter = scale.formatters[this.formatterName] ||
|
|
6129
|
+
scale.formatters[FALLBACK_FORMATTER];
|
|
5782
6130
|
const labelContent = formatter === null || formatter === void 0 ? void 0 : formatter(value);
|
|
5783
6131
|
if (!labelContent) {
|
|
5784
6132
|
throw new Error("labelContent is not defined");
|
|
5785
6133
|
}
|
|
5786
|
-
const textSelection = interactionLabel
|
|
6134
|
+
const textSelection = interactionLabel
|
|
6135
|
+
.select("text")
|
|
5787
6136
|
.text(labelContent);
|
|
5788
6137
|
const bbox = textSelection.node().getBBox();
|
|
5789
6138
|
const gridDimension = this.chart.getGrid().config().dimension;
|
|
5790
6139
|
// subtract the relative vertical text offset inside the bbox from
|
|
5791
6140
|
// the grid height to determine the label's vertical placement
|
|
5792
|
-
const heightOffset =
|
|
6141
|
+
const heightOffset = gridDimension.height() - bbox.y;
|
|
5793
6142
|
textSelection
|
|
5794
6143
|
.attr("transform", `translate(0, ${heightOffset})`)
|
|
5795
6144
|
.style("text-anchor", "middle");
|
|
5796
6145
|
// match the horizontal padding to the built-in bbox vertical padding
|
|
5797
6146
|
const horizontalPadding = (bbox.height + bbox.y) * 2;
|
|
5798
6147
|
const labelWidth = bbox.width + horizontalPadding;
|
|
5799
|
-
const allowedRange = [
|
|
6148
|
+
const allowedRange = [
|
|
6149
|
+
labelWidth / 2,
|
|
6150
|
+
gridDimension.width() - labelWidth / 2,
|
|
6151
|
+
];
|
|
5800
6152
|
const x = convert(scale, value, 0.5);
|
|
5801
6153
|
const clampedX = UtilityService.clampToRange(x, allowedRange);
|
|
5802
6154
|
interactionLabel
|
|
5803
6155
|
.attr("transform", `translate(${clampedX},0)`)
|
|
5804
6156
|
.select("rect")
|
|
5805
6157
|
.attrs({
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
6158
|
+
transform: `translate(0,${heightOffset})`,
|
|
6159
|
+
x: -(labelWidth / 2),
|
|
6160
|
+
y: bbox.y,
|
|
6161
|
+
width: labelWidth,
|
|
6162
|
+
height: bbox.height,
|
|
5811
6163
|
});
|
|
5812
6164
|
}
|
|
5813
6165
|
destroy() {
|
|
5814
|
-
this.chart
|
|
6166
|
+
this.chart
|
|
6167
|
+
.getGrid()
|
|
6168
|
+
.getLasagna()
|
|
6169
|
+
.removeLayer(InteractionLabelPlugin.LAYER_NAME);
|
|
5815
6170
|
this.destroy$.next();
|
|
5816
6171
|
this.destroy$.complete();
|
|
5817
6172
|
}
|
|
5818
6173
|
buildInteractionLabel(target) {
|
|
5819
|
-
const label = target
|
|
6174
|
+
const label = target
|
|
6175
|
+
.append("g")
|
|
5820
6176
|
.attr("class", InteractionLabelPlugin.LAYER_NAME);
|
|
5821
|
-
label
|
|
6177
|
+
label
|
|
6178
|
+
.append("rect")
|
|
5822
6179
|
.attr("class", `${InteractionLabelPlugin.LAYER_NAME}__rect`);
|
|
5823
|
-
label
|
|
6180
|
+
label
|
|
6181
|
+
.append("text")
|
|
5824
6182
|
.attr("class", `${InteractionLabelPlugin.LAYER_NAME}__text`);
|
|
5825
6183
|
return label;
|
|
5826
6184
|
}
|
|
@@ -5845,7 +6203,9 @@ class InteractionLinePlugin extends ChartPlugin {
|
|
|
5845
6203
|
order: 900,
|
|
5846
6204
|
clipped: true,
|
|
5847
6205
|
});
|
|
5848
|
-
this.chart
|
|
6206
|
+
this.chart
|
|
6207
|
+
.getEventBus()
|
|
6208
|
+
.getStream(INTERACTION_VALUES_EVENT)
|
|
5849
6209
|
.pipe(takeUntil(this.destroy$))
|
|
5850
6210
|
.subscribe((event) => {
|
|
5851
6211
|
this.lastInteractionValuesPayload = event.data;
|
|
@@ -5853,7 +6213,9 @@ class InteractionLinePlugin extends ChartPlugin {
|
|
|
5853
6213
|
this.handleLineUpdate();
|
|
5854
6214
|
}
|
|
5855
6215
|
});
|
|
5856
|
-
this.chart
|
|
6216
|
+
this.chart
|
|
6217
|
+
.getEventBus()
|
|
6218
|
+
.getStream(CHART_VIEW_STATUS_EVENT)
|
|
5857
6219
|
.pipe(takeUntil(this.destroy$))
|
|
5858
6220
|
.subscribe((event) => {
|
|
5859
6221
|
this.isChartInView = event.data.isChartInView;
|
|
@@ -5864,7 +6226,9 @@ class InteractionLinePlugin extends ChartPlugin {
|
|
|
5864
6226
|
}
|
|
5865
6227
|
handleLineUpdate() {
|
|
5866
6228
|
const scales = this.chart.getGrid().scales;
|
|
5867
|
-
if (this.lastInteractionValuesPayload.interactionType !==
|
|
6229
|
+
if (this.lastInteractionValuesPayload.interactionType !==
|
|
6230
|
+
InteractionType.MouseMove ||
|
|
6231
|
+
isEmpty(scales)) {
|
|
5868
6232
|
return;
|
|
5869
6233
|
}
|
|
5870
6234
|
const grid = this.chart.getGrid();
|
|
@@ -5872,7 +6236,9 @@ class InteractionLinePlugin extends ChartPlugin {
|
|
|
5872
6236
|
if (!xScale) {
|
|
5873
6237
|
throw new Error("xScale is not defined");
|
|
5874
6238
|
}
|
|
5875
|
-
const xValue = this.lastInteractionValuesPayload.values.x
|
|
6239
|
+
const xValue = this.lastInteractionValuesPayload.values.x
|
|
6240
|
+
? this.lastInteractionValuesPayload.values.x[xScale.id]
|
|
6241
|
+
: null;
|
|
5876
6242
|
this.updateLine(this.interactionLineLayer, xScale, xValue);
|
|
5877
6243
|
}
|
|
5878
6244
|
updateLine(layer, xScale, value) {
|
|
@@ -5880,14 +6246,16 @@ class InteractionLinePlugin extends ChartPlugin {
|
|
|
5880
6246
|
if (value) {
|
|
5881
6247
|
data.push(value);
|
|
5882
6248
|
}
|
|
5883
|
-
const line = layer
|
|
6249
|
+
const line = layer
|
|
6250
|
+
.selectAll(`.${InteractionLinePlugin.LAYER_NAME}`)
|
|
6251
|
+
.data(data);
|
|
5884
6252
|
const xFn = (d) => xScale.convert(d);
|
|
5885
6253
|
const attrs = {
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
6254
|
+
class: InteractionLinePlugin.LAYER_NAME,
|
|
6255
|
+
x1: xFn,
|
|
6256
|
+
y1: 0,
|
|
6257
|
+
x2: xFn,
|
|
6258
|
+
y2: this.chart.getGrid().config().dimension.height(),
|
|
5891
6259
|
};
|
|
5892
6260
|
line.enter()
|
|
5893
6261
|
.append("line")
|
|
@@ -5896,7 +6264,10 @@ class InteractionLinePlugin extends ChartPlugin {
|
|
|
5896
6264
|
line.exit().remove();
|
|
5897
6265
|
}
|
|
5898
6266
|
destroy() {
|
|
5899
|
-
this.chart
|
|
6267
|
+
this.chart
|
|
6268
|
+
.getGrid()
|
|
6269
|
+
.getLasagna()
|
|
6270
|
+
.removeLayer(InteractionLinePlugin.LAYER_NAME);
|
|
5900
6271
|
this.destroy$.next();
|
|
5901
6272
|
this.destroy$.complete();
|
|
5902
6273
|
}
|
|
@@ -5912,10 +6283,17 @@ class MouseInteractiveAreaPlugin extends ChartPlugin {
|
|
|
5912
6283
|
this.interactionValuesActive = true;
|
|
5913
6284
|
}
|
|
5914
6285
|
initialize() {
|
|
5915
|
-
this.mouseInteractiveArea.active
|
|
5916
|
-
|
|
6286
|
+
this.mouseInteractiveArea.active
|
|
6287
|
+
.pipe(takeUntil(this.destroy$))
|
|
6288
|
+
.subscribe((active) => {
|
|
6289
|
+
this.chart
|
|
6290
|
+
.getEventBus()
|
|
6291
|
+
.getStream(MOUSE_ACTIVE_EVENT)
|
|
6292
|
+
.next({ data: active });
|
|
5917
6293
|
});
|
|
5918
|
-
this.chart
|
|
6294
|
+
this.chart
|
|
6295
|
+
.getEventBus()
|
|
6296
|
+
.getStream(MOUSE_ACTIVE_EVENT)
|
|
5919
6297
|
.pipe(takeUntil(this.destroy$))
|
|
5920
6298
|
.subscribe((event) => {
|
|
5921
6299
|
const active = event.data;
|
|
@@ -5923,9 +6301,11 @@ class MouseInteractiveAreaPlugin extends ChartPlugin {
|
|
|
5923
6301
|
this.highlightReset();
|
|
5924
6302
|
}
|
|
5925
6303
|
});
|
|
5926
|
-
this.chart
|
|
6304
|
+
this.chart
|
|
6305
|
+
.getEventBus()
|
|
6306
|
+
.getStream(INTERACTION_VALUES_ACTIVE_EVENT)
|
|
5927
6307
|
.pipe(takeUntil(this.destroy$))
|
|
5928
|
-
.subscribe((event) => this.interactionValuesActive = event.data);
|
|
6308
|
+
.subscribe((event) => (this.interactionValuesActive = event.data));
|
|
5929
6309
|
this.mouseInteractiveArea.interaction
|
|
5930
6310
|
.pipe(takeUntil(this.destroy$))
|
|
5931
6311
|
.subscribe((event) => {
|
|
@@ -5939,10 +6319,21 @@ class MouseInteractiveAreaPlugin extends ChartPlugin {
|
|
|
5939
6319
|
const xCoordinate = event.coordinates.x;
|
|
5940
6320
|
const yCoordinate = event.coordinates.y;
|
|
5941
6321
|
const values = UtilityService.getXYValues(xScales, yScales, xCoordinate, yCoordinate);
|
|
5942
|
-
this.chart
|
|
6322
|
+
this.chart
|
|
6323
|
+
.getEventBus()
|
|
6324
|
+
.getStream(INTERACTION_VALUES_EVENT)
|
|
6325
|
+
.next({
|
|
6326
|
+
data: { interactionType: event.type, values },
|
|
6327
|
+
});
|
|
5943
6328
|
}
|
|
5944
|
-
this.chart
|
|
5945
|
-
|
|
6329
|
+
this.chart
|
|
6330
|
+
.getEventBus()
|
|
6331
|
+
.getStream(INTERACTION_COORDINATES_EVENT)
|
|
6332
|
+
.next({
|
|
6333
|
+
data: {
|
|
6334
|
+
interactionType: event.type,
|
|
6335
|
+
coordinates: event.coordinates,
|
|
6336
|
+
},
|
|
5946
6337
|
});
|
|
5947
6338
|
});
|
|
5948
6339
|
}
|
|
@@ -5957,7 +6348,15 @@ class MouseInteractiveAreaPlugin extends ChartPlugin {
|
|
|
5957
6348
|
this.destroy$.complete();
|
|
5958
6349
|
}
|
|
5959
6350
|
highlightReset() {
|
|
5960
|
-
this.chart
|
|
6351
|
+
this.chart
|
|
6352
|
+
.getEventBus()
|
|
6353
|
+
.getStream(INTERACTION_VALUES_EVENT)
|
|
6354
|
+
.next({
|
|
6355
|
+
data: {
|
|
6356
|
+
interactionType: InteractionType.MouseMove,
|
|
6357
|
+
values: {},
|
|
6358
|
+
},
|
|
6359
|
+
});
|
|
5961
6360
|
}
|
|
5962
6361
|
}
|
|
5963
6362
|
|
|
@@ -5972,15 +6371,26 @@ function defaultTextOverflowHandler(textSelection, args) {
|
|
|
5972
6371
|
const originalText = textSelection.text();
|
|
5973
6372
|
const chars = originalText.split("");
|
|
5974
6373
|
// add IGNORE_INTERACTION_CLASS so that mouse events used for displaying the title don't propagate from the mouse-interactive-area
|
|
5975
|
-
const ellipsisTSpan = textSelection
|
|
5976
|
-
|
|
6374
|
+
const ellipsisTSpan = textSelection
|
|
6375
|
+
.text("")
|
|
6376
|
+
.append("tspan")
|
|
6377
|
+
.attr("class", `${IGNORE_INTERACTION_CLASS} ellipsis`)
|
|
6378
|
+
.text("...");
|
|
6379
|
+
const textTSpan = textSelection
|
|
6380
|
+
.insert("tspan", ":first-child")
|
|
6381
|
+
.attr("class", `${IGNORE_INTERACTION_CLASS} text`)
|
|
6382
|
+
.text(originalText);
|
|
5977
6383
|
const paddingAndEllipsisWidth = args.ellipsisWidth + args.horizontalPadding * 2;
|
|
5978
6384
|
const originalCharCount = chars.length;
|
|
5979
|
-
let labelWidth = (((_a = textTSpan === null || textTSpan === void 0 ? void 0 : textTSpan.node()) === null || _a === void 0 ? void 0 : _a.getComputedTextLength()) || 0) +
|
|
5980
|
-
|
|
6385
|
+
let labelWidth = (((_a = textTSpan === null || textTSpan === void 0 ? void 0 : textTSpan.node()) === null || _a === void 0 ? void 0 : _a.getComputedTextLength()) || 0) +
|
|
6386
|
+
args.horizontalPadding * 2;
|
|
6387
|
+
while (chars.length &&
|
|
6388
|
+
(labelWidth > args.widthLimit || chars[chars.length - 1] === " ")) {
|
|
5981
6389
|
chars.pop();
|
|
5982
6390
|
textTSpan.text(chars.join(""));
|
|
5983
|
-
labelWidth =
|
|
6391
|
+
labelWidth =
|
|
6392
|
+
paddingAndEllipsisWidth +
|
|
6393
|
+
(((_b = textTSpan === null || textTSpan === void 0 ? void 0 : textTSpan.node()) === null || _b === void 0 ? void 0 : _b.getComputedTextLength()) || 0);
|
|
5984
6394
|
}
|
|
5985
6395
|
if (chars.length === originalCharCount) {
|
|
5986
6396
|
ellipsisTSpan.remove();
|
|
@@ -6148,9 +6558,12 @@ class XYGrid extends Grid {
|
|
|
6148
6558
|
config = this.config().axis.bottom;
|
|
6149
6559
|
axisGenerator = axisBottom;
|
|
6150
6560
|
}
|
|
6151
|
-
if (scale.domainCalculator &&
|
|
6561
|
+
if (scale.domainCalculator &&
|
|
6562
|
+
!isDomainWithTicksCalculator(scale.domainCalculator) &&
|
|
6563
|
+
config.gridTicks) {
|
|
6152
6564
|
scale.__domainCalculatedWithTicks = true;
|
|
6153
|
-
scale.domainCalculator =
|
|
6565
|
+
scale.domainCalculator =
|
|
6566
|
+
getAutomaticDomainWithTicks(config, axisGenerator, scale.domainCalculator);
|
|
6154
6567
|
}
|
|
6155
6568
|
});
|
|
6156
6569
|
});
|
|
@@ -6177,9 +6590,14 @@ class XYGrid extends Grid {
|
|
|
6177
6590
|
this.buildAxes(this.gridElementsLayer);
|
|
6178
6591
|
this.recalculateMargins(this.container);
|
|
6179
6592
|
const untilDestroy = () => takeUntil(this.eventBus.getStream(DESTROY_EVENT));
|
|
6180
|
-
this.eventBus
|
|
6593
|
+
this.eventBus
|
|
6594
|
+
.getStream(SERIES_STATE_CHANGE_EVENT)
|
|
6595
|
+
.pipe(untilDestroy())
|
|
6596
|
+
.subscribe((e) => {
|
|
6181
6597
|
const axesStyles = this.handleSeriesStateChange(e);
|
|
6182
|
-
this.eventBus.getStream(AXES_STYLE_CHANGE_EVENT).next({
|
|
6598
|
+
this.eventBus.getStream(AXES_STYLE_CHANGE_EVENT).next({
|
|
6599
|
+
data: axesStyles,
|
|
6600
|
+
});
|
|
6183
6601
|
});
|
|
6184
6602
|
return this;
|
|
6185
6603
|
}
|
|
@@ -6195,7 +6613,10 @@ class XYGrid extends Grid {
|
|
|
6195
6613
|
return;
|
|
6196
6614
|
}
|
|
6197
6615
|
const axes = [
|
|
6198
|
-
{
|
|
6616
|
+
{
|
|
6617
|
+
scaleId: this.leftScaleId,
|
|
6618
|
+
element: this.axisYLeft.group,
|
|
6619
|
+
},
|
|
6199
6620
|
{ scaleId: this.rightScaleId, element: (_a = this.axisYRight) === null || _a === void 0 ? void 0 : _a.group },
|
|
6200
6621
|
];
|
|
6201
6622
|
const axesStyles = this.calculateAxesStyles(e, axes);
|
|
@@ -6216,17 +6637,22 @@ class XYGrid extends Grid {
|
|
|
6216
6637
|
calculateAxesStyles(e, axes) {
|
|
6217
6638
|
const renderStates = e.data;
|
|
6218
6639
|
const emphasizedSeries = renderStates
|
|
6219
|
-
.filter(rs => rs.state === RenderState.emphasized && rs.series)
|
|
6220
|
-
.map(rs => rs.series);
|
|
6640
|
+
.filter((rs) => rs.state === RenderState.emphasized && rs.series)
|
|
6641
|
+
.map((rs) => rs.series);
|
|
6221
6642
|
if (emphasizedSeries.length > 0) {
|
|
6222
|
-
const emphasizedYScales = uniq(emphasizedSeries
|
|
6643
|
+
const emphasizedYScales = uniq(emphasizedSeries
|
|
6644
|
+
.map((s) => s === null || s === void 0 ? void 0 : s.scales["y"])
|
|
6645
|
+
.filter((s) => !!s));
|
|
6223
6646
|
if (emphasizedYScales.length <= 0) {
|
|
6224
6647
|
return {};
|
|
6225
6648
|
}
|
|
6226
6649
|
for (const emphasizedYScale of emphasizedYScales) {
|
|
6227
|
-
if (emphasizedYScale.id === this.leftScaleId ||
|
|
6650
|
+
if (emphasizedYScale.id === this.leftScaleId ||
|
|
6651
|
+
emphasizedYScale.id === this.rightScaleId) {
|
|
6228
6652
|
return axes.reduce((acc, next) => {
|
|
6229
|
-
acc[next.scaleId] = {
|
|
6653
|
+
acc[next.scaleId] = {
|
|
6654
|
+
opacity: emphasizedYScale.id === next.scaleId ? 1 : 0.1,
|
|
6655
|
+
};
|
|
6230
6656
|
return acc;
|
|
6231
6657
|
}, {});
|
|
6232
6658
|
}
|
|
@@ -6267,8 +6693,7 @@ class XYGrid extends Grid {
|
|
|
6267
6693
|
.ticks(config.approximateTicks)
|
|
6268
6694
|
.tickSize(0)
|
|
6269
6695
|
.tickFormat(scale.formatters["tick"]);
|
|
6270
|
-
axis.labelGroup
|
|
6271
|
-
.call(bottomLabelAxis);
|
|
6696
|
+
axis.labelGroup.call(bottomLabelAxis);
|
|
6272
6697
|
let tickAxis;
|
|
6273
6698
|
if (scale instanceof BandScale) {
|
|
6274
6699
|
tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
|
|
@@ -6315,20 +6740,25 @@ class XYGrid extends Grid {
|
|
|
6315
6740
|
const dimension = this.config().dimension;
|
|
6316
6741
|
const padding = dimension.padding;
|
|
6317
6742
|
if (this.scales.x) {
|
|
6318
|
-
each(this.scales.x.list, xScale => {
|
|
6743
|
+
each(this.scales.x.list, (xScale) => {
|
|
6319
6744
|
xScale.range([padding.left, dimension.width() - padding.right]);
|
|
6320
6745
|
});
|
|
6321
6746
|
}
|
|
6322
6747
|
if (this.scales.y) {
|
|
6323
|
-
each(this.scales.y.list, yScale => {
|
|
6324
|
-
yScale.range([
|
|
6748
|
+
each(this.scales.y.list, (yScale) => {
|
|
6749
|
+
yScale.range([
|
|
6750
|
+
dimension.height() - padding.bottom,
|
|
6751
|
+
padding.top,
|
|
6752
|
+
]);
|
|
6325
6753
|
});
|
|
6326
6754
|
}
|
|
6327
6755
|
super.updateRanges();
|
|
6328
6756
|
return this;
|
|
6329
6757
|
}
|
|
6330
6758
|
updateXAxis() {
|
|
6331
|
-
const xScale = this.bottomScaleId
|
|
6759
|
+
const xScale = this.bottomScaleId
|
|
6760
|
+
? this.scales["x"].index[this.bottomScaleId]
|
|
6761
|
+
: undefined;
|
|
6332
6762
|
const axis = this.config().axis;
|
|
6333
6763
|
if (!xScale) {
|
|
6334
6764
|
throw new Error("xScale is not defined");
|
|
@@ -6338,12 +6768,13 @@ class XYGrid extends Grid {
|
|
|
6338
6768
|
this.axisX.labelGroup.attr("transform", `translate(0, ${axis.bottom.tickSize})`);
|
|
6339
6769
|
this.drawTicks(axis.bottom, this.axisX, xScale, axisBottom);
|
|
6340
6770
|
this.drawGrids(axis.bottom, this.gridX, axisTop, xScale, this.config().dimension.height());
|
|
6341
|
-
this.gridX.tickGroup
|
|
6342
|
-
.attr("transform", `translate(0, ${this.config().dimension.height()})`);
|
|
6771
|
+
this.gridX.tickGroup.attr("transform", `translate(0, ${this.config().dimension.height()})`);
|
|
6343
6772
|
}
|
|
6344
6773
|
updateYAxes() {
|
|
6345
6774
|
const axis = this.config().axis;
|
|
6346
|
-
const yLeftScale = this.leftScaleId
|
|
6775
|
+
const yLeftScale = this.leftScaleId
|
|
6776
|
+
? this.scales["y"].index[this.leftScaleId]
|
|
6777
|
+
: undefined;
|
|
6347
6778
|
if (!yLeftScale) {
|
|
6348
6779
|
throw new Error("yLeftScale is not defined");
|
|
6349
6780
|
}
|
|
@@ -6352,7 +6783,9 @@ class XYGrid extends Grid {
|
|
|
6352
6783
|
this.drawGrids(axis.left, this.gridY, axisRight, yLeftScale, this.config().dimension.width());
|
|
6353
6784
|
if (this.rightScaleId) {
|
|
6354
6785
|
const yRightScale = this.scales["y"].index[this.rightScaleId];
|
|
6355
|
-
const rightScaleLabelX = axis.right.padding +
|
|
6786
|
+
const rightScaleLabelX = axis.right.padding +
|
|
6787
|
+
this.config().dimension.width() +
|
|
6788
|
+
axis.right.tickSize;
|
|
6356
6789
|
this.axisYRight.labelGroup.attr("transform", `translate(${rightScaleLabelX}, 0)`);
|
|
6357
6790
|
this.axisYRight.tickGroup.attr("transform", `translate(${this.config().dimension.width()}, 0)`);
|
|
6358
6791
|
this.drawTicks(axis.right, this.axisYRight, yRightScale, axisRight);
|
|
@@ -6369,7 +6802,9 @@ class XYGrid extends Grid {
|
|
|
6369
6802
|
const textOfTicks = [];
|
|
6370
6803
|
labelGroup.attr("cursor", "default");
|
|
6371
6804
|
labelGroup.selectAll("g").each(function () {
|
|
6372
|
-
select(this)
|
|
6805
|
+
select(this)
|
|
6806
|
+
.classed("sw-hidden", false)
|
|
6807
|
+
.classed("tick-hidden-text", false);
|
|
6373
6808
|
textOfTicks.push(this);
|
|
6374
6809
|
});
|
|
6375
6810
|
const toRemove = this.filterRepeatedElements(textOfTicks);
|
|
@@ -6381,11 +6816,16 @@ class XYGrid extends Grid {
|
|
|
6381
6816
|
const groupSelection = select(group);
|
|
6382
6817
|
// zero-out the d3-provided x position of all labels since we're manually translating the x position of the entire group;
|
|
6383
6818
|
// add IGNORE_INTERACTION_CLASS so that mouse events used for displaying the title don't propagate from the mouse-interactive-area
|
|
6384
|
-
groupSelection
|
|
6819
|
+
groupSelection
|
|
6820
|
+
.select("text")
|
|
6821
|
+
.attr("x", 0)
|
|
6822
|
+
.classed(IGNORE_INTERACTION_CLASS, true);
|
|
6385
6823
|
groupSelection.classed("pointer-events", true);
|
|
6386
6824
|
if (groupSelection.select("title").empty()) {
|
|
6387
6825
|
const datum = groupSelection.data()[0];
|
|
6388
|
-
const titleText = (scale.formatters["tick"]
|
|
6826
|
+
const titleText = (scale.formatters["tick"]
|
|
6827
|
+
? scale.formatters["tick"](datum)
|
|
6828
|
+
: datum);
|
|
6389
6829
|
groupSelection.append("title").text(titleText);
|
|
6390
6830
|
}
|
|
6391
6831
|
});
|
|
@@ -6394,7 +6834,9 @@ class XYGrid extends Grid {
|
|
|
6394
6834
|
handleTickLabelOverflow(labelGroup, scale, axisLabels) {
|
|
6395
6835
|
var _a;
|
|
6396
6836
|
const axisConfig = this.config().axis;
|
|
6397
|
-
if (scale.id === this.bottomScaleId &&
|
|
6837
|
+
if (scale.id === this.bottomScaleId &&
|
|
6838
|
+
(scale.isContinuous() ||
|
|
6839
|
+
!axisConfig.bottom.tickLabel.overflowHandler)) {
|
|
6398
6840
|
const textToHide = this.getElementsToHide(axisLabels, this._config.dimension.width(), true);
|
|
6399
6841
|
textToHide.forEach((group) => {
|
|
6400
6842
|
const groupSelection = select(group);
|
|
@@ -6420,9 +6862,14 @@ class XYGrid extends Grid {
|
|
|
6420
6862
|
const maxLeftWidth = axisConfig.left.tickLabel.maxWidth;
|
|
6421
6863
|
if (scale.id === this.bottomScaleId) {
|
|
6422
6864
|
const maxBottomWidth = axisConfig.bottom.tickLabel.maxWidth;
|
|
6423
|
-
const calculatedBottomWidth = scale.bandwidth
|
|
6865
|
+
const calculatedBottomWidth = scale.bandwidth
|
|
6866
|
+
? scale.bandwidth()
|
|
6867
|
+
: this.getTickDistance(axisLabels);
|
|
6424
6868
|
if (!isUndefined(maxBottomWidth)) {
|
|
6425
|
-
widthLimit =
|
|
6869
|
+
widthLimit =
|
|
6870
|
+
calculatedBottomWidth > maxBottomWidth
|
|
6871
|
+
? maxBottomWidth
|
|
6872
|
+
: calculatedBottomWidth;
|
|
6426
6873
|
}
|
|
6427
6874
|
else {
|
|
6428
6875
|
widthLimit = calculatedBottomWidth;
|
|
@@ -6431,9 +6878,14 @@ class XYGrid extends Grid {
|
|
|
6431
6878
|
overflowHandler = axisConfig.bottom.tickLabel.overflowHandler;
|
|
6432
6879
|
}
|
|
6433
6880
|
else if (scale.id === this.rightScaleId && !axisConfig.right.fit) {
|
|
6434
|
-
const calculatedRightWidth = margin.right -
|
|
6881
|
+
const calculatedRightWidth = margin.right -
|
|
6882
|
+
axisConfig.right.padding -
|
|
6883
|
+
axisConfig.right.tickSize;
|
|
6435
6884
|
if (!isUndefined(maxRightWidth)) {
|
|
6436
|
-
widthLimit =
|
|
6885
|
+
widthLimit =
|
|
6886
|
+
calculatedRightWidth > maxRightWidth
|
|
6887
|
+
? maxRightWidth
|
|
6888
|
+
: calculatedRightWidth;
|
|
6437
6889
|
}
|
|
6438
6890
|
else {
|
|
6439
6891
|
widthLimit = calculatedRightWidth;
|
|
@@ -6442,9 +6894,14 @@ class XYGrid extends Grid {
|
|
|
6442
6894
|
overflowHandler = axisConfig.right.tickLabel.overflowHandler;
|
|
6443
6895
|
}
|
|
6444
6896
|
else if (scale.id === this.leftScaleId && !axisConfig.left.fit) {
|
|
6445
|
-
const calculatedLeftWidth = margin.left -
|
|
6897
|
+
const calculatedLeftWidth = margin.left -
|
|
6898
|
+
axisConfig.left.padding -
|
|
6899
|
+
axisConfig.left.tickSize;
|
|
6446
6900
|
if (!isUndefined(maxLeftWidth)) {
|
|
6447
|
-
widthLimit =
|
|
6901
|
+
widthLimit =
|
|
6902
|
+
calculatedLeftWidth > maxLeftWidth
|
|
6903
|
+
? maxLeftWidth
|
|
6904
|
+
: calculatedLeftWidth;
|
|
6448
6905
|
}
|
|
6449
6906
|
else {
|
|
6450
6907
|
widthLimit = calculatedLeftWidth;
|
|
@@ -6452,13 +6909,17 @@ class XYGrid extends Grid {
|
|
|
6452
6909
|
horizontalPadding = axisConfig.left.tickLabel.horizontalPadding;
|
|
6453
6910
|
overflowHandler = axisConfig.left.tickLabel.overflowHandler;
|
|
6454
6911
|
}
|
|
6455
|
-
else if (scale.id === this.rightScaleId &&
|
|
6912
|
+
else if (scale.id === this.rightScaleId &&
|
|
6913
|
+
axisConfig.right.fit &&
|
|
6914
|
+
!isUndefined(maxRightWidth)) {
|
|
6456
6915
|
widthLimit = maxRightWidth;
|
|
6457
6916
|
horizontalPadding = axisConfig.right.tickLabel.horizontalPadding;
|
|
6458
6917
|
overflowHandler = axisConfig.right.tickLabel.overflowHandler;
|
|
6459
6918
|
fixRightMargin = true;
|
|
6460
6919
|
}
|
|
6461
|
-
else if (scale.id === this.leftScaleId &&
|
|
6920
|
+
else if (scale.id === this.leftScaleId &&
|
|
6921
|
+
axisConfig.left.fit &&
|
|
6922
|
+
!isUndefined(maxLeftWidth)) {
|
|
6462
6923
|
widthLimit = maxLeftWidth;
|
|
6463
6924
|
horizontalPadding = axisConfig.left.tickLabel.horizontalPadding;
|
|
6464
6925
|
overflowHandler = axisConfig.left.tickLabel.overflowHandler;
|
|
@@ -6474,7 +6935,11 @@ class XYGrid extends Grid {
|
|
|
6474
6935
|
let ellipsisWidth = 0;
|
|
6475
6936
|
if (labelGroup.select(".sample-ellipsis").empty()) {
|
|
6476
6937
|
const testText = labelGroup.append("text");
|
|
6477
|
-
const ellipsis = testText
|
|
6938
|
+
const ellipsis = testText
|
|
6939
|
+
.classed("sample-ellipsis", true)
|
|
6940
|
+
.attr("opacity", 0)
|
|
6941
|
+
.append("tspan")
|
|
6942
|
+
.text("...");
|
|
6478
6943
|
ellipsisWidth = ((_a = ellipsis.node()) === null || _a === void 0 ? void 0 : _a.getComputedTextLength()) || 0;
|
|
6479
6944
|
testText.remove();
|
|
6480
6945
|
}
|
|
@@ -6493,7 +6958,13 @@ class XYGrid extends Grid {
|
|
|
6493
6958
|
axisLabels.forEach((group) => {
|
|
6494
6959
|
const groupSelection = select(group);
|
|
6495
6960
|
// invoke the handler for each text element
|
|
6496
|
-
groupSelection
|
|
6961
|
+
groupSelection
|
|
6962
|
+
.select("text")
|
|
6963
|
+
.call(overflowHandler, {
|
|
6964
|
+
widthLimit,
|
|
6965
|
+
horizontalPadding,
|
|
6966
|
+
ellipsisWidth,
|
|
6967
|
+
});
|
|
6497
6968
|
// restore pointer events
|
|
6498
6969
|
groupSelection.classed("pointer-events", true);
|
|
6499
6970
|
});
|
|
@@ -6515,7 +6986,9 @@ class XYGrid extends Grid {
|
|
|
6515
6986
|
return actualTextElements;
|
|
6516
6987
|
}
|
|
6517
6988
|
getOuterWidthDimensionCorrection() {
|
|
6518
|
-
return this.config().axis.bottom.visible
|
|
6989
|
+
return this.config().axis.bottom.visible
|
|
6990
|
+
? Grid.TICK_DIMENSION_CORRECTION
|
|
6991
|
+
: 0;
|
|
6519
6992
|
}
|
|
6520
6993
|
handleMarginUpdate() {
|
|
6521
6994
|
const oldMargin = clone(this._config.dimension.margin);
|
|
@@ -6524,32 +6997,43 @@ class XYGrid extends Grid {
|
|
|
6524
6997
|
}
|
|
6525
6998
|
hasRightYAxis() {
|
|
6526
6999
|
var _a;
|
|
6527
|
-
return this.config().axis.right.visible && ((_a = this.rightScaleId) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
7000
|
+
return (this.config().axis.right.visible && ((_a = this.rightScaleId) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
6528
7001
|
}
|
|
6529
7002
|
buildAxes(container) {
|
|
6530
7003
|
// Grid lines: no sense to have right
|
|
6531
|
-
this.gridY.tickGroup = container
|
|
7004
|
+
this.gridY.tickGroup = container
|
|
7005
|
+
.append("g")
|
|
6532
7006
|
.classed("sw-axis sw-axis-grid sw-axis-gridY", true);
|
|
6533
|
-
this.gridX.tickGroup = container
|
|
7007
|
+
this.gridX.tickGroup = container
|
|
7008
|
+
.append("g")
|
|
6534
7009
|
.classed("sw-axis sw-axis-grid sw-axis-gridX", true);
|
|
6535
7010
|
// Axis groups
|
|
6536
|
-
this.axisX.group = container
|
|
7011
|
+
this.axisX.group = container
|
|
7012
|
+
.append("g")
|
|
6537
7013
|
.classed("sw-axis sw-axis-x", true);
|
|
6538
|
-
this.axisX.tickGroup = this.axisX.group
|
|
7014
|
+
this.axisX.tickGroup = this.axisX.group
|
|
7015
|
+
.append("g")
|
|
6539
7016
|
.classed("sw-axis sw-axis-x sw-axis-x-ticks", true);
|
|
6540
|
-
this.axisX.labelGroup = this.axisX.group
|
|
7017
|
+
this.axisX.labelGroup = this.axisX.group
|
|
7018
|
+
.append("g")
|
|
6541
7019
|
.classed("sw-axis sw-axis-x sw-axis-x-labels", true);
|
|
6542
|
-
this.axisYLeft.group = container
|
|
7020
|
+
this.axisYLeft.group = container
|
|
7021
|
+
.append("g")
|
|
6543
7022
|
.classed("sw-axis sw-axis-y sw-axis-y-left", true);
|
|
6544
|
-
this.axisYLeft.tickGroup = this.axisYLeft.group
|
|
7023
|
+
this.axisYLeft.tickGroup = this.axisYLeft.group
|
|
7024
|
+
.append("g")
|
|
6545
7025
|
.classed("sw-axis sw-axis-y sw-axis-y-ticks", true);
|
|
6546
|
-
this.axisYLeft.labelGroup = this.axisYLeft.group
|
|
7026
|
+
this.axisYLeft.labelGroup = this.axisYLeft.group
|
|
7027
|
+
.append("g")
|
|
6547
7028
|
.classed("sw-axis sw-axis-y sw-axis-y-labels", true);
|
|
6548
|
-
this.axisYRight.group = container
|
|
7029
|
+
this.axisYRight.group = container
|
|
7030
|
+
.append("g")
|
|
6549
7031
|
.classed("sw-axis sw-axis-y sw-axis-y-right", true);
|
|
6550
|
-
this.axisYRight.tickGroup = this.axisYRight.group
|
|
7032
|
+
this.axisYRight.tickGroup = this.axisYRight.group
|
|
7033
|
+
.append("g")
|
|
6551
7034
|
.classed("sw-axis sw-axis-y sw-axis-y-ticks", true);
|
|
6552
|
-
this.axisYRight.labelGroup = this.axisYRight.group
|
|
7035
|
+
this.axisYRight.labelGroup = this.axisYRight.group
|
|
7036
|
+
.append("g")
|
|
6553
7037
|
.classed("sw-axis sw-axis-y sw-axis-y-labels", true);
|
|
6554
7038
|
}
|
|
6555
7039
|
filterRepeatedElements(elementsToFilter) {
|
|
@@ -6561,19 +7045,25 @@ class XYGrid extends Grid {
|
|
|
6561
7045
|
}
|
|
6562
7046
|
return textInsideNext;
|
|
6563
7047
|
}, elementsToFilter[0] && select(elementsToFilter[0]).text());
|
|
6564
|
-
return elementsToFilter.filter(element => arr.indexOf(element) === -1);
|
|
7048
|
+
return elementsToFilter.filter((element) => arr.indexOf(element) === -1);
|
|
6565
7049
|
}
|
|
6566
7050
|
getElementsToHide(elementsToFilter, measurement, isBottomAxis) {
|
|
6567
7051
|
let elementsToDisplay;
|
|
6568
7052
|
const measureType = isBottomAxis ? "width" : "height";
|
|
6569
|
-
const measurementComparison =
|
|
6570
|
-
|
|
6571
|
-
const
|
|
7053
|
+
const measurementComparison = this.getTextMeasurement(elementsToFilter, measureType) <
|
|
7054
|
+
measurement;
|
|
7055
|
+
const bottomAxisComparison = isBottomAxis
|
|
7056
|
+
? this.getMaxTextWidth(elementsToFilter) <
|
|
7057
|
+
this.getTickDistance(elementsToFilter)
|
|
7058
|
+
: false;
|
|
7059
|
+
const shouldNotFilter = isBottomAxis
|
|
7060
|
+
? measurementComparison && bottomAxisComparison
|
|
7061
|
+
: measurementComparison;
|
|
6572
7062
|
if (shouldNotFilter) {
|
|
6573
7063
|
return [];
|
|
6574
7064
|
}
|
|
6575
7065
|
elementsToDisplay = this.elementsFiltering(elementsToFilter, measurement, measureType);
|
|
6576
|
-
return elementsToFilter.filter(element => elementsToDisplay.indexOf(element) === -1);
|
|
7066
|
+
return elementsToFilter.filter((element) => elementsToDisplay.indexOf(element) === -1);
|
|
6577
7067
|
}
|
|
6578
7068
|
elementsFiltering(elementsToFilter, parameter, measureType) {
|
|
6579
7069
|
let elementsToDisplay;
|
|
@@ -6582,10 +7072,11 @@ class XYGrid extends Grid {
|
|
|
6582
7072
|
? this.getMaxTextWidth(array) > this.getTickDistance(array)
|
|
6583
7073
|
: this.getTextMeasurement(array, measureType) > parameter;
|
|
6584
7074
|
do {
|
|
6585
|
-
elementsToDisplay = elementsToFilter.filter((element, index) =>
|
|
7075
|
+
elementsToDisplay = elementsToFilter.filter((element, index) => index % counter === 0);
|
|
6586
7076
|
counter++;
|
|
6587
7077
|
// Break the loop when we have only 1 tick and its size is bigger than available width/height
|
|
6588
|
-
if (elementsToDisplay.length === 1 &&
|
|
7078
|
+
if (elementsToDisplay.length === 1 &&
|
|
7079
|
+
condition(elementsToDisplay)) {
|
|
6589
7080
|
break;
|
|
6590
7081
|
}
|
|
6591
7082
|
} while (condition(elementsToDisplay));
|
|
@@ -6593,7 +7084,9 @@ class XYGrid extends Grid {
|
|
|
6593
7084
|
}
|
|
6594
7085
|
getTextMeasurement(array, measureType) {
|
|
6595
7086
|
const textPadding = measureType === "width" ? 5 : 0;
|
|
6596
|
-
return array.reduce((prev, next) => prev +
|
|
7087
|
+
return array.reduce((prev, next) => prev +
|
|
7088
|
+
next.getBoundingClientRect()[measureType] +
|
|
7089
|
+
textPadding, 0);
|
|
6597
7090
|
}
|
|
6598
7091
|
getMaxTextWidth(array) {
|
|
6599
7092
|
if (array.length === 0) {
|
|
@@ -6632,13 +7125,24 @@ class XYGrid extends Grid {
|
|
|
6632
7125
|
const oldOuterWidth = d.outerWidth();
|
|
6633
7126
|
const oldOuterHeight = d.outerHeight();
|
|
6634
7127
|
if (!((_a = d.marginLocked) === null || _a === void 0 ? void 0 : _a.left) && axis.left.fit && axis.left.visible) {
|
|
6635
|
-
d.margin.left =
|
|
7128
|
+
d.margin.left =
|
|
7129
|
+
this.getMaxTextWidth(this.selectAllAxisLabels(this.axisYLeft.labelGroup)) +
|
|
7130
|
+
axis.left.tickSize +
|
|
7131
|
+
axis.left.padding;
|
|
6636
7132
|
}
|
|
6637
7133
|
if (!((_b = d.marginLocked) === null || _b === void 0 ? void 0 : _b.right) && axis.right.fit && this.hasRightYAxis()) {
|
|
6638
|
-
d.margin.right =
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
7134
|
+
d.margin.right =
|
|
7135
|
+
this.getMaxTextWidth(this.selectAllAxisLabels(this.axisYRight.labelGroup)) +
|
|
7136
|
+
axis.right.tickSize +
|
|
7137
|
+
axis.right.padding;
|
|
7138
|
+
}
|
|
7139
|
+
const bottomScale = this.bottomScaleId && this.scales
|
|
7140
|
+
? (_c = this.scales["x"]) === null || _c === void 0 ? void 0 : _c.index[this.bottomScaleId]
|
|
7141
|
+
: undefined;
|
|
7142
|
+
if (axis.bottom.fit &&
|
|
7143
|
+
axis.bottom.visible &&
|
|
7144
|
+
((bottomScale === null || bottomScale === void 0 ? void 0 : bottomScale.isContinuous()) ||
|
|
7145
|
+
!axis.bottom.tickLabel.overflowHandler)) {
|
|
6642
7146
|
this.fitBottomAxis(d);
|
|
6643
7147
|
}
|
|
6644
7148
|
const newTopMargin = d.margin.top; // TODO: Do the calculation, if needed
|
|
@@ -6662,12 +7166,15 @@ class XYGrid extends Grid {
|
|
|
6662
7166
|
}
|
|
6663
7167
|
let lastTextWidth = 0;
|
|
6664
7168
|
let lastTickScaleValue = 0;
|
|
6665
|
-
const node = this.axisX.labelGroup
|
|
7169
|
+
const node = this.axisX.labelGroup
|
|
7170
|
+
.select(".tick:not(.tick-hidden-text):last-child text")
|
|
7171
|
+
.node();
|
|
6666
7172
|
if (node) {
|
|
6667
7173
|
lastTextWidth = node.getBoundingClientRect().width;
|
|
6668
7174
|
lastTickScaleValue = (_c = scale(node.innerHTML)) !== null && _c !== void 0 ? _c : 0;
|
|
6669
7175
|
const topOfRange = scale.range()[1];
|
|
6670
|
-
const diff =
|
|
7176
|
+
const diff = lastTextWidth / 2 -
|
|
7177
|
+
Math.abs(topOfRange - lastTickScaleValue) / 2;
|
|
6671
7178
|
d.margin.right = diff > 0 ? diff : 0;
|
|
6672
7179
|
}
|
|
6673
7180
|
}
|
|
@@ -6693,10 +7200,10 @@ class XYGrid extends Grid {
|
|
|
6693
7200
|
}, 100);
|
|
6694
7201
|
}
|
|
6695
7202
|
areMarginsApproximatelyEqual(margin1, margin2) {
|
|
6696
|
-
return this.isApproximatelyEqual(margin1.top, margin2.top) &&
|
|
7203
|
+
return (this.isApproximatelyEqual(margin1.top, margin2.top) &&
|
|
6697
7204
|
this.isApproximatelyEqual(margin1.right, margin2.right) &&
|
|
6698
7205
|
this.isApproximatelyEqual(margin1.bottom, margin2.bottom) &&
|
|
6699
|
-
this.isApproximatelyEqual(margin1.left, margin2.left);
|
|
7206
|
+
this.isApproximatelyEqual(margin1.left, margin2.left));
|
|
6700
7207
|
}
|
|
6701
7208
|
}
|
|
6702
7209
|
XYGrid.TICK_LABEL_OVERFLOW_DEBOUNCE_INTERVAL = 200;
|
|
@@ -6749,14 +7256,18 @@ class GaugeUtil {
|
|
|
6749
7256
|
*/
|
|
6750
7257
|
static createChartAssist(gaugeConfig, mode, labelsPlugin) {
|
|
6751
7258
|
var _a, _b, _c;
|
|
6752
|
-
const grid =
|
|
7259
|
+
const grid = mode === GaugeMode.Donut
|
|
7260
|
+
? radialGrid()
|
|
7261
|
+
: new XYGrid(linearGaugeGridConfig(mode, gaugeConfig.linearThickness));
|
|
6753
7262
|
const gridConfig = grid.config();
|
|
6754
7263
|
const chart = new Chart(grid);
|
|
6755
|
-
const enableLabels = !isEmpty((_a = gaugeConfig.thresholds) === null || _a === void 0 ? void 0 : _a.definitions) &&
|
|
7264
|
+
const enableLabels = !isEmpty((_a = gaugeConfig.thresholds) === null || _a === void 0 ? void 0 : _a.definitions) &&
|
|
7265
|
+
!((_b = gaugeConfig.thresholds) === null || _b === void 0 ? void 0 : _b.disableMarkers);
|
|
6756
7266
|
if (mode === GaugeMode.Donut) {
|
|
6757
7267
|
if (enableLabels) {
|
|
6758
7268
|
chart.addPlugin(labelsPlugin !== null && labelsPlugin !== void 0 ? labelsPlugin : new DonutGaugeLabelsPlugin());
|
|
6759
|
-
gridConfig.dimension.margin =
|
|
7269
|
+
gridConfig.dimension.margin =
|
|
7270
|
+
GaugeUtil.getMarginForLabelClearance(gaugeConfig, mode, gridConfig.dimension.margin);
|
|
6760
7271
|
}
|
|
6761
7272
|
return new ChartAssist(chart, radial);
|
|
6762
7273
|
}
|
|
@@ -6811,10 +7322,21 @@ class GaugeUtil {
|
|
|
6811
7322
|
const updatedSeriesSet = seriesSet.map((series) => {
|
|
6812
7323
|
var _a, _b, _c;
|
|
6813
7324
|
if (series.id === GAUGE_QUANTITY_SERIES_ID) {
|
|
6814
|
-
return Object.assign(Object.assign({}, series), { data: [
|
|
7325
|
+
return Object.assign(Object.assign({}, series), { data: [
|
|
7326
|
+
{
|
|
7327
|
+
category: GaugeUtil.DATA_CATEGORY,
|
|
7328
|
+
value: clampedConfig.value,
|
|
7329
|
+
},
|
|
7330
|
+
], activeThreshold: thresholdsData.activeThreshold, defaultColor: clampedConfig.defaultQuantityColor ||
|
|
7331
|
+
StandardGaugeColor.Ok });
|
|
6815
7332
|
}
|
|
6816
7333
|
if (series.id === GAUGE_REMAINDER_SERIES_ID) {
|
|
6817
|
-
return Object.assign(Object.assign({}, series), { data: [
|
|
7334
|
+
return Object.assign(Object.assign({}, series), { data: [
|
|
7335
|
+
{
|
|
7336
|
+
category: GaugeUtil.DATA_CATEGORY,
|
|
7337
|
+
value: clampedConfig.max - clampedConfig.value,
|
|
7338
|
+
},
|
|
7339
|
+
] });
|
|
6818
7340
|
}
|
|
6819
7341
|
if (series.id === GAUGE_THRESHOLD_MARKERS_SERIES_ID) {
|
|
6820
7342
|
series.renderer.config.enabled = !((_a = clampedConfig.thresholds) === null || _a === void 0 ? void 0 : _a.disableMarkers);
|
|
@@ -6904,18 +7426,23 @@ class GaugeUtil {
|
|
|
6904
7426
|
static generateQuantityAndRemainderSeriesSet(gaugeConfig, renderingAttributes, activeThreshold) {
|
|
6905
7427
|
// assigning to variable to prevent "Lambda not supported" error
|
|
6906
7428
|
const seriesSet = GaugeUtil.generateQuantityAndRemainderData(gaugeConfig).map((series) => {
|
|
6907
|
-
const { quantityAccessors, remainderAccessors, scales, mainRenderer } = renderingAttributes;
|
|
7429
|
+
const { quantityAccessors, remainderAccessors, scales, mainRenderer, } = renderingAttributes;
|
|
6908
7430
|
if (quantityAccessors.data) {
|
|
6909
|
-
quantityAccessors.data.color = (data, i, series, dataSeries) => dataSeries.activeThreshold
|
|
7431
|
+
quantityAccessors.data.color = (data, i, series, dataSeries) => dataSeries.activeThreshold
|
|
7432
|
+
? dataSeries.activeThreshold.color
|
|
7433
|
+
: dataSeries.defaultColor;
|
|
6910
7434
|
}
|
|
6911
7435
|
if (remainderAccessors.data) {
|
|
6912
7436
|
remainderAccessors.data.color = () => gaugeConfig.remainderColor || StandardGaugeColor.Remainder;
|
|
6913
7437
|
}
|
|
6914
7438
|
if (series.id === GAUGE_QUANTITY_SERIES_ID) {
|
|
6915
7439
|
series.activeThreshold = activeThreshold;
|
|
6916
|
-
series.defaultColor =
|
|
7440
|
+
series.defaultColor =
|
|
7441
|
+
gaugeConfig.defaultQuantityColor || StandardGaugeColor.Ok;
|
|
6917
7442
|
}
|
|
6918
|
-
return Object.assign(Object.assign({}, series), { accessors: series.id === GAUGE_QUANTITY_SERIES_ID
|
|
7443
|
+
return Object.assign(Object.assign({}, series), { accessors: series.id === GAUGE_QUANTITY_SERIES_ID
|
|
7444
|
+
? quantityAccessors
|
|
7445
|
+
: remainderAccessors, scales, renderer: mainRenderer });
|
|
6919
7446
|
});
|
|
6920
7447
|
return seriesSet;
|
|
6921
7448
|
}
|
|
@@ -6977,7 +7504,8 @@ class GaugeUtil {
|
|
|
6977
7504
|
remainderAccessorFunction: () => new RadialAccessors(),
|
|
6978
7505
|
scaleFunction: () => {
|
|
6979
7506
|
const scales = radialScales();
|
|
6980
|
-
scales.r.formatters[GAUGE_LABEL_FORMATTER_NAME_DEFAULT] =
|
|
7507
|
+
scales.r.formatters[GAUGE_LABEL_FORMATTER_NAME_DEFAULT] =
|
|
7508
|
+
labelFormatter;
|
|
6981
7509
|
return scales;
|
|
6982
7510
|
},
|
|
6983
7511
|
},
|
|
@@ -6988,7 +7516,8 @@ class GaugeUtil {
|
|
|
6988
7516
|
remainderAccessorFunction: () => new HorizontalBarAccessors(),
|
|
6989
7517
|
scaleFunction: () => {
|
|
6990
7518
|
const scales = barScales({ horizontal: true });
|
|
6991
|
-
scales.x.formatters[GAUGE_LABEL_FORMATTER_NAME_DEFAULT] =
|
|
7519
|
+
scales.x.formatters[GAUGE_LABEL_FORMATTER_NAME_DEFAULT] =
|
|
7520
|
+
labelFormatter;
|
|
6992
7521
|
return scales;
|
|
6993
7522
|
},
|
|
6994
7523
|
},
|
|
@@ -6999,7 +7528,8 @@ class GaugeUtil {
|
|
|
6999
7528
|
remainderAccessorFunction: () => new VerticalBarAccessors(),
|
|
7000
7529
|
scaleFunction: () => {
|
|
7001
7530
|
const scales = barScales();
|
|
7002
|
-
scales.y.formatters[GAUGE_LABEL_FORMATTER_NAME_DEFAULT] =
|
|
7531
|
+
scales.y.formatters[GAUGE_LABEL_FORMATTER_NAME_DEFAULT] =
|
|
7532
|
+
labelFormatter;
|
|
7003
7533
|
return scales;
|
|
7004
7534
|
},
|
|
7005
7535
|
},
|
|
@@ -7017,8 +7547,24 @@ class GaugeUtil {
|
|
|
7017
7547
|
static generateQuantityAndRemainderData(gaugeConfig) {
|
|
7018
7548
|
return [
|
|
7019
7549
|
// category property is used for unifying the linear-style gauge visualization into a single bar stack
|
|
7020
|
-
{
|
|
7021
|
-
|
|
7550
|
+
{
|
|
7551
|
+
id: GAUGE_QUANTITY_SERIES_ID,
|
|
7552
|
+
data: [
|
|
7553
|
+
{
|
|
7554
|
+
category: GaugeUtil.DATA_CATEGORY,
|
|
7555
|
+
value: gaugeConfig.value,
|
|
7556
|
+
},
|
|
7557
|
+
],
|
|
7558
|
+
},
|
|
7559
|
+
{
|
|
7560
|
+
id: GAUGE_REMAINDER_SERIES_ID,
|
|
7561
|
+
data: [
|
|
7562
|
+
{
|
|
7563
|
+
category: GaugeUtil.DATA_CATEGORY,
|
|
7564
|
+
value: gaugeConfig.max - gaugeConfig.value,
|
|
7565
|
+
},
|
|
7566
|
+
],
|
|
7567
|
+
},
|
|
7022
7568
|
];
|
|
7023
7569
|
}
|
|
7024
7570
|
/**
|
|
@@ -7065,11 +7611,15 @@ class GaugeUtil {
|
|
|
7065
7611
|
var _a;
|
|
7066
7612
|
return (Object.assign(Object.assign({}, threshold), { category: GaugeUtil.DATA_CATEGORY,
|
|
7067
7613
|
// threshold values are exclusive when in reversed mode, inclusive otherwise
|
|
7068
|
-
hit: ((_a = gaugeConfig.thresholds) === null || _a === void 0 ? void 0 : _a.reversed)
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7614
|
+
hit: ((_a = gaugeConfig.thresholds) === null || _a === void 0 ? void 0 : _a.reversed)
|
|
7615
|
+
? threshold.value < gaugeConfig.value
|
|
7616
|
+
: threshold.value <= gaugeConfig.value }));
|
|
7617
|
+
})
|
|
7618
|
+
.sort((a, b) => a.value - b.value);
|
|
7619
|
+
const activeThreshold = ((_b = gaugeConfig
|
|
7620
|
+
.thresholds) === null || _b === void 0 ? void 0 : _b.reversed)
|
|
7621
|
+
? thresholds === null || thresholds === void 0 ? void 0 : thresholds.find((threshold) => !isUndefined(threshold.hit) && !threshold.hit)
|
|
7622
|
+
: thresholds === null || thresholds === void 0 ? void 0 : thresholds.slice().reverse().find((threshold) => threshold.hit);
|
|
7073
7623
|
return {
|
|
7074
7624
|
thresholds,
|
|
7075
7625
|
activeThreshold,
|
|
@@ -7088,7 +7638,7 @@ class GaugeUtil {
|
|
|
7088
7638
|
value = 0;
|
|
7089
7639
|
}
|
|
7090
7640
|
const thresholdDefs = ((_a = gaugeConfig.thresholds) === null || _a === void 0 ? void 0 : _a.definitions) || {};
|
|
7091
|
-
Object.keys(thresholdDefs || {}).forEach(thresholdId => {
|
|
7641
|
+
Object.keys(thresholdDefs || {}).forEach((thresholdId) => {
|
|
7092
7642
|
const threshold = thresholdDefs[thresholdId];
|
|
7093
7643
|
if (threshold) {
|
|
7094
7644
|
if (threshold.value > gaugeConfig.max) {
|
|
@@ -7119,8 +7669,7 @@ class MappedValueProvider {
|
|
|
7119
7669
|
this.get = (entityId) => this.valueMap[entityId] || this.defaultValue;
|
|
7120
7670
|
this.reset();
|
|
7121
7671
|
}
|
|
7122
|
-
reset() {
|
|
7123
|
-
}
|
|
7672
|
+
reset() { }
|
|
7124
7673
|
}
|
|
7125
7674
|
|
|
7126
7675
|
/**
|
|
@@ -7135,13 +7684,13 @@ class PathMarker {
|
|
|
7135
7684
|
constructor(d) {
|
|
7136
7685
|
this.element = document.createElement("path");
|
|
7137
7686
|
this.setAttributes({
|
|
7138
|
-
|
|
7687
|
+
class: "nui-chart-element-marker nui-chart--path__outline",
|
|
7139
7688
|
"vector-effect": "non-scaling-stroke",
|
|
7140
|
-
|
|
7689
|
+
d: d,
|
|
7141
7690
|
});
|
|
7142
7691
|
}
|
|
7143
7692
|
setColor(color) {
|
|
7144
|
-
this.setAttributes({
|
|
7693
|
+
this.setAttributes({ fill: color });
|
|
7145
7694
|
}
|
|
7146
7695
|
setAttributes(attrs) {
|
|
7147
7696
|
for (const attr of Object.keys(attrs)) {
|
|
@@ -7169,7 +7718,7 @@ const domainWithAuxiliarySeries = (additionalSeriesFn, domainCalculator) => (cha
|
|
|
7169
7718
|
class PointScale extends Scale {
|
|
7170
7719
|
constructor(id) {
|
|
7171
7720
|
super(id);
|
|
7172
|
-
this.formatters.tick = value => value;
|
|
7721
|
+
this.formatters.tick = (value) => value;
|
|
7173
7722
|
}
|
|
7174
7723
|
createD3Scale() {
|
|
7175
7724
|
return scalePoint();
|
|
@@ -7179,7 +7728,10 @@ class PointScale extends Scale {
|
|
|
7179
7728
|
}
|
|
7180
7729
|
invert(coordinate) {
|
|
7181
7730
|
const domain = this._d3Scale.domain();
|
|
7182
|
-
const rangeMidPoints = domain
|
|
7731
|
+
const rangeMidPoints = domain
|
|
7732
|
+
.map(this._d3Scale)
|
|
7733
|
+
.slice(0, -1)
|
|
7734
|
+
.map((d) => d + this._d3Scale.step() / 2);
|
|
7183
7735
|
return domain[bisect(rangeMidPoints, coordinate)];
|
|
7184
7736
|
}
|
|
7185
7737
|
round(round) {
|
|
@@ -7225,15 +7777,23 @@ class PointScale extends Scale {
|
|
|
7225
7777
|
|
|
7226
7778
|
const intlFormat = (date, options) => new Intl.DateTimeFormat(moment.locale(), options).format(date);
|
|
7227
7779
|
const ɵ0 = intlFormat;
|
|
7228
|
-
const formatSecond = (d) => intlFormat(d, {
|
|
7780
|
+
const formatSecond = (d) => intlFormat(d, {
|
|
7781
|
+
hour: "numeric",
|
|
7782
|
+
minute: "2-digit",
|
|
7783
|
+
second: "2-digit",
|
|
7784
|
+
}), formatMinute = (d) => intlFormat(d, { hour: "numeric", minute: "2-digit" }), formatWeek = (d) => intlFormat(d, { month: "short", day: "2-digit" }), formatMonth = (d) => intlFormat(d, { month: "short" }), formatYear = (d) => intlFormat(d, { year: "numeric" });
|
|
7229
7785
|
const ɵ1 = formatSecond, ɵ2 = formatMinute, ɵ3 = formatWeek, ɵ4 = formatMonth, ɵ5 = formatYear;
|
|
7230
7786
|
/**
|
|
7231
7787
|
* Formatter for dates
|
|
7232
7788
|
*/
|
|
7233
|
-
const datetimeFormatter = (date) => (timeMinute(date) < date
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7789
|
+
const datetimeFormatter = (date) => (timeMinute(date) < date
|
|
7790
|
+
? formatSecond
|
|
7791
|
+
: timeDay(date) < date
|
|
7792
|
+
? formatMinute
|
|
7793
|
+
: timeMonth(date) < date
|
|
7794
|
+
? formatWeek
|
|
7795
|
+
: timeYear(date) < date
|
|
7796
|
+
? formatMonth
|
|
7237
7797
|
: formatYear)(date);
|
|
7238
7798
|
|
|
7239
7799
|
/**
|
|
@@ -7252,14 +7812,16 @@ class TimeScale extends Scale {
|
|
|
7252
7812
|
}
|
|
7253
7813
|
invert(coordinate) {
|
|
7254
7814
|
const date = this._d3Scale.invert(coordinate);
|
|
7255
|
-
const result = isNaN(date.getTime())
|
|
7815
|
+
const result = isNaN(date.getTime())
|
|
7816
|
+
? undefined
|
|
7817
|
+
: date;
|
|
7256
7818
|
return result;
|
|
7257
7819
|
}
|
|
7258
7820
|
isContinuous() {
|
|
7259
7821
|
return true;
|
|
7260
7822
|
}
|
|
7261
7823
|
isDomainValid() {
|
|
7262
|
-
return -1 === this.domain().findIndex((value) => isNaN(value.getTime()));
|
|
7824
|
+
return (-1 === this.domain().findIndex((value) => isNaN(value.getTime())));
|
|
7263
7825
|
}
|
|
7264
7826
|
}
|
|
7265
7827
|
|
|
@@ -7288,8 +7850,10 @@ class TimeIntervalScale extends TimeScale {
|
|
|
7288
7850
|
standardTimeOffsetMs = isTransFromDst ? 3600000 : -3600000;
|
|
7289
7851
|
}
|
|
7290
7852
|
const adjustedDate = new Date(inputDate.getTime() + standardTimeOffsetMs);
|
|
7291
|
-
const endDate = intervalDays >= 1
|
|
7292
|
-
|
|
7853
|
+
const endDate = intervalDays >= 1
|
|
7854
|
+
? moment(adjustedDate).add(intervalDays, "days").toDate()
|
|
7855
|
+
: moment(adjustedDate).add(this.interval()).toDate();
|
|
7856
|
+
return (datetimeFormatter(adjustedDate) + " - " + datetimeFormatter(endDate));
|
|
7293
7857
|
};
|
|
7294
7858
|
this.interval(interval);
|
|
7295
7859
|
this._bandScale = scaleBand();
|
|
@@ -7317,7 +7881,9 @@ class TimeIntervalScale extends TimeScale {
|
|
|
7317
7881
|
}
|
|
7318
7882
|
this._bandScale.domain(bands);
|
|
7319
7883
|
// maintain the same domain if it's empty
|
|
7320
|
-
const d = isDomainEmpty
|
|
7884
|
+
const d = isDomainEmpty
|
|
7885
|
+
? domain
|
|
7886
|
+
: [domain[0], moment(domain[1]).add(this.interval()).toDate()];
|
|
7321
7887
|
return super.domain(d);
|
|
7322
7888
|
}
|
|
7323
7889
|
return super.domain();
|
|
@@ -7363,17 +7929,22 @@ class TimeIntervalScale extends TimeScale {
|
|
|
7363
7929
|
return datetime;
|
|
7364
7930
|
}
|
|
7365
7931
|
const isDst = isDaylightSavingTime(datetime);
|
|
7366
|
-
const isDomainStartDst = isDomainChange
|
|
7932
|
+
const isDomainStartDst = isDomainChange
|
|
7933
|
+
? isDst
|
|
7934
|
+
: isDaylightSavingTime(this.domain()[0]);
|
|
7367
7935
|
const isTransFromDst = isDomainStartDst && !isDst;
|
|
7368
7936
|
const isTransToDst = !isDomainStartDst && isDst;
|
|
7369
7937
|
const intervalDays = this.interval().asDays();
|
|
7370
|
-
const transToDstAdjustment = intervalDays >= 1 && isTransToDst
|
|
7938
|
+
const transToDstAdjustment = intervalDays >= 1 && isTransToDst
|
|
7939
|
+
? duration(1, "hour").asMilliseconds()
|
|
7940
|
+
: 0;
|
|
7371
7941
|
const adjustedDt = new Date(datetime.getTime() + transToDstAdjustment);
|
|
7372
7942
|
let standardTimeOffsetMinutes = 0;
|
|
7373
7943
|
if (isTransFromDst || isTransToDst) {
|
|
7374
7944
|
standardTimeOffsetMinutes = isTransFromDst ? -60 : 60;
|
|
7375
7945
|
}
|
|
7376
|
-
const timeZoneOffsetMs = (adjustedDt.getTimezoneOffset() + standardTimeOffsetMinutes) *
|
|
7946
|
+
const timeZoneOffsetMs = (adjustedDt.getTimezoneOffset() + standardTimeOffsetMinutes) *
|
|
7947
|
+
60000;
|
|
7377
7948
|
const timestamp = adjustedDt.getTime() - timeZoneOffsetMs;
|
|
7378
7949
|
const intervalMs = interval.asMilliseconds();
|
|
7379
7950
|
const remainder = timestamp % intervalMs;
|
|
@@ -7400,7 +7971,9 @@ class TimeIntervalScale extends TimeScale {
|
|
|
7400
7971
|
// Add one hour to the "to" date if:
|
|
7401
7972
|
// 1) we're transitioning to daylight saving time and 2) the interval is >= one day.
|
|
7402
7973
|
// This ensures that the last day in the domain, which starts an hour later, is included in the generated bands.
|
|
7403
|
-
const dstAdjustment = !isDomainStartDst && isDomainEndDst
|
|
7974
|
+
const dstAdjustment = !isDomainStartDst && isDomainEndDst
|
|
7975
|
+
? duration(1, "hour").asMilliseconds()
|
|
7976
|
+
: 0;
|
|
7404
7977
|
const adjustedToDate = intervalDays >= 1 ? new Date(to.getTime() + dstAdjustment) : to;
|
|
7405
7978
|
while (bandDate <= adjustedToDate) {
|
|
7406
7979
|
bands.push(bandDate);
|
|
@@ -7461,7 +8034,8 @@ class DataSeries {
|
|
|
7461
8034
|
data: {
|
|
7462
8035
|
category: (d) => d.name,
|
|
7463
8036
|
value: (d) => d.value,
|
|
7464
|
-
},
|
|
8037
|
+
},
|
|
8038
|
+
series: {},
|
|
7465
8039
|
};
|
|
7466
8040
|
}
|
|
7467
8041
|
}
|
|
@@ -7575,11 +8149,15 @@ class RadialPopoverPlugin extends ChartPopoverPlugin {
|
|
|
7575
8149
|
if (!chartElement) {
|
|
7576
8150
|
throw new Error("Chart parent node is not defined");
|
|
7577
8151
|
}
|
|
7578
|
-
const dataPointsLeft = Math.min(...valArr.map(d => d.position.x));
|
|
7579
|
-
const dataPointsTop = Math.min(...valArr.map(d => d.position.y));
|
|
7580
|
-
const left = chartElement.offsetLeft +
|
|
7581
|
-
|
|
7582
|
-
|
|
8152
|
+
const dataPointsLeft = Math.min(...valArr.map((d) => d.position.x));
|
|
8153
|
+
const dataPointsTop = Math.min(...valArr.map((d) => d.position.y));
|
|
8154
|
+
const left = chartElement.offsetLeft +
|
|
8155
|
+
this.chart.getGrid().config().dimension.margin.left +
|
|
8156
|
+
dataPointsLeft +
|
|
8157
|
+
this.chart.getGrid().config().dimension.width() / 2;
|
|
8158
|
+
const top = chartElement.offsetTop +
|
|
8159
|
+
dataPointsTop +
|
|
8160
|
+
this.chart.getGrid().config().dimension.height() / 2;
|
|
7583
8161
|
return {
|
|
7584
8162
|
top: top,
|
|
7585
8163
|
left: left,
|
|
@@ -7605,10 +8183,10 @@ const CONNECTION_POINTS = [
|
|
|
7605
8183
|
];
|
|
7606
8184
|
/** This conversion map is used to calculate the opposite connection points for the tooltip element */
|
|
7607
8185
|
const OPPOSITE = {
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
8186
|
+
start: "end",
|
|
8187
|
+
end: "start",
|
|
8188
|
+
top: "bottom",
|
|
8189
|
+
bottom: "top",
|
|
7612
8190
|
};
|
|
7613
8191
|
/**
|
|
7614
8192
|
* This radial tooltips plugin handles special tooltip positioning requirements for donut / pie charts.
|
|
@@ -7635,8 +8213,10 @@ class RadialTooltipsPlugin extends ChartTooltipsPlugin {
|
|
|
7635
8213
|
const absolutePosition = super.getAbsolutePosition(relativePosition, chartPosition);
|
|
7636
8214
|
// radial grid is shifted so that the origin is located in the middle of the rendering area,
|
|
7637
8215
|
// so we need to add it back when we're emitting absolute positions for the tooltips
|
|
7638
|
-
absolutePosition.x +=
|
|
7639
|
-
|
|
8216
|
+
absolutePosition.x +=
|
|
8217
|
+
this.chart.getGrid().config().dimension.width() / 2;
|
|
8218
|
+
absolutePosition.y +=
|
|
8219
|
+
this.chart.getGrid().config().dimension.height() / 2;
|
|
7640
8220
|
return absolutePosition;
|
|
7641
8221
|
}
|
|
7642
8222
|
/**
|
|
@@ -7660,7 +8240,7 @@ class RadialTooltipsPlugin extends ChartTooltipsPlugin {
|
|
|
7660
8240
|
* @param {number} sections The number of sections the circle is divided into
|
|
7661
8241
|
*/
|
|
7662
8242
|
getSectionIndex(angle, sections) {
|
|
7663
|
-
let sectionIndex = Math.round(angle / (Math.PI * 2 / sections)) % sections;
|
|
8243
|
+
let sectionIndex = Math.round(angle / ((Math.PI * 2) / sections)) % sections;
|
|
7664
8244
|
while (sectionIndex < 0) {
|
|
7665
8245
|
sectionIndex += sections;
|
|
7666
8246
|
}
|
|
@@ -7686,7 +8266,10 @@ class ZoomPlugin extends ChartPlugin {
|
|
|
7686
8266
|
if (!isUndefined(this.brushStartX)) {
|
|
7687
8267
|
return;
|
|
7688
8268
|
}
|
|
7689
|
-
this.chart
|
|
8269
|
+
this.chart
|
|
8270
|
+
.getEventBus()
|
|
8271
|
+
.getStream(INTERACTION_VALUES_ACTIVE_EVENT)
|
|
8272
|
+
.next({ data: false });
|
|
7690
8273
|
this.brushStartX = xCoord;
|
|
7691
8274
|
};
|
|
7692
8275
|
this.brushMove = (xCoord) => {
|
|
@@ -7702,7 +8285,10 @@ class ZoomPlugin extends ChartPlugin {
|
|
|
7702
8285
|
}
|
|
7703
8286
|
const selection = [this.brushStartX, xCoord].sort((a, b) => a - b);
|
|
7704
8287
|
this.brushStartX = undefined;
|
|
7705
|
-
this.chart
|
|
8288
|
+
this.chart
|
|
8289
|
+
.getEventBus()
|
|
8290
|
+
.getStream(INTERACTION_VALUES_ACTIVE_EVENT)
|
|
8291
|
+
.next({ data: true });
|
|
7706
8292
|
// remove the brush
|
|
7707
8293
|
this.brush.move(this.brushElement, null);
|
|
7708
8294
|
const xScales = this.grid.scales.x.list;
|
|
@@ -7711,12 +8297,17 @@ class ZoomPlugin extends ChartPlugin {
|
|
|
7711
8297
|
}
|
|
7712
8298
|
let widthCorrection = 0;
|
|
7713
8299
|
const gridConfig = this.grid.config();
|
|
7714
|
-
if (!gridConfig.disableRenderAreaWidthCorrection &&
|
|
8300
|
+
if (!gridConfig.disableRenderAreaWidthCorrection &&
|
|
8301
|
+
selection[1] ===
|
|
8302
|
+
gridConfig.dimension.width() - Grid.RENDER_AREA_WIDTH_CORRECTION) {
|
|
7715
8303
|
// Width correction to accommodate similar adjustment in grid. This ensures that the right-most column of pixels on the chart is selectable.
|
|
7716
8304
|
widthCorrection = Grid.RENDER_AREA_WIDTH_CORRECTION;
|
|
7717
8305
|
}
|
|
7718
8306
|
const data = xScales.reduce((result, next) => {
|
|
7719
|
-
result[next.id] = [
|
|
8307
|
+
result[next.id] = [
|
|
8308
|
+
selection[0],
|
|
8309
|
+
selection[1] + widthCorrection,
|
|
8310
|
+
].map((x) => next.invert(x));
|
|
7720
8311
|
return result;
|
|
7721
8312
|
}, {});
|
|
7722
8313
|
// zoom the chart
|
|
@@ -7737,7 +8328,9 @@ class ZoomPlugin extends ChartPlugin {
|
|
|
7737
8328
|
order: STANDARD_RENDER_LAYERS[RenderLayerName.foreground].order + 1,
|
|
7738
8329
|
clipped: true,
|
|
7739
8330
|
});
|
|
7740
|
-
this.chart
|
|
8331
|
+
this.chart
|
|
8332
|
+
.getEventBus()
|
|
8333
|
+
.getStream(INTERACTION_COORDINATES_EVENT)
|
|
7741
8334
|
.pipe(takeUntil(this.destroy$))
|
|
7742
8335
|
.subscribe((chartEvent) => {
|
|
7743
8336
|
if (chartEvent.broadcast && !this.config.enableExternalEvents) {
|
|
@@ -7753,27 +8346,31 @@ class ZoomPlugin extends ChartPlugin {
|
|
|
7753
8346
|
}
|
|
7754
8347
|
});
|
|
7755
8348
|
this.brush = brushX();
|
|
7756
|
-
this.brushElement = this.zoomBrushLayer
|
|
8349
|
+
this.brushElement = this.zoomBrushLayer
|
|
8350
|
+
.append("g")
|
|
7757
8351
|
.attr("class", "brush");
|
|
7758
8352
|
// engage pointer capture to confine mouse events to the interactive area
|
|
7759
8353
|
// (in other words, if the 'mouseup' is physically triggered outside the interactive area,
|
|
7760
8354
|
// the pointer capture allows us to still zoom based on that event)
|
|
7761
|
-
this.chart
|
|
8355
|
+
this.chart
|
|
8356
|
+
.getGrid()
|
|
8357
|
+
.getInteractiveArea()
|
|
7762
8358
|
.on("pointerdown", () => event.target.setPointerCapture(event.pointerId))
|
|
7763
8359
|
.on("pointerup", () => event.target.releasePointerCapture(event.pointerId));
|
|
7764
8360
|
}
|
|
7765
8361
|
updateDimensions() {
|
|
7766
8362
|
const dimension = this.grid.config().dimension;
|
|
7767
8363
|
// set the brush area's dimensions
|
|
7768
|
-
this.brush.extent([
|
|
8364
|
+
this.brush.extent([
|
|
8365
|
+
[0, 0],
|
|
8366
|
+
[dimension.width(), dimension.height()],
|
|
8367
|
+
]);
|
|
7769
8368
|
// render the brush area after we have dimensions
|
|
7770
8369
|
this.brush(this.zoomBrushLayer.select(".brush"));
|
|
7771
8370
|
// prevent the brush from handling its own pointer events
|
|
7772
|
-
this.brushElement.select(".overlay")
|
|
7773
|
-
.style("pointer-events", "none");
|
|
8371
|
+
this.brushElement.select(".overlay").style("pointer-events", "none");
|
|
7774
8372
|
// remove stroke per mockups
|
|
7775
|
-
this.brushElement.select(".selection")
|
|
7776
|
-
.attr("stroke", null);
|
|
8373
|
+
this.brushElement.select(".selection").attr("stroke", null);
|
|
7777
8374
|
}
|
|
7778
8375
|
destroy() {
|
|
7779
8376
|
this.grid.getLasagna().removeLayer(ZoomPlugin.LAYER_NAME);
|
|
@@ -7815,7 +8412,10 @@ class SparkChartAssist {
|
|
|
7815
8412
|
* See {@link IChartAssist#update}
|
|
7816
8413
|
*/
|
|
7817
8414
|
update(inputSeriesSet) {
|
|
7818
|
-
const sparks = inputSeriesSet.map(chartSeries => ({
|
|
8415
|
+
const sparks = inputSeriesSet.map((chartSeries) => ({
|
|
8416
|
+
id: chartSeries.id,
|
|
8417
|
+
chartSeriesSet: [chartSeries],
|
|
8418
|
+
}));
|
|
7819
8419
|
this.updateSparks(sparks);
|
|
7820
8420
|
}
|
|
7821
8421
|
/**
|
|
@@ -7827,7 +8427,9 @@ class SparkChartAssist {
|
|
|
7827
8427
|
const inputSparks = cloneDeep(sparks);
|
|
7828
8428
|
this.sparks = inputSparks.map((spark, index) => {
|
|
7829
8429
|
const lastSpark = index === inputSparks.length - 1;
|
|
7830
|
-
const existingSparkIndex = spark.id
|
|
8430
|
+
const existingSparkIndex = spark.id
|
|
8431
|
+
? this.sparks.findIndex((existingSpark) => existingSpark.id === spark.id)
|
|
8432
|
+
: -1;
|
|
7831
8433
|
if (existingSparkIndex !== -1) {
|
|
7832
8434
|
spark.chart = this.reconfigureChart(this.sparks[existingSparkIndex].chart, lastSpark);
|
|
7833
8435
|
}
|
|
@@ -7872,7 +8474,7 @@ class SparkChartAssist {
|
|
|
7872
8474
|
eventBus.getStream(INTERACTION_DATA_POINTS_EVENT).subscribe((event) => {
|
|
7873
8475
|
if (event.data.interactionType === InteractionType.MouseMove) {
|
|
7874
8476
|
const dataPoints = event.data.dataPoints;
|
|
7875
|
-
Object.keys(dataPoints).forEach(seriesId => {
|
|
8477
|
+
Object.keys(dataPoints).forEach((seriesId) => {
|
|
7876
8478
|
this.highlightedDataPoints[seriesId] = Object.assign({}, dataPoints[seriesId]);
|
|
7877
8479
|
});
|
|
7878
8480
|
}
|
|
@@ -7882,7 +8484,9 @@ class SparkChartAssist {
|
|
|
7882
8484
|
});
|
|
7883
8485
|
}
|
|
7884
8486
|
reconfigureChart(chart, lastSpark) {
|
|
7885
|
-
chart
|
|
8487
|
+
chart
|
|
8488
|
+
.getGrid()
|
|
8489
|
+
.config(lastSpark ? this.lastGridConfig : this.gridConfig);
|
|
7886
8490
|
chart.updateDimensions();
|
|
7887
8491
|
const hasInteractionLabel = chart.hasPlugin(InteractionLabelPlugin);
|
|
7888
8492
|
if (lastSpark && !hasInteractionLabel && this.showBottomAxis) {
|
|
@@ -7909,11 +8513,9 @@ class NoopAccessors {
|
|
|
7909
8513
|
*/
|
|
7910
8514
|
class NoopRenderer extends Renderer {
|
|
7911
8515
|
/** See {@link Renderer#draw} */
|
|
7912
|
-
draw(renderSeries, rendererSubject) {
|
|
7913
|
-
}
|
|
8516
|
+
draw(renderSeries, rendererSubject) { }
|
|
7914
8517
|
/** See {@link Renderer#highlightDataPoint} */
|
|
7915
|
-
highlightDataPoint(renderSeries, dataPointIndex, rendererSubject) {
|
|
7916
|
-
}
|
|
8518
|
+
highlightDataPoint(renderSeries, dataPointIndex, rendererSubject) { }
|
|
7917
8519
|
/** See {@link Renderer#getRequiredLayers} */
|
|
7918
8520
|
getRequiredLayers() {
|
|
7919
8521
|
return [];
|
|
@@ -7934,7 +8536,9 @@ class NoopRenderer extends Renderer {
|
|
|
7934
8536
|
*/
|
|
7935
8537
|
function barGrid(config) {
|
|
7936
8538
|
const grid = new XYGrid();
|
|
7937
|
-
grid.config(
|
|
8539
|
+
grid.config(config && config.horizontal
|
|
8540
|
+
? new BarHorizontalGridConfig()
|
|
8541
|
+
: new BarGridConfig());
|
|
7938
8542
|
return grid;
|
|
7939
8543
|
}
|
|
7940
8544
|
|
|
@@ -7948,7 +8552,7 @@ function barGrid(config) {
|
|
|
7948
8552
|
* @returns {IBarAccessors}
|
|
7949
8553
|
*/
|
|
7950
8554
|
function barAccessors(config, colorProvider, markerProvider) {
|
|
7951
|
-
return
|
|
8555
|
+
return config && config.horizontal
|
|
7952
8556
|
? new HorizontalBarAccessors(colorProvider, markerProvider)
|
|
7953
8557
|
: new VerticalBarAccessors(colorProvider, markerProvider);
|
|
7954
8558
|
}
|
|
@@ -7997,42 +8601,58 @@ class BarHighlightStrategy {
|
|
|
7997
8601
|
else if (value.valueOf) {
|
|
7998
8602
|
const valueOf = value.valueOf();
|
|
7999
8603
|
if (scales && ((_a = scales[scaleKey]) === null || _a === void 0 ? void 0 : _a.isContinuous())) {
|
|
8000
|
-
let index = findIndex(series.data, (d, i) => valueOf >=
|
|
8001
|
-
|
|
8604
|
+
let index = findIndex(series.data, (d, i) => valueOf >=
|
|
8605
|
+
(startAccessor === null || startAccessor === void 0 ? void 0 : startAccessor(d, i, series.data, series).valueOf()) &&
|
|
8606
|
+
valueOf <=
|
|
8607
|
+
(endAccessor === null || endAccessor === void 0 ? void 0 : endAccessor(d, i, series.data, series).valueOf()));
|
|
8002
8608
|
if (index === -1 && typeof endAccessor !== "undefined") {
|
|
8003
8609
|
if (isBandScale(scales[scaleKey])) {
|
|
8004
8610
|
const accessor = (d, i) => startAccessor === null || startAccessor === void 0 ? void 0 : startAccessor(d, i, series.data, series);
|
|
8005
8611
|
const nearestIndex = UtilityService.findNearestIndex(series.data, value, accessor);
|
|
8006
|
-
index =
|
|
8612
|
+
index =
|
|
8613
|
+
nearestIndex >= series.data.length ||
|
|
8614
|
+
accessor(series.data[nearestIndex], nearestIndex) >
|
|
8615
|
+
valueOf
|
|
8616
|
+
? -1
|
|
8617
|
+
: nearestIndex;
|
|
8007
8618
|
}
|
|
8008
8619
|
else {
|
|
8009
8620
|
// @ts-ignore
|
|
8010
8621
|
// Needs to catch -1 otherwise typescript errors
|
|
8011
|
-
index =
|
|
8622
|
+
index =
|
|
8623
|
+
(_b = UtilityService.getClosestIndex(series.data, (d, i) => endAccessor(d, i, series.data, series), value)) !== null && _b !== void 0 ? _b : -1;
|
|
8012
8624
|
}
|
|
8013
8625
|
}
|
|
8014
8626
|
return index;
|
|
8015
8627
|
}
|
|
8016
|
-
return findIndex(series.data, (d, i) => valueOf >=
|
|
8017
|
-
|
|
8628
|
+
return findIndex(series.data, (d, i) => valueOf >=
|
|
8629
|
+
(startAccessor === null || startAccessor === void 0 ? void 0 : startAccessor(d, i, series.data, series).valueOf()) &&
|
|
8630
|
+
valueOf <=
|
|
8631
|
+
(endAccessor === null || endAccessor === void 0 ? void 0 : endAccessor(d, i, series.data, series).valueOf()));
|
|
8018
8632
|
}
|
|
8019
8633
|
return DATA_POINT_INTERACTION_RESET;
|
|
8020
8634
|
}
|
|
8021
8635
|
highlightDataPoint(renderer, renderSeries, dataPointIndex, rendererSubject) {
|
|
8022
8636
|
const target = renderSeries.containers[RenderLayerName.data];
|
|
8023
8637
|
const barStylesFn = renderer.getContainerStateStyles;
|
|
8024
|
-
const selectedDataPointIdx = !isUndefined(this.selectedDataPointIdxFn)
|
|
8025
|
-
|
|
8638
|
+
const selectedDataPointIdx = !isUndefined(this.selectedDataPointIdxFn)
|
|
8639
|
+
? this.selectedDataPointIdxFn(renderSeries.dataSeries.id)
|
|
8640
|
+
: DATA_POINT_NOT_FOUND;
|
|
8641
|
+
target
|
|
8642
|
+
.selectAll(`g.${renderer.barContainerClass}`)
|
|
8643
|
+
.each(function (d, index) {
|
|
8026
8644
|
let renderState;
|
|
8027
8645
|
if (dataPointIndex === DATA_POINT_INTERACTION_RESET) {
|
|
8028
|
-
if (index === selectedDataPointIdx ||
|
|
8646
|
+
if (index === selectedDataPointIdx ||
|
|
8647
|
+
selectedDataPointIdx === DATA_POINT_NOT_FOUND) {
|
|
8029
8648
|
renderState = RenderState.default;
|
|
8030
8649
|
}
|
|
8031
8650
|
else {
|
|
8032
8651
|
renderState = RenderState.deemphasized;
|
|
8033
8652
|
}
|
|
8034
8653
|
}
|
|
8035
|
-
else if (dataPointIndex === index ||
|
|
8654
|
+
else if (dataPointIndex === index ||
|
|
8655
|
+
index === selectedDataPointIdx) {
|
|
8036
8656
|
renderState = RenderState.emphasized;
|
|
8037
8657
|
}
|
|
8038
8658
|
else {
|
|
@@ -8045,8 +8665,7 @@ class BarHighlightStrategy {
|
|
|
8045
8665
|
// data: renderer.getDataPoint(renderSeries, renderSeries.dataSeries.data[dataPointIndex], dataPointIndex),
|
|
8046
8666
|
// });
|
|
8047
8667
|
}
|
|
8048
|
-
draw(renderer, renderSeries, rendererSubject) {
|
|
8049
|
-
}
|
|
8668
|
+
draw(renderer, renderSeries, rendererSubject) { }
|
|
8050
8669
|
}
|
|
8051
8670
|
|
|
8052
8671
|
class BarSeriesHighlightStrategy {
|
|
@@ -8090,21 +8709,23 @@ class BarSeriesHighlightStrategy {
|
|
|
8090
8709
|
}
|
|
8091
8710
|
else if (value.valueOf) {
|
|
8092
8711
|
const valueOf = value.valueOf();
|
|
8093
|
-
return findIndex(series.data, (d, i) => valueOf >=
|
|
8094
|
-
|
|
8712
|
+
return findIndex(series.data, (d, i) => valueOf >=
|
|
8713
|
+
(startAccessor === null || startAccessor === void 0 ? void 0 : startAccessor(d, i, series.data, series).valueOf()) &&
|
|
8714
|
+
valueOf <=
|
|
8715
|
+
(endAccessor === null || endAccessor === void 0 ? void 0 : endAccessor(d, i, series.data, series).valueOf()));
|
|
8095
8716
|
}
|
|
8096
8717
|
return DATA_POINT_INTERACTION_RESET;
|
|
8097
8718
|
}
|
|
8098
8719
|
highlightDataPoint(renderer, renderSeries, dataPointIndex, rendererSubject) {
|
|
8099
|
-
if (dataPointIndex >= 0 ||
|
|
8720
|
+
if (dataPointIndex >= 0 ||
|
|
8721
|
+
dataPointIndex === DATA_POINT_INTERACTION_RESET) {
|
|
8100
8722
|
rendererSubject.next({
|
|
8101
8723
|
eventName: HIGHLIGHT_SERIES_EVENT,
|
|
8102
8724
|
data: renderer.getDataPoint(renderSeries, renderSeries.dataSeries.data[dataPointIndex], dataPointIndex),
|
|
8103
8725
|
});
|
|
8104
8726
|
}
|
|
8105
8727
|
}
|
|
8106
|
-
draw(renderer, renderSeries, rendererSubject) {
|
|
8107
|
-
}
|
|
8728
|
+
draw(renderer, renderSeries, rendererSubject) { }
|
|
8108
8729
|
}
|
|
8109
8730
|
|
|
8110
8731
|
/**
|
|
@@ -8112,8 +8733,7 @@ class BarSeriesHighlightStrategy {
|
|
|
8112
8733
|
*/
|
|
8113
8734
|
class PieRenderer extends RadialRenderer {
|
|
8114
8735
|
getArc(range, arc, index) {
|
|
8115
|
-
return arc.outerRadius(range[1] - range[0])
|
|
8116
|
-
.innerRadius(0);
|
|
8736
|
+
return arc.outerRadius(range[1] - range[0]).innerRadius(0);
|
|
8117
8737
|
}
|
|
8118
8738
|
}
|
|
8119
8739
|
|
|
@@ -8174,13 +8794,15 @@ class LineSelectSeriesInteractionStrategy {
|
|
|
8174
8794
|
throw new Error("renderer.config.strokeWidth is not defined");
|
|
8175
8795
|
}
|
|
8176
8796
|
if (interactionPath.empty()) {
|
|
8177
|
-
interactionPath = target
|
|
8797
|
+
interactionPath = target
|
|
8798
|
+
.append("path")
|
|
8178
8799
|
.classed("interaction", true)
|
|
8179
8800
|
.classed(`pointer-events pointer-events-click`, true)
|
|
8180
8801
|
.attrs({
|
|
8181
|
-
"stroke-width": renderer.config.strokeWidth +
|
|
8182
|
-
|
|
8183
|
-
|
|
8802
|
+
"stroke-width": renderer.config.strokeWidth +
|
|
8803
|
+
2 * this.INTERACTION_MARGIN,
|
|
8804
|
+
stroke: "transparent",
|
|
8805
|
+
fill: "none",
|
|
8184
8806
|
})
|
|
8185
8807
|
.on("mouseenter", () => {
|
|
8186
8808
|
const dataPoint = {
|
|
@@ -8190,7 +8812,10 @@ class LineSelectSeriesInteractionStrategy {
|
|
|
8190
8812
|
index: 0,
|
|
8191
8813
|
data: renderSeries.dataSeries.data[0],
|
|
8192
8814
|
};
|
|
8193
|
-
rendererSubject.next({
|
|
8815
|
+
rendererSubject.next({
|
|
8816
|
+
eventName: HIGHLIGHT_SERIES_EVENT,
|
|
8817
|
+
data: dataPoint,
|
|
8818
|
+
});
|
|
8194
8819
|
})
|
|
8195
8820
|
.on("mouseleave", () => {
|
|
8196
8821
|
const dataPoint = {
|
|
@@ -8198,7 +8823,10 @@ class LineSelectSeriesInteractionStrategy {
|
|
|
8198
8823
|
dataSeries: renderSeries.dataSeries,
|
|
8199
8824
|
index: DATA_POINT_NOT_FOUND,
|
|
8200
8825
|
};
|
|
8201
|
-
rendererSubject.next({
|
|
8826
|
+
rendererSubject.next({
|
|
8827
|
+
eventName: HIGHLIGHT_SERIES_EVENT,
|
|
8828
|
+
data: dataPoint,
|
|
8829
|
+
});
|
|
8202
8830
|
})
|
|
8203
8831
|
.on("click", (d, i) => {
|
|
8204
8832
|
this.emitEvent(renderer, INTERACTION_SERIES_EVENT, InteractionType.Click, renderSeries, d, i, rendererSubject);
|
|
@@ -8211,8 +8839,7 @@ class LineSelectSeriesInteractionStrategy {
|
|
|
8211
8839
|
// @ts-ignore
|
|
8212
8840
|
return;
|
|
8213
8841
|
}
|
|
8214
|
-
highlightDataPoint(renderer, renderSeries, dataPointIndex, rendererSubject) {
|
|
8215
|
-
}
|
|
8842
|
+
highlightDataPoint(renderer, renderSeries, dataPointIndex, rendererSubject) { }
|
|
8216
8843
|
emitEvent(renderer, eventName, interactionType, renderSeries, data, i, rendererSubject) {
|
|
8217
8844
|
const dataPoint = {
|
|
8218
8845
|
seriesId: renderSeries.dataSeries.id,
|
|
@@ -8282,10 +8909,11 @@ class AreaRenderer extends XYRenderer {
|
|
|
8282
8909
|
if (!this.config.areaClass) {
|
|
8283
8910
|
throw new Error("areaClass is not defined");
|
|
8284
8911
|
}
|
|
8285
|
-
path = target
|
|
8912
|
+
path = target
|
|
8913
|
+
.append("path")
|
|
8286
8914
|
.classed(this.config.areaClass, true)
|
|
8287
8915
|
.attrs({
|
|
8288
|
-
|
|
8916
|
+
fill: (_b = (_a = accessors.series).color) === null || _b === void 0 ? void 0 : _b.call(_a, renderSeries.dataSeries.id, renderSeries.dataSeries),
|
|
8289
8917
|
})
|
|
8290
8918
|
.style("stroke-width", (_c = this.config.strokeWidth) !== null && _c !== void 0 ? _c : 1);
|
|
8291
8919
|
}
|
|
@@ -8322,10 +8950,22 @@ class AreaRenderer extends XYRenderer {
|
|
|
8322
8950
|
throw new Error("curveType is not defined");
|
|
8323
8951
|
}
|
|
8324
8952
|
const areaFunc = area()
|
|
8325
|
-
.x0((d, i) => {
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8953
|
+
.x0((d, i) => {
|
|
8954
|
+
var _a, _b;
|
|
8955
|
+
return this.safetyCheck(renderSeries.scales.x.convert((_b = (_a = accessors.data).absoluteX0) === null || _b === void 0 ? void 0 : _b.call(_a, d, i, dataSeries.data, dataSeries)));
|
|
8956
|
+
})
|
|
8957
|
+
.x1((d, i) => {
|
|
8958
|
+
var _a, _b;
|
|
8959
|
+
return this.safetyCheck(renderSeries.scales.x.convert((_b = (_a = accessors.data).absoluteX1) === null || _b === void 0 ? void 0 : _b.call(_a, d, i, dataSeries.data, dataSeries)));
|
|
8960
|
+
})
|
|
8961
|
+
.y0((d, i) => {
|
|
8962
|
+
var _a, _b;
|
|
8963
|
+
return this.safetyCheck(renderSeries.scales.y.convert((_b = (_a = accessors.data).absoluteY0) === null || _b === void 0 ? void 0 : _b.call(_a, d, i, dataSeries.data, dataSeries)));
|
|
8964
|
+
})
|
|
8965
|
+
.y1((d, i) => {
|
|
8966
|
+
var _a, _b;
|
|
8967
|
+
return this.safetyCheck(renderSeries.scales.y.convert((_b = (_a = accessors.data).absoluteY1) === null || _b === void 0 ? void 0 : _b.call(_a, d, i, dataSeries.data, dataSeries)));
|
|
8968
|
+
})
|
|
8329
8969
|
.curve(this.config.curveType);
|
|
8330
8970
|
path.attr("d", (_a = areaFunc(validatedData)) !== null && _a !== void 0 ? _a : "");
|
|
8331
8971
|
}
|
|
@@ -8340,8 +8980,14 @@ class AreaRenderer extends XYRenderer {
|
|
|
8340
8980
|
const accessor0 = dataAccessors[`absolute${scaleName.toUpperCase()}0`];
|
|
8341
8981
|
const accessor1 = dataAccessors[`absolute${scaleName.toUpperCase()}1`];
|
|
8342
8982
|
return [
|
|
8343
|
-
min(data, (datum, index, arr) => min([
|
|
8344
|
-
|
|
8983
|
+
min(data, (datum, index, arr) => min([
|
|
8984
|
+
accessor0 === null || accessor0 === void 0 ? void 0 : accessor0(datum, index, arr, dataSeries),
|
|
8985
|
+
accessor1 === null || accessor1 === void 0 ? void 0 : accessor1(datum, index, arr, dataSeries),
|
|
8986
|
+
])),
|
|
8987
|
+
max(data, (datum, index, arr) => max([
|
|
8988
|
+
accessor0 === null || accessor0 === void 0 ? void 0 : accessor0(datum, index, arr, dataSeries),
|
|
8989
|
+
accessor1 === null || accessor1 === void 0 ? void 0 : accessor1(datum, index, arr, dataSeries),
|
|
8990
|
+
])),
|
|
8345
8991
|
];
|
|
8346
8992
|
}
|
|
8347
8993
|
/** See {@link Renderer#getRequiredLayers} */
|
|
@@ -8365,7 +9011,8 @@ class AreaRenderer extends XYRenderer {
|
|
|
8365
9011
|
return data.filter((d, i) => {
|
|
8366
9012
|
const value0 = accessor0 === null || accessor0 === void 0 ? void 0 : accessor0(d, i, data, dataSeries);
|
|
8367
9013
|
const value1 = accessor1 === null || accessor1 === void 0 ? void 0 : accessor1(d, i, data, dataSeries);
|
|
8368
|
-
return Math.max(value0, value1) >= domain[0] &&
|
|
9014
|
+
return (Math.max(value0, value1) >= domain[0] &&
|
|
9015
|
+
Math.min(value0, value1) <= domain[1]);
|
|
8369
9016
|
});
|
|
8370
9017
|
}
|
|
8371
9018
|
highlightDataPoint(renderSeries, dataPointIndex, rendererSubject) {
|
|
@@ -8411,7 +9058,10 @@ function stackedAreaPreprocessor(chartSeriesSet, isVisible) {
|
|
|
8411
9058
|
}
|
|
8412
9059
|
const end = start + diff;
|
|
8413
9060
|
domainValueStacks[base.valueOf()] = end;
|
|
8414
|
-
datum["__stack_" + valueAccessorKey] = {
|
|
9061
|
+
datum["__stack_" + valueAccessorKey] = {
|
|
9062
|
+
start,
|
|
9063
|
+
end,
|
|
9064
|
+
};
|
|
8415
9065
|
});
|
|
8416
9066
|
}
|
|
8417
9067
|
return chartSeriesSet;
|