@acorex/charts 19.14.0-next.2 → 19.14.0
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/lib/bar-chart.component.d.ts +2 -6
- package/bar-chart/lib/bar-chart.type.d.ts +13 -6
- package/donut-chart/lib/donut-chart.component.d.ts +5 -0
- package/donut-chart/lib/donut-chart.type.d.ts +57 -0
- package/fesm2022/acorex-charts-bar-chart.mjs +87 -67
- package/fesm2022/acorex-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-chart-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-charts-donut-chart.mjs +128 -68
- package/fesm2022/acorex-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-gauge-chart.mjs +261 -110
- package/fesm2022/acorex-charts-gauge-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-hierarchy-chart.mjs +11 -14
- package/fesm2022/acorex-charts-hierarchy-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts-line-chart.mjs +204 -66
- package/fesm2022/acorex-charts-line-chart.mjs.map +1 -1
- package/fesm2022/acorex-charts.mjs.map +1 -1
- package/gauge-chart/lib/gauge-chart.component.d.ts +41 -13
- package/gauge-chart/lib/gauge-chart.type.d.ts +36 -5
- package/hierarchy-chart/lib/hierarchy-chart.component.d.ts +0 -3
- package/hierarchy-chart/lib/hierarchy-chart.type.d.ts +41 -13
- package/line-chart/lib/line-chart.component.d.ts +1 -0
- package/line-chart/lib/line-chart.type.d.ts +12 -0
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ export declare class AXBarChartComponent extends NXComponent implements OnDestro
|
|
|
29
29
|
private width;
|
|
30
30
|
private height;
|
|
31
31
|
private margin;
|
|
32
|
+
private _initialAnimationComplete;
|
|
32
33
|
private _tooltipVisible;
|
|
33
34
|
private _tooltipPosition;
|
|
34
35
|
private _tooltipData;
|
|
@@ -44,15 +45,10 @@ export declare class AXBarChartComponent extends NXComponent implements OnDestro
|
|
|
44
45
|
protected effectiveOptions: import("@angular/core").Signal<{
|
|
45
46
|
width?: number;
|
|
46
47
|
height?: number;
|
|
47
|
-
margin?: {
|
|
48
|
-
top: number;
|
|
49
|
-
right: number;
|
|
50
|
-
bottom: number;
|
|
51
|
-
left: number;
|
|
52
|
-
};
|
|
53
48
|
showXAxis?: boolean;
|
|
54
49
|
showYAxis?: boolean;
|
|
55
50
|
showGrid?: boolean;
|
|
51
|
+
showDataLabels?: boolean;
|
|
56
52
|
xAxisLabel?: string;
|
|
57
53
|
yAxisLabel?: string;
|
|
58
54
|
showTooltip?: boolean;
|
|
@@ -17,19 +17,26 @@ export interface AXBarChartClickEvent {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Bar chart options interface
|
|
20
|
+
*
|
|
21
|
+
* Component supports the following CSS custom properties (design tokens):
|
|
22
|
+
* - `--ax-comp-bar-chart-labels-color`: Color for axis labels in option (X/Y axis titles).
|
|
23
|
+
* Default: `--ax-sys-color-on-lightest-surface` (applied with 0.7 opacity where needed)
|
|
24
|
+
* - `--ax-comp-bar-chart-data-labels-color`: Color for data labels.
|
|
25
|
+
* Default: `--ax-sys-color-on-lightest-surface`
|
|
26
|
+
* - `--ax-comp-bar-chart-axis-color`: Color for X/Y axis lines.
|
|
27
|
+
* Default: `--ax-sys-color-on-lightest-surface`
|
|
28
|
+
* - `--ax-comp-bar-chart-grid-lines-color`: Color for grid lines.
|
|
29
|
+
* Default: `--ax-sys-color-on-lightest-surface` (applied with 0.2 opacity)
|
|
30
|
+
* - `--ax-comp-bar-chart-bg-color`: Background color for the chart.
|
|
31
|
+
* Default: `--ax-sys-color-lightest-surface`
|
|
20
32
|
*/
|
|
21
33
|
export interface AXPBarChartOption {
|
|
22
34
|
width?: number;
|
|
23
35
|
height?: number;
|
|
24
|
-
margin?: {
|
|
25
|
-
top: number;
|
|
26
|
-
right: number;
|
|
27
|
-
bottom: number;
|
|
28
|
-
left: number;
|
|
29
|
-
};
|
|
30
36
|
showXAxis?: boolean;
|
|
31
37
|
showYAxis?: boolean;
|
|
32
38
|
showGrid?: boolean;
|
|
39
|
+
showDataLabels?: boolean;
|
|
33
40
|
xAxisLabel?: string;
|
|
34
41
|
yAxisLabel?: string;
|
|
35
42
|
showTooltip?: boolean;
|
|
@@ -43,6 +43,7 @@ export declare class AXDonutChartComponent implements OnDestroy {
|
|
|
43
43
|
width?: number;
|
|
44
44
|
height?: number;
|
|
45
45
|
showTooltip?: boolean;
|
|
46
|
+
showDataLabels?: boolean;
|
|
46
47
|
donutWidth?: number;
|
|
47
48
|
cornerRadius?: number;
|
|
48
49
|
animationDuration?: number;
|
|
@@ -138,6 +139,10 @@ export declare class AXDonutChartComponent implements OnDestroy {
|
|
|
138
139
|
* Cleans up chart resources
|
|
139
140
|
*/
|
|
140
141
|
private cleanupChart;
|
|
142
|
+
/**
|
|
143
|
+
* Gets an accessibility label describing the donut chart for screen readers
|
|
144
|
+
*/
|
|
145
|
+
protected getAccessibilityLabel(): string;
|
|
141
146
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXDonutChartComponent, never>;
|
|
142
147
|
static ɵcmp: i0.ɵɵComponentDeclaration<AXDonutChartComponent, "ax-donut-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "segmentClick": "segmentClick"; "segmentHover": "segmentHover"; }, never, never, true, never>;
|
|
143
148
|
}
|
|
@@ -8,14 +8,71 @@ export interface AXPDonutChartData {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Configuration options for the donut chart
|
|
11
|
+
*
|
|
12
|
+
* ## Design Tokens
|
|
13
|
+
* The component supports the following CSS custom properties:
|
|
14
|
+
*
|
|
15
|
+
* ### `--ax-comp-donut-chart-bg-color`
|
|
16
|
+
* Background color for the chart area and separator lines between segments.
|
|
17
|
+
* Default: `var(--ax-sys-color-lightest-surface)`
|
|
18
|
+
* Usage: `rgb(var(--ax-comp-donut-chart-bg-color))`
|
|
19
|
+
*
|
|
20
|
+
* ### `--ax-comp-donut-chart-text-color`
|
|
21
|
+
* Text color for all labels, values, total count, and percentage indicators.
|
|
22
|
+
* Default: `var(--ax-sys-color-on-lightest-surface)`
|
|
23
|
+
* Usage: `rgb(var(--ax-comp-donut-chart-text-color))`
|
|
24
|
+
*
|
|
25
|
+
* ## Usage
|
|
26
|
+
* Override these tokens in your CSS to customize the chart's appearance:
|
|
27
|
+
* ```css
|
|
28
|
+
* ax-donut-chart {
|
|
29
|
+
* --ax-comp-donut-chart-bg-color: var(--your-custom-background);
|
|
30
|
+
* --ax-comp-donut-chart-text-color: var(--your-custom-text-color);
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
11
33
|
*/
|
|
12
34
|
export interface AXPDonutChartOption {
|
|
35
|
+
/**
|
|
36
|
+
* Width of the chart in pixels
|
|
37
|
+
* If not provided, will use container width
|
|
38
|
+
*/
|
|
13
39
|
width?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Height of the chart in pixels
|
|
42
|
+
* If not provided, will use container height
|
|
43
|
+
*/
|
|
14
44
|
height?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to show tooltips on hover
|
|
47
|
+
* Default: true
|
|
48
|
+
*/
|
|
15
49
|
showTooltip?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to show percentage labels inside chart segments
|
|
52
|
+
* Labels will only appear on segments large enough to fit text
|
|
53
|
+
* Default: true
|
|
54
|
+
*/
|
|
55
|
+
showDataLabels?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Width of the donut ring as a percentage (10-90)
|
|
58
|
+
* Higher values create a thicker ring
|
|
59
|
+
* Default: 35
|
|
60
|
+
*/
|
|
16
61
|
donutWidth?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Radius for rounded corners on segments in pixels
|
|
64
|
+
* Default: 4
|
|
65
|
+
*/
|
|
17
66
|
cornerRadius?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Duration of animations in milliseconds
|
|
69
|
+
* Default: 800
|
|
70
|
+
*/
|
|
18
71
|
animationDuration?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Type of easing function for animations
|
|
74
|
+
* Default: 'cubic-out'
|
|
75
|
+
*/
|
|
19
76
|
animationEasing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic' | 'cubic-in' | 'cubic-out' | 'cubic-in-out';
|
|
20
77
|
}
|
|
21
78
|
/**
|
|
@@ -2,20 +2,15 @@ import { AXChartTooltipComponent } from '@acorex/charts/chart-tooltip';
|
|
|
2
2
|
import { NXComponent } from '@acorex/components/common';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { InjectionToken, inject, input, output, viewChild, signal, computed, afterNextRender, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
|
+
import { InjectionToken, inject, input, output, viewChild, signal, computed, afterNextRender, effect, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
6
6
|
import { AX_GLOBAL_CONFIG } from '@acorex/core/config';
|
|
7
7
|
import { set } from 'lodash-es';
|
|
8
8
|
|
|
9
9
|
const AXBarChartDefaultConfig = {
|
|
10
|
-
margin: {
|
|
11
|
-
top: 20,
|
|
12
|
-
right: 20,
|
|
13
|
-
bottom: 30,
|
|
14
|
-
left: 40,
|
|
15
|
-
},
|
|
16
10
|
showXAxis: true,
|
|
17
11
|
showYAxis: true,
|
|
18
12
|
showGrid: true,
|
|
13
|
+
showDataLabels: true,
|
|
19
14
|
showTooltip: true,
|
|
20
15
|
barWidth: 80,
|
|
21
16
|
cornerRadius: 4,
|
|
@@ -86,6 +81,8 @@ class AXBarChartComponent extends NXComponent {
|
|
|
86
81
|
width;
|
|
87
82
|
height;
|
|
88
83
|
margin = { top: 20, right: 20, bottom: 30, left: 40 };
|
|
84
|
+
// Animation state
|
|
85
|
+
_initialAnimationComplete = signal(false);
|
|
89
86
|
// Tooltip state
|
|
90
87
|
_tooltipVisible = signal(false);
|
|
91
88
|
_tooltipPosition = signal({ x: 0, y: 0 });
|
|
@@ -233,10 +230,10 @@ class AXBarChartComponent extends NXComponent {
|
|
|
233
230
|
calculateMargins(options) {
|
|
234
231
|
// Start with default margins
|
|
235
232
|
this.margin = {
|
|
236
|
-
top:
|
|
237
|
-
right:
|
|
238
|
-
bottom:
|
|
239
|
-
left:
|
|
233
|
+
top: 20,
|
|
234
|
+
right: 20,
|
|
235
|
+
bottom: 30,
|
|
236
|
+
left: 40,
|
|
240
237
|
};
|
|
241
238
|
// Adjust margins if axis labels are present
|
|
242
239
|
if (options.xAxisLabel) {
|
|
@@ -296,7 +293,13 @@ class AXBarChartComponent extends NXComponent {
|
|
|
296
293
|
.attr('transform', `translate(0,${this.height})`)
|
|
297
294
|
.call(this.d3.axisBottom(this.xScale));
|
|
298
295
|
// Style the axis text
|
|
299
|
-
this.xAxis
|
|
296
|
+
this.xAxis
|
|
297
|
+
.selectAll('text')
|
|
298
|
+
.style('font-size', '11px')
|
|
299
|
+
.style('font-weight', '400')
|
|
300
|
+
.style('fill', 'rgba(var(--ax-comp-bar-chart-labels-color), 0.7)');
|
|
301
|
+
// Style all lines in the x-axis (path, ticks)
|
|
302
|
+
this.xAxis.selectAll('line, path').style('stroke', 'rgb(var(--ax-comp-bar-chart-grid-lines-color))');
|
|
300
303
|
// Add X axis label if provided
|
|
301
304
|
if (options.xAxisLabel) {
|
|
302
305
|
const labelY = this.height + this.margin.bottom * 0.65;
|
|
@@ -309,7 +312,7 @@ class AXBarChartComponent extends NXComponent {
|
|
|
309
312
|
.attr('y', labelY)
|
|
310
313
|
.style('font-size', '13px')
|
|
311
314
|
.style('font-weight', '500')
|
|
312
|
-
.style('fill', '
|
|
315
|
+
.style('fill', 'rgb(var(--ax-comp-bar-chart-axis-label-color))')
|
|
313
316
|
.text(options.xAxisLabel);
|
|
314
317
|
}
|
|
315
318
|
}
|
|
@@ -317,7 +320,13 @@ class AXBarChartComponent extends NXComponent {
|
|
|
317
320
|
// Create Y axis
|
|
318
321
|
this.yAxis = axesGroup.append('g').attr('class', 'ax-bar-chart-axis-y').call(this.d3.axisLeft(this.yScale));
|
|
319
322
|
// Style the axis text
|
|
320
|
-
this.yAxis
|
|
323
|
+
this.yAxis
|
|
324
|
+
.selectAll('text')
|
|
325
|
+
.style('font-size', '11px')
|
|
326
|
+
.style('font-weight', '400')
|
|
327
|
+
.style('fill', 'rgba(var(--ax-comp-bar-chart-labels-color), 0.7)');
|
|
328
|
+
// Style all lines in the y-axis (path, ticks)
|
|
329
|
+
this.yAxis.selectAll('line, path').style('stroke', 'rgb(var(--ax-comp-bar-chart-grid-lines-color))');
|
|
321
330
|
// Add Y axis label if provided
|
|
322
331
|
if (options.yAxisLabel) {
|
|
323
332
|
const labelX = -this.height / 2;
|
|
@@ -332,7 +341,7 @@ class AXBarChartComponent extends NXComponent {
|
|
|
332
341
|
.attr('y', labelY)
|
|
333
342
|
.style('font-size', '13px')
|
|
334
343
|
.style('font-weight', '500')
|
|
335
|
-
.style('fill', '
|
|
344
|
+
.style('fill', 'rgb(var(--ax-comp-bar-chart-axis-label-color))')
|
|
336
345
|
.text(options.yAxisLabel);
|
|
337
346
|
}
|
|
338
347
|
}
|
|
@@ -345,14 +354,19 @@ class AXBarChartComponent extends NXComponent {
|
|
|
345
354
|
.axisLeft(this.yScale)
|
|
346
355
|
.tickSize(-this.width)
|
|
347
356
|
.tickFormat(() => ''))
|
|
348
|
-
.selectAll('
|
|
349
|
-
.style('
|
|
357
|
+
.selectAll('line')
|
|
358
|
+
.style('stroke', 'rgb(var(--ax-comp-bar-chart-grid-lines-color))')
|
|
359
|
+
.style('stroke-opacity', 0.2);
|
|
360
|
+
// Remove unneeded elements from grid
|
|
361
|
+
this.chart.select('.ax-bar-chart-grid').selectAll('path, text').remove();
|
|
350
362
|
}
|
|
351
363
|
}
|
|
352
364
|
/**
|
|
353
365
|
* Renders the bars with animations
|
|
354
366
|
*/
|
|
355
367
|
renderBars(data) {
|
|
368
|
+
// Reset animation state
|
|
369
|
+
this._initialAnimationComplete.set(false);
|
|
356
370
|
// Get corner radius from options
|
|
357
371
|
const radius = this.effectiveOptions().cornerRadius;
|
|
358
372
|
// Get animation options
|
|
@@ -379,52 +393,61 @@ class AXBarChartComponent extends NXComponent {
|
|
|
379
393
|
.attr('rx', radius) // Rounded corners
|
|
380
394
|
.attr('ry', radius) // Rounded corners
|
|
381
395
|
.attr('fill', (d, i) => d.color || AXBarChartColors.getColor(i));
|
|
396
|
+
// Add data labels if they're enabled
|
|
397
|
+
if (this.effectiveOptions().showDataLabels !== false) {
|
|
398
|
+
barGroups
|
|
399
|
+
.append('text')
|
|
400
|
+
.attr('class', 'ax-bar-chart-data-label')
|
|
401
|
+
.attr('text-anchor', 'middle')
|
|
402
|
+
.attr('x', (d) => this.xScale(d.label) + this.xScale.bandwidth() / 2)
|
|
403
|
+
.attr('y', this.height) // Start from bottom for animation
|
|
404
|
+
.style('font-size', 'clamp(8px, 2vmin, 12px)')
|
|
405
|
+
.style('font-weight', '500')
|
|
406
|
+
.style('fill', 'rgb(var(--ax-comp-bar-chart-data-labels-color))')
|
|
407
|
+
.style('opacity', 0) // Start invisible for animation
|
|
408
|
+
.text((d) => d.value);
|
|
409
|
+
// Animate data labels
|
|
410
|
+
barGroups
|
|
411
|
+
.selectAll('.ax-bar-chart-data-label')
|
|
412
|
+
.transition()
|
|
413
|
+
.duration(animationDuration)
|
|
414
|
+
.delay((d, i) => i * 50 + 100) // Slightly delayed after bar animation
|
|
415
|
+
.attr('y', (d) => this.yScale(d.value) - 8) // Position above bar
|
|
416
|
+
.style('opacity', 1)
|
|
417
|
+
.ease(animationEasing);
|
|
418
|
+
}
|
|
382
419
|
// Set up event handlers on each group
|
|
383
420
|
barGroups
|
|
384
421
|
.on('mouseenter', (event, d) => {
|
|
422
|
+
// Only apply hover effects if initial animation is complete
|
|
423
|
+
if (!this._initialAnimationComplete())
|
|
424
|
+
return;
|
|
385
425
|
const barEl = this.d3.select(event.currentTarget).select('rect');
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const currentWidth = parseFloat(barEl.attr('width'));
|
|
389
|
-
const currentHeight = parseFloat(barEl.attr('height'));
|
|
390
|
-
// Calculate horizontal center point of the bar
|
|
391
|
-
const centerX = currentX + currentWidth / 2;
|
|
392
|
-
// Scale amount (5% larger)
|
|
393
|
-
const scaleX = 1.05;
|
|
394
|
-
const scaleY = 1.05;
|
|
395
|
-
// Calculate new dimensions with scaling
|
|
396
|
-
const newWidth = currentWidth * scaleX;
|
|
397
|
-
const newHeight = currentHeight * scaleY;
|
|
398
|
-
// Calculate new position:
|
|
399
|
-
// - Horizontally center-aligned
|
|
400
|
-
// - Vertically grow only upward from the bottom (X-axis)
|
|
401
|
-
const newX = centerX - newWidth / 2;
|
|
402
|
-
// The bottom of the bar stays at the same position (aligned with x-axis)
|
|
403
|
-
const newY = currentY - (newHeight - currentHeight);
|
|
404
|
-
// Apply the new position and size
|
|
405
|
-
barEl
|
|
406
|
-
.transition()
|
|
407
|
-
.duration(200)
|
|
408
|
-
.attr('x', newX)
|
|
409
|
-
.attr('y', newY)
|
|
410
|
-
.attr('width', newWidth)
|
|
411
|
-
.attr('height', newHeight);
|
|
426
|
+
// Standard hover effect - darken the bar slightly and add a subtle shadow
|
|
427
|
+
barEl.transition().duration(150).style('filter', 'brightness(0.7) drop-shadow(0 0 2px rgba(0,0,0,0.1))');
|
|
412
428
|
this.handleBarHover(event, d);
|
|
413
429
|
})
|
|
414
|
-
.on('mousemove', (event) =>
|
|
430
|
+
.on('mousemove', (event) => {
|
|
431
|
+
// Only update tooltip if initial animation is complete
|
|
432
|
+
if (this._initialAnimationComplete()) {
|
|
433
|
+
this.updateTooltipPosition(event);
|
|
434
|
+
}
|
|
435
|
+
})
|
|
415
436
|
.on('mouseleave', (event, d) => {
|
|
437
|
+
// Only apply hover effects if initial animation is complete
|
|
438
|
+
if (!this._initialAnimationComplete())
|
|
439
|
+
return;
|
|
416
440
|
const barEl = this.d3.select(event.currentTarget).select('rect');
|
|
417
|
-
//
|
|
418
|
-
barEl
|
|
419
|
-
.transition()
|
|
420
|
-
.duration(200)
|
|
421
|
-
.attr('x', (d) => this.xScale(d.label))
|
|
422
|
-
.attr('y', (d) => this.yScale(d.value))
|
|
423
|
-
.attr('width', this.xScale.bandwidth())
|
|
424
|
-
.attr('height', (d) => this.height - this.yScale(d.value));
|
|
441
|
+
// Remove hover effect
|
|
442
|
+
barEl.transition().duration(150).style('filter', null);
|
|
425
443
|
this._tooltipVisible.set(false);
|
|
426
444
|
})
|
|
427
|
-
.on('click', (event, d) =>
|
|
445
|
+
.on('click', (event, d) => {
|
|
446
|
+
// Only trigger click events if initial animation is complete
|
|
447
|
+
if (this._initialAnimationComplete()) {
|
|
448
|
+
this.handleBarClick(event, d);
|
|
449
|
+
}
|
|
450
|
+
});
|
|
428
451
|
// Add animation
|
|
429
452
|
bars
|
|
430
453
|
.transition()
|
|
@@ -432,7 +455,12 @@ class AXBarChartComponent extends NXComponent {
|
|
|
432
455
|
.delay((d, i) => i * 50) // Stagger each bar animation
|
|
433
456
|
.attr('y', (d) => this.yScale(d.value))
|
|
434
457
|
.attr('height', (d) => this.height - this.yScale(d.value))
|
|
435
|
-
.ease(animationEasing)
|
|
458
|
+
.ease(animationEasing) // Use the configured easing function
|
|
459
|
+
.end() // Wait for all animations to complete
|
|
460
|
+
.then(() => {
|
|
461
|
+
// Mark animation as complete to enable hover effects
|
|
462
|
+
this._initialAnimationComplete.set(true);
|
|
463
|
+
});
|
|
436
464
|
}
|
|
437
465
|
/**
|
|
438
466
|
* Gets the appropriate D3 easing function based on the option string
|
|
@@ -495,7 +523,7 @@ class AXBarChartComponent extends NXComponent {
|
|
|
495
523
|
}
|
|
496
524
|
const tooltipRect = tooltipEl.getBoundingClientRect();
|
|
497
525
|
let x = event.clientX - container.left;
|
|
498
|
-
|
|
526
|
+
const y = event.clientY - container.top;
|
|
499
527
|
// Adjust position if near the right edge
|
|
500
528
|
if (x + tooltipRect.width + 10 > container.width) {
|
|
501
529
|
x = x - tooltipRect.width - 10;
|
|
@@ -503,13 +531,6 @@ class AXBarChartComponent extends NXComponent {
|
|
|
503
531
|
else {
|
|
504
532
|
x = x + 10;
|
|
505
533
|
}
|
|
506
|
-
// Adjust vertical position to ensure tooltip stays within container
|
|
507
|
-
if (y + tooltipRect.height / 2 > container.height) {
|
|
508
|
-
y = container.height - tooltipRect.height / 2;
|
|
509
|
-
}
|
|
510
|
-
else if (y - tooltipRect.height / 2 < 0) {
|
|
511
|
-
y = tooltipRect.height / 2;
|
|
512
|
-
}
|
|
513
534
|
this._tooltipPosition.set({ x, y });
|
|
514
535
|
}
|
|
515
536
|
/**
|
|
@@ -532,13 +553,13 @@ class AXBarChartComponent extends NXComponent {
|
|
|
532
553
|
.style('flex-direction', 'column')
|
|
533
554
|
.style('align-items', 'center')
|
|
534
555
|
.style('justify-content', 'center')
|
|
535
|
-
.style('text-align', 'center')
|
|
556
|
+
.style('text-align', 'center')
|
|
557
|
+
.style('background-color', 'rgb(var(--ax-comp-bar-chart-bg-color))');
|
|
536
558
|
// Add an icon
|
|
537
559
|
messageContainer
|
|
538
560
|
.append('div')
|
|
539
561
|
.attr('class', 'ax-bar-chart-no-data-icon')
|
|
540
562
|
.style('margin-bottom', '10px')
|
|
541
|
-
.style('color', 'var(--ax-text-muted, #999)')
|
|
542
563
|
.html('<i class="fa-light fa-chart-bar fa-2x"></i>');
|
|
543
564
|
// Add text message
|
|
544
565
|
messageContainer
|
|
@@ -546,15 +567,14 @@ class AXBarChartComponent extends NXComponent {
|
|
|
546
567
|
.attr('class', 'ax-bar-chart-no-data-text')
|
|
547
568
|
.style('font-size', '16px')
|
|
548
569
|
.style('font-weight', '600')
|
|
549
|
-
.style('color', 'var(--ax-text-color, #333)')
|
|
550
570
|
.text('No data available');
|
|
551
571
|
}
|
|
552
572
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXBarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
553
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.10", type: AXBarChartComponent, isStandalone: true, selector: "ax-bar-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: { barClick: "barClick" }, viewQueries: [{ propertyName: "chartContainerEl", first: true, predicate: ["chartContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-bar-chart\" #chartContainer>\n <!-- Shared tooltip component -->\n <ax-chart-tooltip\n [visible]=\"tooltipVisible()\"\n [position]=\"tooltipPosition()\"\n [data]=\"tooltipData()\"\n [showPercentage]=\"true\"\n ></ax-chart-tooltip>\n</div>\n", styles: ["
|
|
573
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.10", type: AXBarChartComponent, isStandalone: true, selector: "ax-bar-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: { barClick: "barClick" }, viewQueries: [{ propertyName: "chartContainerEl", first: true, predicate: ["chartContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-bar-chart\" #chartContainer>\n <!-- Shared tooltip component -->\n <ax-chart-tooltip\n [visible]=\"tooltipVisible()\"\n [position]=\"tooltipPosition()\"\n [data]=\"tooltipData()\"\n [showPercentage]=\"true\"\n ></ax-chart-tooltip>\n</div>\n", styles: ["ax-bar-chart{display:block;width:100%;height:100%;min-height:200px;--ax-comp-bar-chart-axis-label-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-data-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-grid-lines-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-bg-color: var(--ax-sys-color-lightest-surface)}.ax-bar-chart{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center;border-radius:.5rem;overflow:hidden;color:rgb(var(--ax-sys-color-on-lightest-surface));background-color:rgb(var(--ax-comp-bar-chart-bg-color))}.ax-bar-chart svg{width:100%;height:100%;max-width:100%;max-height:100%;overflow:visible}.ax-bar-chart-no-data-message{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:1rem;width:100%;height:100%;color:rgb(var(--ax-sys-color-on-lightest-surface));background-color:rgb(var(--ax-comp-bar-chart-bg-color))}.ax-bar-chart-no-data-icon{margin-bottom:.75rem;color:rgba(var(--ax-sys-color-on-lightest-surface),.6)}.ax-bar-chart-no-data-text{font-weight:600;color:rgb(var(--ax-sys-color-on-lightest-surface))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: AXChartTooltipComponent, selector: "ax-chart-tooltip", inputs: ["data", "position", "visible", "showPercentage", "style"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
554
574
|
}
|
|
555
575
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXBarChartComponent, decorators: [{
|
|
556
576
|
type: Component,
|
|
557
|
-
args: [{ selector: 'ax-bar-chart',
|
|
577
|
+
args: [{ selector: 'ax-bar-chart', encapsulation: ViewEncapsulation.None, imports: [CommonModule, AXChartTooltipComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ax-bar-chart\" #chartContainer>\n <!-- Shared tooltip component -->\n <ax-chart-tooltip\n [visible]=\"tooltipVisible()\"\n [position]=\"tooltipPosition()\"\n [data]=\"tooltipData()\"\n [showPercentage]=\"true\"\n ></ax-chart-tooltip>\n</div>\n", styles: ["ax-bar-chart{display:block;width:100%;height:100%;min-height:200px;--ax-comp-bar-chart-axis-label-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-data-labels-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-grid-lines-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-bar-chart-bg-color: var(--ax-sys-color-lightest-surface)}.ax-bar-chart{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center;border-radius:.5rem;overflow:hidden;color:rgb(var(--ax-sys-color-on-lightest-surface));background-color:rgb(var(--ax-comp-bar-chart-bg-color))}.ax-bar-chart svg{width:100%;height:100%;max-width:100%;max-height:100%;overflow:visible}.ax-bar-chart-no-data-message{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:1rem;width:100%;height:100%;color:rgb(var(--ax-sys-color-on-lightest-surface));background-color:rgb(var(--ax-comp-bar-chart-bg-color))}.ax-bar-chart-no-data-icon{margin-bottom:.75rem;color:rgba(var(--ax-sys-color-on-lightest-surface),.6)}.ax-bar-chart-no-data-text{font-weight:600;color:rgb(var(--ax-sys-color-on-lightest-surface))}\n"] }]
|
|
558
578
|
}], ctorParameters: () => [] });
|
|
559
579
|
|
|
560
580
|
/**
|