@acorex/charts 21.0.3-next.26 → 21.0.3-next.29
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/bar-chart/index.d.ts +3 -27
- package/donut-chart/index.d.ts +4 -21
- package/fesm2022/acorex-charts-bar-chart.mjs +52 -77
- package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-chart-legend.mjs +1 -1
- package/fesm2022/acorex-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/acorex-charts-chart-tooltip.mjs +1 -1
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-charts-donut-chart.mjs +36 -61
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-funnel-chart.mjs +6 -8
- package/fesm2022/acorex-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-gauge-chart.mjs +53 -34
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-heatmap-chart.mjs +6 -9
- package/fesm2022/acorex-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +24 -65
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-line-chart.mjs +31 -98
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts.mjs +65 -1
- package/fesm2022/acorex-charts.mjs.map +1 -1
- package/funnel-chart/index.d.ts +3 -24
- package/gauge-chart/index.d.ts +6 -20
- package/heatmap-chart/index.d.ts +2 -27
- package/hierarchy-chart/index.d.ts +2 -26
- package/index.d.ts +52 -2
- package/line-chart/index.d.ts +2 -37
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AXChartComponent } from '@acorex/charts';
|
|
1
|
+
import { AX_CHART_DEFAULT_MESSAGES, AXChartComponent, mergeChartOptions, mergeChartMessages, renderChartEmptyMessage } from '@acorex/charts';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, viewChild, contentChild, inject, NgZone, ViewContainerRef, signal, input, output, computed, afterNextRender, effect, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
4
4
|
|
|
@@ -19,8 +19,7 @@ const AXHierarchyChartDefaultConfig = {
|
|
|
19
19
|
animationDuration: 100,
|
|
20
20
|
animationEasing: 'cubic-out',
|
|
21
21
|
messages: {
|
|
22
|
-
|
|
23
|
-
noDataHelp: 'Please provide hierarchy data to display the chart',
|
|
22
|
+
...AX_CHART_DEFAULT_MESSAGES,
|
|
24
23
|
noDataIcon: 'fa-light fa-sitemap',
|
|
25
24
|
},
|
|
26
25
|
};
|
|
@@ -29,11 +28,18 @@ const AX_HIERARCHY_CHART_CONFIG = new InjectionToken('AX_HIERARCHY_CHART_CONFIG'
|
|
|
29
28
|
factory: () => AXHierarchyChartDefaultConfig,
|
|
30
29
|
});
|
|
31
30
|
function hierarchyChartConfig(config = {}) {
|
|
32
|
-
|
|
31
|
+
return {
|
|
33
32
|
...AXHierarchyChartDefaultConfig,
|
|
34
33
|
...config,
|
|
34
|
+
margin: {
|
|
35
|
+
...AXHierarchyChartDefaultConfig.margin,
|
|
36
|
+
...config.margin,
|
|
37
|
+
},
|
|
38
|
+
messages: {
|
|
39
|
+
...AXHierarchyChartDefaultConfig.messages,
|
|
40
|
+
...config.messages,
|
|
41
|
+
},
|
|
35
42
|
};
|
|
36
|
-
return result;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
/**
|
|
@@ -81,24 +87,9 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
81
87
|
hasCustomTemplate = computed(() => {
|
|
82
88
|
return Boolean(this.customNodeTemplate() || this.nodeTemplate());
|
|
83
89
|
}, ...(ngDevMode ? [{ debugName: "hasCustomTemplate" }] : []));
|
|
84
|
-
effectiveOptions = computed(() => {
|
|
85
|
-
return {
|
|
86
|
-
...this.configToken,
|
|
87
|
-
...this.options(),
|
|
88
|
-
};
|
|
89
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
|
|
90
|
+
effectiveOptions = computed(() => mergeChartOptions(this.configToken, this.options()), ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
|
|
90
91
|
// Messages with defaults
|
|
91
|
-
effectiveMessages = computed(() => {
|
|
92
|
-
const defaultMessages = {
|
|
93
|
-
noData: 'No data available',
|
|
94
|
-
noDataHelp: 'Please provide hierarchy data to display the chart',
|
|
95
|
-
noDataIcon: 'fa-light fa-sitemap',
|
|
96
|
-
};
|
|
97
|
-
return {
|
|
98
|
-
...defaultMessages,
|
|
99
|
-
...this.effectiveOptions().messages,
|
|
100
|
-
};
|
|
101
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : []));
|
|
92
|
+
effectiveMessages = computed(() => mergeChartMessages(this.configToken.messages, this.options()?.messages), ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : []));
|
|
102
93
|
constructor() {
|
|
103
94
|
super();
|
|
104
95
|
// Dynamically load D3 and initialize the chart when the component is ready
|
|
@@ -168,8 +159,8 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
168
159
|
const container = this.chartContainer().nativeElement;
|
|
169
160
|
const options = this.effectiveOptions();
|
|
170
161
|
const containerRect = container.getBoundingClientRect();
|
|
171
|
-
const width = options.width || Math.max(containerRect.width,
|
|
172
|
-
const height = options.height || Math.max(containerRect.height,
|
|
162
|
+
const width = options.width || Math.max(containerRect.width || 0, 1);
|
|
163
|
+
const height = options.height || Math.max(containerRect.height || 0, 1);
|
|
173
164
|
this._dimensions.set({ width, height });
|
|
174
165
|
}
|
|
175
166
|
/**
|
|
@@ -630,7 +621,7 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
630
621
|
const container = this.chartContainer()?.nativeElement;
|
|
631
622
|
if (!container)
|
|
632
623
|
return;
|
|
633
|
-
container.querySelectorAll('svg, .ax-hierarchy-chart-no-data-message').forEach((el) => el.remove());
|
|
624
|
+
container.querySelectorAll('svg, .ax-chart-empty, .ax-hierarchy-chart-no-data-message').forEach((el) => el.remove());
|
|
634
625
|
}
|
|
635
626
|
ngOnDestroy() {
|
|
636
627
|
this.cleanupChart();
|
|
@@ -677,51 +668,19 @@ class AXHierarchyChartComponent extends AXChartComponent {
|
|
|
677
668
|
* Shows a message when no data is available
|
|
678
669
|
*/
|
|
679
670
|
showNoDataMessage(containerElement) {
|
|
680
|
-
this.
|
|
681
|
-
|
|
682
|
-
.
|
|
683
|
-
.
|
|
684
|
-
.
|
|
685
|
-
|
|
686
|
-
.style('left', '50%')
|
|
687
|
-
.style('top', '50%')
|
|
688
|
-
.style('transform', 'translate(-50%, -50%)')
|
|
689
|
-
.style('text-align', 'center')
|
|
690
|
-
.style('background-color', 'rgb(var(--ax-comp-hierarchy-chart-bg-color))')
|
|
691
|
-
.style('padding', '1.5rem')
|
|
692
|
-
.style('border-radius', '0.5rem')
|
|
693
|
-
.style('box-shadow', '0 2px 12px rgba(0, 0, 0, 0.08)')
|
|
694
|
-
.style('width', '80%')
|
|
695
|
-
.style('max-width', '300px');
|
|
696
|
-
// Add an icon
|
|
697
|
-
messageContainer
|
|
698
|
-
.append('div')
|
|
699
|
-
.attr('class', 'ax-hierarchy-chart-no-data-icon')
|
|
700
|
-
.style('opacity', '0.6')
|
|
701
|
-
.style('margin-bottom', '0.75rem')
|
|
702
|
-
.html(`<i class="${this.effectiveMessages().noDataIcon} fa-2x"></i>`);
|
|
703
|
-
// Add text message
|
|
704
|
-
messageContainer
|
|
705
|
-
.append('div')
|
|
706
|
-
.attr('class', 'ax-hierarchy-chart-no-data-text')
|
|
707
|
-
.style('font-size', '1rem')
|
|
708
|
-
.style('font-weight', '600')
|
|
709
|
-
.style('margin-bottom', '0.5rem')
|
|
710
|
-
.text(this.effectiveMessages().noData);
|
|
711
|
-
// Add help text
|
|
712
|
-
messageContainer
|
|
713
|
-
.append('div')
|
|
714
|
-
.attr('class', 'ax-hierarchy-chart-no-data-help')
|
|
715
|
-
.style('font-size', '0.8rem')
|
|
716
|
-
.style('opacity', '0.6')
|
|
717
|
-
.text(this.effectiveMessages().noDataHelp);
|
|
671
|
+
const messages = this.effectiveMessages();
|
|
672
|
+
renderChartEmptyMessage(this.d3, containerElement, {
|
|
673
|
+
icon: messages.noDataIcon,
|
|
674
|
+
title: messages.noData,
|
|
675
|
+
help: messages.noDataHelp,
|
|
676
|
+
});
|
|
718
677
|
}
|
|
719
678
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXHierarchyChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
720
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.3", 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:
|
|
679
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.3", 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-chart-empty{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:1rem;pointer-events:none}.ax-chart-empty__card{text-align:center;padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px;box-sizing:border-box}.ax-chart-empty__icon{opacity:.6;margin-bottom:.75rem}.ax-chart-empty__title{font-size:1rem;font-weight:600;margin-bottom:.5rem}.ax-chart-empty__help{font-size:.8rem;opacity:.6}ax-hierarchy-chart{display:block;width:100%;height:100%;min-height:clamp(220px,38vw,360px);box-sizing:border-box;--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:0;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}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
721
680
|
}
|
|
722
681
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXHierarchyChartComponent, decorators: [{
|
|
723
682
|
type: Component,
|
|
724
|
-
args: [{ selector: 'ax-hierarchy-chart',
|
|
683
|
+
args: [{ selector: 'ax-hierarchy-chart', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ax-hierarchy-chart\" role=\"img\" #chartContainer></div>\n", styles: [".ax-chart-empty{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:1rem;pointer-events:none}.ax-chart-empty__card{text-align:center;padding:1.5rem;border-radius:.5rem;border:1px solid rgba(var(--ax-sys-color-surface));width:80%;max-width:300px;box-sizing:border-box}.ax-chart-empty__icon{opacity:.6;margin-bottom:.75rem}.ax-chart-empty__title{font-size:1rem;font-weight:600;margin-bottom:.5rem}.ax-chart-empty__help{font-size:.8rem;opacity:.6}ax-hierarchy-chart{display:block;width:100%;height:100%;min-height:clamp(220px,38vw,360px);box-sizing:border-box;--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:0;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}\n"] }]
|
|
725
684
|
}], ctorParameters: () => [] });
|
|
726
685
|
|
|
727
686
|
/**
|