@acorex/charts 21.0.2-next.31 → 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 +20 -19
- 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
|
@@ -49,7 +49,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
49
49
|
// Chart container reference
|
|
50
50
|
chartContainer = viewChild.required('chartContainer');
|
|
51
51
|
// Custom node template provided by the user
|
|
52
|
-
customNodeTemplate = contentChild('nodeTemplate', ...(ngDevMode ? [{ debugName: "customNodeTemplate" }] : []));
|
|
52
|
+
customNodeTemplate = contentChild('nodeTemplate', ...(ngDevMode ? [{ debugName: "customNodeTemplate" }] : /* istanbul ignore next */ []));
|
|
53
53
|
// Services
|
|
54
54
|
ngZone = inject(NgZone);
|
|
55
55
|
viewContainerRef = inject(ViewContainerRef);
|
|
@@ -57,16 +57,17 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
57
57
|
// D3 instance
|
|
58
58
|
d3;
|
|
59
59
|
// Internal state signals
|
|
60
|
-
_expandedNodes = signal(new Map(), ...(ngDevMode ? [{ debugName: "_expandedNodes" }] : []));
|
|
61
|
-
_initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : []));
|
|
62
|
-
_rendered = signal(false, ...(ngDevMode ? [{ debugName: "_rendered" }] : []));
|
|
63
|
-
_dimensions = signal({ width: 0, height: 0 }, ...(ngDevMode ? [{ debugName: "_dimensions" }] : []));
|
|
64
|
-
_nodeElements = signal(new Map(), ...(ngDevMode ? [{ debugName: "_nodeElements" }] : [])); // Store references to node elements
|
|
65
|
-
_chartData = signal(null, ...(ngDevMode ? [{ debugName: "_chartData" }] : [])); // Store the current chart data and layout
|
|
60
|
+
_expandedNodes = signal(new Map(), ...(ngDevMode ? [{ debugName: "_expandedNodes" }] : /* istanbul ignore next */ []));
|
|
61
|
+
_initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : /* istanbul ignore next */ []));
|
|
62
|
+
_rendered = signal(false, ...(ngDevMode ? [{ debugName: "_rendered" }] : /* istanbul ignore next */ []));
|
|
63
|
+
_dimensions = signal({ width: 0, height: 0 }, ...(ngDevMode ? [{ debugName: "_dimensions" }] : /* istanbul ignore next */ []));
|
|
64
|
+
_nodeElements = signal(new Map(), ...(ngDevMode ? [{ debugName: "_nodeElements" }] : /* istanbul ignore next */ [])); // Store references to node elements
|
|
65
|
+
_chartData = signal(null, ...(ngDevMode ? [{ debugName: "_chartData" }] : /* istanbul ignore next */ [])); // Store the current chart data and layout
|
|
66
|
+
embeddedViews = [];
|
|
66
67
|
// Inputs
|
|
67
|
-
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
68
|
-
options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
69
|
-
nodeTemplate = input(null, ...(ngDevMode ? [{ debugName: "nodeTemplate" }] : []));
|
|
68
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
69
|
+
options = input({}, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
70
|
+
nodeTemplate = input(null, ...(ngDevMode ? [{ debugName: "nodeTemplate" }] : /* istanbul ignore next */ []));
|
|
70
71
|
// Outputs
|
|
71
72
|
itemClick = output();
|
|
72
73
|
nodeToggle = output();
|
|
@@ -75,17 +76,17 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
75
76
|
const data = this.data();
|
|
76
77
|
// Handle both single node and array formats
|
|
77
78
|
return Array.isArray(data) ? { id: 'root', children: data } : data;
|
|
78
|
-
}, ...(ngDevMode ? [{ debugName: "processedData" }] : []));
|
|
79
|
+
}, ...(ngDevMode ? [{ debugName: "processedData" }] : /* istanbul ignore next */ []));
|
|
79
80
|
// Check if custom template is available
|
|
80
81
|
hasCustomTemplate = computed(() => {
|
|
81
82
|
return Boolean(this.customNodeTemplate() || this.nodeTemplate());
|
|
82
|
-
}, ...(ngDevMode ? [{ debugName: "hasCustomTemplate" }] : []));
|
|
83
|
+
}, ...(ngDevMode ? [{ debugName: "hasCustomTemplate" }] : /* istanbul ignore next */ []));
|
|
83
84
|
effectiveOptions = computed(() => {
|
|
84
85
|
return {
|
|
85
86
|
...this.configToken,
|
|
86
87
|
...this.options(),
|
|
87
88
|
};
|
|
88
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
|
|
89
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : /* istanbul ignore next */ []));
|
|
89
90
|
// Messages with defaults
|
|
90
91
|
effectiveMessages = computed(() => {
|
|
91
92
|
const defaultMessages = {
|
|
@@ -97,7 +98,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
97
98
|
...defaultMessages,
|
|
98
99
|
...this.effectiveOptions().messages,
|
|
99
100
|
};
|
|
100
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : []));
|
|
101
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : /* istanbul ignore next */ []));
|
|
101
102
|
constructor() {
|
|
102
103
|
super();
|
|
103
104
|
// Dynamically load D3 and initialize the chart when the component is ready
|
|
@@ -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')
|
|
@@ -710,13 +716,13 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
710
716
|
.style('opacity', '0.6')
|
|
711
717
|
.text(this.effectiveMessages().noDataHelp);
|
|
712
718
|
}
|
|
713
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
714
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
719
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXHierarchyChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
720
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: AXHierarchyChartComponent, isStandalone: true, selector: "ax-hierarchy-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, nodeTemplate: { classPropertyName: "nodeTemplate", publicName: "nodeTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick", nodeToggle: "nodeToggle" }, queries: [{ propertyName: "customNodeTemplate", first: true, predicate: ["nodeTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "chartContainer", first: true, predicate: ["chartContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-hierarchy-chart\" role=\"img\" #chartContainer></div>\n", styles: ["ax-hierarchy-chart{display:block;width:100%;height:100%;min-height:300px;--ax-comp-hierarchy-chart-node-color: var(--ax-sys-color-primary-500);--ax-comp-hierarchy-chart-node-stroke-color: var(--ax-sys-color-primary-400);--ax-comp-hierarchy-chart-link-color: var(--ax-sys-color-primary-400);--ax-comp-hierarchy-chart-text-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-hierarchy-chart-bg-color: 0, 0, 0, 0;color:rgb(var(--ax-comp-hierarchy-chart-text-color));background-color:rgba(var(--ax-comp-hierarchy-chart-bg-color))}ax-hierarchy-chart .ax-hierarchy-chart{width:100%;height:100%;min-height:300px;position:relative;overflow:hidden}ax-hierarchy-chart .ax-hierarchy-chart svg{width:100%;height:100%;max-width:100%;max-height:100%;overflow:visible}ax-hierarchy-chart .ax-hierarchy-chart svg g:has(text){font-family:inherit}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message{position:absolute;text-align:center;transform:translate(-50%,-50%);background-color:rgb(var(--ax-comp-hierarchy-chart-bg-color));padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message .ax-hierarchy-chart-no-data-icon{opacity:.6;margin-bottom:.75rem}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message .ax-hierarchy-chart-no-data-text{font-size:1rem;font-weight:600;margin-bottom:.5rem}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message .ax-hierarchy-chart-no-data-help{font-size:.8rem;opacity:.6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
715
721
|
}
|
|
716
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXHierarchyChartComponent, decorators: [{
|
|
717
723
|
type: Component,
|
|
718
724
|
args: [{ selector: 'ax-hierarchy-chart', standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ax-hierarchy-chart\" role=\"img\" #chartContainer></div>\n", styles: ["ax-hierarchy-chart{display:block;width:100%;height:100%;min-height:300px;--ax-comp-hierarchy-chart-node-color: var(--ax-sys-color-primary-500);--ax-comp-hierarchy-chart-node-stroke-color: var(--ax-sys-color-primary-400);--ax-comp-hierarchy-chart-link-color: var(--ax-sys-color-primary-400);--ax-comp-hierarchy-chart-text-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-hierarchy-chart-bg-color: 0, 0, 0, 0;color:rgb(var(--ax-comp-hierarchy-chart-text-color));background-color:rgba(var(--ax-comp-hierarchy-chart-bg-color))}ax-hierarchy-chart .ax-hierarchy-chart{width:100%;height:100%;min-height:300px;position:relative;overflow:hidden}ax-hierarchy-chart .ax-hierarchy-chart svg{width:100%;height:100%;max-width:100%;max-height:100%;overflow:visible}ax-hierarchy-chart .ax-hierarchy-chart svg g:has(text){font-family:inherit}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message{position:absolute;text-align:center;transform:translate(-50%,-50%);background-color:rgb(var(--ax-comp-hierarchy-chart-bg-color));padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message .ax-hierarchy-chart-no-data-icon{opacity:.6;margin-bottom:.75rem}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message .ax-hierarchy-chart-no-data-text{font-size:1rem;font-weight:600;margin-bottom:.5rem}ax-hierarchy-chart .ax-hierarchy-chart-no-data-message .ax-hierarchy-chart-no-data-help{font-size:.8rem;opacity:.6}\n"] }]
|
|
719
|
-
}], ctorParameters: () => [] });
|
|
725
|
+
}], ctorParameters: () => [], propDecorators: { chartContainer: [{ type: i0.ViewChild, args: ['chartContainer', { isSignal: true }] }], customNodeTemplate: [{ type: i0.ContentChild, args: ['nodeTemplate', { isSignal: true }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], nodeTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeTemplate", required: false }] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], nodeToggle: [{ type: i0.Output, args: ["nodeToggle"] }] } });
|
|
720
726
|
|
|
721
727
|
/**
|
|
722
728
|
* Generated bundle index. Do not edit.
|