@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
|
@@ -2,7 +2,7 @@ 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, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
|
+
import { InjectionToken, inject, input, output, viewChild, signal, computed, 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
|
|
|
@@ -192,7 +192,14 @@ class AXLineChartComponent extends NXComponent {
|
|
|
192
192
|
.attr('width', '100%')
|
|
193
193
|
.attr('height', '100%')
|
|
194
194
|
.attr('viewBox', `0 0 ${totalWidth} ${totalHeight}`)
|
|
195
|
-
.attr('preserveAspectRatio', 'xMidYMid meet')
|
|
195
|
+
.attr('preserveAspectRatio', 'xMidYMid meet')
|
|
196
|
+
.attr('style', `
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 100%;
|
|
199
|
+
max-width: 100%;
|
|
200
|
+
max-height: 100%;
|
|
201
|
+
overflow: visible;
|
|
202
|
+
`);
|
|
196
203
|
this.svg = svg;
|
|
197
204
|
this.chart = this.svg.append('g').attr('transform', `translate(${this.margin.left},${this.margin.top})`);
|
|
198
205
|
}
|
|
@@ -284,7 +291,18 @@ class AXLineChartComponent extends NXComponent {
|
|
|
284
291
|
.attr('class', 'ax-line-chart-axis-x')
|
|
285
292
|
.attr('transform', `translate(0,${this.height})`)
|
|
286
293
|
.call(this.d3.axisBottom(this.xScale).tickSize(5).tickPadding(8));
|
|
287
|
-
|
|
294
|
+
// Style the x-axis path and lines
|
|
295
|
+
this.xAxis.selectAll('path').attr('stroke', 'rgba(var(--ax-comp-line-chart-axis-color), 0.2)');
|
|
296
|
+
this.xAxis
|
|
297
|
+
.selectAll('line')
|
|
298
|
+
.attr('stroke', 'rgba(var(--ax-comp-line-chart-grid-lines-color), 0.2)')
|
|
299
|
+
.attr('stroke-dasharray', '2,2')
|
|
300
|
+
.attr('stroke-opacity', '0.5');
|
|
301
|
+
this.xAxis.selectAll('text').attr('style', `
|
|
302
|
+
font-size: 11px;
|
|
303
|
+
font-weight: 400;
|
|
304
|
+
fill: rgba(var(--ax-comp-line-chart-labels-color), 0.7);
|
|
305
|
+
`);
|
|
288
306
|
if (options.xAxisLabel) {
|
|
289
307
|
const labelY = this.height + this.margin.bottom * 0.65;
|
|
290
308
|
axesGroup
|
|
@@ -294,9 +312,14 @@ class AXLineChartComponent extends NXComponent {
|
|
|
294
312
|
.attr('dominant-baseline', 'middle')
|
|
295
313
|
.attr('x', this.width / 2)
|
|
296
314
|
.attr('y', labelY)
|
|
297
|
-
.
|
|
298
|
-
.
|
|
299
|
-
.
|
|
315
|
+
.attr('transform', 'translate(0, 5)')
|
|
316
|
+
.attr('font-family', 'var(--ax-font-family, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)')
|
|
317
|
+
.attr('style', `
|
|
318
|
+
font-size: 13px;
|
|
319
|
+
font-weight: 500;
|
|
320
|
+
fill: rgb(var(--ax-comp-line-chart-text-color));
|
|
321
|
+
pointer-events: none;
|
|
322
|
+
`)
|
|
300
323
|
.text(options.xAxisLabel);
|
|
301
324
|
}
|
|
302
325
|
}
|
|
@@ -305,7 +328,18 @@ class AXLineChartComponent extends NXComponent {
|
|
|
305
328
|
.append('g')
|
|
306
329
|
.attr('class', 'ax-line-chart-axis-y')
|
|
307
330
|
.call(this.d3.axisLeft(this.yScale).tickSize(5).tickPadding(8));
|
|
308
|
-
|
|
331
|
+
// Style the y-axis path and lines
|
|
332
|
+
this.yAxis.selectAll('path').attr('stroke', 'rgba(var(--ax-comp-line-chart-axis-color), 0.2)');
|
|
333
|
+
this.yAxis
|
|
334
|
+
.selectAll('line')
|
|
335
|
+
.attr('stroke', 'rgba(var(--ax-comp-line-chart-grid-lines-color), 0.2)')
|
|
336
|
+
.attr('stroke-dasharray', '2,2')
|
|
337
|
+
.attr('stroke-opacity', '0.5');
|
|
338
|
+
this.yAxis.selectAll('text').attr('style', `
|
|
339
|
+
font-size: 11px;
|
|
340
|
+
font-weight: 400;
|
|
341
|
+
fill: rgba(var(--ax-comp-line-chart-labels-color), 0.7);
|
|
342
|
+
`);
|
|
309
343
|
if (options.yAxisLabel) {
|
|
310
344
|
const labelX = -this.height / 2;
|
|
311
345
|
const labelY = -this.margin.left * 0.65;
|
|
@@ -314,29 +348,42 @@ class AXLineChartComponent extends NXComponent {
|
|
|
314
348
|
.attr('class', 'ax-line-chart-axis-label ax-y-axis-label')
|
|
315
349
|
.attr('text-anchor', 'middle')
|
|
316
350
|
.attr('dominant-baseline', 'middle')
|
|
317
|
-
.attr('transform', 'rotate(-90)')
|
|
351
|
+
.attr('transform', 'rotate(-90) translate(-5, 0)')
|
|
318
352
|
.attr('x', labelX)
|
|
319
353
|
.attr('y', labelY)
|
|
320
|
-
.
|
|
321
|
-
.
|
|
322
|
-
|
|
354
|
+
.attr('font-family', 'var(--ax-font-family, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)')
|
|
355
|
+
.attr('style', `
|
|
356
|
+
font-size: 13px;
|
|
357
|
+
font-weight: 500;
|
|
358
|
+
fill: rgb(var(--ax-comp-line-chart-text-color));
|
|
359
|
+
pointer-events: none;
|
|
360
|
+
`)
|
|
323
361
|
.text(options.yAxisLabel);
|
|
324
362
|
}
|
|
325
363
|
}
|
|
326
364
|
if (showGrid) {
|
|
327
|
-
const gridGroup = this.chart
|
|
328
|
-
|
|
365
|
+
const gridGroup = this.chart
|
|
366
|
+
.append('g')
|
|
367
|
+
.attr('class', 'ax-line-chart-grid-container')
|
|
368
|
+
.attr('pointer-events', 'none');
|
|
369
|
+
const yGrid = gridGroup
|
|
329
370
|
.append('g')
|
|
330
371
|
.attr('class', 'ax-line-chart-grid')
|
|
331
372
|
.call(this.d3
|
|
332
373
|
.axisLeft(this.yScale)
|
|
333
374
|
.tickSize(-this.width)
|
|
334
375
|
.tickFormat(() => '')
|
|
335
|
-
.tickValues(this.yScale.ticks()))
|
|
376
|
+
.tickValues(this.yScale.ticks()));
|
|
377
|
+
// Style the grid path and lines
|
|
378
|
+
yGrid.selectAll('path').attr('stroke-width', '0');
|
|
379
|
+
yGrid
|
|
336
380
|
.selectAll('.tick')
|
|
337
|
-
.
|
|
381
|
+
.selectAll('line')
|
|
382
|
+
.attr('stroke', 'rgba(var(--ax-comp-line-chart-grid-lines-color), 0.2)')
|
|
383
|
+
.attr('stroke-dasharray', '2,2')
|
|
384
|
+
.attr('stroke-opacity', '0.5');
|
|
338
385
|
if (options.showVerticalGrid) {
|
|
339
|
-
gridGroup
|
|
386
|
+
const xGrid = gridGroup
|
|
340
387
|
.append('g')
|
|
341
388
|
.attr('class', 'ax-line-chart-grid-vertical')
|
|
342
389
|
.attr('transform', `translate(0,${this.height})`)
|
|
@@ -344,9 +391,15 @@ class AXLineChartComponent extends NXComponent {
|
|
|
344
391
|
.axisBottom(this.xScale)
|
|
345
392
|
.tickSize(-this.height)
|
|
346
393
|
.tickFormat(() => '')
|
|
347
|
-
.tickValues(isBandScale ? undefined : this.xScale.ticks()))
|
|
394
|
+
.tickValues(isBandScale ? undefined : this.xScale.ticks()));
|
|
395
|
+
// Style the vertical grid path and lines
|
|
396
|
+
xGrid.selectAll('path').attr('stroke-width', '0');
|
|
397
|
+
xGrid
|
|
348
398
|
.selectAll('.tick')
|
|
349
|
-
.
|
|
399
|
+
.selectAll('line')
|
|
400
|
+
.attr('stroke', 'rgba(var(--ax-comp-line-chart-grid-lines-color), 0.15)')
|
|
401
|
+
.attr('stroke-dasharray', '2,2')
|
|
402
|
+
.attr('stroke-opacity', '0.5');
|
|
350
403
|
}
|
|
351
404
|
}
|
|
352
405
|
}
|
|
@@ -375,13 +428,21 @@ class AXLineChartComponent extends NXComponent {
|
|
|
375
428
|
if (this.effectiveOptions().smoothLine !== false) {
|
|
376
429
|
areaGenerator.curve(this.d3.curveMonotoneX);
|
|
377
430
|
}
|
|
378
|
-
|
|
379
|
-
|
|
431
|
+
// Add class to chart container to disable pointer events during animation
|
|
432
|
+
this.svg.attr('class', 'ax-line-chart-animating');
|
|
433
|
+
const allSeriesGroup = this.chart
|
|
434
|
+
.append('g')
|
|
435
|
+
.attr('class', 'ax-line-chart-all-series')
|
|
436
|
+
.attr('pointer-events', 'none'); // Disable pointer events during animation
|
|
437
|
+
const allPointsGroup = this.chart
|
|
438
|
+
.append('g')
|
|
439
|
+
.attr('class', 'ax-line-chart-all-points')
|
|
440
|
+
.attr('pointer-events', 'none'); // Disable pointer events during animation
|
|
380
441
|
if (this.effectiveOptions().showCrosshair === true) {
|
|
381
442
|
const crosshairGroup = this.chart
|
|
382
443
|
.append('g')
|
|
383
444
|
.attr('class', 'ax-line-chart-crosshair')
|
|
384
|
-
.
|
|
445
|
+
.attr('pointer-events', 'none');
|
|
385
446
|
}
|
|
386
447
|
// Get animation options
|
|
387
448
|
const animationDuration = this.effectiveOptions().animationDuration;
|
|
@@ -392,7 +453,8 @@ class AXLineChartComponent extends NXComponent {
|
|
|
392
453
|
const seriesGroup = allSeriesGroup
|
|
393
454
|
.append('g')
|
|
394
455
|
.attr('class', `ax-line-chart-series ax-line-chart-series-${seriesIndex}`)
|
|
395
|
-
.attr('data-series', series.label || `series-${seriesIndex}`)
|
|
456
|
+
.attr('data-series', series.label || `series-${seriesIndex}`)
|
|
457
|
+
.attr('pointer-events', 'none'); // Disable pointer events during animation
|
|
396
458
|
const lineColor = series.lineColor || AXPLineChartColors.getColor(seriesIndex);
|
|
397
459
|
const fillColor = series.fillColor || lineColor;
|
|
398
460
|
const line = seriesGroup
|
|
@@ -401,8 +463,26 @@ class AXLineChartComponent extends NXComponent {
|
|
|
401
463
|
.attr('class', 'ax-line-chart-line')
|
|
402
464
|
.attr('stroke', lineColor)
|
|
403
465
|
.attr('stroke-width', this.effectiveOptions().lineWidth ?? 2)
|
|
466
|
+
.attr('stroke-linejoin', 'round')
|
|
467
|
+
.attr('stroke-linecap', 'round')
|
|
404
468
|
.attr('d', lineGenerator)
|
|
405
|
-
.attr('fill', 'none')
|
|
469
|
+
.attr('fill', 'none')
|
|
470
|
+
.attr('style', 'transition: stroke-width 0.3s ease;')
|
|
471
|
+
.attr('pointer-events', 'none'); // Disable pointer events during animation
|
|
472
|
+
// Setup hover listener
|
|
473
|
+
line
|
|
474
|
+
.on('mouseenter', () => {
|
|
475
|
+
line
|
|
476
|
+
.transition()
|
|
477
|
+
.duration(150)
|
|
478
|
+
.attr('stroke-width', (this.effectiveOptions().lineWidth ?? 2) * 1.5);
|
|
479
|
+
})
|
|
480
|
+
.on('mouseleave', () => {
|
|
481
|
+
line
|
|
482
|
+
.transition()
|
|
483
|
+
.duration(150)
|
|
484
|
+
.attr('stroke-width', this.effectiveOptions().lineWidth ?? 2);
|
|
485
|
+
});
|
|
406
486
|
const totalLength = line.node().getTotalLength();
|
|
407
487
|
line
|
|
408
488
|
.attr('stroke-dasharray', totalLength + ' ' + totalLength)
|
|
@@ -410,7 +490,11 @@ class AXLineChartComponent extends NXComponent {
|
|
|
410
490
|
.transition()
|
|
411
491
|
.duration(animationDuration)
|
|
412
492
|
.ease(animationEasing)
|
|
413
|
-
.attr('stroke-dashoffset', 0)
|
|
493
|
+
.attr('stroke-dashoffset', 0)
|
|
494
|
+
.on('end', function () {
|
|
495
|
+
// Enable pointer events after animation completes
|
|
496
|
+
line.attr('pointer-events', 'all');
|
|
497
|
+
});
|
|
414
498
|
if (this.effectiveOptions().fillArea) {
|
|
415
499
|
const area = seriesGroup
|
|
416
500
|
.append('path')
|
|
@@ -418,12 +502,32 @@ class AXLineChartComponent extends NXComponent {
|
|
|
418
502
|
.attr('class', 'ax-line-chart-area')
|
|
419
503
|
.attr('fill', fillColor)
|
|
420
504
|
.attr('opacity', 0)
|
|
421
|
-
.attr('d', areaGenerator)
|
|
505
|
+
.attr('d', areaGenerator)
|
|
506
|
+
.attr('style', 'transition: opacity 0.3s ease;')
|
|
507
|
+
.attr('pointer-events', 'none'); // Disable pointer events during animation
|
|
508
|
+
// Setup hover listener
|
|
509
|
+
area
|
|
510
|
+
.on('mouseenter', () => {
|
|
511
|
+
area
|
|
512
|
+
.transition()
|
|
513
|
+
.duration(150)
|
|
514
|
+
.attr('opacity', ((this.effectiveOptions().fillOpacity ?? 20) / 100) * 1.5);
|
|
515
|
+
})
|
|
516
|
+
.on('mouseleave', () => {
|
|
517
|
+
area
|
|
518
|
+
.transition()
|
|
519
|
+
.duration(150)
|
|
520
|
+
.attr('opacity', (this.effectiveOptions().fillOpacity ?? 20) / 100);
|
|
521
|
+
});
|
|
422
522
|
area
|
|
423
523
|
.transition()
|
|
424
524
|
.duration(animationDuration)
|
|
425
525
|
.ease(animationEasing)
|
|
426
|
-
.attr('opacity', (this.effectiveOptions().fillOpacity ?? 20) / 100)
|
|
526
|
+
.attr('opacity', (this.effectiveOptions().fillOpacity ?? 20) / 100)
|
|
527
|
+
.on('end', function () {
|
|
528
|
+
// Enable pointer events after animation completes
|
|
529
|
+
area.attr('pointer-events', 'all');
|
|
530
|
+
});
|
|
427
531
|
}
|
|
428
532
|
});
|
|
429
533
|
if (this.effectiveOptions().showPoints !== false) {
|
|
@@ -448,13 +552,17 @@ class AXLineChartComponent extends NXComponent {
|
|
|
448
552
|
});
|
|
449
553
|
});
|
|
450
554
|
});
|
|
555
|
+
// Create a counter to track animation completion
|
|
556
|
+
let animationCounter = 0;
|
|
557
|
+
const totalSeriesCount = data.length;
|
|
451
558
|
data.forEach((series, seriesIndex) => {
|
|
452
559
|
if (!series.data || series.data.length === 0)
|
|
453
560
|
return;
|
|
454
561
|
const lineColor = series.lineColor || AXPLineChartColors.getColor(seriesIndex);
|
|
455
562
|
const pointsGroup = allPointsGroup
|
|
456
563
|
.append('g')
|
|
457
|
-
.attr('class', `ax-line-chart-points ax-line-chart-points-${seriesIndex}`)
|
|
564
|
+
.attr('class', `ax-line-chart-points ax-line-chart-points-${seriesIndex}`)
|
|
565
|
+
.attr('pointer-events', 'none'); // Disable pointer events during animation
|
|
458
566
|
pointsGroup
|
|
459
567
|
.on('mouseenter', () => this.handlePointGroupEnter(seriesIndex, lineColor))
|
|
460
568
|
.on('mouseleave', () => this.handlePointGroupLeave());
|
|
@@ -475,6 +583,7 @@ class AXLineChartComponent extends NXComponent {
|
|
|
475
583
|
.attr('data-x', (d) => d.x)
|
|
476
584
|
.attr('data-y', (d) => d.y)
|
|
477
585
|
.style('cursor', 'pointer')
|
|
586
|
+
.attr('pointer-events', 'none') // Disable pointer events during animation
|
|
478
587
|
.on('mouseenter', (event, d) => {
|
|
479
588
|
const x = getX(d);
|
|
480
589
|
const y = this.yScale(d.y);
|
|
@@ -490,7 +599,9 @@ class AXLineChartComponent extends NXComponent {
|
|
|
490
599
|
.select(event.target)
|
|
491
600
|
.transition()
|
|
492
601
|
.duration(150)
|
|
493
|
-
.attr('r', (this.effectiveOptions().pointRadius ?? 4) * 1.5)
|
|
602
|
+
.attr('r', (this.effectiveOptions().pointRadius ?? 4) * 1.5)
|
|
603
|
+
.attr('stroke-width', 2)
|
|
604
|
+
.attr('stroke', `rgb(var(--ax-comp-line-chart-bg-color))`);
|
|
494
605
|
})
|
|
495
606
|
.on('mousemove', (event) => this.updateTooltipPosition(event))
|
|
496
607
|
.on('mouseleave', (event) => {
|
|
@@ -499,7 +610,9 @@ class AXLineChartComponent extends NXComponent {
|
|
|
499
610
|
.select(event.target)
|
|
500
611
|
.transition()
|
|
501
612
|
.duration(150)
|
|
502
|
-
.attr('r', this.effectiveOptions().pointRadius ?? 4)
|
|
613
|
+
.attr('r', this.effectiveOptions().pointRadius ?? 4)
|
|
614
|
+
.attr('stroke-width', 1)
|
|
615
|
+
.attr('stroke', '#fff');
|
|
503
616
|
})
|
|
504
617
|
.on('click', (event, d) => {
|
|
505
618
|
const x = getX(d);
|
|
@@ -519,9 +632,39 @@ class AXLineChartComponent extends NXComponent {
|
|
|
519
632
|
.delay((d, i) => i * Math.min(50, animationDuration * 0.05) + animationDuration * 0.5)
|
|
520
633
|
.duration(animationDuration * 0.3)
|
|
521
634
|
.ease(animationEasing)
|
|
522
|
-
.attr('r', this.effectiveOptions().pointRadius ?? 4)
|
|
635
|
+
.attr('r', this.effectiveOptions().pointRadius ?? 4)
|
|
636
|
+
.on('end', (d, i, nodes) => {
|
|
637
|
+
// When the last point finishes animating
|
|
638
|
+
if (i === nodes.length - 1) {
|
|
639
|
+
animationCounter++;
|
|
640
|
+
// If this is the last series, enable all pointer events
|
|
641
|
+
if (animationCounter >= totalSeriesCount) {
|
|
642
|
+
// Enable pointer events for all elements after all animations have completed
|
|
643
|
+
this.enablePointerEventsAfterAnimation();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
});
|
|
523
647
|
});
|
|
524
648
|
}
|
|
649
|
+
else {
|
|
650
|
+
// If not showing points, wait for line animations to complete
|
|
651
|
+
setTimeout(() => {
|
|
652
|
+
// Enable pointer events for all elements after animation duration
|
|
653
|
+
this.enablePointerEventsAfterAnimation();
|
|
654
|
+
}, animationDuration + 100);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
enablePointerEventsAfterAnimation() {
|
|
658
|
+
// Enable pointer events for all chart elements after animation completes
|
|
659
|
+
this.chart.selectAll('.ax-line-chart-all-series').attr('pointer-events', 'all');
|
|
660
|
+
this.chart.selectAll('.ax-line-chart-series').attr('pointer-events', 'all');
|
|
661
|
+
this.chart.selectAll('.ax-line-chart-line').attr('pointer-events', 'all');
|
|
662
|
+
this.chart.selectAll('.ax-line-chart-area').attr('pointer-events', 'all');
|
|
663
|
+
this.chart.selectAll('.ax-line-chart-all-points').attr('pointer-events', 'all');
|
|
664
|
+
this.chart.selectAll('.ax-line-chart-points').attr('pointer-events', 'all');
|
|
665
|
+
this.chart.selectAll('.ax-line-chart-point').attr('pointer-events', 'all');
|
|
666
|
+
// Remove the animating class from the SVG
|
|
667
|
+
this.svg.classed('ax-line-chart-animating', false);
|
|
525
668
|
}
|
|
526
669
|
handlePointGroupEnter(seriesIndex, color) {
|
|
527
670
|
this.chart
|
|
@@ -581,7 +724,7 @@ class AXLineChartComponent extends NXComponent {
|
|
|
581
724
|
const y = this.yScale(dataPoint.y);
|
|
582
725
|
let crosshairGroup = this.chart.select('.ax-line-chart-crosshair');
|
|
583
726
|
if (crosshairGroup.empty()) {
|
|
584
|
-
crosshairGroup = this.chart.append('g').attr('class', 'ax-line-chart-crosshair').
|
|
727
|
+
crosshairGroup = this.chart.append('g').attr('class', 'ax-line-chart-crosshair').attr('pointer-events', 'none');
|
|
585
728
|
}
|
|
586
729
|
crosshairGroup.selectAll('*').remove();
|
|
587
730
|
crosshairGroup
|
|
@@ -591,11 +734,11 @@ class AXLineChartComponent extends NXComponent {
|
|
|
591
734
|
.attr('y1', 0)
|
|
592
735
|
.attr('x2', x)
|
|
593
736
|
.attr('y2', this.height)
|
|
594
|
-
.attr('stroke', '
|
|
737
|
+
.attr('stroke', 'rgba(var(--ax-comp-line-chart-grid-lines-color), 0.5)')
|
|
595
738
|
.attr('stroke-width', 1)
|
|
596
739
|
.attr('stroke-dasharray', '3,3')
|
|
597
740
|
.attr('opacity', 0.7)
|
|
598
|
-
.
|
|
741
|
+
.attr('pointer-events', 'none');
|
|
599
742
|
crosshairGroup
|
|
600
743
|
.append('line')
|
|
601
744
|
.attr('class', 'ax-line-chart-crosshair-horizontal')
|
|
@@ -603,11 +746,11 @@ class AXLineChartComponent extends NXComponent {
|
|
|
603
746
|
.attr('y1', y)
|
|
604
747
|
.attr('x2', this.width)
|
|
605
748
|
.attr('y2', y)
|
|
606
|
-
.attr('stroke', '
|
|
749
|
+
.attr('stroke', 'rgba(var(--ax-comp-line-chart-grid-lines-color), 0.5)')
|
|
607
750
|
.attr('stroke-width', 1)
|
|
608
751
|
.attr('stroke-dasharray', '3,3')
|
|
609
752
|
.attr('opacity', 0.7)
|
|
610
|
-
.
|
|
753
|
+
.attr('pointer-events', 'none');
|
|
611
754
|
}
|
|
612
755
|
updateTooltipPosition(event) {
|
|
613
756
|
const container = this.chartContainerEl().nativeElement.getBoundingClientRect();
|
|
@@ -620,19 +763,15 @@ class AXLineChartComponent extends NXComponent {
|
|
|
620
763
|
}
|
|
621
764
|
const tooltipRect = tooltipEl.getBoundingClientRect();
|
|
622
765
|
let x = event.clientX - container.left;
|
|
623
|
-
|
|
624
|
-
if (x + tooltipRect.width +
|
|
625
|
-
x = x - tooltipRect.width -
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}
|
|
633
|
-
else if (y - tooltipRect.height / 2 < 0) {
|
|
634
|
-
y = tooltipRect.height / 2;
|
|
635
|
-
}
|
|
766
|
+
const y = event.clientY - container.top;
|
|
767
|
+
if (x + tooltipRect.width + 20 > container.width) {
|
|
768
|
+
x = x - tooltipRect.width - 15;
|
|
769
|
+
}
|
|
770
|
+
// if (y + tooltipRect.height / 2 > container.height) {
|
|
771
|
+
// y = container.height - tooltipRect.height / 2;
|
|
772
|
+
// } else if (y - tooltipRect.height / 2 < 0) {
|
|
773
|
+
// y = tooltipRect.height / 2;
|
|
774
|
+
// }
|
|
636
775
|
this._tooltipPosition.set({ x, y });
|
|
637
776
|
}
|
|
638
777
|
handlePointClick(event, dataPoint, series) {
|
|
@@ -649,26 +788,25 @@ class AXLineChartComponent extends NXComponent {
|
|
|
649
788
|
const messageContainer = this.d3
|
|
650
789
|
.select(containerElement)
|
|
651
790
|
.append('div')
|
|
652
|
-
.attr('class', '
|
|
653
|
-
.
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
791
|
+
.attr('class', 'ax-line-chart-no-data-message')
|
|
792
|
+
.attr('style', `
|
|
793
|
+
width: 100%;
|
|
794
|
+
height: 100%;
|
|
795
|
+
display: flex;
|
|
796
|
+
flex-direction: column;
|
|
797
|
+
align-items: center;
|
|
798
|
+
justify-content: center;
|
|
799
|
+
text-align: center;
|
|
800
|
+
`);
|
|
660
801
|
messageContainer
|
|
661
802
|
.append('div')
|
|
662
|
-
.attr('class', '
|
|
663
|
-
.
|
|
664
|
-
.style('color', 'var(--ax-text-muted, #999)')
|
|
803
|
+
.attr('class', 'ax-line-chart-no-data-icon')
|
|
804
|
+
.attr('style', 'margin-bottom: 0.75rem;')
|
|
665
805
|
.html('<i class="fa-light fa-chart-line fa-2x"></i>');
|
|
666
806
|
messageContainer
|
|
667
807
|
.append('div')
|
|
668
|
-
.attr('class', '
|
|
669
|
-
.
|
|
670
|
-
.style('font-weight', '600')
|
|
671
|
-
.style('color', 'var(--ax-text-color, #333)')
|
|
808
|
+
.attr('class', 'ax-line-chart-no-data-text')
|
|
809
|
+
.attr('style', 'font-size: 16px; font-weight: 600;')
|
|
672
810
|
.text('No data available');
|
|
673
811
|
}
|
|
674
812
|
handleOverlappingPointsHover(event, overlappingPoints) {
|
|
@@ -676,7 +814,7 @@ class AXLineChartComponent extends NXComponent {
|
|
|
676
814
|
return;
|
|
677
815
|
const tooltipData = {
|
|
678
816
|
title: 'Multiple Series',
|
|
679
|
-
value:
|
|
817
|
+
value: overlappingPoints[0].point.y.toString(),
|
|
680
818
|
seriesName: '',
|
|
681
819
|
color: '',
|
|
682
820
|
items: overlappingPoints.map(({ point, series, seriesIndex }) => {
|
|
@@ -723,11 +861,11 @@ class AXLineChartComponent extends NXComponent {
|
|
|
723
861
|
}
|
|
724
862
|
}
|
|
725
863
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLineChartComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
726
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.10", 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: ["
|
|
864
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.10", 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:200px;--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: var(--ax-sys-color-lightest-surface);--ax-comp-line-chart-text-color: var(--ax-sys-color-on-lightest-surface)}.ax-line-chart{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center;border-radius:.5rem;overflow:hidden;color:rgb(var(--ax-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}.ax-line-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-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}.ax-line-chart-no-data-icon{margin-bottom:.75rem;color:rgba(var(--ax-comp-line-chart-text-color),.6)}.ax-line-chart-no-data-text{font-weight:600;color:rgb(var(--ax-comp-line-chart-text-color))}\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 });
|
|
727
865
|
}
|
|
728
866
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXLineChartComponent, decorators: [{
|
|
729
867
|
type: Component,
|
|
730
|
-
args: [{ selector: 'ax-line-chart', standalone: true, imports: [CommonModule, 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: ["
|
|
868
|
+
args: [{ selector: 'ax-line-chart', standalone: true, encapsulation: ViewEncapsulation.None, imports: [CommonModule, 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:200px;--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: var(--ax-sys-color-lightest-surface);--ax-comp-line-chart-text-color: var(--ax-sys-color-on-lightest-surface)}.ax-line-chart{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center;border-radius:.5rem;overflow:hidden;color:rgb(var(--ax-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}.ax-line-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-comp-line-chart-text-color));background-color:rgb(var(--ax-comp-line-chart-bg-color))}.ax-line-chart-no-data-icon{margin-bottom:.75rem;color:rgba(var(--ax-comp-line-chart-text-color),.6)}.ax-line-chart-no-data-text{font-weight:600;color:rgb(var(--ax-comp-line-chart-text-color))}\n"] }]
|
|
731
869
|
}] });
|
|
732
870
|
|
|
733
871
|
/**
|