@acorex/charts 21.0.3-next.26 → 21.0.3-next.28
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 +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AXChartComponent, AX_CHART_COLOR_PALETTE, formatLargeNumber, getChartColor, getEasingFunction, computeTooltipPosition } from '@acorex/charts';
|
|
1
|
+
import { AX_CHART_DEFAULT_MESSAGES, AXChartComponent, AX_CHART_COLOR_PALETTE, mergeChartOptions, mergeChartMessages, formatLargeNumber, getChartColor, getEasingFunction, computeTooltipPosition, renderChartEmptyMessage } from '@acorex/charts';
|
|
2
2
|
import { AXChartTooltipComponent } from '@acorex/charts/chart-tooltip';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { InjectionToken, input, output, viewChild, signal, inject, computed, effect, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
@@ -27,12 +27,8 @@ const AXLineChartDefaultConfig = {
|
|
|
27
27
|
animationDuration: 1000,
|
|
28
28
|
animationEasing: 'cubic-out',
|
|
29
29
|
messages: {
|
|
30
|
-
|
|
31
|
-
noDataHelp: 'Please provide data to display the chart',
|
|
32
|
-
allHidden: 'All series are hidden',
|
|
33
|
-
allHiddenHelp: 'Click legend items to show series in the chart',
|
|
30
|
+
...AX_CHART_DEFAULT_MESSAGES,
|
|
34
31
|
noDataIcon: 'fa-light fa-chart-line',
|
|
35
|
-
allHiddenIcon: 'fa-light fa-eye-slash',
|
|
36
32
|
},
|
|
37
33
|
};
|
|
38
34
|
const AX_LINE_CHART_CONFIG = new InjectionToken('AX_LINE_CHART_CONFIG', {
|
|
@@ -40,11 +36,18 @@ const AX_LINE_CHART_CONFIG = new InjectionToken('AX_LINE_CHART_CONFIG', {
|
|
|
40
36
|
factory: () => AXLineChartDefaultConfig,
|
|
41
37
|
});
|
|
42
38
|
function lineChartConfig(config = {}) {
|
|
43
|
-
|
|
39
|
+
return {
|
|
44
40
|
...AXLineChartDefaultConfig,
|
|
45
41
|
...config,
|
|
42
|
+
margins: {
|
|
43
|
+
...AXLineChartDefaultConfig.margins,
|
|
44
|
+
...config.margins,
|
|
45
|
+
},
|
|
46
|
+
messages: {
|
|
47
|
+
...AXLineChartDefaultConfig.messages,
|
|
48
|
+
...config.messages,
|
|
49
|
+
},
|
|
46
50
|
};
|
|
47
|
-
return result;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/**
|
|
@@ -87,29 +90,11 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
87
90
|
configToken = inject(AX_LINE_CHART_CONFIG);
|
|
88
91
|
// Inject the chart colors
|
|
89
92
|
chartColors = inject(AX_CHART_COLOR_PALETTE);
|
|
90
|
-
effectiveOptions = computed(() => {
|
|
91
|
-
return {
|
|
92
|
-
...this.configToken,
|
|
93
|
-
...this.options(),
|
|
94
|
-
};
|
|
95
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
|
|
93
|
+
effectiveOptions = computed(() => mergeChartOptions(this.configToken, this.options()), ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
|
|
96
94
|
// Messages with defaults
|
|
97
|
-
effectiveMessages = computed(() => {
|
|
98
|
-
const defaultMessages = {
|
|
99
|
-
noData: 'No data available',
|
|
100
|
-
noDataHelp: 'Please provide data to display the chart',
|
|
101
|
-
allHidden: 'All series are hidden',
|
|
102
|
-
allHiddenHelp: 'Click legend items to show series in the chart',
|
|
103
|
-
noDataIcon: 'fa-light fa-chart-line',
|
|
104
|
-
allHiddenIcon: 'fa-light fa-eye-slash',
|
|
105
|
-
};
|
|
106
|
-
return {
|
|
107
|
-
...defaultMessages,
|
|
108
|
-
...this.effectiveOptions().messages,
|
|
109
|
-
};
|
|
110
|
-
}, ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : []));
|
|
95
|
+
effectiveMessages = computed(() => mergeChartMessages(this.configToken.messages, this.options()?.messages), ...(ngDevMode ? [{ debugName: "effectiveMessages" }] : []));
|
|
111
96
|
// Layout & Dimensions
|
|
112
|
-
MIN_DIMENSION =
|
|
97
|
+
MIN_DIMENSION = 1;
|
|
113
98
|
DEFAULT_MARGIN_TOP = 12;
|
|
114
99
|
DEFAULT_MARGIN_RIGHT = 12;
|
|
115
100
|
DEFAULT_MARGIN_BOTTOM = 8;
|
|
@@ -488,7 +473,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
488
473
|
targetPointsGroup
|
|
489
474
|
.selectAll('circle.ax-line-chart-point')
|
|
490
475
|
.attr('r', (this.effectiveOptions().pointRadius ?? this.DEFAULT_POINT_RADIUS) * this.POINT_HIGHLIGHT_MULTIPLIER)
|
|
491
|
-
.classed('ax-chart-highlighted-
|
|
476
|
+
.classed('ax-chart-highlighted-point', true);
|
|
492
477
|
}
|
|
493
478
|
toggleSegment(id) {
|
|
494
479
|
if (this.hiddenSeries.has(id)) {
|
|
@@ -520,7 +505,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
520
505
|
// Clear previous SVG and any empty-state messages (preserve tooltip component)
|
|
521
506
|
this.d3
|
|
522
507
|
.select(containerElement)
|
|
523
|
-
.selectAll('svg, .ax-line-chart-no-data-message, .ax-line-chart-all-hidden-message')
|
|
508
|
+
.selectAll('svg, .ax-chart-empty, .ax-line-chart-no-data-message, .ax-line-chart-all-hidden-message')
|
|
524
509
|
.remove();
|
|
525
510
|
if (allSeriesData.length === 0 || allSeriesData.every((series) => !series.data || series.data.length === 0)) {
|
|
526
511
|
this.showNoDataMessage(containerElement);
|
|
@@ -558,7 +543,7 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
558
543
|
if (this.svg) {
|
|
559
544
|
this.d3
|
|
560
545
|
?.select(this.chartContainerEl()?.nativeElement)
|
|
561
|
-
.selectAll('svg, .ax-line-chart-no-data-message, .ax-line-chart-all-hidden-message')
|
|
546
|
+
.selectAll('svg, .ax-chart-empty, .ax-line-chart-no-data-message, .ax-line-chart-all-hidden-message')
|
|
562
547
|
.remove();
|
|
563
548
|
this.svg = null;
|
|
564
549
|
this.chart = null;
|
|
@@ -1233,72 +1218,20 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
1233
1218
|
});
|
|
1234
1219
|
}
|
|
1235
1220
|
showNoDataMessage(containerElement) {
|
|
1236
|
-
|
|
1237
|
-
this.d3
|
|
1238
|
-
.
|
|
1239
|
-
|
|
1240
|
-
.
|
|
1241
|
-
|
|
1242
|
-
.select(containerElement)
|
|
1243
|
-
.append('div')
|
|
1244
|
-
.attr('class', 'ax-line-chart-no-data-message')
|
|
1245
|
-
.style('position', 'absolute')
|
|
1246
|
-
.style('left', '50%')
|
|
1247
|
-
.style('top', '50%')
|
|
1248
|
-
.style('transform', 'translate(-50%, -50%)');
|
|
1249
|
-
messageContainer
|
|
1250
|
-
.append('div')
|
|
1251
|
-
.attr('class', 'ax-line-chart-no-data-icon')
|
|
1252
|
-
.style('opacity', '0.6')
|
|
1253
|
-
.style('margin-bottom', '0.75rem')
|
|
1254
|
-
.html(`<i class="${this.effectiveMessages().noDataIcon} fa-2x"></i>`);
|
|
1255
|
-
messageContainer
|
|
1256
|
-
.append('div')
|
|
1257
|
-
.attr('class', 'ax-line-chart-no-data-text')
|
|
1258
|
-
.style('font-size', '1rem')
|
|
1259
|
-
.style('font-weight', '600')
|
|
1260
|
-
.style('margin-bottom', '0.5rem')
|
|
1261
|
-
.text(this.effectiveMessages().noData);
|
|
1262
|
-
messageContainer
|
|
1263
|
-
.append('div')
|
|
1264
|
-
.attr('class', 'ax-line-chart-no-data-help')
|
|
1265
|
-
.style('font-size', '0.8rem')
|
|
1266
|
-
.style('opacity', '0.6')
|
|
1267
|
-
.text(this.effectiveMessages().noDataHelp);
|
|
1221
|
+
const messages = this.effectiveMessages();
|
|
1222
|
+
renderChartEmptyMessage(this.d3, containerElement, {
|
|
1223
|
+
icon: messages.noDataIcon,
|
|
1224
|
+
title: messages.noData,
|
|
1225
|
+
help: messages.noDataHelp,
|
|
1226
|
+
});
|
|
1268
1227
|
}
|
|
1269
1228
|
showAllSeriesHiddenMessage(containerElement) {
|
|
1270
|
-
|
|
1271
|
-
this.d3
|
|
1272
|
-
.
|
|
1273
|
-
|
|
1274
|
-
.
|
|
1275
|
-
|
|
1276
|
-
.select(containerElement)
|
|
1277
|
-
.append('div')
|
|
1278
|
-
.attr('class', 'ax-line-chart-all-hidden-message') // Different class
|
|
1279
|
-
.style('position', 'absolute')
|
|
1280
|
-
.style('left', '50%')
|
|
1281
|
-
.style('top', '50%')
|
|
1282
|
-
.style('transform', 'translate(-50%, -50%)');
|
|
1283
|
-
messageContainer
|
|
1284
|
-
.append('div')
|
|
1285
|
-
.attr('class', 'ax-line-chart-all-hidden-icon')
|
|
1286
|
-
.style('opacity', '0.6')
|
|
1287
|
-
.style('margin-bottom', '0.75rem')
|
|
1288
|
-
.html(`<i class="${this.effectiveMessages().allHiddenIcon} fa-2x"></i>`); // Different icon
|
|
1289
|
-
messageContainer
|
|
1290
|
-
.append('div')
|
|
1291
|
-
.attr('class', 'ax-line-chart-all-hidden-text')
|
|
1292
|
-
.style('font-size', '1rem')
|
|
1293
|
-
.style('font-weight', '600')
|
|
1294
|
-
.style('margin-bottom', '0.5rem')
|
|
1295
|
-
.text(this.effectiveMessages().allHidden);
|
|
1296
|
-
messageContainer
|
|
1297
|
-
.append('div')
|
|
1298
|
-
.attr('class', 'ax-line-chart-all-hidden-help')
|
|
1299
|
-
.style('font-size', '0.8rem')
|
|
1300
|
-
.style('opacity', '0.6')
|
|
1301
|
-
.text(this.effectiveMessages().allHiddenHelp);
|
|
1229
|
+
const messages = this.effectiveMessages();
|
|
1230
|
+
renderChartEmptyMessage(this.d3, containerElement, {
|
|
1231
|
+
icon: messages.allHiddenIcon,
|
|
1232
|
+
title: messages.allHidden,
|
|
1233
|
+
help: messages.allHiddenHelp,
|
|
1234
|
+
});
|
|
1302
1235
|
}
|
|
1303
1236
|
handleOverlappingPointsHover(event, overlappingPoints) {
|
|
1304
1237
|
if (this.effectiveOptions().showTooltip === false)
|
|
@@ -1316,11 +1249,11 @@ class AXLineChartComponent extends AXChartComponent {
|
|
|
1316
1249
|
}
|
|
1317
1250
|
}
|
|
1318
1251
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXLineChartComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1319
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.3", 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:
|
|
1252
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.3", 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-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-line-chart{display:block;width:100%;height:100%;min-height:clamp(220px,38vw,360px);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;min-height:0;box-sizing:border-box;padding:clamp(.25rem,.6vw,.5rem);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}\n"], dependencies: [{ kind: "component", type: AXChartTooltipComponent, selector: "ax-chart-tooltip", inputs: ["data", "position", "visible", "showPercentage", "style"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1320
1253
|
}
|
|
1321
1254
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXLineChartComponent, decorators: [{
|
|
1322
1255
|
type: Component,
|
|
1323
|
-
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:
|
|
1256
|
+
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-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-line-chart{display:block;width:100%;height:100%;min-height:clamp(220px,38vw,360px);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;min-height:0;box-sizing:border-box;padding:clamp(.25rem,.6vw,.5rem);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}\n"] }]
|
|
1324
1257
|
}] });
|
|
1325
1258
|
|
|
1326
1259
|
/**
|