@acorex/charts 20.7.31 → 20.7.32
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-chart-tooltip.mjs +2 -2
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-charts-donut-chart.mjs +6 -5
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-funnel-chart.mjs +2 -2
- package/fesm2022/acorex-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-gauge-chart.mjs +2 -2
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-heatmap-chart.mjs +22 -7
- package/fesm2022/acorex-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +17 -11
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-line-chart.mjs +43 -17
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -1
- package/heatmap-chart/index.d.ts +14 -0
- package/hierarchy-chart/index.d.ts +5 -2
- package/line-chart/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -63,6 +63,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
63
63
|
_dimensions = signal({ width: 0, height: 0 }, ...(ngDevMode ? [{ debugName: "_dimensions" }] : []));
|
|
64
64
|
_nodeElements = signal(new Map(), ...(ngDevMode ? [{ debugName: "_nodeElements" }] : [])); // Store references to node elements
|
|
65
65
|
_chartData = signal(null, ...(ngDevMode ? [{ debugName: "_chartData" }] : [])); // Store the current chart data and layout
|
|
66
|
+
embeddedViews = [];
|
|
66
67
|
// Inputs
|
|
67
68
|
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
68
69
|
options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
@@ -259,14 +260,14 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
259
260
|
maxY = Math.max(maxY, y);
|
|
260
261
|
});
|
|
261
262
|
// Calculate the center of the tree
|
|
262
|
-
const centerX = (minX + maxX) / 2;
|
|
263
|
-
const centerY = (minY + maxY) / 2;
|
|
263
|
+
const centerX = Number.isFinite(minX) && Number.isFinite(maxX) ? (minX + maxX) / 2 : 0;
|
|
264
|
+
const centerY = Number.isFinite(minY) && Number.isFinite(maxY) ? (minY + maxY) / 2 : 0;
|
|
264
265
|
// Create a group for the chart content with proper centering
|
|
265
266
|
const g = svg
|
|
266
267
|
.append('g')
|
|
267
268
|
.attr('transform', isHorizontal
|
|
268
269
|
? `translate(${margin.left}, ${height / 2 - centerX})`
|
|
269
|
-
: `translate(${width / 2}, ${margin.top})`);
|
|
270
|
+
: `translate(${width / 2 - centerX}, ${margin.top})`);
|
|
270
271
|
// Add zoom and pan behavior (replaces AXPanViewDirective)
|
|
271
272
|
const zoom = this.d3
|
|
272
273
|
.zoom()
|
|
@@ -277,8 +278,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
277
278
|
// Apply zoom behavior to SVG
|
|
278
279
|
svg.call(zoom);
|
|
279
280
|
// Set initial transform to match the centering
|
|
280
|
-
const initialTransform = this.d3.zoomIdentity
|
|
281
|
-
.translate(isHorizontal ? margin.left : width / 2, isHorizontal ? height / 2 - centerX : margin.top);
|
|
281
|
+
const initialTransform = this.d3.zoomIdentity.translate(isHorizontal ? margin.left : width / 2 - centerX, isHorizontal ? height / 2 - centerX : margin.top);
|
|
282
282
|
svg.call(zoom.transform, initialTransform);
|
|
283
283
|
// Draw links between nodes
|
|
284
284
|
const links = g
|
|
@@ -427,6 +427,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
427
427
|
$implicit: node,
|
|
428
428
|
};
|
|
429
429
|
const viewRef = this.viewContainerRef.createEmbeddedView(templateToUse, context);
|
|
430
|
+
this.embeddedViews.push(viewRef);
|
|
430
431
|
viewRef.detectChanges();
|
|
431
432
|
// Append template contents to the div
|
|
432
433
|
const nodes = viewRef.rootNodes;
|
|
@@ -625,14 +626,20 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
625
626
|
* Clear existing chart
|
|
626
627
|
*/
|
|
627
628
|
cleanupChart() {
|
|
629
|
+
this.destroyEmbeddedViews();
|
|
628
630
|
const container = this.chartContainer()?.nativeElement;
|
|
629
631
|
if (!container)
|
|
630
632
|
return;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
633
|
+
container.querySelectorAll('svg, .ax-hierarchy-chart-no-data-message').forEach((el) => el.remove());
|
|
634
|
+
}
|
|
635
|
+
ngOnDestroy() {
|
|
636
|
+
this.cleanupChart();
|
|
637
|
+
}
|
|
638
|
+
destroyEmbeddedViews() {
|
|
639
|
+
for (const view of this.embeddedViews) {
|
|
640
|
+
view.destroy();
|
|
635
641
|
}
|
|
642
|
+
this.embeddedViews = [];
|
|
636
643
|
}
|
|
637
644
|
updateChart() {
|
|
638
645
|
this.createChart();
|
|
@@ -670,8 +677,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
670
677
|
* Shows a message when no data is available
|
|
671
678
|
*/
|
|
672
679
|
showNoDataMessage(containerElement) {
|
|
673
|
-
|
|
674
|
-
this.d3.select(containerElement).selectAll('*').remove();
|
|
680
|
+
this.cleanupChart();
|
|
675
681
|
const messageContainer = this.d3
|
|
676
682
|
.select(containerElement)
|
|
677
683
|
.append('div')
|