@acorex/charts 21.0.2-next.32 → 21.0.2-next.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/acorex-charts-bar-chart.mjs +17 -17
- package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-chart-legend.mjs +13 -13
- package/fesm2022/acorex-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/acorex-charts-chart-tooltip.mjs +11 -11
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-charts-donut-chart.mjs +22 -21
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-funnel-chart.mjs +14 -16
- package/fesm2022/acorex-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-gauge-chart.mjs +14 -14
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-heatmap-chart.mjs +33 -18
- package/fesm2022/acorex-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +35 -29
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-line-chart.mjs +57 -34
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts.mjs +4 -4
- package/fesm2022/acorex-charts.mjs.map +1 -1
- package/package.json +13 -12
- package/{bar-chart/index.d.ts → types/acorex-charts-bar-chart.d.ts} +2 -1
- package/{donut-chart/index.d.ts → types/acorex-charts-donut-chart.d.ts} +2 -1
- package/{funnel-chart/index.d.ts → types/acorex-charts-funnel-chart.d.ts} +2 -1
- package/{gauge-chart/index.d.ts → types/acorex-charts-gauge-chart.d.ts} +2 -1
- package/{heatmap-chart/index.d.ts → types/acorex-charts-heatmap-chart.d.ts} +16 -1
- package/{hierarchy-chart/index.d.ts → types/acorex-charts-hierarchy-chart.d.ts} +8 -4
- package/{line-chart/index.d.ts → types/acorex-charts-line-chart.d.ts} +3 -1
- /package/{chart-legend/index.d.ts → types/acorex-charts-chart-legend.d.ts} +0 -0
- /package/{chart-tooltip/index.d.ts → types/acorex-charts-chart-tooltip.d.ts} +0 -0
- /package/{index.d.ts → types/acorex-charts.d.ts} +0 -0
|
@@ -51,8 +51,8 @@ function lineChartConfig(config = {}) {
|
|
|
51
51
|
* Line Chart Component for rendering data as lines with interactive hover effects and animations
|
|
52
52
|
*/
|
|
53
53
|
class AXLineChartComponent extends AXChartComponent {
|
|
54
|
-
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
55
|
-
options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
54
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
55
|
+
options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
56
56
|
pointClick = output();
|
|
57
57
|
chartContainerEl = viewChild.required('chartContainer');
|
|
58
58
|
d3;
|
|
@@ -65,18 +65,18 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
65
65
|
width;
|
|
66
66
|
height;
|
|
67
67
|
margin = { top: 20, right: 25, bottom: 40, left: 50 };
|
|
68
|
-
_tooltipVisible = signal(false, ...(ngDevMode ? [{ debugName: "_tooltipVisible" }] : []));
|
|
69
|
-
_tooltipPosition = signal({ x: 0, y: 0 }, ...(ngDevMode ? [{ debugName: "_tooltipPosition" }] : []));
|
|
68
|
+
_tooltipVisible = signal(false, ...(ngDevMode ? [{ debugName: "_tooltipVisible" }] : /* istanbul ignore next */ []));
|
|
69
|
+
_tooltipPosition = signal({ x: 0, y: 0 }, ...(ngDevMode ? [{ debugName: "_tooltipPosition" }] : /* istanbul ignore next */ []));
|
|
70
70
|
_tooltipData = signal({
|
|
71
71
|
title: '',
|
|
72
72
|
value: '0',
|
|
73
73
|
percentage: '0%',
|
|
74
74
|
color: '',
|
|
75
|
-
}, ...(ngDevMode ? [{ debugName: "_tooltipData" }] : []));
|
|
75
|
+
}, ...(ngDevMode ? [{ debugName: "_tooltipData" }] : /* istanbul ignore next */ []));
|
|
76
76
|
_tooltipRafId = null;
|
|
77
77
|
_pendingTooltipCoords = null;
|
|
78
|
-
_initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : []));
|
|
79
|
-
_rendered = signal(false, ...(ngDevMode ? [{ debugName: "_rendered" }] : []));
|
|
78
|
+
_initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : /* istanbul ignore next */ []));
|
|
79
|
+
_rendered = signal(false, ...(ngDevMode ? [{ debugName: "_rendered" }] : /* istanbul ignore next */ []));
|
|
80
80
|
hiddenSeries = new Set();
|
|
81
81
|
_fullNormalizedData = [];
|
|
82
82
|
tooltipVisible = this._tooltipVisible.asReadonly();
|
|
@@ -91,7 +91,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
91
91
|
...this.configToken,
|
|
92
92
|
...this.options(),
|
|
93
93
|
};
|
|
94
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
|
|
94
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : /* istanbul ignore next */ []));
|
|
95
95
|
// Messages with defaults
|
|
96
96
|
effectiveMessages = computed(() => {
|
|
97
97
|
const defaultMessages = {
|
|
@@ -106,7 +106,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
106
106
|
...defaultMessages,
|
|
107
107
|
...this.effectiveOptions().messages,
|
|
108
108
|
};
|
|
109
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : []));
|
|
109
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : /* istanbul ignore next */ []));
|
|
110
110
|
// Layout & Dimensions
|
|
111
111
|
MIN_DIMENSION = 100;
|
|
112
112
|
MIN_CONTAINER_DIMENSION = 200;
|
|
@@ -230,7 +230,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
230
230
|
if (this._rendered()) {
|
|
231
231
|
this.updateChart();
|
|
232
232
|
}
|
|
233
|
-
}, ...(ngDevMode ? [{ debugName: "#effect" }] : []));
|
|
233
|
+
}, ...(ngDevMode ? [{ debugName: "#effect" }] : /* istanbul ignore next */ []));
|
|
234
234
|
ngAfterViewInit() {
|
|
235
235
|
this._initialized.set(true);
|
|
236
236
|
if (this.d3 && this.chartContainerEl()) {
|
|
@@ -359,7 +359,10 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
359
359
|
}
|
|
360
360
|
this._pendingTooltipCoords = null;
|
|
361
361
|
if (this.svg) {
|
|
362
|
-
this.d3
|
|
362
|
+
this.d3
|
|
363
|
+
?.select(this.chartContainerEl()?.nativeElement)
|
|
364
|
+
.selectAll('svg, .ax-line-chart-no-data-message, .ax-line-chart-all-hidden-message')
|
|
365
|
+
.remove();
|
|
363
366
|
this.svg = null;
|
|
364
367
|
this.chart = null;
|
|
365
368
|
}
|
|
@@ -472,10 +475,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
472
475
|
const xMax = this.d3.max(allDataPoints, (d) => d.x) ?? 0;
|
|
473
476
|
if (xMax === 0) {
|
|
474
477
|
// If all values are 0, show -1 to 1 range
|
|
475
|
-
this.xScale = this.d3
|
|
476
|
-
.scaleLinear()
|
|
477
|
-
.domain([-1, 1])
|
|
478
|
-
.range([0, this.width]);
|
|
478
|
+
this.xScale = this.d3.scaleLinear().domain([-1, 1]).range([0, this.width]);
|
|
479
479
|
}
|
|
480
480
|
else {
|
|
481
481
|
// Always start X axis from 0 for numeric data
|
|
@@ -483,9 +483,18 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
else {
|
|
486
|
+
const xDomain = [];
|
|
487
|
+
const seenX = new Set();
|
|
488
|
+
for (const point of allDataPoints) {
|
|
489
|
+
const key = String(point.x);
|
|
490
|
+
if (!seenX.has(key)) {
|
|
491
|
+
seenX.add(key);
|
|
492
|
+
xDomain.push(key);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
486
495
|
this.xScale = this.d3
|
|
487
496
|
.scaleBand()
|
|
488
|
-
.domain(
|
|
497
|
+
.domain(xDomain)
|
|
489
498
|
.range([0, this.width])
|
|
490
499
|
.paddingInner(0.2)
|
|
491
500
|
.paddingOuter(0);
|
|
@@ -901,23 +910,23 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
901
910
|
else {
|
|
902
911
|
this.handlePointHover(event, d, series, series.originalIndex);
|
|
903
912
|
}
|
|
913
|
+
const pointRadius = this.effectiveOptions().pointRadius ?? this.DEFAULT_POINT_RADIUS;
|
|
904
914
|
this.d3
|
|
905
915
|
.select(event.target)
|
|
906
|
-
.
|
|
907
|
-
.
|
|
908
|
-
.attr('
|
|
909
|
-
.attr('stroke-width', 2)
|
|
916
|
+
.interrupt()
|
|
917
|
+
.attr('r', pointRadius * this.POINT_HIGHLIGHT_MULTIPLIER)
|
|
918
|
+
.attr('stroke-width', this.POINT_HOVER_STROKE_WIDTH)
|
|
910
919
|
.attr('stroke', `rgb(var(--ax-comp-line-chart-bg-color))`);
|
|
911
920
|
})
|
|
912
921
|
.on('mousemove', (event) => this.updateTooltipPosition(event))
|
|
913
922
|
.on('mouseleave', (event) => {
|
|
914
923
|
this._tooltipVisible.set(false);
|
|
924
|
+
const pointRadius = this.effectiveOptions().pointRadius ?? this.DEFAULT_POINT_RADIUS;
|
|
915
925
|
this.d3
|
|
916
926
|
.select(event.target)
|
|
917
|
-
.
|
|
918
|
-
.
|
|
919
|
-
.attr('
|
|
920
|
-
.attr('stroke-width', 1)
|
|
927
|
+
.interrupt()
|
|
928
|
+
.attr('r', pointRadius)
|
|
929
|
+
.attr('stroke-width', this.POINT_STROKE_WIDTH)
|
|
921
930
|
.attr('stroke', '#fff');
|
|
922
931
|
})
|
|
923
932
|
.on('click', (event, d) => {
|
|
@@ -1055,19 +1064,33 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
1055
1064
|
this._pendingTooltipCoords = { x: event.clientX, y: event.clientY };
|
|
1056
1065
|
if (this._tooltipRafId != null)
|
|
1057
1066
|
return;
|
|
1067
|
+
this.scheduleTooltipPosition(0);
|
|
1068
|
+
}
|
|
1069
|
+
scheduleTooltipPosition(attempt) {
|
|
1058
1070
|
this._tooltipRafId = requestAnimationFrame(() => {
|
|
1059
|
-
this._tooltipRafId = null;
|
|
1060
1071
|
const coords = this._pendingTooltipCoords;
|
|
1061
|
-
if (!coords)
|
|
1072
|
+
if (!coords) {
|
|
1073
|
+
this._tooltipRafId = null;
|
|
1062
1074
|
return;
|
|
1075
|
+
}
|
|
1063
1076
|
const containerEl = this.chartContainerEl()?.nativeElement;
|
|
1064
|
-
if (!containerEl)
|
|
1077
|
+
if (!containerEl) {
|
|
1078
|
+
this._tooltipRafId = null;
|
|
1065
1079
|
return;
|
|
1066
|
-
|
|
1080
|
+
}
|
|
1067
1081
|
const tooltipEl = containerEl.querySelector('.chart-tooltip');
|
|
1082
|
+
if (!tooltipEl && this._tooltipVisible() && attempt < 3) {
|
|
1083
|
+
this.scheduleTooltipPosition(attempt + 1);
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
this._tooltipRafId = null;
|
|
1087
|
+
const rect = containerEl.getBoundingClientRect();
|
|
1068
1088
|
const tooltipRect = tooltipEl ? tooltipEl.getBoundingClientRect() : null;
|
|
1069
1089
|
const pos = computeTooltipPosition(rect, tooltipRect, coords.x, coords.y, this.TOOLTIP_GAP);
|
|
1070
|
-
this._tooltipPosition
|
|
1090
|
+
const prev = this._tooltipPosition();
|
|
1091
|
+
if (prev.x !== pos.x || prev.y !== pos.y) {
|
|
1092
|
+
this._tooltipPosition.set(pos);
|
|
1093
|
+
}
|
|
1071
1094
|
});
|
|
1072
1095
|
}
|
|
1073
1096
|
// computeTooltipPosition moved to shared chart utils
|
|
@@ -1164,13 +1187,13 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
1164
1187
|
this.showCrosshairLines(overlappingPoints[0].point);
|
|
1165
1188
|
}
|
|
1166
1189
|
}
|
|
1167
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1168
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
1190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXLineChartComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1191
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: AXLineChartComponent, isStandalone: true, selector: "ax-line-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointClick: "pointClick" }, viewQueries: [{ propertyName: "chartContainerEl", first: true, predicate: ["chartContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-line-chart\" #chartContainer>\n <!-- Shared tooltip component -->\n <ax-chart-tooltip\n [visible]=\"tooltipVisible()\"\n [position]=\"tooltipPosition()\"\n [data]=\"tooltipData()\"\n [showPercentage]=\"false\"\n ></ax-chart-tooltip>\n</div>\n", styles: ["ax-line-chart{display:block;width:100%;height:100%;min-height:0;box-sizing:border-box;--ax-comp-line-chart-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-axis-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-grid-lines-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-bg-color: 0, 0, 0, 0;--ax-comp-line-chart-text-color: var(--ax-sys-color-on-lightest-surface)}ax-line-chart .ax-line-chart{width:100%;height:100%;position:relative;box-sizing:border-box;padding:clamp(.5rem,1.2vw,.875rem);border-radius:.5rem;overflow:hidden;contain:layout style;color:rgba(var(--ax-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}ax-line-chart .ax-line-chart svg{display:block;width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden;flex-shrink:0}ax-line-chart .ax-line-chart svg g:has(text){font-family:inherit}ax-line-chart .ax-line-chart-no-data-message{text-align:center;background-color:rgb(var(--ax-comp-line-chart-bg-color));padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-icon{opacity:.6;margin-bottom:.75rem}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-text{font-size:1rem;font-weight:600;margin-bottom:.5rem}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-help{font-size:.8rem;opacity:.6}\n"], dependencies: [{ kind: "component", type: AXChartTooltipComponent, selector: "ax-chart-tooltip", inputs: ["data", "position", "visible", "showPercentage", "style"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1169
1192
|
}
|
|
1170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXLineChartComponent, decorators: [{
|
|
1171
1194
|
type: Component,
|
|
1172
|
-
args: [{ selector: 'ax-line-chart', encapsulation: ViewEncapsulation.None, imports: [AXChartTooltipComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ax-line-chart\" #chartContainer>\n <!-- Shared tooltip component -->\n <ax-chart-tooltip\n [visible]=\"tooltipVisible()\"\n [position]=\"tooltipPosition()\"\n [data]=\"tooltipData()\"\n [showPercentage]=\"false\"\n ></ax-chart-tooltip>\n</div>\n", styles: ["ax-line-chart{display:block;width:100%;height:100%;min-height:0;box-sizing:border-box;--ax-comp-line-chart-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-axis-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-grid-lines-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-bg-color: 0, 0, 0, 0;--ax-comp-line-chart-text-color: var(--ax-sys-color-on-lightest-surface)}ax-line-chart .ax-line-chart{width:100%;height:100%;position:relative;box-sizing:border-box;padding:clamp(.5rem,1.2vw,.875rem);border-radius:.5rem;overflow:hidden;color:rgba(var(--ax-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}ax-line-chart .ax-line-chart svg{display:block;width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden}ax-line-chart .ax-line-chart svg g:has(text){font-family:inherit}ax-line-chart .ax-line-chart-no-data-message{text-align:center;background-color:rgb(var(--ax-comp-line-chart-bg-color));padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-icon{opacity:.6;margin-bottom:.75rem}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-text{font-size:1rem;font-weight:600;margin-bottom:.5rem}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-help{font-size:.8rem;opacity:.6}\n"] }]
|
|
1173
|
-
}] });
|
|
1195
|
+
args: [{ selector: 'ax-line-chart', encapsulation: ViewEncapsulation.None, imports: [AXChartTooltipComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ax-line-chart\" #chartContainer>\n <!-- Shared tooltip component -->\n <ax-chart-tooltip\n [visible]=\"tooltipVisible()\"\n [position]=\"tooltipPosition()\"\n [data]=\"tooltipData()\"\n [showPercentage]=\"false\"\n ></ax-chart-tooltip>\n</div>\n", styles: ["ax-line-chart{display:block;width:100%;height:100%;min-height:0;box-sizing:border-box;--ax-comp-line-chart-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-axis-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-grid-lines-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-line-chart-bg-color: 0, 0, 0, 0;--ax-comp-line-chart-text-color: var(--ax-sys-color-on-lightest-surface)}ax-line-chart .ax-line-chart{width:100%;height:100%;position:relative;box-sizing:border-box;padding:clamp(.5rem,1.2vw,.875rem);border-radius:.5rem;overflow:hidden;contain:layout style;color:rgba(var(--ax-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}ax-line-chart .ax-line-chart svg{display:block;width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden;flex-shrink:0}ax-line-chart .ax-line-chart svg g:has(text){font-family:inherit}ax-line-chart .ax-line-chart-no-data-message{text-align:center;background-color:rgb(var(--ax-comp-line-chart-bg-color));padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-icon{opacity:.6;margin-bottom:.75rem}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-text{font-size:1rem;font-weight:600;margin-bottom:.5rem}ax-line-chart .ax-line-chart-no-data-message .ax-line-chart-no-data-help{font-size:.8rem;opacity:.6}\n"] }]
|
|
1196
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], pointClick: [{ type: i0.Output, args: ["pointClick"] }], chartContainerEl: [{ type: i0.ViewChild, args: ['chartContainer', { isSignal: true }] }] } });
|
|
1174
1197
|
|
|
1175
1198
|
/**
|
|
1176
1199
|
* Generated bundle index. Do not edit.
|