axidio-styleguide-library1-v2 0.2.28 → 0.2.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.
@@ -3379,6 +3379,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3379
3379
  class GroupChartComponent extends ComponentUniqueId {
3380
3380
  constructor() {
3381
3381
  super();
3382
+ this.customChartConfiguration = {};
3382
3383
  this.clickEvent = new EventEmitter();
3383
3384
  this.headerMenuclickEvent = new EventEmitter();
3384
3385
  this.isHeaderVisible = true;
@@ -3386,6 +3387,18 @@ class GroupChartComponent extends ComponentUniqueId {
3386
3387
  this.isTransparentBackground = false;
3387
3388
  this.chartConfiguration = {};
3388
3389
  this.objectKeys = Object.keys;
3390
+ this.CONSTANTS = {
3391
+ SHORT_TICK_LENGTH: 4,
3392
+ LONG_TICK_LENGTH: 16,
3393
+ SHORT_TICK_LENGTH_BG: 5,
3394
+ LONG_TICK_LENGTH_BG: 30,
3395
+ LEFT_RIGHT_SPACES: 50,
3396
+ RIGHT_SVG_WIDTH: 60,
3397
+ ZOOM_WIDTH_MULTIPLIER: 40,
3398
+ DRILLDOWN_WIDTH_MULTIPLIER: 160,
3399
+ MIN_BAR_WIDTH_SINGLE: 200,
3400
+ MIN_BAR_WIDTH_MULTIPLE: 125,
3401
+ };
3389
3402
  this.defaultConfiguration = {
3390
3403
  margin: { top: 20, right: 20, bottom: 20, left: 40 },
3391
3404
  labelFormatter: ChartHelper.defaultFormatter,
@@ -3398,22 +3411,9 @@ class GroupChartComponent extends ComponentUniqueId {
3398
3411
  showLineChartAxis: true,
3399
3412
  showValues: true,
3400
3413
  headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
3401
- xAxisGrid: undefined,
3402
3414
  yAxisGrid: false,
3403
3415
  legendVisible: true,
3404
- isHeaderVisible: undefined,
3405
- isTransparentBackground: undefined,
3406
- isMultiChartGridLine: undefined,
3407
- isFullScreen: undefined,
3408
- customYscale: undefined,
3409
- textsOnBar: undefined,
3410
- isXaxisLabelHidden: undefined,
3411
3416
  isYaxisLabelHidden: false,
3412
- isYaxisHidden: undefined,
3413
- isYaxisDashed: undefined,
3414
- textFormatter: undefined,
3415
- isNoAlternateXaxisText: undefined,
3416
- isXgridBetweenLabels: undefined,
3417
3417
  backgroundColor: '#FFFFFF',
3418
3418
  hideLegendOnTop: true,
3419
3419
  isXaxisColor: '#999999',
@@ -3421,190 +3421,141 @@ class GroupChartComponent extends ComponentUniqueId {
3421
3421
  noHoverEffect: true,
3422
3422
  noHoverDisplayData: true,
3423
3423
  showXaxisTop: true,
3424
- displayYaxisLabels: undefined,
3425
- xLabelsOnSameLine: undefined,
3426
- textAlwaysHorizontal: undefined,
3427
- legendAtTopRight: undefined,
3428
- isDrilldownChart: undefined,
3429
- displayTitleOnTop: undefined,
3430
- isToggleVisible: undefined,
3431
- isTitleHidden: undefined,
3432
- isDisplayBarDetailsAtBottom: undefined,
3433
3424
  howmanyBarDetailsToDisplay: 0,
3434
- barVauleColor: undefined,
3435
3425
  };
3436
3426
  this.uniqueId = this.getUniqueId();
3437
3427
  this.isZoomedOut = false;
3438
3428
  this.isDD1Open = false;
3439
3429
  this.isDD2Open = false;
3440
- this.keepOrder = (a, b) => {
3441
- return a;
3442
- };
3430
+ this.keepOrder = (a) => a;
3431
+ }
3432
+ ngOnInit() {
3433
+ this.initializeConfiguration();
3434
+ }
3435
+ get isAlertEnabled() {
3436
+ return this.chartConfiguration?.headerMenuOptions?.some((option) => option.id === 'editAlert');
3443
3437
  }
3444
3438
  onResized(event) {
3445
- let self = this;
3446
- setTimeout(function () {
3447
- d3.select('#' + self.uniqueId).remove();
3448
- self.initializegroupChart();
3449
- }.bind(self), 10);
3439
+ setTimeout(() => {
3440
+ d3.select('#' + this.uniqueId).remove();
3441
+ this.initializegroupChart();
3442
+ }, 10);
3450
3443
  }
3451
- isZoomOutSelected(isZoomOut, event) {
3444
+ handleZoominZoomoutClick({ isZoomOut, event }) {
3452
3445
  this.isZoomedOut = isZoomOut;
3453
3446
  this.onResized(event);
3454
3447
  }
3455
- handleZoominZoomoutClick({ isZoomOut, event }) {
3456
- this.isZoomOutSelected(isZoomOut, event);
3457
- }
3458
- ngOnInit() { }
3459
3448
  isLegendVisible() {
3460
- if (this.chartData &&
3461
- this.chartData.metaData.colors &&
3462
- Object.keys(this.chartData.metaData.colors).length > 1) {
3463
- return true;
3464
- }
3465
- return false;
3449
+ return !!(this.chartData?.metaData?.colors &&
3450
+ Object.keys(this.chartData.metaData.colors).length > 1);
3466
3451
  }
3467
- get isAlertEnabled() {
3468
- return this.chartConfiguration?.headerMenuOptions?.some(option => option.id === 'editAlert');
3452
+ initializeConfiguration() {
3453
+ for (const key in this.defaultConfiguration) {
3454
+ this.chartConfiguration[key] = ChartHelper.getValueByConfigurationType(key, this.defaultConfiguration, this.customChartConfiguration);
3455
+ }
3456
+ if (this.chartConfiguration.isHeaderVisible !== undefined) {
3457
+ this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
3458
+ }
3459
+ if (this.chartConfiguration.legendVisible !== undefined) {
3460
+ this.legendVisible = this.chartConfiguration.legendVisible;
3461
+ }
3462
+ if (this.chartConfiguration.isTransparentBackground !== undefined) {
3463
+ this.isTransparentBackground = this.chartConfiguration.isTransparentBackground;
3464
+ }
3469
3465
  }
3470
3466
  initializegroupChart() {
3471
- var self = this;
3472
- let data = [];
3473
- let metaData = null;
3474
- let keyList = null;
3475
- let lineData = null;
3476
- let colorMap = {};
3477
- var formatFromBackend;
3478
- var formatForHugeNumbers;
3479
- let isria = this.customChartConfiguration.isRia;
3480
- var x;
3481
- var alternate_text = false;
3482
- var short_tick_length = 4;
3483
- var long_tick_length = 16;
3484
- /**
3485
- * longer tick length needed for weekly charts
3486
- */
3487
- var short_tick_length_bg = 5;
3488
- var long_tick_length_bg = 30;
3489
- var leftAndRightSpaces = 50;
3490
- var rightSvgWidth = 60;
3491
- var tempScale;
3492
- for (var i in this.defaultConfiguration) {
3493
- this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
3494
- }
3495
- data = this.chartData.data;
3496
- metaData = this.chartData.metaData;
3497
- lineData = this.chartData.lineData;
3498
- // if (lineData || this.chartData.targetLineData) {
3499
- // rightSvgWidth = 60;
3500
- // }
3467
+ const data = this.chartData.data;
3468
+ const metaData = this.prepareMetaData(this.chartData.metaData);
3469
+ const lineData = this.chartData.lineData;
3470
+ const isRia = this.chartConfiguration.isRia || false;
3471
+ const { width, height } = this.calculateDimensions();
3472
+ const { svg, svgYAxisLeft, svgYAxisRight } = this.createSvgContainers(width, height);
3473
+ const scales = this.createScales(data, metaData, width, height, lineData);
3474
+ this.renderAxes(svg, svgYAxisLeft, svgYAxisRight, scales, width, height);
3475
+ this.renderBars(svg, data, metaData, scales, isRia);
3476
+ this.renderLabels(svg, svgYAxisLeft, svgYAxisRight, metaData, width, height, scales);
3477
+ this.renderTargetLine(svg, svgYAxisRight, scales.y, width);
3478
+ this.renderLineGraph(svg, lineData, metaData, scales, isRia);
3479
+ }
3480
+ prepareMetaData(metaData) {
3501
3481
  if (!metaData.colorAboveTarget) {
3502
- metaData['colorAboveTarget'] = metaData.colors;
3482
+ metaData.colorAboveTarget = metaData.colors;
3503
3483
  }
3504
- colorMap = metaData.colors;
3505
- keyList = metaData.keyList;
3506
- var chartContainer = d3.select(this.containerElt.nativeElement);
3507
- var verticalstackedcontainer = d3.select(this.groupcontainerElt.nativeElement);
3508
- var margin = this.chartConfiguration.margin;
3509
- var width = parseInt(chartContainer.style('width')) - margin.left - margin.right;
3510
- if (this.chartData.data.length > 30 && this.isZoomedOut) {
3511
- width =
3512
- width > this.chartData.data.length * 40
3513
- ? this.chartData.dropdownData1
3514
- ? this.chartData.data.length * 60
3515
- : width
3516
- : this.chartData.dropdownData1
3517
- ? this.chartData.data.length * 60
3518
- : this.chartData.data.length * 40;
3519
- width =
3520
- width > this.chartData.data.length * 40
3521
- ? width
3522
- : this.chartData.data.length * 40;
3484
+ return metaData;
3485
+ }
3486
+ calculateDimensions() {
3487
+ const chartContainer = d3.select(this.containerElt.nativeElement);
3488
+ const verticalstackedcontainer = d3.select(this.groupcontainerElt.nativeElement);
3489
+ const margin = this.chartConfiguration.margin;
3490
+ let width = parseInt(chartContainer.style('width')) - margin.left - margin.right;
3491
+ width = this.adjustWidthForZoom(width);
3492
+ let height = this.calculateHeight(verticalstackedcontainer, margin);
3493
+ return { width, height };
3494
+ }
3495
+ adjustWidthForZoom(width) {
3496
+ const dataLength = this.chartData.data.length;
3497
+ if (dataLength > 30 && this.isZoomedOut) {
3498
+ const baseWidth = dataLength * this.CONSTANTS.ZOOM_WIDTH_MULTIPLIER;
3499
+ const dropdownWidth = this.chartData.dropdownData1 ? dataLength * 60 : baseWidth;
3500
+ width = Math.max(width, dropdownWidth);
3523
3501
  }
3524
- if (this.chartData.dropdownData2 &&
3525
- width < this.chartData.data.length * 120 &&
3526
- this.isZoomedOut) {
3527
- width = this.chartData.data.length * 120;
3502
+ if (this.chartData.dropdownData2 && width < dataLength * 120 && this.isZoomedOut) {
3503
+ width = dataLength * 120;
3528
3504
  }
3529
- if (this.chartData.data.length > 8 && !this.isZoomedOut) {
3530
- if (this.chartData.dropdownData2 &&
3531
- width < this.chartData.data.length * 250) {
3532
- width = this.chartData.data.length * 250;
3533
- }
3534
- else
3535
- width = this.chartData.data.length * 160;
3505
+ if (dataLength > 8 && !this.isZoomedOut) {
3506
+ width = this.chartData.dropdownData2 && width < dataLength * 250
3507
+ ? dataLength * 250
3508
+ : dataLength * this.CONSTANTS.DRILLDOWN_WIDTH_MULTIPLIER;
3536
3509
  }
3537
- // if (this.chartData.data.length > 8) {
3538
- // width = this.chartData.data.length * 140;
3539
- // }
3540
- var height = parseInt(verticalstackedcontainer.style('height')) *
3541
- (self.chartConfiguration.svgHeight / 100) -
3542
- margin.top -
3543
- margin.bottom;
3544
- /**
3545
- * entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
3546
- */
3547
- if (this.chartConfiguration.isFullScreen != undefined &&
3548
- this.chartConfiguration.isFullScreen) {
3549
- height =
3550
- this.chartConfiguration.svgHeight != 70
3551
- ? this.chartConfiguration.svgHeight
3552
- : parseInt(verticalstackedcontainer.style('height'));
3510
+ return width;
3511
+ }
3512
+ calculateHeight(container, margin) {
3513
+ let height = parseInt(container.style('height')) *
3514
+ (this.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
3515
+ if (this.chartConfiguration.isFullScreen && this.chartConfiguration.svgHeight !== 70) {
3516
+ height = this.chartConfiguration.svgHeight;
3517
+ }
3518
+ else if (this.chartConfiguration.isFullScreen) {
3519
+ height = parseInt(container.style('height'));
3553
3520
  }
3554
3521
  if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
3555
- height =
3556
- parseInt(verticalstackedcontainer.style('height')) -
3557
- margin.top -
3558
- margin.bottom -
3559
- 130;
3522
+ height = parseInt(container.style('height')) - margin.top - margin.bottom - 130;
3560
3523
  }
3561
3524
  if (this.chartConfiguration.isHeaderVisible) {
3562
- height =
3563
- parseInt(verticalstackedcontainer.style('height')) -
3564
- margin.top -
3565
- margin.bottom -
3566
- 100;
3567
- }
3568
- /**
3569
- * for hiding header
3570
- * used by weekly charts
3571
- */
3572
- if (this.chartConfiguration.isHeaderVisible != undefined)
3573
- this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
3574
- /**
3575
- * for hiding legends
3576
- * used by weekly charts
3577
- */
3578
- if (this.chartConfiguration.legendVisible != undefined) {
3579
- this.legendVisible = this.chartConfiguration.legendVisible;
3580
- }
3581
- /**
3582
- * for removing background color so that it can take parents color
3583
- *
3584
- */
3585
- if (this.chartConfiguration.isTransparentBackground != undefined) {
3586
- this.isTransparentBackground =
3587
- this.chartConfiguration.isTransparentBackground;
3588
- }
3589
- /**
3590
- * format data values based on configuration received
3591
- */
3592
- if (this.chartConfiguration.textFormatter != undefined) {
3593
- formatFromBackend = ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter);
3594
- formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
3525
+ height = parseInt(container.style('height')) - margin.top - margin.bottom - 100;
3595
3526
  }
3596
- var outerContainer = chartContainer
3527
+ return height;
3528
+ }
3529
+ createSvgContainers(width, height) {
3530
+ const chartContainer = d3.select(this.containerElt.nativeElement);
3531
+ const margin = this.chartConfiguration.margin;
3532
+ const outerContainer = chartContainer
3597
3533
  .append('div')
3598
- .attr('id', self.uniqueId)
3534
+ .attr('id', this.uniqueId)
3599
3535
  .attr('class', 'outer-container')
3600
3536
  .style('width', '100%')
3601
- .style('height', height)
3537
+ .style('height', height + 'px')
3602
3538
  .style('overflow-x', 'hidden')
3603
3539
  .style('padding-left', `${margin.left}px`)
3604
- // .call(ChartHelper.responsivefy)
3605
- .style('padding-right', `${rightSvgWidth}px`)
3540
+ .style('padding-right', `${this.CONSTANTS.RIGHT_SVG_WIDTH}px`)
3606
3541
  .style('margin-left', '15px');
3607
- var svgYAxisLeft = outerContainer
3542
+ const svgYAxisLeft = this.createLeftYAxis(outerContainer, height, margin);
3543
+ const svgYAxisRight = this.createRightYAxis(outerContainer, height, margin);
3544
+ const innerContainer = outerContainer
3545
+ .append('div')
3546
+ .attr('class', 'inner-container')
3547
+ .style('width', '100%')
3548
+ .style('overflow-x', 'auto');
3549
+ const svg = innerContainer
3550
+ .append('svg')
3551
+ .attr('width', width - this.CONSTANTS.RIGHT_SVG_WIDTH)
3552
+ .attr('height', height + margin.top + margin.bottom + 30)
3553
+ .append('g')
3554
+ .attr('transform', `translate(0, ${margin.top})`);
3555
+ return { svg, svgYAxisLeft, svgYAxisRight };
3556
+ }
3557
+ createLeftYAxis(container, height, margin) {
3558
+ return container
3608
3559
  .append('svg')
3609
3560
  .attr('width', '100')
3610
3561
  .attr('height', height + margin.top + margin.bottom + 10)
@@ -3612,971 +3563,443 @@ class GroupChartComponent extends ComponentUniqueId {
3612
3563
  .style('left', '0')
3613
3564
  .style('z-index', 1)
3614
3565
  .append('g')
3615
- .attr('transform', 'translate(' + (margin.left + 15) + ',' + margin.top + ')');
3616
- var svgYAxisRight = outerContainer
3566
+ .attr('transform', `translate(${margin.left + 15}, ${margin.top})`);
3567
+ }
3568
+ createRightYAxis(container, height, margin) {
3569
+ return container
3617
3570
  .append('svg')
3618
- .attr('width', rightSvgWidth)
3571
+ .attr('width', this.CONSTANTS.RIGHT_SVG_WIDTH)
3619
3572
  .attr('height', height + margin.top + margin.bottom + 10)
3620
3573
  .style('position', 'absolute')
3621
3574
  .style('right', '12px')
3622
3575
  .style('z-index', 1)
3623
3576
  .append('g')
3624
- .attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
3625
- var innerContainer = outerContainer
3626
- .append('div')
3627
- .attr('class', 'inner-container')
3628
- .style('width', '100%')
3629
- .style('overflow-x', 'auto');
3630
- var svg = innerContainer
3631
- .append('svg')
3632
- // .attr('id', self.uniqueId)
3633
- .attr('width', width - rightSvgWidth)
3634
- .attr('height', height + margin.top + margin.bottom + 30)
3635
- // .call(ChartHelper.responsivefy)
3636
- .append('g')
3637
- .attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
3638
- var subgroups = keyList;
3639
- var groups = d3
3640
- .map(data, function (d) {
3641
- return d.name;
3642
- })
3643
- .keys();
3644
- /**
3645
- * x axis range made similar to line chart or vertical stack so that all the charts will get aligned with each other.
3646
- */
3647
- if (this.chartConfiguration.isMultiChartGridLine != undefined) {
3648
- x = d3
3649
- .scaleBand()
3650
- .rangeRound([width, 0])
3651
- .align(0.5)
3652
- .padding([0.5])
3653
- .domain(data.map(function (d) {
3654
- return d.name.toLowerCase();
3655
- }));
3656
- }
3657
- else {
3658
- x = d3
3659
- .scaleBand()
3660
- .domain(groups)
3661
- .range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
3662
- .padding([0.3]);
3663
- }
3664
- // x.bandwidth(96);
3665
- var xScaleFromOrigin = d3
3577
+ .attr('transform', `translate(0, ${margin.top})`);
3578
+ }
3579
+ createScales(data, metaData, width, height, lineData) {
3580
+ const { x, xScaleFromOrigin } = this.createXScales(data, width);
3581
+ const y = this.createYScale(data, metaData.keyList, height);
3582
+ const xSubgroup = this.createSubgroupScale(metaData.keyList, x);
3583
+ const lineYscale = lineData ? this.createLineYScale(lineData, height) : null;
3584
+ return { x, xScaleFromOrigin, y, xSubgroup, lineYscale };
3585
+ }
3586
+ createXScales(data, width) {
3587
+ const groups = data.map((d) => d.name);
3588
+ const x = d3
3666
3589
  .scaleBand()
3667
3590
  .domain(groups)
3668
- .range([0, width - rightSvgWidth]);
3669
- // .padding([0.2]);
3670
- /**
3671
- * draw second x axis on top
3672
- */
3673
- // if (self.chartConfiguration.showXaxisTop) {
3674
- // svg
3675
- // .append('g')
3676
- // .attr('class', 'lib-line-axis-text lib-line-x-axis-text x-axis')
3677
- // .attr('style', self.chartConfiguration.xAxisCustomTextStyles)
3678
- // .call(d3.axisBottom(x).tickSize(0));
3679
- // }
3680
- // d3.svg.axis().scale(x).orient('bottom').ticks(1).innerTickSize(-height);
3681
- if (this.chartConfiguration.isMultiChartGridLine == undefined) {
3682
- /**
3683
- * normal ticks for all dashboard charts
3684
- */
3591
+ .range([
3592
+ this.CONSTANTS.LEFT_RIGHT_SPACES,
3593
+ width - this.CONSTANTS.RIGHT_SVG_WIDTH - this.CONSTANTS.LEFT_RIGHT_SPACES,
3594
+ ])
3595
+ .padding(0.3);
3596
+ const xScaleFromOrigin = d3
3597
+ .scaleBand()
3598
+ .domain(groups)
3599
+ .range([0, width - this.CONSTANTS.RIGHT_SVG_WIDTH]);
3600
+ return { x, xScaleFromOrigin };
3601
+ }
3602
+ createYScale(data, keyList, height) {
3603
+ let maxValue = d3.max(data, (d) => d3.max(keyList, (key) => +d[key])) || 0;
3604
+ if (maxValue === 0) {
3605
+ maxValue = this.chartData.targetLineData
3606
+ ? this.chartData.targetLineData.target + 20
3607
+ : 100;
3608
+ }
3609
+ if (this.chartConfiguration.customYscale) {
3610
+ maxValue *= this.chartConfiguration.customYscale;
3611
+ }
3612
+ if (this.chartData.targetLineData && maxValue < this.chartData.targetLineData.target) {
3613
+ const target = this.chartData.targetLineData.target;
3614
+ maxValue = maxValue < 10 && target < 10 ? target + 3 : target + 20;
3615
+ }
3616
+ return d3.scaleLinear().domain([0, maxValue]).range([height, 0]).nice();
3617
+ }
3618
+ createSubgroupScale(subgroups, x) {
3619
+ return d3.scaleBand().domain(subgroups).range([0, x.bandwidth()]);
3620
+ }
3621
+ createLineYScale(lineData, height) {
3622
+ let maxLineValue = d3.max(lineData, (d) => +d.value) || 0;
3623
+ maxLineValue *= this.chartConfiguration.customYscale || 1;
3624
+ let minLineValue = d3.min(lineData, (d) => +d.value) || 0;
3625
+ if (maxLineValue > 0)
3626
+ minLineValue -= 3;
3627
+ if (minLineValue > 0)
3628
+ minLineValue = 0;
3629
+ return d3
3630
+ .scaleLinear()
3631
+ .domain([minLineValue, maxLineValue])
3632
+ .range([height, minLineValue]);
3633
+ }
3634
+ renderAxes(svg, svgYAxisLeft, svgYAxisRight, scales, width, height) {
3635
+ this.renderXAxis(svg, scales.x, height);
3636
+ this.renderYAxis(svg, svgYAxisLeft, scales.y, width, height);
3637
+ this.renderGridLines(svg, scales, width, height);
3638
+ }
3639
+ renderXAxis(svg, x, height) {
3640
+ if (!this.chartConfiguration.isMultiChartGridLine) {
3685
3641
  svg
3686
3642
  .append('g')
3687
3643
  .attr('class', 'x1 axis1')
3688
- .attr('transform', 'translate(0,' + height + ')')
3644
+ .attr('transform', `translate(0, ${height})`)
3689
3645
  .call(d3.axisBottom(x))
3690
3646
  .call((g) => g.select('.domain').remove());
3691
3647
  svg.selectAll('g.x1.axis1 g.tick line').remove();
3692
- if (subgroups.length > 1 && !metaData.xLabel) {
3693
- svg
3694
- .selectAll('g.x1.axis1 g.tick text')
3695
- .attr('class', 'lib-xaxis-labels-texts-drilldown')
3696
- .style('fill', 'var(--chart-text-color)')
3697
- .attr('y', 32); // Increase distance from bars (default is ~9)
3698
- }
3699
- else {
3700
- svg
3701
- .selectAll('g.x1.axis1 g.tick text')
3702
- .attr('class', 'lib-xaxis-labels-texts-drilldown')
3703
- .style('fill', 'var(--chart-text-color)');
3704
- }
3705
- // .attr('y', function () {
3706
- // if (alternate_text) {
3707
- // alternate_text = false;
3708
- // return long_tick_length + 1;
3709
- // } else {
3710
- // alternate_text = true;
3711
- // return short_tick_length + 1;
3712
- // }
3713
- // });
3714
- }
3715
- else {
3716
- /**
3717
- * bigger ticks for weekly charts and more space from x axis to labels
3718
- */
3719
- /**
3720
- * draw x axis
3721
- */
3722
- svg
3723
- .append('g')
3724
- .attr('class', 'x1 axis1')
3725
- .attr('transform', 'translate(0,' + height + ')')
3726
- .call(d3.axisBottom(x).tickSize(0))
3727
- .call((g) => g.select('.domain').attr('fill', 'none'));
3728
- /**
3729
- * tick line size in alternate fashion
3730
- */
3731
- svg.selectAll('g.x1.axis1 g.tick line').attr('y2', function () {
3732
- if (alternate_text &&
3733
- self.chartConfiguration.isNoAlternateXaxisText == undefined) {
3734
- alternate_text = false;
3735
- return long_tick_length_bg - 7;
3736
- }
3737
- else {
3738
- alternate_text = true;
3739
- return short_tick_length_bg - 4;
3740
- }
3741
- });
3742
- /**
3743
- * reset the flag so that values can be shown in same alternate fashion
3744
- */
3745
- alternate_text = false;
3746
- /**
3747
- * print x-axis label texts
3748
- * used by weekly charts
3749
- */
3750
- svg
3751
- .selectAll('g.x1.axis1 g.tick text')
3752
- .attr('class', 'lib-xaxis-labels-texts-weeklycharts')
3753
- .attr('y', function () {
3754
- if (alternate_text) {
3755
- alternate_text = false;
3756
- return long_tick_length_bg;
3757
- }
3758
- else {
3759
- alternate_text = true;
3760
- return short_tick_length_bg;
3761
- }
3762
- });
3763
- }
3764
- if (self.chartConfiguration.xLabelsOnSameLine) {
3648
+ const yOffset = this.chartData.metaData.keyList.length > 1 &&
3649
+ !this.chartData.metaData.xLabel ? 32 : 0;
3765
3650
  svg
3766
3651
  .selectAll('g.x1.axis1 g.tick text')
3767
3652
  .attr('class', 'lib-xaxis-labels-texts-drilldown')
3768
- .attr('y', short_tick_length_bg)
3769
- .text(function (d) {
3770
- var isValueToBeIgnored = false;
3771
- data.map((indiv) => {
3772
- if (indiv.name.toLowerCase() == d.trim().toLowerCase() &&
3773
- indiv[metaData.keyList[0]] == -1) {
3774
- isValueToBeIgnored = true;
3775
- }
3776
- });
3777
- if (isValueToBeIgnored) {
3778
- return '';
3779
- }
3780
- if (d.trim().indexOf(' ') > -1) {
3781
- return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
3782
- }
3783
- return d.toLowerCase();
3784
- });
3785
- svg
3786
- .selectAll('g.x1.axis1 g.tick')
3787
- .append('text')
3788
- .attr('class', 'lib-xaxis-labels-texts-drilldown')
3789
- .attr('y', long_tick_length_bg)
3790
- .attr('fill', 'currentColor')
3791
- .text(function (d) {
3792
- if (d.trim().indexOf(' ') > -1) {
3793
- return d.trim().substring(d.indexOf(' '), d.length).toLowerCase();
3794
- }
3795
- return '';
3796
- });
3797
- }
3798
- /**y scale for left y axis */
3799
- var y = d3.scaleLinear().rangeRound([height, 0]);
3800
- var maxValue = d3.max(data, (d) => d3.max(keyList, (key) => +d[key]));
3801
- if (maxValue == 0) {
3802
- if (this.chartData.targetLineData) {
3803
- maxValue = this.chartData.targetLineData.target + 20;
3804
- }
3805
- else {
3806
- maxValue = 100;
3807
- }
3808
- }
3809
- if (self.chartConfiguration.yAxisGrid) {
3810
- // svg
3811
- // .append('g')
3812
- // .attr('class', 'grid')
3813
- // .call(
3814
- // d3
3815
- // .axisLeft(y)
3816
- // .ticks(self.chartConfiguration.numberOfYTicks)
3817
- // .tickSize(-width)
3818
- // .tickFormat('')
3819
- // )
3820
- // // .style('stroke-dasharray', '5 5')
3821
- // .style('color', '#B9B9B9')
3822
- // .style('opacity', '0.5')
3823
- // .call((g) => g.select('.domain').remove());
3824
- }
3825
- if (this.chartConfiguration.customYscale) {
3826
- /**
3827
- * increase y-scale so that values wont cross or exceed out of range
3828
- * used in weekly charts
3829
- */
3830
- maxValue = maxValue * this.chartConfiguration.customYscale;
3831
- }
3832
- if (this.chartData.targetLineData &&
3833
- maxValue < this.chartData.targetLineData.target) {
3834
- maxValue =
3835
- maxValue < 10 && this.chartData.targetLineData.target < 10
3836
- ? this.chartData.targetLineData.target + 3
3837
- : this.chartData.targetLineData.target + 20;
3838
- }
3839
- y.domain([0, maxValue]).nice();
3840
- let lineYscale;
3841
- if (lineData != null) {
3842
- let maxLineValue = d3.max(lineData, function (d) {
3843
- return +d.value;
3844
- });
3845
- maxLineValue = maxLineValue * this.chartConfiguration.customYscale;
3846
- let minLineValue = d3.min(lineData, function (d) {
3847
- return +d.value;
3848
- });
3849
- if (maxLineValue > 0)
3850
- minLineValue = minLineValue - 3;
3851
- if (minLineValue > 0) {
3852
- minLineValue = 0;
3853
- }
3854
- lineYscale = d3
3855
- .scaleLinear()
3856
- .domain([minLineValue, maxLineValue])
3857
- .range([height, minLineValue]);
3858
- }
3859
- let yLineAxis;
3860
- if (lineYscale != null) {
3861
- yLineAxis = d3
3862
- .axisRight(lineYscale)
3863
- .ticks(self.chartConfiguration.numberOfYTicks)
3864
- .tickSize(0)
3865
- .tickFormat(self.chartConfiguration.yLineAxisLabelFomatter);
3653
+ .style('fill', 'var(--chart-text-color)')
3654
+ .attr('y', yOffset);
3866
3655
  }
3867
- /**
3868
- * show x-axis grid between labels
3869
- * used by weekly charts
3870
- */
3871
- if (self.chartConfiguration.isXgridBetweenLabels) {
3656
+ }
3657
+ renderYAxis(svg, svgYAxisLeft, y, width, height) {
3658
+ svgYAxisLeft
3659
+ .append('g')
3660
+ .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
3661
+ .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
3662
+ .call(d3
3663
+ .axisLeft(y)
3664
+ .tickSize(0)
3665
+ .ticks(this.chartConfiguration.numberOfYTicks)
3666
+ .tickFormat(this.chartConfiguration.yAxisLabelFomatter))
3667
+ .selectAll('text')
3668
+ .style('fill', 'var(--chart-text-color)');
3669
+ this.applyAxisVisibility();
3670
+ }
3671
+ renderGridLines(svg, scales, width, height) {
3672
+ if (this.chartConfiguration.isXgridBetweenLabels) {
3872
3673
  svg
3873
3674
  .append('g')
3874
3675
  .attr('class', 'grid')
3875
- .attr('transform', 'translate(' + x.bandwidth() / 2 + ',' + height + ')')
3876
- .call(d3.axisBottom(x).tickSize(-height).tickFormat(''))
3676
+ .attr('transform', `translate(${scales.x.bandwidth() / 2}, ${height})`)
3677
+ .call(d3.axisBottom(scales.x).tickSize(-height).tickFormat(''))
3877
3678
  .style('stroke-dasharray', '5 5')
3878
3679
  .style('color', 'var(--chart-grid-color, #999999)')
3879
3680
  .call((g) => g.select('.domain').remove());
3880
3681
  }
3881
3682
  if (this.chartConfiguration.yAxisGrid) {
3882
- /**
3883
- * draw y axis
3884
- */
3885
3683
  svg
3886
3684
  .append('g')
3887
3685
  .call(d3
3888
- .axisLeft(y)
3889
- .ticks(self.chartConfiguration.numberOfYTicks)
3686
+ .axisLeft(scales.y)
3687
+ .ticks(this.chartConfiguration.numberOfYTicks)
3890
3688
  .tickSize(-width))
3891
3689
  .style('color', 'var(--chart-axis-color, #B9B9B9)')
3892
3690
  .style('opacity', '0.5')
3893
3691
  .call((g) => g.select('.domain').remove());
3894
3692
  }
3895
- else {
3896
- svg
3897
- .append('g')
3898
- .call(d3.axisLeft(y).ticks(self.chartConfiguration.numberOfYTicks))
3899
- .style('color', '#B9B9B9')
3900
- .style('opacity', '0.5')
3901
- .call((g) => g.select('.domain').remove());
3693
+ }
3694
+ applyAxisVisibility() {
3695
+ if (this.chartConfiguration.isXaxisLabelHidden) {
3696
+ d3.selectAll('g.lib-line-x-axis-text > g > text').attr('class', 'lib-display-hidden');
3902
3697
  }
3903
- var xSubgroup = d3.scaleBand().domain(subgroups);
3904
- if (this.chartConfiguration.isMultiChartGridLine == undefined) {
3905
- xSubgroup.range([0, x.bandwidth()]);
3698
+ if (this.chartConfiguration.isYaxisLabelHidden) {
3699
+ d3.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
3906
3700
  }
3907
- else {
3908
- /**
3909
- * used to make grouped bars with lesser width as we are not using padding for width
3910
- * used by weekly charts
3911
- */
3912
- xSubgroup.range([0, x.bandwidth()]);
3701
+ if (this.chartConfiguration.isYaxisHidden) {
3702
+ d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
3913
3703
  }
3914
- // if (this.chartConfiguration.isDrilldownChart) {
3915
- // }
3916
- var color = d3
3917
- .scaleOrdinal()
3918
- .domain(subgroups)
3919
- .range(Object.values(metaData.colors));
3920
- // var colorAboveTarget = d3
3921
- // .scaleOrdinal()
3922
- // .domain(subgroups)
3923
- // .range(Object.values(metaData.colorAboveTarget));
3924
- var state = svg
3704
+ if (this.chartConfiguration.isYaxisDashed) {
3705
+ d3.selectAll('.yaxis-dashed')
3706
+ .style('stroke-dasharray', '5 5')
3707
+ .style('color', '#999999');
3708
+ }
3709
+ }
3710
+ renderBars(svg, data, metaData, scales, isRia) {
3711
+ const state = svg
3925
3712
  .append('g')
3926
3713
  .selectAll('.state')
3927
3714
  .data(data)
3928
3715
  .enter()
3929
3716
  .append('g')
3930
- .attr('transform', function (d) {
3931
- return 'translate(' + x(d.name) + ',0)';
3932
- });
3717
+ .attr('transform', (d) => `translate(${scales.x(d.name)}, 0)`);
3933
3718
  state
3934
3719
  .selectAll('rect')
3935
- .data(function (d) {
3936
- let newList = [];
3937
- subgroups.map(function (key) {
3938
- // if (key !== "group") {
3939
- let obj = { key: key, value: d[key], name: d.name };
3940
- newList.push(obj);
3941
- // }
3942
- });
3943
- return newList;
3944
- })
3720
+ .data((d) => this.prepareBarData(d, metaData.keyList))
3945
3721
  .enter()
3946
3722
  .append('rect')
3947
3723
  .attr('class', 'bars')
3948
- .on('click', function (d) {
3949
- if (d.key != 'Target') {
3950
- if (!metaData.barWithoutClick ||
3951
- !metaData.barWithoutClick.length ||
3952
- (!metaData.barWithoutClick.includes(d?.name) &&
3953
- !metaData.barWithoutClick.includes(d?.key)))
3954
- // self.handleClick(d.data.name);
3955
- self.handleClick(d);
3956
- }
3957
- })
3958
- .attr('x', function (d) {
3959
- if (self.chartConfiguration.isDrilldownChart) {
3960
- data.map((indiv) => {
3961
- if (indiv.name == d.name) {
3962
- let keys = Object.keys(indiv).filter((temp, i) => i != 0);
3963
- tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
3964
- if (x.bandwidth() > 100) {
3965
- if (self.chartData.data.length == 1) {
3966
- if (Object.keys(self.chartData.data[0]).length == 2) {
3967
- tempScale.range([
3968
- 0 + (x.bandwidth() - 200) / 2,
3969
- x.bandwidth() - (x.bandwidth() - 200) / 2,
3970
- ]);
3971
- // .padding(0.05);
3972
- }
3973
- else
3974
- tempScale.range([
3975
- 0 + (x.bandwidth() - 300) / 2,
3976
- x.bandwidth() - (x.bandwidth() - 300) / 2,
3977
- ]);
3978
- // .padding(0.05);
3979
- }
3980
- else
3981
- tempScale.range([
3982
- 0 + (x.bandwidth() - 125) / 2,
3983
- x.bandwidth() - (x.bandwidth() - 125) / 2,
3984
- ]);
3985
- }
3986
- }
3987
- });
3988
- return tempScale(d.key);
3989
- }
3990
- return xSubgroup(d.key);
3991
- })
3992
- .attr('y', function (d) {
3993
- return y(d.value);
3994
- })
3995
- .attr('width', function (d) {
3996
- if (self.chartConfiguration.isDrilldownChart) {
3997
- // var tempScale;
3998
- data.map((indiv) => {
3999
- if (indiv.name == d.name) {
4000
- let keys = Object.keys(indiv).filter((temp, i) => i != 0);
4001
- var temp;
4002
- tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
4003
- if (x.bandwidth() > 100) {
4004
- if (self.chartData.data.length == 1) {
4005
- if (Object.keys(self.chartData.data[0]).length == 2) {
4006
- tempScale.range([
4007
- 0 + (x.bandwidth() - 200) / 2,
4008
- x.bandwidth() - (x.bandwidth() - 200) / 2,
4009
- ]);
4010
- // .padding(0.05);
4011
- }
4012
- else
4013
- tempScale.range([
4014
- 0 + (x.bandwidth() - 300) / 2,
4015
- x.bandwidth() - (x.bandwidth() - 300) / 2,
4016
- ]);
4017
- // .padding(0.05);
4018
- }
4019
- else
4020
- tempScale.range([
4021
- 0 + (x.bandwidth() - 125) / 2,
4022
- x.bandwidth() - (x.bandwidth() - 125) / 2,
4023
- ]);
4024
- }
4025
- }
4026
- });
4027
- return tempScale.bandwidth();
4028
- }
4029
- return xSubgroup.bandwidth();
4030
- })
4031
- .attr('height', function (d) {
4032
- if (d.value == -1) {
4033
- return height - y(0);
3724
+ .on('click', (d) => this.handleBarClick(d, metaData))
3725
+ .attr('x', (d) => this.getBarX(d, scales, data))
3726
+ .attr('y', (d) => scales.y(d.value))
3727
+ .attr('width', (d) => this.getBarWidth(d, scales, data))
3728
+ .attr('height', (d) => this.getBarHeight(d, scales))
3729
+ .style('cursor', metaData.hasDrillDown && !isRia ? 'pointer' : 'default')
3730
+ .attr('fill', (d) => this.getBarColor(d, metaData));
3731
+ if (!isRia && (this.chartConfiguration.displayTitleOnTop || !this.chartConfiguration.textsOnBar)) {
3732
+ state.selectAll('rect')
3733
+ .on('mouseout', () => this.handleMouseOut(svg))
3734
+ .on('mouseover', (d) => this.handleMouseOver(d, svg, scales, metaData, data));
3735
+ }
3736
+ }
3737
+ prepareBarData(d, keyList) {
3738
+ return keyList.map((key) => ({ key, value: d[key], name: d.name }));
3739
+ }
3740
+ handleBarClick(d, metaData) {
3741
+ if (d.key === 'Target')
3742
+ return;
3743
+ const shouldBlock = metaData.barWithoutClick?.length &&
3744
+ (metaData.barWithoutClick.includes(d?.name) || metaData.barWithoutClick.includes(d?.key));
3745
+ if (!shouldBlock) {
3746
+ this.handleClick(d);
3747
+ }
3748
+ }
3749
+ getBarX(d, scales, data) {
3750
+ if (!this.chartConfiguration.isDrilldownChart) {
3751
+ return scales.xSubgroup(d.key);
3752
+ }
3753
+ let tempScale = scales.xSubgroup;
3754
+ data.forEach((indiv) => {
3755
+ if (indiv.name === d.name) {
3756
+ const keys = Object.keys(indiv).filter((_, i) => i !== 0);
3757
+ tempScale = d3.scaleBand().domain(keys).range([0, scales.x.bandwidth()]);
3758
+ tempScale = this.adjustScaleForWidth(tempScale, scales.x.bandwidth(), data.length);
4034
3759
  }
4035
- if (d.value)
4036
- return height - y(d.value);
4037
- return height - y(0);
4038
- })
4039
- // .style('cursor', 'pointer')
4040
- .style('cursor', function (d) {
4041
- if (metaData.hasDrillDown && !isria)
4042
- return 'pointer';
4043
- else
4044
- return 'default';
4045
- })
4046
- .attr('fill', function (d) {
4047
- if (d.value &&
4048
- self.chartData.targetLineData &&
4049
- d.value >= parseInt(self.chartData.targetLineData.target) &&
4050
- self.chartData.metaData.colorAboveTarget)
4051
- return self.chartData.metaData.colorAboveTarget[d.key];
4052
- return self.chartData.metaData.colors[d.key];
4053
3760
  });
4054
- /**
4055
- * display angled texts on the bars
4056
- */
4057
- if (this.chartConfiguration.textsOnBar != undefined && !this.isZoomedOut) {
4058
- state
4059
- .selectAll('text')
4060
- .data(function (d) {
4061
- let newList = [];
4062
- subgroups.map(function (key) {
4063
- let obj = { key: key, value: d[key], name: d.name };
4064
- newList.push(obj);
4065
- });
4066
- return newList;
4067
- })
4068
- .enter()
4069
- .append('text')
4070
- .attr('x', function (d) {
4071
- return 0;
4072
- })
4073
- .attr('y', function (d) {
4074
- return 0;
4075
- })
4076
- .attr('class', 'lib-data-labels-weeklycharts')
4077
- .text(function (d) {
4078
- return d.key && d.value
4079
- ? d.key.length > 20
4080
- ? d.key.substring(0, 17) + '...'
4081
- : d.key
4082
- : '';
4083
- })
4084
- .style('fill', function (d) {
4085
- return '#000';
4086
- })
4087
- .style('font-weight', 'bold')
4088
- .style('font-size', function (d) {
4089
- if (self.chartConfiguration.isDrilldownChart) {
4090
- if (window.innerWidth > 1900) {
4091
- return '18px';
4092
- }
4093
- else if (window.innerWidth < 1400) {
4094
- return '10px';
4095
- }
4096
- else {
4097
- return '14px';
4098
- }
4099
- }
4100
- else {
4101
- return '14px';
4102
- }
4103
- })
4104
- .attr('transform', function (d) {
4105
- data.map((indiv) => {
4106
- if (indiv.name == d.name) {
4107
- let keys = Object.keys(indiv).filter((temp, i) => i != 0);
4108
- var temp;
4109
- tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
4110
- if (x.bandwidth() > 100) {
4111
- if (self.chartData.data.length == 1) {
4112
- if (Object.keys(self.chartData.data[0]).length == 2) {
4113
- tempScale.range([
4114
- 0 + (x.bandwidth() - 200) / 2,
4115
- x.bandwidth() - (x.bandwidth() - 200) / 2,
4116
- ]);
4117
- // .padding(0.05);
4118
- }
4119
- else
4120
- tempScale.range([
4121
- 0 + (x.bandwidth() - 300) / 2,
4122
- x.bandwidth() - (x.bandwidth() - 300) / 2,
4123
- ]);
4124
- // .padding(0.05);
4125
- }
4126
- else
4127
- tempScale.range([
4128
- 0 + (x.bandwidth() - 125) / 2,
4129
- x.bandwidth() - (x.bandwidth() - 125) / 2,
4130
- ]);
4131
- }
4132
- }
4133
- });
4134
- /**
4135
- * if set, then all texts ll be horizontal
4136
- */
4137
- if (self.chartConfiguration.textAlwaysHorizontal) {
4138
- return ('translate(' + xSubgroup(d.key) + ',' + (y(d.value) - 3) + ')');
4139
- }
4140
- /**
4141
- * rotate texts having more than one digits
4142
- */
4143
- // if (d.value > 9)
4144
- if (!isNaN(tempScale(d.key)))
4145
- return ('translate(' +
4146
- (tempScale(d.key) + tempScale.bandwidth() * 0.55) +
4147
- ',' +
4148
- (y(0) - 10) +
4149
- ') rotate(270)');
4150
- return 'translate(0,0)';
4151
- // else
4152
- // return (
4153
- // 'translate(' +
4154
- // (tempScale(d.key) + tempScale.bandwidth() / 2) +
4155
- // ',' +
4156
- // y(0) +
4157
- // ')'
4158
- // );
4159
- })
4160
- .on('click', function (d) {
4161
- if (!metaData.barWithoutClick ||
4162
- !metaData.barWithoutClick.length ||
4163
- (!metaData.barWithoutClick.includes(d?.name) &&
4164
- !metaData.barWithoutClick.includes(d?.key)))
4165
- self.handleClick(d);
4166
- });
4167
- if (!isria) {
4168
- state.selectAll('.lib-data-labels-weeklycharts')
4169
- .on('mouseout', handleMouseOut)
4170
- .on('mouseover', handleMouseOver);
4171
- }
3761
+ return tempScale(d.key);
3762
+ }
3763
+ getBarWidth(d, scales, data) {
3764
+ if (!this.chartConfiguration.isDrilldownChart) {
3765
+ return scales.xSubgroup.bandwidth();
4172
3766
  }
4173
- if (this.chartConfiguration.displayTitleOnTop || (this.chartConfiguration.textsOnBar == undefined &&
4174
- this.chartConfiguration.displayTitleOnTop == undefined)) {
4175
- if (!isria) {
4176
- state
4177
- .selectAll('rect')
4178
- .on('mouseout', handleMouseOut)
4179
- .on('mouseover', handleMouseOver);
3767
+ let tempScale = scales.xSubgroup;
3768
+ data.forEach((indiv) => {
3769
+ if (indiv.name === d.name) {
3770
+ const keys = Object.keys(indiv).filter((_, i) => i !== 0);
3771
+ tempScale = d3.scaleBand().domain(keys).range([0, scales.x.bandwidth()]);
3772
+ tempScale = this.adjustScaleForWidth(tempScale, scales.x.bandwidth(), data.length);
4180
3773
  }
3774
+ });
3775
+ return tempScale.bandwidth();
3776
+ }
3777
+ adjustScaleForWidth(tempScale, bandwidth, dataLength) {
3778
+ if (bandwidth <= 100)
3779
+ return tempScale;
3780
+ const isSingleItem = dataLength === 1;
3781
+ const minWidth = isSingleItem
3782
+ ? this.CONSTANTS.MIN_BAR_WIDTH_SINGLE
3783
+ : this.CONSTANTS.MIN_BAR_WIDTH_MULTIPLE;
3784
+ const offset = (bandwidth - minWidth) / 2;
3785
+ tempScale.range([offset, bandwidth - offset]);
3786
+ return tempScale;
3787
+ }
3788
+ getBarHeight(d, scales) {
3789
+ if (d.value === -1 || !d.value) {
3790
+ return scales.y.range()[0] - scales.y(0);
3791
+ }
3792
+ return scales.y.range()[0] - scales.y(d.value);
3793
+ }
3794
+ getBarColor(d, metaData) {
3795
+ const targetLineData = this.chartData.targetLineData;
3796
+ const isAboveTarget = targetLineData && d.value >= targetLineData.target;
3797
+ if (d.value && isAboveTarget && metaData.colorAboveTarget) {
3798
+ return metaData.colorAboveTarget[d.key];
3799
+ }
3800
+ return metaData.colors[d.key];
3801
+ }
3802
+ handleMouseOver(d, svg, scales, metaData, data) {
3803
+ svg.selectAll('.lib-verticalstack-title-ontop').remove();
3804
+ const foreignObject = svg
3805
+ .append('foreignObject')
3806
+ .attr('class', 'lib-verticalstack-title-ontop')
3807
+ .attr('x', this.getTooltipX(d, scales, data, metaData))
3808
+ .attr('y', scales.y(d.value) - 43)
3809
+ .attr('width', this.getTooltipWidth(d, scales, data, metaData))
3810
+ .attr('height', 40);
3811
+ foreignObject
3812
+ .append('xhtml:div')
3813
+ .attr('class', 'title')
3814
+ .style('z-index', 99)
3815
+ .html(this.getTooltipHtml(d, metaData));
3816
+ }
3817
+ getTooltipX(d, scales, data, metaData) {
3818
+ let tempScale = this.getTempScale(d, scales, data);
3819
+ const baseX = scales.x(d.name) + tempScale(d.key);
3820
+ if (!metaData.hasDrillDown) {
3821
+ return baseX - (tempScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2) / 2 + tempScale.bandwidth() / 2;
4181
3822
  }
4182
- function handleMouseOver(d, i) {
4183
- svg.selectAll('.lib-verticalstack-title-ontop').remove();
4184
- svg
4185
- .append('foreignObject')
4186
- .attr('x', function () {
4187
- // var tempScale;
4188
- var elementsCounter;
4189
- data.map((indiv) => {
4190
- if (indiv.name == d.name) {
4191
- let keys = Object.keys(indiv).filter((temp, i) => i != 0);
4192
- elementsCounter = keys.length;
4193
- tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
4194
- if (x.bandwidth() > 100) {
4195
- if (self.chartData.data.length == 1) {
4196
- if (Object.keys(self.chartData.data[0]).length == 2) {
4197
- tempScale.range([
4198
- 0 + (x.bandwidth() - 200) / 2,
4199
- x.bandwidth() - (x.bandwidth() - 200) / 2,
4200
- ]);
4201
- // .padding(0.05);
4202
- }
4203
- else
4204
- tempScale.range([
4205
- 0 + (x.bandwidth() - 300) / 2,
4206
- x.bandwidth() - (x.bandwidth() - 300) / 2,
4207
- ]);
4208
- // .padding(0.05);
4209
- }
4210
- else
4211
- tempScale.range([
4212
- 0 + (x.bandwidth() - 125) / 2,
4213
- x.bandwidth() - (x.bandwidth() - 125) / 2,
4214
- ]);
4215
- }
4216
- }
4217
- });
4218
- if (metaData.hasDrillDown) {
4219
- if (tempScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
4220
- return (x(d.name) + tempScale(d.key) + tempScale.bandwidth() / 2 - 90);
4221
- }
4222
- return (x(d.name) +
4223
- tempScale(d.key) -
4224
- (tempScale.bandwidth() + leftAndRightSpaces * 2) / 2 +
4225
- tempScale.bandwidth() / 2);
4226
- }
4227
- else
4228
- return x(d.name) + tempScale(d.key) - (tempScale.bandwidth() + leftAndRightSpaces * 2) / 2 + tempScale.bandwidth() / 2;
4229
- })
4230
- .attr('class', 'lib-verticalstack-title-ontop')
4231
- .attr('y', function () {
4232
- return y(d.value) - 3 - 40;
4233
- })
4234
- .attr('dy', function () {
4235
- return d.class;
4236
- })
4237
- .attr('width', function () {
4238
- // var tempScale;
4239
- data.map((indiv) => {
4240
- if (indiv.name == d.name) {
4241
- let keys = Object.keys(indiv).filter((temp, i) => i != 0);
4242
- tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
4243
- if (x.bandwidth() > 100) {
4244
- if (self.chartData.data.length == 1) {
4245
- if (Object.keys(self.chartData.data[0]).length == 2) {
4246
- tempScale.range([
4247
- 0 + (x.bandwidth() - 200) / 2,
4248
- x.bandwidth() - (x.bandwidth() - 200) / 2,
4249
- ]);
4250
- // .padding(0.05);
4251
- }
4252
- else
4253
- tempScale.range([
4254
- 0 + (x.bandwidth() - 300) / 2,
4255
- x.bandwidth() - (x.bandwidth() - 300) / 2,
4256
- ]);
4257
- // .padding(0.05);
4258
- }
4259
- else
4260
- tempScale.range([
4261
- 0 + (x.bandwidth() - 125) / 2,
4262
- x.bandwidth() - (x.bandwidth() - 125) / 2,
4263
- ]);
4264
- }
4265
- }
4266
- });
4267
- if (metaData.hasDrillDown) {
4268
- if (tempScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
4269
- return '180px';
4270
- }
4271
- return tempScale.bandwidth() + leftAndRightSpaces * 2;
4272
- }
4273
- else
4274
- return tempScale.bandwidth() + leftAndRightSpaces * 2;
4275
- })
4276
- .attr('height', 40)
4277
- .append('xhtml:div')
4278
- .attr('class', 'title')
4279
- .style('z-index', 99)
4280
- .html(function () {
4281
- let dataType = metaData.dataType ? metaData.dataType : '';
4282
- if (!self.isZoomedOut) {
4283
- let desiredText = '<span class="title-bar-name">' + d.name + '</span>';
4284
- desiredText +=
4285
- '<span class="title-bar-value"><span>' +
4286
- d.value +
4287
- '</span>' +
4288
- dataType +
4289
- '</span>';
4290
- return desiredText;
4291
- }
4292
- else {
4293
- let tempKey = d.name.length <= 8 ? d.name : d.name.substring(0, 5) + '...';
4294
- let desiredText = '<span class="title-bar-name">' +
4295
- tempKey +
4296
- ':' +
4297
- d.value +
4298
- dataType +
4299
- '</span>';
4300
- desiredText +=
4301
- '<span class="title-bar-value">' + d.name + '</span>';
4302
- return desiredText;
4303
- }
4304
- });
3823
+ if (tempScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 > 180) {
3824
+ return baseX + tempScale.bandwidth() / 2 - 90;
4305
3825
  }
4306
- function handleMouseOut(d, i) {
4307
- svg.selectAll('.lib-verticalstack-title-ontop').remove();
3826
+ return baseX - (tempScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2) / 2 + tempScale.bandwidth() / 2;
3827
+ }
3828
+ getTooltipWidth(d, scales, data, metaData) {
3829
+ let tempScale = this.getTempScale(d, scales, data);
3830
+ if (!metaData.hasDrillDown) {
3831
+ return (tempScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2) + 'px';
4308
3832
  }
4309
- svg
4310
- .append('g')
4311
- .attr('class', 'x2 axis2')
4312
- .attr('transform', 'translate(0,' + height + ')')
4313
- .style('color', '#000')
4314
- .call(d3.axisBottom(xScaleFromOrigin).tickSize(0))
4315
- .call((g) => g.select('.domain').attr('fill', 'none'));
4316
- svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
4317
- svg
4318
- .append('g')
4319
- .attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
4320
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
4321
- .attr('transform', 'translate(0,0)')
4322
- .call(y)
4323
- .style('display', 'none');
4324
- svgYAxisLeft
4325
- .append('g')
4326
- .append('g')
4327
- .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
4328
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
4329
- .attr('transform', 'translate(0,0)')
4330
- .call(d3
4331
- .axisLeft(y)
4332
- .tickSize(0)
4333
- .ticks(self.chartConfiguration.numberOfYTicks)
4334
- .tickFormat(self.chartConfiguration.yAxisLabelFomatter))
4335
- .selectAll('text')
4336
- .style('fill', 'var(--chart-text-color)');
4337
- svgYAxisRight
4338
- .append('g')
4339
- .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
4340
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
4341
- .attr('transform', 'translate(0,0)')
4342
- .call(y)
4343
- .style('display', 'none');
4344
- /**
4345
- * hide x axis labels
4346
- * config is there for future use
4347
- * used by weekly charts
4348
- */
4349
- if (this.chartConfiguration.isXaxisLabelHidden != undefined &&
4350
- this.chartConfiguration.isXaxisLabelHidden) {
4351
- d3.selectAll('g.lib-line-x-axis-text > g > text').attr('class', 'lib-display-hidden');
4352
- }
4353
- /**
4354
- * hide y axis labels
4355
- * used by weekly charts
4356
- */
4357
- if (this.chartConfiguration.isYaxisLabelHidden != undefined &&
4358
- this.chartConfiguration.isYaxisLabelHidden) {
4359
- d3.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
4360
- }
4361
- /**
4362
- * hide y axis labels
4363
- * config is there for future use
4364
- */
4365
- if (this.chartConfiguration.isYaxisHidden != undefined &&
4366
- this.chartConfiguration.isYaxisHidden) {
4367
- d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
4368
- }
4369
- /**
4370
- * dashed y axis
4371
- * used by weekly charts
4372
- */
4373
- if (this.chartConfiguration.isYaxisDashed != undefined &&
4374
- this.chartConfiguration.isYaxisDashed) {
4375
- d3.selectAll('.yaxis-dashed')
4376
- .style('stroke-dasharray', '5 5')
4377
- .style('color', '#999999');
3833
+ if (tempScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 > 180) {
3834
+ return '180px';
4378
3835
  }
4379
- if (lineData != null) {
4380
- if (lineData && self.chartConfiguration.showLineChartAxis) {
4381
- svgYAxisRight
4382
- .append('g')
4383
- .attr('class', 'lib-stacked-y-axis-text1')
4384
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
4385
- .attr('transform', 'translate(' + 0 + ',0)')
4386
- .call(yLineAxis);
3836
+ return (tempScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2) + 'px';
3837
+ }
3838
+ getTempScale(d, scales, data) {
3839
+ let tempScale = scales.xSubgroup;
3840
+ data.forEach((indiv) => {
3841
+ if (indiv.name === d.name) {
3842
+ const keys = Object.keys(indiv).filter((_, i) => i !== 0);
3843
+ tempScale = d3.scaleBand().domain(keys).range([0, scales.x.bandwidth()]);
3844
+ tempScale = this.adjustScaleForWidth(tempScale, scales.x.bandwidth(), data.length);
4387
3845
  }
3846
+ });
3847
+ return tempScale;
3848
+ }
3849
+ getTooltipHtml(d, metaData) {
3850
+ const dataType = metaData.dataType || '';
3851
+ if (!this.isZoomedOut) {
3852
+ return `<span class="title-bar-name">${d.name}</span>
3853
+ <span class="title-bar-value"><span>${d.value}</span>${dataType}</span>`;
4388
3854
  }
4389
- /**
4390
- * used to display y label
4391
- */
4392
- if (this.isZoomedOut) {
4393
- svg
4394
- .selectAll('.lib-xaxis-labels-texts-drilldown')
4395
- .attr('class', 'lib-display-hidden');
4396
- }
4397
- /**
4398
- * used to write y labels based on configuration
4399
- */
3855
+ const truncatedName = d.name.length <= 8 ? d.name : d.name.substring(0, 5) + '...';
3856
+ return `<span class="title-bar-name">${truncatedName}:${d.value}${dataType}</span>
3857
+ <span class="title-bar-value">${d.name}</span>`;
3858
+ }
3859
+ handleMouseOut(svg) {
3860
+ svg.selectAll('.lib-verticalstack-title-ontop').remove();
3861
+ }
3862
+ renderLabels(svg, svgYAxisLeft, svgYAxisRight, metaData, width, height, scales) {
4400
3863
  if (metaData.yLabel) {
4401
- svgYAxisLeft
4402
- .append('text')
4403
- .attr('class', 'lib-axis-group-label font-size-1')
4404
- .attr('style', self.chartConfiguration.yAxisCustomlabelStyles)
4405
- .attr('transform', 'rotate(-90)')
4406
- .attr('y', 0 - margin.left / 2 - 30)
4407
- .attr('x', 0 - height / 2)
4408
- .attr('dy', '1em')
4409
- .style('text-anchor', 'middle')
4410
- .attr('fill', 'var(--chart-text-color)');
4411
- if (this.chartConfiguration.isMultiChartGridLine == undefined) {
4412
- svgYAxisLeft
4413
- .selectAll('.lib-axis-group-label')
4414
- .style('font-size', 'smaller')
4415
- .text(metaData.yLabel);
4416
- }
4417
- else {
4418
- /**
4419
- * used by weekly charts
4420
- */
4421
- svg
4422
- .selectAll('.lib-axis-group-label')
4423
- .attr('class', 'lib-ylabel-weeklyCharts')
4424
- .text(metaData.yLabel.toLowerCase());
4425
- }
3864
+ this.renderYLabel(svgYAxisLeft, metaData.yLabel, height);
4426
3865
  }
4427
3866
  if (metaData.xLabel) {
4428
- function isAcronym(label) {
4429
- return ((label.length <= 4 && /^[A-Z]+$/.test(label)) ||
4430
- (label === label.toUpperCase() && /[A-Z]/.test(label)));
4431
- }
4432
- const xLabelText = metaData.xLabel;
4433
- const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
4434
- svg
4435
- .append('text')
4436
- .attr('class', function () {
4437
- let baseClass = 'lib-axis-group-label font-size-1';
4438
- if (self.chartConfiguration.isDrilldownChart)
4439
- return baseClass + ' lib-xlabel-drilldowncharts';
4440
- if (self.chartConfiguration.isMultiChartGridLine != undefined)
4441
- return baseClass + ' lib-xlabel-weeklyCharts';
4442
- return baseClass + ' lib-axis-waterfall-label';
4443
- })
4444
- .attr('style', self.chartConfiguration.xAxisCustomlabelStyles)
4445
- .attr('transform', 'translate(' + width / 2 + ' ,' + (height + margin.top + 20) + ')')
4446
- .style('text-anchor', 'middle')
4447
- .style('fill', 'var(--chart-text-color)')
4448
- .text(isAcr ? xLabelText.toUpperCase() : xLabelText.toLowerCase())
4449
- .style('text-transform', isAcr ? 'none' : 'capitalize');
3867
+ this.renderXLabel(svg, metaData.xLabel, width, height);
4450
3868
  }
4451
- if (this.chartData.targetLineData) {
4452
- const yZero = y(this.chartData.targetLineData.target);
4453
- svg
4454
- .append('line')
4455
- .attr('x1', 0)
4456
- .attr('x2', width)
4457
- .attr('y1', yZero)
4458
- .attr('y2', yZero)
4459
- .style('stroke-dasharray', '5 5')
4460
- .style('stroke', this.chartData.targetLineData.color);
4461
- // svgYAxisRight
4462
- // .append('line')
4463
- // .attr('x1', 0)
4464
- // .attr('x2', rightSvgWidth)
4465
- // .attr('y1', yZero)
4466
- // .attr('y2', yZero)
4467
- // .style('stroke', this.chartData.targetLineData.color);
4468
- svgYAxisRight
4469
- .append('foreignObject')
4470
- .attr('transform', 'translate(' + 0 + ',' + (yZero - 30) + ')')
4471
- .attr('width', rightSvgWidth)
4472
- .attr('height', 50)
4473
- .append('xhtml:div')
4474
- .attr('class', 'target-display')
4475
- .style('color', 'var(--chart-text-color)')
4476
- .html(function () {
4477
- let dataTypeTemp = '';
4478
- let targetLineName = 'target';
4479
- if (metaData.dataType) {
4480
- dataTypeTemp = metaData.dataType;
4481
- }
4482
- if (self.chartData.targetLineData &&
4483
- self.chartData.targetLineData.targetName) {
4484
- targetLineName = self.chartData.targetLineData.targetName;
4485
- }
4486
- return (`<div>${targetLineName}</div>` +
4487
- '<div>' +
4488
- self.chartData.targetLineData.target +
4489
- '' +
4490
- dataTypeTemp +
4491
- '</div>');
4492
- });
3869
+ if (metaData.lineyLabel) {
3870
+ this.renderLineYLabel(svgYAxisRight, metaData.lineyLabel);
4493
3871
  }
3872
+ }
3873
+ renderYLabel(svgYAxisLeft, yLabel, height) {
3874
+ const margin = this.chartConfiguration.margin;
3875
+ svgYAxisLeft
3876
+ .append('text')
3877
+ .attr('class', 'lib-axis-group-label font-size-1')
3878
+ .attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
3879
+ .attr('transform', 'rotate(-90)')
3880
+ .attr('y', 0 - margin.left / 2 - 30)
3881
+ .attr('x', 0 - height / 2)
3882
+ .attr('dy', '1em')
3883
+ .style('text-anchor', 'middle')
3884
+ .attr('fill', 'var(--chart-text-color)')
3885
+ .text(this.chartConfiguration.isMultiChartGridLine ? yLabel.toLowerCase() : yLabel);
3886
+ }
3887
+ renderXLabel(svg, xLabel, width, height) {
3888
+ const margin = this.chartConfiguration.margin;
3889
+ const isAcronym = this.isAcronym(xLabel.replace(/[^A-Za-z]/g, ''));
3890
+ let labelClass = 'lib-axis-group-label font-size-1';
4494
3891
  if (this.chartConfiguration.isDrilldownChart) {
4495
- /**
4496
- * used by drilldown charts
4497
- */
4498
- // svg
4499
- // .selectAll('.lib-axis-group-label')
4500
- // .attr('class', 'lib-ylabel-drilldowncharts')
4501
- // .text(metaData.yLabel.toLowerCase());
4502
- svg.selectAll('g.x1.axis1 g.tick line').style('display', 'none');
3892
+ labelClass += ' lib-xlabel-drilldowncharts';
4503
3893
  }
4504
- if (metaData.lineyLabel) {
4505
- svgYAxisRight
4506
- .append('text')
4507
- .attr('class', 'lib-axis-group-label lib-line-axis')
4508
- .attr('style', self.chartConfiguration.yAxisCustomlabelStyles)
4509
- .attr('transform', 'translate(0,0) rotate(90)')
4510
- .attr('y', 0 - 100)
4511
- .attr('x', 0 + 100)
4512
- .attr('dy', '5em')
4513
- .style('text-anchor', 'middle')
4514
- .style('font-size', 'smaller')
4515
- .text(metaData.lineyLabel);
3894
+ else if (this.chartConfiguration.isMultiChartGridLine) {
3895
+ labelClass += ' lib-xlabel-weeklyCharts';
4516
3896
  }
4517
- if (lineData) {
4518
- svg
4519
- .append('path')
4520
- .datum(lineData)
4521
- .attr('fill', 'none')
4522
- .attr('stroke', self.chartConfiguration.lineGraphColor)
4523
- .attr('stroke-width', 1.5)
4524
- .attr('d', d3
4525
- .line()
4526
- .x(function (d) {
4527
- return x(d.name) + x.bandwidth() / 2;
4528
- })
4529
- .y(function (d) {
4530
- return lineYscale(d.value);
4531
- }));
4532
- var dot = svg
4533
- .selectAll('myCircles')
4534
- .data(lineData)
4535
- .enter()
4536
- .append('g')
4537
- .on('click', function (d) {
4538
- if (!metaData.barWithoutClick ||
4539
- !metaData.barWithoutClick.length ||
4540
- (!metaData.barWithoutClick.includes(d?.name) &&
4541
- !metaData.barWithoutClick.includes(d?.key)))
4542
- self.handleClick(d);
4543
- });
3897
+ else {
3898
+ labelClass += ' lib-axis-waterfall-label';
3899
+ }
3900
+ svg
3901
+ .append('text')
3902
+ .attr('class', labelClass)
3903
+ .attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
3904
+ .attr('transform', `translate(${width / 2}, ${height + margin.top + 20})`)
3905
+ .style('text-anchor', 'middle')
3906
+ .style('fill', 'var(--chart-text-color)')
3907
+ .text(isAcronym ? xLabel.toUpperCase() : xLabel.toLowerCase())
3908
+ .style('text-transform', isAcronym ? 'none' : 'capitalize');
3909
+ }
3910
+ renderLineYLabel(svgYAxisRight, lineyLabel) {
3911
+ svgYAxisRight
3912
+ .append('text')
3913
+ .attr('class', 'lib-axis-group-label lib-line-axis')
3914
+ .attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
3915
+ .attr('transform', 'translate(0,0) rotate(90)')
3916
+ .attr('y', -100)
3917
+ .attr('x', 100)
3918
+ .attr('dy', '5em')
3919
+ .style('text-anchor', 'middle')
3920
+ .style('font-size', 'smaller')
3921
+ .text(lineyLabel);
3922
+ }
3923
+ isAcronym(label) {
3924
+ return ((label.length <= 4 && /^[A-Z]+$/.test(label)) ||
3925
+ (label === label.toUpperCase() && /[A-Z]/.test(label)));
3926
+ }
3927
+ renderTargetLine(svg, svgYAxisRight, yScale, width) {
3928
+ if (!this.chartData.targetLineData)
3929
+ return;
3930
+ const targetLineData = this.chartData.targetLineData;
3931
+ const yZero = yScale(targetLineData.target);
3932
+ svg
3933
+ .append('line')
3934
+ .attr('x1', 0)
3935
+ .attr('x2', width)
3936
+ .attr('y1', yZero)
3937
+ .attr('y2', yZero)
3938
+ .style('stroke-dasharray', '5 5')
3939
+ .style('stroke', targetLineData.color);
3940
+ const dataType = this.chartData.metaData.dataType || '';
3941
+ const targetName = targetLineData.targetName || 'target';
3942
+ svgYAxisRight
3943
+ .append('foreignObject')
3944
+ .attr('transform', `translate(0, ${yZero - 30})`)
3945
+ .attr('width', this.CONSTANTS.RIGHT_SVG_WIDTH)
3946
+ .attr('height', 50)
3947
+ .append('xhtml:div')
3948
+ .attr('class', 'target-display')
3949
+ .style('color', 'var(--chart-text-color)')
3950
+ .html(`<div>${targetName}</div><div>${targetLineData.target}${dataType}</div>`);
3951
+ }
3952
+ renderLineGraph(svg, lineData, metaData, scales, isRia) {
3953
+ if (!lineData)
3954
+ return;
3955
+ const linePath = d3
3956
+ .line()
3957
+ .x((d) => scales.x(d.name) + scales.x.bandwidth() / 2)
3958
+ .y((d) => scales.lineYscale(d.value));
3959
+ svg
3960
+ .append('path')
3961
+ .datum(lineData)
3962
+ .attr('fill', 'none')
3963
+ .attr('stroke', this.chartConfiguration.lineGraphColor)
3964
+ .attr('stroke-width', 1.5)
3965
+ .attr('d', linePath);
3966
+ const dot = svg
3967
+ .selectAll('myCircles')
3968
+ .data(lineData)
3969
+ .enter()
3970
+ .append('g')
3971
+ .on('click', (d) => this.handleLinePointClick(d, metaData));
3972
+ dot
3973
+ .append('circle')
3974
+ .attr('fill', this.chartConfiguration.lineGraphColor)
3975
+ .attr('stroke', 'none')
3976
+ .attr('cx', (d) => scales.x(d.name) + scales.x.bandwidth() / 2)
3977
+ .attr('cy', (d) => scales.lineYscale(d.value))
3978
+ .style('cursor', 'pointer')
3979
+ .attr('r', 3);
3980
+ if (this.chartConfiguration.lineGraphColor) {
4544
3981
  dot
4545
- .append('circle')
4546
- .attr('fill', function (d) {
4547
- return self.chartConfiguration.lineGraphColor;
4548
- })
4549
- .attr('stroke', 'none')
4550
- .attr('cx', function (d) {
4551
- return x(d.name) + x.bandwidth() / 2;
4552
- })
4553
- .attr('cy', function (d) {
4554
- return lineYscale(d.value);
4555
- })
4556
- .style('cursor', 'pointer')
4557
- .attr('r', 3);
4558
- if (self.chartConfiguration.lineGraphColor) {
4559
- dot
4560
- .append('text')
4561
- .attr('class', 'dot')
4562
- .attr('color', self.chartConfiguration.lineGraphColor)
4563
- .attr('style', 'font-size: ' + '.85em')
4564
- .attr('x', function (d, i) {
4565
- return x(d.name) + x.bandwidth() / 2;
4566
- })
4567
- .attr('y', function (d) {
4568
- return lineYscale(d.value);
4569
- })
4570
- .attr('dy', '-1em')
4571
- .text(function (d) {
4572
- return self.chartConfiguration.labelFormatter(d.value);
4573
- });
4574
- }
3982
+ .append('text')
3983
+ .attr('class', 'dot')
3984
+ .attr('color', this.chartConfiguration.lineGraphColor)
3985
+ .attr('style', 'font-size: .85em')
3986
+ .attr('x', (d) => scales.x(d.name) + scales.x.bandwidth() / 2)
3987
+ .attr('y', (d) => scales.lineYscale(d.value))
3988
+ .attr('dy', '-1em')
3989
+ .text((d) => this.chartConfiguration.labelFormatter(d.value));
3990
+ }
3991
+ }
3992
+ handleLinePointClick(d, metaData) {
3993
+ const shouldBlock = metaData.barWithoutClick?.length &&
3994
+ (metaData.barWithoutClick.includes(d?.name) || metaData.barWithoutClick.includes(d?.key));
3995
+ if (!shouldBlock) {
3996
+ this.handleClick(d);
4575
3997
  }
4576
3998
  }
4577
3999
  handleClick(d) {
4578
- if (this.chartData.metaData.hasDrillDown || d?.toggleFrom)
4000
+ if (this.chartData.metaData.hasDrillDown || d?.toggleFrom) {
4579
4001
  this.clickEvent.emit(d);
4002
+ }
4580
4003
  }
4581
4004
  handleHeaderMenuClick(id) {
4582
4005
  this.headerMenuclickEvent.emit(id);
@@ -6825,6 +6248,21 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6825
6248
  this.isTopCaptionVisible = true;
6826
6249
  this.uniqueId = this.getUniqueId();
6827
6250
  this.isTransparentBackground = false;
6251
+ this.isCC = false;
6252
+ this.isZoomedOut = true;
6253
+ this.CONSTANTS = {
6254
+ RIGHT_SVG_WIDTH: 60,
6255
+ LEFT_RIGHT_SPACES: 50,
6256
+ SHORT_TICK_LENGTH: 4,
6257
+ LONG_TICK_LENGTH: 16,
6258
+ SHORT_TICK_LENGTH_BG: 5,
6259
+ LONG_TICK_LENGTH_BG: 30,
6260
+ MIN_MOBILE_BAR_WIDTH: 32,
6261
+ DESKTOP_MIN_BAR_WIDTH: 40,
6262
+ MOBILE_BAR_PADDING: 12,
6263
+ ZOOM_THRESHOLD: 30,
6264
+ ZOOM_IN_THRESHOLD: 8,
6265
+ };
6828
6266
  this.defaultConfiguration = {
6829
6267
  margin: { top: 20, right: 20, bottom: 20, left: 40 },
6830
6268
  svgHeight: 70,
@@ -6840,6 +6278,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6840
6278
  forComparison: true,
6841
6279
  headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
6842
6280
  yAxisGrid: false,
6281
+ // Optional configs with undefined defaults
6843
6282
  isHeaderVisible: undefined,
6844
6283
  isTransparentBackground: undefined,
6845
6284
  isTopCaptionVisible: undefined,
@@ -6867,56 +6306,40 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6867
6306
  isToggleVisible: undefined,
6868
6307
  isTitleHidden: undefined,
6869
6308
  };
6870
- this.isCC = false;
6871
- this.isZoomedOut = true;
6872
- }
6873
- isZoomOutSelected(isZoomOut) {
6874
- this.isZoomedOut = isZoomOut;
6875
- this.ngOnChanges();
6876
6309
  }
6310
+ ngOnInit() { }
6877
6311
  ngOnChanges() {
6878
- let self = this;
6879
- d3.select('#' + self.uniqueId).remove();
6312
+ this.removeExistingChart();
6880
6313
  this.initializeStackedChart();
6881
6314
  }
6882
6315
  onResized(event) {
6883
- let self = this;
6884
- setTimeout(function () {
6885
- d3.select('#' + self.uniqueId).remove();
6886
- self.initializeStackedChart();
6887
- }.bind(self), 10);
6316
+ setTimeout(() => {
6317
+ this.removeExistingChart();
6318
+ this.initializeStackedChart();
6319
+ }, 10);
6888
6320
  }
6889
- ngOnInit() { }
6890
- initializeStackedChart() {
6891
- var self = this;
6892
- let data = [];
6893
- let metaData = null;
6894
- let keyList = null;
6895
- let lineData = null;
6896
- let colors = null;
6897
- var alternate_text = false;
6898
- var alternate_label = false;
6899
- var short_tick_length = 4;
6900
- var long_tick_length = 16;
6901
- var short_tick_length_bg = 5;
6902
- var long_tick_length_bg = 30;
6903
- var formatFromBackend;
6904
- var formatForHugeNumbers;
6905
- var tempObjectHolder = {};
6906
- var rightSvgWidth = 60;
6907
- var leftAndRightSpaces = 50;
6908
- let isria = this.customChartConfiguration.isRia;
6909
- // Responsive breakpoints
6910
- const isMobile = window.innerWidth < 576;
6911
- const isTablet = window.innerWidth >= 576 && window.innerWidth < 992;
6912
- const isDesktop = window.innerWidth >= 992;
6913
- // Adjust margins and font sizes based on device
6914
- if (isMobile) {
6321
+ isZoomOutSelected(isZoomOut) {
6322
+ this.isZoomedOut = isZoomOut;
6323
+ this.ngOnChanges();
6324
+ }
6325
+ removeExistingChart() {
6326
+ d3.select('#' + this.uniqueId).remove();
6327
+ }
6328
+ getDeviceConfig() {
6329
+ const width = window.innerWidth;
6330
+ return {
6331
+ isMobile: width < 576,
6332
+ isTablet: width >= 576 && width < 992,
6333
+ isDesktop: width >= 992,
6334
+ };
6335
+ }
6336
+ configureResponsiveSettings(device) {
6337
+ if (device.isMobile) {
6915
6338
  this.chartConfiguration.margin = { top: 20, right: 10, bottom: 40, left: 30 };
6916
6339
  this.chartConfiguration.numberOfYTicks = 4;
6917
6340
  this.chartConfiguration.svgHeight = 60;
6918
6341
  }
6919
- else if (isTablet) {
6342
+ else if (device.isTablet) {
6920
6343
  this.chartConfiguration.margin = { top: 25, right: 20, bottom: 45, left: 40 };
6921
6344
  this.chartConfiguration.numberOfYTicks = 6;
6922
6345
  this.chartConfiguration.svgHeight = 70;
@@ -6926,922 +6349,605 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6926
6349
  this.chartConfiguration.numberOfYTicks = 7;
6927
6350
  this.chartConfiguration.svgHeight = 80;
6928
6351
  }
6929
- for (var i in this.defaultConfiguration) {
6930
- this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
6352
+ }
6353
+ mergeConfigurations() {
6354
+ for (const key in this.defaultConfiguration) {
6355
+ this.chartConfiguration[key] = ChartHelper.getValueByConfigurationType(key, this.defaultConfiguration, this.customChartConfiguration);
6931
6356
  }
6932
- data = this.chartData.data;
6933
- metaData = this.chartData.metaData;
6934
- if (metaData.unit == undefined)
6357
+ }
6358
+ prepareMetaData(metaData) {
6359
+ if (!metaData.unit)
6935
6360
  metaData.unit = '';
6936
- if (metaData.isCC) {
6361
+ if (metaData.isCC)
6937
6362
  this.isCC = metaData.isCC;
6938
- }
6939
- if (metaData.barWithoutClick && metaData.barWithoutClick.length) {
6940
- metaData.barWithoutClick = metaData.barWithoutClick.map((ele) => ele.toLowerCase());
6363
+ if (metaData.barWithoutClick?.length) {
6364
+ metaData.barWithoutClick = metaData.barWithoutClick.map(el => el.toLowerCase());
6941
6365
  }
6942
6366
  else {
6943
6367
  metaData.barWithoutClick = [];
6944
6368
  }
6945
- lineData = this.chartData.lineData;
6946
- colors = metaData.colors;
6947
- keyList = metaData.keyList;
6948
- var chartContainer = d3.select(this.containerElt.nativeElement);
6949
- var verticalstackedcontainer = d3.select(this.verticalstackedcontainerElt.nativeElement);
6950
- let parsedNum = parseFloat(this.chartData?.targetLineData?.target);
6951
- if (!isNaN(parsedNum)) {
6952
- if (Number.isInteger(parsedNum)) {
6953
- parsedNum = parseInt(this.chartData.targetLineData.target);
6954
- }
6955
- else {
6956
- parsedNum = parseFloat(this.chartData.targetLineData.target);
6957
- }
6369
+ return metaData;
6370
+ }
6371
+ calculateDimensions(chartContainer, verticalContainer, margin, device, dataLength) {
6372
+ const containerWidth = chartContainer.node().getBoundingClientRect().width;
6373
+ const containerHeight = verticalContainer.node().getBoundingClientRect().height;
6374
+ let width = containerWidth - margin.left - margin.right;
6375
+ let height = containerHeight * (this.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
6376
+ if (dataLength > this.CONSTANTS.ZOOM_THRESHOLD && this.isZoomedOut) {
6377
+ const minWidth = dataLength * (device.isMobile ? 15 : 25);
6378
+ width = Math.max(width, minWidth);
6958
6379
  }
6959
- var margin = this.chartConfiguration.margin;
6960
- // Responsive width and height
6961
- var containerWidth = chartContainer.node().getBoundingClientRect().width;
6962
- var containerHeight = verticalstackedcontainer.node().getBoundingClientRect().height;
6963
- var width = containerWidth - margin.left - margin.right;
6964
- var height = containerHeight * (self.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
6965
- // Adjust width for large datasets and zoom
6966
- if (this.chartData.data.length > 30 && this.isZoomedOut) {
6967
- width = width > this.chartData.data.length * (isMobile ? 15 : 25)
6968
- ? width
6969
- : this.chartData.data.length * (isMobile ? 15 : 25);
6970
- }
6971
- if (this.chartData.data.length > 8 && !this.isZoomedOut) {
6972
- width = this.chartData.data.length * (isMobile ? 60 : 130);
6973
- }
6974
- // Fullscreen and drilldown adjustments
6975
- if (this.chartConfiguration.isFullScreen != undefined && this.chartConfiguration.isFullScreen) {
6976
- height = this.chartConfiguration.svgHeight != 80
6380
+ if (dataLength > this.CONSTANTS.ZOOM_IN_THRESHOLD && !this.isZoomedOut) {
6381
+ width = dataLength * (device.isMobile ? 60 : 130);
6382
+ }
6383
+ if (this.chartConfiguration.isFullScreen) {
6384
+ height = this.chartConfiguration.svgHeight !== 80
6977
6385
  ? this.chartConfiguration.svgHeight
6978
6386
  : containerHeight;
6979
6387
  }
6980
6388
  if (this.chartConfiguration.isDrilldownChart) {
6981
- height = containerHeight - margin.top - margin.bottom - (isMobile ? 60 : 130);
6982
- }
6983
- // ...existing code...
6984
- /**
6985
- * for hiding header
6986
- * used by weekly charts
6987
- */
6988
- if (this.chartConfiguration.isHeaderVisible != undefined) {
6989
- this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
6990
- }
6991
- /**
6992
- * for hiding legends
6993
- * used by weekly charts
6994
- */
6995
- if (this.chartConfiguration.isTopCaptionVisible != undefined) {
6996
- //UPDATENAME
6997
- this.isTopCaptionVisible = this.chartConfiguration.isTopCaptionVisible;
6998
- }
6999
- /**
7000
- * for removing background color so that it can take parents color
7001
- *
7002
- */
7003
- if (this.chartConfiguration.isTransparentBackground != undefined) {
7004
- this.isTransparentBackground =
7005
- this.chartConfiguration.isTransparentBackground;
6389
+ height = containerHeight - margin.top - margin.bottom - (device.isMobile ? 60 : 130);
7006
6390
  }
7007
- /**
7008
- * format data values based on configuration received
7009
- */
7010
- if (this.chartConfiguration.textFormatter != undefined) {
7011
- formatFromBackend = ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter);
7012
- formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
6391
+ let barWidth;
6392
+ let barPadding;
6393
+ let requiredSvgWidth;
6394
+ if (device.isMobile) {
6395
+ barWidth = this.CONSTANTS.MIN_MOBILE_BAR_WIDTH;
6396
+ barPadding = this.CONSTANTS.MOBILE_BAR_PADDING;
6397
+ requiredSvgWidth = Math.max(width - this.CONSTANTS.RIGHT_SVG_WIDTH, (barWidth + barPadding) * dataLength + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 +
6398
+ this.CONSTANTS.RIGHT_SVG_WIDTH - barPadding);
7013
6399
  }
7014
- var outerContainer = chartContainer
6400
+ else {
6401
+ barWidth = Math.max(this.CONSTANTS.DESKTOP_MIN_BAR_WIDTH, (width - this.CONSTANTS.RIGHT_SVG_WIDTH - this.CONSTANTS.LEFT_RIGHT_SPACES * 2) / dataLength);
6402
+ barPadding = 0;
6403
+ requiredSvgWidth = width - this.CONSTANTS.RIGHT_SVG_WIDTH;
6404
+ }
6405
+ return {
6406
+ width,
6407
+ height,
6408
+ containerWidth,
6409
+ containerHeight,
6410
+ barWidth,
6411
+ barPadding,
6412
+ requiredSvgWidth,
6413
+ };
6414
+ }
6415
+ createSvgContainers(chartContainer, dimensions, margin) {
6416
+ const outerContainer = chartContainer
7015
6417
  .append('div')
7016
- .attr('id', self.uniqueId)
6418
+ .attr('id', this.uniqueId)
7017
6419
  .attr('class', 'outer-container')
7018
6420
  .style('width', '100%')
7019
- .style('height', height)
6421
+ .style('height', dimensions.height)
7020
6422
  .style('overflow-x', 'hidden')
7021
6423
  .style('padding-left', `${margin.left}px`)
7022
6424
  .style('margin-left', '10px')
7023
- .style('padding-right', `${rightSvgWidth}px`);
7024
- var svgYAxisLeft = outerContainer
6425
+ .style('padding-right', `${this.CONSTANTS.RIGHT_SVG_WIDTH}px`);
6426
+ const svgYAxisLeft = outerContainer
7025
6427
  .append('svg')
7026
6428
  .attr('width', '80')
7027
- .attr('height', height + margin.top + margin.bottom)
6429
+ .attr('height', dimensions.height + margin.top + margin.bottom)
7028
6430
  .style('position', 'absolute')
7029
6431
  .style('left', '0')
7030
6432
  .style('z-index', 1)
7031
6433
  .append('g')
7032
- .attr('transform', 'translate(' + (margin.left + 10) + ',' + margin.top + ')');
7033
- var svgYAxisRight = outerContainer
6434
+ .attr('transform', `translate(${margin.left + 10},${margin.top})`);
6435
+ const svgYAxisRight = outerContainer
7034
6436
  .append('svg')
7035
- .attr('width', rightSvgWidth)
7036
- .attr('height', height + margin.top + margin.bottom)
6437
+ .attr('width', this.CONSTANTS.RIGHT_SVG_WIDTH)
6438
+ .attr('height', dimensions.height + margin.top + margin.bottom)
7037
6439
  .style('position', 'absolute')
7038
6440
  .style('right', '2px')
7039
6441
  .style('z-index', 1)
7040
6442
  .append('g')
7041
- .attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
7042
- var innerContainer = outerContainer
6443
+ .attr('transform', `translate(0,${margin.top})`);
6444
+ const innerContainer = outerContainer
7043
6445
  .append('div')
7044
6446
  .attr('class', 'inner-container')
7045
6447
  .style('width', '100%')
7046
6448
  .style('overflow-x', 'auto');
7047
- // Calculate bar width and padding for mobile to avoid overlap and add space between bars
7048
- let barWidth;
7049
- let barPadding = 12; // px, space between bars on mobile
7050
- let requiredSvgWidth;
7051
- if (isMobile) {
7052
- // Use a minimum width per bar and add padding between bars
7053
- const minBarWidth = 32; // px, can adjust as needed
7054
- barWidth = minBarWidth;
7055
- requiredSvgWidth = Math.max(width - rightSvgWidth, (barWidth + barPadding) * data.length + leftAndRightSpaces * 2 + rightSvgWidth - barPadding // no padding after last bar
7056
- );
7057
- innerContainer.style('overflow-x', 'auto');
7058
- }
7059
- else {
7060
- barWidth = Math.max(40, (width - rightSvgWidth - leftAndRightSpaces * 2) / data.length);
7061
- barPadding = 0;
7062
- requiredSvgWidth = width - rightSvgWidth;
7063
- }
7064
- var svg = innerContainer
6449
+ const svg = innerContainer
7065
6450
  .append('svg')
7066
- .attr('width', requiredSvgWidth)
7067
- .attr('height', height + margin.top + margin.bottom + 30)
6451
+ .attr('width', dimensions.requiredSvgWidth)
6452
+ .attr('height', dimensions.height + margin.top + margin.bottom + 30)
7068
6453
  .append('g')
7069
- .attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
7070
- let stackKey = keyList;
7071
- var stack = d3
7072
- .stack()
7073
- .keys(stackKey)
7074
- /*.order(d3.stackOrder)*/
7075
- .offset(d3.stackOffsetNone);
7076
- var layers = stack(data);
7077
- data.sort(function (a, b) {
7078
- return b.total - a.total;
7079
- });
7080
- let lineYscale;
7081
- if (lineData != null) {
7082
- lineYscale = d3
7083
- .scaleLinear()
7084
- .domain([
7085
- 0,
7086
- d3.max(lineData, function (d) {
7087
- return +d.value;
7088
- }),
7089
- ])
7090
- .range([height, 0]);
7091
- }
7092
- // Calculate bar width for mobile to avoid overlap
7093
- // ...barWidth is now calculated above, remove duplicate...
7094
- var xScale = d3
6454
+ .attr('transform', `translate(0,${margin.top})`);
6455
+ return { svg, svgYAxisLeft, svgYAxisRight, innerContainer };
6456
+ }
6457
+ createScales(data, layers, lineData, dimensions, device) {
6458
+ const { width, height, barWidth, barPadding } = dimensions;
6459
+ const xScale = d3
7095
6460
  .scaleBand()
7096
6461
  .rangeRound([
7097
- leftAndRightSpaces,
7098
- width - rightSvgWidth - leftAndRightSpaces
6462
+ this.CONSTANTS.LEFT_RIGHT_SPACES,
6463
+ width - this.CONSTANTS.RIGHT_SVG_WIDTH - this.CONSTANTS.LEFT_RIGHT_SPACES
7099
6464
  ])
7100
- .domain(data.map(function (d) {
7101
- return d.name;
7102
- }).reverse())
7103
- .padding(isMobile ? 0.2 : 0.5);
7104
- var xScaleFromOrigin = d3
6465
+ .domain(data.map(d => d.name).reverse())
6466
+ .padding(device.isMobile ? 0.2 : 0.5);
6467
+ const xScaleFromOrigin = d3
7105
6468
  .scaleBand()
7106
- .rangeRound([width - rightSvgWidth, 0])
7107
- .domain(data.map(function (d) {
7108
- return d.name;
7109
- }).reverse());
7110
- // ...existing code...
7111
- /**
7112
- * draw second x axis on top
7113
- */
7114
- if (self.chartConfiguration.showXaxisTop) {
7115
- svg
7116
- .append('g')
7117
- .attr('class', 'lib-line-axis-text lib-line-x-axis-text x-axis')
7118
- .attr('style', self.chartConfiguration.xAxisCustomTextStyles)
7119
- .call(d3.axisBottom(xScale).tickSize(0));
7120
- svg.selectAll('.x-axis > g > text').attr('class', 'lib-display-hidden');
7121
- }
7122
- /**
7123
- * draw second x axis on top
7124
- */
7125
- // if (self.chartConfiguration.showXaxisAtTarget) {
7126
- // svg
7127
- // .append('g')
7128
- // .attr('class', 'lib-line-axis-text lib-line-x-axis-text x-axis')
7129
- // .attr('style', self.chartConfiguration.xAxisCustomTextStyles)
7130
- // .call(d3.axisBottom(xScale).tickSize(0));
7131
- // svg.selectAll('.x-axis > g > text').attr('class', 'lib-display-hidden');
7132
- // }
7133
- if (this.chartConfiguration.xAxisGrid) {
7134
- for (var j = 0; j < this.chartConfiguration.xAxisGrid.length; j++) {
7135
- svg
7136
- .append('g')
7137
- .attr('class', `x${j + 2} axis${j + 2}`)
7138
- .style('color', 'var(--chart-grid-color)') // Use CSS variable instead of hardcoded
7139
- .attr('transform', 'translate(0,' + height * this.chartConfiguration.xAxisGrid[j] + ')')
7140
- .call(d3.axisBottom(xScale).tickSize(0).ticks(5).tickFormat(''))
7141
- .style('fill', 'var(--chart-text-color)');
7142
- }
7143
- }
7144
- let yScale = d3.scaleLinear().rangeRound([height, 0]);
7145
- /**
7146
- * update max vakues so that the vakue wont exceed the max limit
7147
- * used by weekly charts
7148
- */
7149
- var maxValue = d3.max(layers, (d) => d3.max(d, (d) => d[1]));
7150
- if (maxValue == 0) {
7151
- if (this.chartData.targetLineData) {
7152
- maxValue = this.chartData.targetLineData.target + 20;
7153
- }
7154
- else {
7155
- maxValue = 100;
7156
- }
6469
+ .rangeRound([width - this.CONSTANTS.RIGHT_SVG_WIDTH, 0])
6470
+ .domain(data.map(d => d.name).reverse());
6471
+ const yScale = d3.scaleLinear().rangeRound([height, 0]);
6472
+ let maxValue = d3.max(layers, (d) => d3.max(d, (d) => d[1]));
6473
+ if (maxValue === 0) {
6474
+ maxValue = this.chartData.targetLineData
6475
+ ? Number(this.chartData.targetLineData.target) + 20
6476
+ : 100;
7157
6477
  }
7158
6478
  if (this.chartConfiguration.customYscale) {
7159
- maxValue = maxValue * this.chartConfiguration.customYscale;
6479
+ maxValue *= this.chartConfiguration.customYscale;
7160
6480
  }
7161
- if (this.chartData.targetLineData &&
7162
- maxValue < this.chartData.targetLineData.target) {
7163
- maxValue =
7164
- maxValue < 10 && this.chartData.targetLineData.target < 10
7165
- ? this.chartData.targetLineData.target + 3
7166
- : this.chartData.targetLineData.target + 20;
6481
+ if (this.chartData.targetLineData && maxValue < Number(this.chartData.targetLineData.target)) {
6482
+ const target = Number(this.chartData.targetLineData.target);
6483
+ maxValue = maxValue < 10 && target < 10 ? target + 3 : target + 20;
7167
6484
  }
7168
6485
  yScale.domain([0, maxValue]).nice();
7169
- let xAxis = d3
7170
- .axisBottom(xScale)
6486
+ let lineYscale = null;
6487
+ if (lineData) {
6488
+ lineYscale = d3
6489
+ .scaleLinear()
6490
+ .domain([0, d3.max(lineData, d => +d.value)])
6491
+ .range([height, 0]);
6492
+ }
6493
+ return { xScale, xScaleFromOrigin, yScale, lineYscale };
6494
+ }
6495
+ createAxes(scales) {
6496
+ const xAxis = d3
6497
+ .axisBottom(scales.xScale)
7171
6498
  .tickSize(0)
7172
- .tickFormat(self.chartConfiguration.xAxisLabelFomatter);
7173
- let yAxis = d3
7174
- .axisLeft(yScale)
7175
- .ticks(self.chartConfiguration.numberOfYTicks)
6499
+ .tickFormat(this.chartConfiguration.xAxisLabelFomatter);
6500
+ const yAxis = d3
6501
+ .axisLeft(scales.yScale)
6502
+ .ticks(this.chartConfiguration.numberOfYTicks)
7176
6503
  .tickSize(0)
7177
- .tickFormat(self.chartConfiguration.yAxisLabelFomatter);
7178
- let yLineAxis;
7179
- if (lineYscale != null) {
6504
+ .tickFormat(this.chartConfiguration.yAxisLabelFomatter);
6505
+ let yLineAxis = null;
6506
+ if (scales.lineYscale) {
7180
6507
  yLineAxis = d3
7181
- .axisRight(lineYscale)
7182
- .ticks(self.chartConfiguration.numberOfYTicks)
6508
+ .axisRight(scales.lineYscale)
6509
+ .ticks(this.chartConfiguration.numberOfYTicks)
7183
6510
  .tickSize(0)
7184
- .tickFormat(self.chartConfiguration.yLineAxisLabelFomatter);
7185
- }
7186
- /**
7187
- * between x-axis label used by weekly charts
7188
- * isXgridBetweenLabels will be undefined for dashboard charts
7189
- */
7190
- if (self.chartConfiguration.isXgridBetweenLabels) {
7191
- svg
7192
- .append('g')
7193
- .attr('class', 'grid')
7194
- .attr('transform', 'translate(' + xScale.bandwidth() / 2 + ',' + height + ')')
7195
- .call(d3.axisBottom(xScale).tickSize(-height).tickFormat(''))
7196
- .style('stroke-dasharray', '5 5')
7197
- .style('color', '#999999')
7198
- // .style("opacity", "0.5")
7199
- .call((g) => g.select('.domain').remove());
7200
- }
7201
- /**
7202
- * used to draw y-axis grid
7203
- */
7204
- if (self.chartConfiguration.yAxisGrid) {
7205
- svg
7206
- .append('g')
7207
- .attr('class', 'grid')
7208
- .call(d3
7209
- .axisLeft(yScale)
7210
- .ticks(self.chartConfiguration.numberOfYTicks)
7211
- .tickSize(-width)
7212
- .tickFormat(''))
7213
- // Remove hardcoded colors and use CSS variables
7214
- .style('color', 'var(--chart-grid-color)')
7215
- .style('opacity', '1');
7216
- // .call((g) => g.select('.domain').remove());
6511
+ .tickFormat(this.chartConfiguration.yLineAxisLabelFomatter);
7217
6512
  }
7218
- var layer = svg
6513
+ return { xAxis, yAxis, yLineAxis };
6514
+ }
6515
+ renderBars(svg, layers, scales, metaData, dimensions, device) {
6516
+ const layer = svg
7219
6517
  .selectAll('.layer')
7220
6518
  .data(layers)
7221
6519
  .enter()
7222
6520
  .append('g')
7223
6521
  .attr('class', 'layer')
7224
- .style('fill', function (d, i) {
7225
- return metaData.colors[d.key];
7226
- });
7227
- var rect = layer
6522
+ .style('fill', (d) => metaData.colors[d.key]);
6523
+ const rect = layer
7228
6524
  .selectAll('rect')
7229
- .data(function (d) {
7230
- return d;
7231
- })
6525
+ .data((d) => d)
7232
6526
  .enter();
6527
+ this.appendRectangles(rect, scales, metaData, dimensions, device);
6528
+ this.addInteractions(rect, svg, metaData, scales);
6529
+ return rect;
6530
+ }
6531
+ appendRectangles(rect, scales, metaData, dimensions, device) {
6532
+ const { barWidth, barPadding } = dimensions;
6533
+ const { xScale, yScale } = scales;
7233
6534
  rect
7234
6535
  .append('rect')
7235
- .on('click', function (d) {
7236
- if (!lineData || self.chartConfiguration.forComparison) {
7237
- if (!metaData.barWithoutClick ||
7238
- !metaData.barWithoutClick.length ||
7239
- !metaData.barWithoutClick.includes(d.data.name.toLowerCase()))
7240
- self.handleClick(d.data.name);
6536
+ .on('click', (d) => {
6537
+ if (!this.chartData.lineData || this.chartConfiguration.forComparison) {
6538
+ if (!metaData.barWithoutClick?.includes(d.data.name.toLowerCase())) {
6539
+ this.handleClick(d.data.name);
6540
+ }
7241
6541
  }
7242
6542
  })
7243
- .attr('y', function (d) {
6543
+ .attr('y', (d) => {
7244
6544
  if (!isNaN(d[0]) && !isNaN(d[1])) {
7245
6545
  const actualHeight = yScale(d[0]) - yScale(d[1]);
7246
6546
  return actualHeight < 3 ? yScale(d[0]) - 3 : yScale(d[1]);
7247
6547
  }
7248
6548
  return 0;
7249
6549
  })
7250
- .attr('x', function (d, i) {
7251
- if (isMobile) {
7252
- // On mobile, position bars with padding
7253
- return leftAndRightSpaces + i * (barWidth + barPadding);
6550
+ .attr('x', (d, i) => {
6551
+ if (device.isMobile) {
6552
+ return this.CONSTANTS.LEFT_RIGHT_SPACES + i * (barWidth + barPadding);
7254
6553
  }
7255
- if (self.chartConfiguration.isMultiChartGridLine == undefined) {
6554
+ if (!this.chartConfiguration.isMultiChartGridLine) {
7256
6555
  return xScale(d.data.name);
7257
6556
  }
7258
- else {
7259
- if (self.chartConfiguration.isDrilldownChart &&
7260
- self.chartData.data.length <= 3) {
7261
- return xScale(d.data.name) + xScale.bandwidth() / 2 - 35;
7262
- }
7263
- return xScale(d.data.name) + xScale.bandwidth() * 0.1;
6557
+ if (this.chartConfiguration.isDrilldownChart && this.chartData.data.length <= 3) {
6558
+ return xScale(d.data.name) + xScale.bandwidth() / 2 - 35;
7264
6559
  }
6560
+ return xScale(d.data.name) + xScale.bandwidth() * 0.1;
7265
6561
  })
7266
- .attr('height', function (d) {
6562
+ .attr('height', (d) => {
7267
6563
  if (!isNaN(d[0]) && !isNaN(d[1])) {
7268
6564
  const actualHeight = yScale(d[0]) - yScale(d[1]);
7269
6565
  return actualHeight < 3 ? 3 : actualHeight;
7270
6566
  }
7271
6567
  return 0;
7272
6568
  })
7273
- .attr('width', function (d) {
7274
- // Use calculated barWidth for mobile, otherwise scale
7275
- if (isMobile) {
6569
+ .attr('width', (d) => {
6570
+ if (device.isMobile)
7276
6571
  return barWidth;
6572
+ if (!this.chartConfiguration.isMultiChartGridLine)
6573
+ return xScale.bandwidth();
6574
+ if (this.chartConfiguration.isDrilldownChart && this.chartData.data.length <= 3) {
6575
+ return 70;
7277
6576
  }
7278
- return self.chartConfiguration.isMultiChartGridLine == undefined
7279
- ? xScale.bandwidth()
7280
- : self.chartConfiguration.isDrilldownChart &&
7281
- self.chartData.data.length <= 3
7282
- ? 70
7283
- : xScale.bandwidth() * 0.8;
6577
+ return xScale.bandwidth() * 0.8;
7284
6578
  })
7285
- // .style('cursor', 'pointer');
7286
- .style('cursor', function (d) {
6579
+ .style('cursor', (d) => {
7287
6580
  if (metaData.hasDrillDown) {
7288
- if (metaData.barWithoutClick.length > 0 &&
7289
- metaData.barWithoutClick.includes(d.data.name.toLowerCase())) {
6581
+ if (metaData.barWithoutClick?.includes(d.data.name.toLowerCase())) {
7290
6582
  return 'default';
7291
6583
  }
7292
6584
  return 'pointer';
7293
6585
  }
7294
- else
7295
- return 'default';
6586
+ return 'default';
7296
6587
  })
7297
- .style('fill', function (d) {
7298
- if (!isNaN(d[0]) &&
7299
- !isNaN(d[1]) &&
7300
- self.chartData.targetLineData &&
7301
- parseFloat(d[1]) - parseFloat(d[0]) >=
7302
- parseFloat(self.chartData.targetLineData.target))
7303
- return self.chartData?.targetLineData?.barAboveTargetColor;
7304
- return metaData.colors[d.key];
7305
- });
7306
- /**
7307
- * do not show valus on hover as its alreay dislayed
7308
- */
7309
- if (!this.isCC && !self.chartConfiguration.isMultiChartGridLine) {
7310
- rect
7311
- .append('svg:title') // TITLE APPENDED HERE
7312
- .text(function (d) {
7313
- return d[1] - d[0];
7314
- });
6588
+ .style('fill', (d) => this.getBarColor(d, metaData));
6589
+ }
6590
+ getBarColor(d, metaData) {
6591
+ if (!isNaN(d[0]) &&
6592
+ !isNaN(d[1]) &&
6593
+ this.chartData.targetLineData &&
6594
+ parseFloat(d[1]) - parseFloat(d[0]) >= parseFloat(String(this.chartData.targetLineData.target))) {
6595
+ return this.chartData.targetLineData.barAboveTargetColor || metaData.colors[d.key];
7315
6596
  }
7316
- if (this.isCC) {
7317
- rect
7318
- .append('text')
7319
- .attr('x', function (d) {
7320
- return xScale(d.data.name);
7321
- })
7322
- .attr('text-anchor', function (d) {
7323
- if (!d[0]) {
7324
- return 'end';
7325
- }
7326
- else {
7327
- return 'start';
7328
- }
7329
- })
7330
- .attr('class', 'verticalbar__text')
7331
- .attr('y', function (d) {
7332
- if (!d[0]) {
7333
- return yScale(d[1]);
7334
- }
7335
- else {
7336
- return yScale(d[1]) - 7;
7337
- }
7338
- })
7339
- // .attr("y", function (d) { return yScale(d[0]) - yScale(d[1]); })
7340
- .attr('dy', function (d) {
7341
- return d.class;
7342
- })
7343
- .text(function (d) {
7344
- if (!d[0]) {
7345
- if (!isNaN(d[1] - d[0])) {
7346
- return Math.round((d[1] - d[0]) * 100) / 100;
7347
- }
7348
- else
7349
- return;
7350
- }
7351
- else {
7352
- if (!isNaN(d[1])) {
7353
- return Math.round(d[1] * 100) / 100;
7354
- }
7355
- else
7356
- return;
7357
- }
7358
- });
7359
- }
7360
- /**
7361
- svg
6597
+ return metaData.colors[d.key];
6598
+ }
6599
+ addInteractions(rect, svg, metaData, scales) {
6600
+ rect
6601
+ .selectAll('rect')
6602
+ .on('mouseenter', (d) => this.handleMouseOver(d, svg, metaData, scales))
6603
+ .on('mouseout', (d) => this.handleMouseOut(svg, metaData));
6604
+ }
6605
+ handleMouseOver(d, svg, metaData, scales) {
6606
+ if (!this.chartConfiguration.displayTitleOnTop)
6607
+ return;
6608
+ svg.selectAll('rect')
6609
+ .filter((data) => data === d)
6610
+ .style('fill', (d) => this.getHoverColor(d, metaData));
6611
+ this.displayTooltip(d, svg, metaData, scales);
6612
+ }
6613
+ getHoverColor(d, metaData) {
6614
+ if (!isNaN(d[0]) &&
6615
+ !isNaN(d[1]) &&
6616
+ this.chartData.targetLineData &&
6617
+ parseFloat(d[1]) - parseFloat(d[0]) >= parseFloat(String(this.chartData.targetLineData.target))) {
6618
+ return this.chartData.targetLineData.barAboveTargetHoverColor ||
6619
+ this.chartData.targetLineData.barAboveTargetColor ||
6620
+ metaData.colors[d.key];
6621
+ }
6622
+ return metaData.hoverColor || metaData.colors[d.key];
6623
+ }
6624
+ displayTooltip(d, svg, metaData, scales) {
6625
+ const { xScale, yScale } = scales;
6626
+ const value = d[1] - d[0];
6627
+ if (isNaN(value))
6628
+ return;
6629
+ const width = /week/i.test(d.data.name) && /\d{4}-\d{2}-\d{2}/.test(d.data.name)
6630
+ ? '250px'
6631
+ : xScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 > 180
6632
+ ? '180px'
6633
+ : xScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2;
6634
+ svg
7362
6635
  .append('foreignObject')
7363
- .attr('transform', 'translate(' + 0 + ',' + (yZero - 25) + ')')
6636
+ .attr('x', this.calculateTooltipX(d, xScale, width))
6637
+ .attr('class', 'lib-verticalstack-title-ontop')
6638
+ .attr('y', yScale(d[1]) - 51)
7364
6639
  .attr('width', width)
7365
- .attr('height', 30)
6640
+ .attr('height', 40)
7366
6641
  .append('xhtml:div')
7367
- .attr('class', 'target-display')
7368
- .style('color', this.chartData.targetLineData.color)
7369
- */
7370
- /**
7371
- * on hover, display title on top
7372
- */
7373
- function handleMouseOver(d, i) {
7374
- if (!self.chartConfiguration.displayTitleOnTop) {
7375
- return;
7376
- }
7377
- svg
7378
- .selectAll('rect')
7379
- .filter(function (data) {
7380
- return data == d;
7381
- })
7382
- .style('fill', function (d) {
7383
- if (!isNaN(d[0]) &&
7384
- !isNaN(d[1]) &&
7385
- self.chartData.targetLineData &&
7386
- parseFloat(d[1]) - parseFloat(d[0]) >=
7387
- parseFloat(self.chartData.targetLineData.target))
7388
- return self.chartData.targetLineData.barAboveTargetHoverColor
7389
- ? self.chartData.targetLineData.barAboveTargetHoverColor
7390
- : self.chartData?.targetLineData?.barAboveTargetColor
7391
- ? self.chartData?.targetLineData?.barAboveTargetColor
7392
- : '';
7393
- return metaData.hoverColor ? metaData.hoverColor : '';
7394
- });
7395
- svg
7396
- .append('foreignObject')
7397
- .attr('x', function () {
7398
- if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
7399
- return (xScale(d.data.name) -
7400
- leftAndRightSpaces +
7401
- (xScale.bandwidth() + leftAndRightSpaces * 2 - 180) / 2);
7402
- }
7403
- return xScale(d.data.name) - leftAndRightSpaces;
7404
- })
7405
- .attr('class', 'lib-verticalstack-title-ontop')
7406
- .attr('y', function () {
7407
- // Increase the gap between the bar and the tooltip (was -1 - 40)
7408
- return yScale(d[1]) - 1 - 50; // 10px more gap
7409
- })
7410
- .attr('dy', function () {
7411
- return d.class;
7412
- })
7413
- .attr('width', function () {
7414
- if (d.data.name && /week/i.test(d.data.name) && /\d{4}-\d{2}-\d{2}/.test(d.data.name)) {
7415
- return '250px'; // increase for week + date
7416
- }
7417
- if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
7418
- return '180px';
7419
- }
7420
- return xScale.bandwidth() + leftAndRightSpaces * 2;
7421
- })
7422
- .attr('height', 40)
7423
- .append('xhtml:div')
7424
- .attr('class', 'title')
7425
- .style('z-index', 99)
7426
- .html(function () {
7427
- // Tooltip content without any arrow mark
7428
- if (!isNaN(d[1] - d[0])) {
7429
- if (d[1] - d[0] === 0) {
7430
- return '<span class="title-top-text">0</span>';
7431
- }
7432
- var dataType = metaData.dataType ? metaData.dataType : '';
7433
- var desiredText = '';
7434
- // Always show the full x-axis label (category name) in the tooltip
7435
- desiredText =
7436
- '<span class="title-bar-name">' +
7437
- (d.data.name ? d.data.name : '') +
7438
- '</span>';
7439
- desiredText += metaData.unit
7440
- ? '<span class="title-top-text">' +
7441
- metaData.unit +
7442
- (d[1] - d[0]) + ' ' +
7443
- dataType +
7444
- '</span>'
7445
- : '<span class="title-top-text">' +
7446
- (d[1] - d[0]) + ' ' +
7447
- dataType +
7448
- '</span>';
7449
- // No arrow mark or arrow HTML/CSS in tooltip
7450
- return desiredText;
7451
- }
7452
- else
7453
- return;
7454
- });
6642
+ .attr('class', 'title')
6643
+ .style('z-index', 99)
6644
+ .html(this.generateTooltipHtml(d, metaData, value));
6645
+ }
6646
+ calculateTooltipX(d, xScale, width) {
6647
+ const bandwidth = xScale.bandwidth();
6648
+ const numericWidth = typeof width === 'string' ? parseInt(width) : width;
6649
+ if (bandwidth + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 > 180) {
6650
+ return xScale(d.data.name) - this.CONSTANTS.LEFT_RIGHT_SPACES +
6651
+ (bandwidth + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 - 180) / 2;
7455
6652
  }
7456
- function handleMouseOut(d, i) {
7457
- if (!self.chartConfiguration.displayTitleOnTop) {
7458
- return;
7459
- }
7460
- // svg.selectAll('rect').style('fill', metaData.colors[d.key]);
7461
- svg.selectAll('rect').style('fill', function (d) {
7462
- if (!isNaN(d[0]) &&
7463
- !isNaN(d[1]) &&
7464
- self.chartData.targetLineData &&
7465
- parseFloat(d[1]) - parseFloat(d[0]) >=
7466
- parseFloat(self.chartData.targetLineData.target))
7467
- return self.chartData?.targetLineData?.barAboveTargetColor;
7468
- return metaData.colors[d.key];
7469
- });
7470
- svg.selectAll('.lib-verticalstack-title-ontop').remove();
6653
+ return xScale(d.data.name) - this.CONSTANTS.LEFT_RIGHT_SPACES;
6654
+ }
6655
+ generateTooltipHtml(d, metaData, value) {
6656
+ if (value === 0)
6657
+ return '<span class="title-top-text">0</span>';
6658
+ const dataType = metaData.dataType || '';
6659
+ const name = d.data.name ? `<span class="title-bar-name">${d.data.name}</span>` : '';
6660
+ const valueText = metaData.unit
6661
+ ? `${metaData.unit}${value} ${dataType}`
6662
+ : `${value} ${dataType}`;
6663
+ return `${name}<span class="title-top-text">${valueText}</span>`;
6664
+ }
6665
+ handleMouseOut(svg, metaData) {
6666
+ if (!this.chartConfiguration.displayTitleOnTop)
6667
+ return;
6668
+ svg.selectAll('rect')
6669
+ .style('fill', (d) => this.getBarColor(d, metaData));
6670
+ svg.selectAll('.lib-verticalstack-title-ontop').remove();
6671
+ }
6672
+ renderAxisLabels(svg, svgYAxisLeft, metaData, dimensions, margin) {
6673
+ if (metaData.yLabel) {
6674
+ this.addYAxisLabel(svgYAxisLeft, metaData.yLabel, dimensions.height, margin);
7471
6675
  }
7472
- /**
7473
- * used to show value on top of the bars
7474
- * need to be used by bar charts only(one bar should contain one value)
7475
- * used by weekly charts
7476
- */
7477
- if (this.chartConfiguration.showTotalOnTop != undefined) {
7478
- rect
7479
- .append('text')
7480
- .attr('x', function (d) {
7481
- return xScale(d.data.name) + xScale.bandwidth() / 2;
7482
- })
7483
- .attr('class', 'lib-verticalstack-labels-ontop-weklycharts')
7484
- .attr('y', function (d) {
7485
- return yScale(d[1]) - 3;
7486
- })
7487
- .attr('dy', function (d) {
7488
- return d.class;
7489
- })
7490
- .text(function (d) {
7491
- if (!isNaN(d[1] - d[0])) {
7492
- if (d[1] - d[0] == 0) {
7493
- return;
7494
- }
7495
- if (d[1] - d[0] <= 999)
7496
- return metaData.unit
7497
- ? metaData.unit + formatFromBackend(d[1] - d[0])
7498
- : formatFromBackend(d[1] - d[0]);
7499
- else
7500
- return metaData.unit
7501
- ? metaData.unit + formatForHugeNumbers(d[1] - d[0])
7502
- : formatForHugeNumbers(d[1] - d[0]);
7503
- }
7504
- else
7505
- return;
7506
- });
6676
+ if (metaData.xLabel) {
6677
+ this.addXAxisLabel(svg, metaData.xLabel, dimensions.width, dimensions.height, margin);
7507
6678
  }
7508
- /**
7509
- * used to show angled values on top of the bars
7510
- * used by weekly charts
7511
- */
7512
- if (this.chartConfiguration.showAngledLabels != undefined) {
7513
- rect
7514
- .append('text')
7515
- .attr('x', 0)
7516
- .attr('fill', function (d, i) {
7517
- return metaData.colors[d.key];
7518
- })
7519
- .attr('class', 'lib-data-labels-angled-weeklycharts')
7520
- .attr('y', 0)
7521
- .attr('dy', function (d) {
7522
- return d.class;
7523
- })
7524
- .text(function (d) {
7525
- if (!isNaN(d[1] - d[0]) && d[1] - d[0] > 0) {
7526
- if (d[1] - d[0] <= 999)
7527
- return metaData.unit
7528
- ? metaData.unit + formatFromBackend(d[1] - d[0])
7529
- : formatFromBackend(d[1] - d[0]);
7530
- else
7531
- return metaData.unit + formatForHugeNumbers(d[1] - d[0]);
7532
- }
7533
- else
7534
- return;
7535
- })
7536
- .attr('transform', function (d) {
7537
- if (!isNaN(d[1] - d[0]) && d[1] - d[0] > 0) {
7538
- var total = 0;
7539
- var incrementer = 1;
7540
- metaData.keyList.forEach((key) => {
7541
- if (d.data[key])
7542
- total = total + d.data[key];
7543
- else
7544
- incrementer = 2;
7545
- });
7546
- if (tempObjectHolder[d.data.name] == undefined) {
7547
- tempObjectHolder[d.data.name] = 1;
7548
- }
7549
- else {
7550
- tempObjectHolder[d.data.name] =
7551
- tempObjectHolder[d.data.name] + incrementer;
7552
- }
7553
- switch (tempObjectHolder[d.data.name]) {
7554
- case 1:
7555
- return ('translate(' +
7556
- (xScale(d.data.name) + xScale.bandwidth() / 3) +
7557
- ',' +
7558
- (yScale(total) - 3) +
7559
- ') rotate(270)');
7560
- case 2:
7561
- return ('translate(' +
7562
- (xScale(d.data.name) + xScale.bandwidth() / 2 + 2) +
7563
- ',' +
7564
- (yScale(total) - 3) +
7565
- ') rotate(270)');
7566
- default:
7567
- return ('translate(' +
7568
- (xScale(d.data.name) + (xScale.bandwidth() * 3) / 4) +
7569
- ',' +
7570
- (yScale(total) - 3) +
7571
- ') rotate(270)');
7572
- }
7573
- }
7574
- return 'rotate(0)';
7575
- });
6679
+ }
6680
+ addYAxisLabel(svgYAxisLeft, label, height, margin) {
6681
+ const isria = this.customChartConfiguration?.isRia;
6682
+ const isAcronym = this.isAcronymLabel(label);
6683
+ const yPosition = isria ? -margin.left / 2 - 30 : -margin.left / 2 - 40;
6684
+ svgYAxisLeft.selectAll('.lib-axis-group-label, .lib-ylabel-drilldowncharts, .lib-ylabel-weeklyCharts').remove();
6685
+ svgYAxisLeft
6686
+ .append('text')
6687
+ .attr('class', this.getYAxisLabelClass())
6688
+ .attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
6689
+ .attr('transform', 'rotate(-90)')
6690
+ .attr('y', yPosition)
6691
+ .attr('x', -height / 2)
6692
+ .attr('dy', '1em')
6693
+ .style('text-anchor', 'middle')
6694
+ .style('fill', 'var(--chart-text-color)')
6695
+ .text(isAcronym ? label.toUpperCase() : label.toLowerCase())
6696
+ .style('text-transform', isAcronym ? 'none' : 'capitalize');
6697
+ }
6698
+ addXAxisLabel(svg, label, width, height, margin) {
6699
+ const isria = this.customChartConfiguration?.isRia;
6700
+ const isAcronym = this.isAcronymLabel(label);
6701
+ const xPosition = isria
6702
+ ? height + margin.top + margin.bottom
6703
+ : height + margin.top + margin.bottom + 10;
6704
+ svg
6705
+ .append('text')
6706
+ .attr('class', this.getXAxisLabelClass())
6707
+ .attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
6708
+ .attr('transform', `translate(${width / 2},${xPosition})`)
6709
+ .style('text-anchor', 'middle')
6710
+ .style('fill', 'var(--chart-text-color)')
6711
+ .text(isAcronym ? label.toUpperCase() : label.toLowerCase())
6712
+ .style('text-transform', isAcronym ? 'none' : 'capitalize');
6713
+ }
6714
+ isAcronymLabel(label) {
6715
+ const cleanLabel = label.replace(/[^A-Za-z]/g, '');
6716
+ return (label.length <= 4 && /^[A-Z]+$/.test(label)) ||
6717
+ (label === label.toUpperCase() && /[A-Z]/.test(label));
6718
+ }
6719
+ getYAxisLabelClass() {
6720
+ let baseClass = 'lib-axis-group-label font-size-1';
6721
+ if (this.chartConfiguration.isDrilldownChart) {
6722
+ return `${baseClass} lib-ylabel-drilldowncharts`;
7576
6723
  }
7577
- if (this.chartConfiguration.isMultiChartGridLine == undefined) {
7578
- if (isMobile) {
7579
- // Custom x-axis label rendering for mobile: evenly distribute under each bar
7580
- svg.selectAll('.custom-x-label').remove();
7581
- data.forEach(function (d, i) {
7582
- const xVal = leftAndRightSpaces + i * (barWidth + barPadding) + barWidth / 2;
7583
- svg.append('text')
7584
- .attr('class', 'custom-x-label')
7585
- .attr('x', 0)
7586
- .attr('y', height + 18)
7587
- .attr('text-anchor', 'middle')
7588
- .attr('transform', 'translate(' + (xVal + 20) + ',0)') // current value + 20
7589
- .style('font-size', '10px')
7590
- .style('fill', 'var(--chart-text-color)')
7591
- .style('writing-mode', 'sideways-lr') // writing mode for mobile
7592
- .text(d.name.substring(0, 3));
7593
- });
7594
- }
7595
- else {
7596
- svg
7597
- .append('g')
7598
- .attr('transform', 'translate(0,' + height + ')')
7599
- .attr('class', 'lib-stacked-x-axis-text')
7600
- .call(xAxis)
7601
- .selectAll('text')
7602
- .style('fill', 'var(--chart-text-color)')
7603
- .style('font-size', '12px')
7604
- .attr('text-anchor', 'middle')
7605
- .attr('dx', '0')
7606
- .attr('dy', '0.71em')
7607
- .attr('transform', null)
7608
- .text(function (d) {
7609
- return d;
7610
- });
7611
- }
7612
- svg
7613
- .append('g')
7614
- .attr('class', 'lib-stacked-y-axis-text')
7615
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
7616
- .attr('transform', 'translate(0,0)')
7617
- .call(yAxis)
7618
- .selectAll('text')
7619
- .style('fill', 'var(--chart-text-color)');
6724
+ if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
6725
+ return `${baseClass} lib-ylabel-weeklyCharts`;
7620
6726
  }
7621
- else if (this.chartConfiguration.isDrilldownChart) {
6727
+ return `${baseClass} lib-axis-waterfall-label`;
6728
+ }
6729
+ getXAxisLabelClass() {
6730
+ let baseClass = 'lib-axis-group-label font-size-1';
6731
+ if (this.chartConfiguration.isDrilldownChart) {
6732
+ return `${baseClass} lib-xlabel-drilldowncharts`;
6733
+ }
6734
+ if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
6735
+ return `${baseClass} lib-xlabel-weeklyCharts`;
6736
+ }
6737
+ return `${baseClass} lib-axis-waterfall-label`;
6738
+ }
6739
+ applyConfigurationFlags() {
6740
+ if (this.chartConfiguration.isHeaderVisible !== undefined) {
6741
+ this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
6742
+ }
6743
+ if (this.chartConfiguration.isTopCaptionVisible !== undefined) {
6744
+ this.isTopCaptionVisible = this.chartConfiguration.isTopCaptionVisible;
6745
+ }
6746
+ if (this.chartConfiguration.isTransparentBackground !== undefined) {
6747
+ this.isTransparentBackground = this.chartConfiguration.isTransparentBackground;
6748
+ }
6749
+ }
6750
+ initializeStackedChart() {
6751
+ const device = this.getDeviceConfig();
6752
+ this.configureResponsiveSettings(device);
6753
+ this.mergeConfigurations();
6754
+ this.applyConfigurationFlags();
6755
+ const data = this.chartData.data;
6756
+ const metaData = this.prepareMetaData(this.chartData.metaData);
6757
+ const lineData = this.chartData.lineData;
6758
+ const colors = metaData.colors;
6759
+ const keyList = metaData.keyList;
6760
+ const chartContainer = d3.select(this.containerElt.nativeElement);
6761
+ const verticalstackedcontainer = d3.select(this.verticalstackedcontainerElt.nativeElement);
6762
+ const margin = this.chartConfiguration.margin;
6763
+ const dimensions = this.calculateDimensions(chartContainer, verticalstackedcontainer, margin, device, data.length);
6764
+ const { svg, svgYAxisLeft, svgYAxisRight } = this.createSvgContainers(chartContainer, dimensions, margin);
6765
+ const stack = d3.stack().keys(keyList).offset(d3.stackOffsetNone);
6766
+ const layers = stack(data);
6767
+ data.sort((a, b) => b.total - a.total);
6768
+ const scales = this.createScales(data, layers, lineData, dimensions, device);
6769
+ const axes = this.createAxes(scales);
6770
+ this.renderGrids(svg, scales, dimensions);
6771
+ const rect = this.renderBars(svg, layers, scales, metaData, dimensions, device);
6772
+ this.renderAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions, device, data);
6773
+ this.renderAxisLabels(svg, svgYAxisLeft, metaData, dimensions, margin);
6774
+ this.renderTargetLine(svg, svgYAxisRight, scales, dimensions, metaData);
6775
+ this.renderDataLabels(rect, scales, metaData, dimensions);
6776
+ this.renderLineChart(svg, lineData, scales, colors, metaData);
6777
+ }
6778
+ renderGrids(svg, scales, dimensions) {
6779
+ if (this.chartConfiguration.isXgridBetweenLabels) {
7622
6780
  svg
7623
6781
  .append('g')
7624
- .attr('transform', 'translate(0,' + height + ')')
7625
- .attr('class', 'lib-stacked-x-axis-text multichart1')
7626
- .call(xAxis)
7627
- .style('display', 'none');
7628
- svgYAxisLeft
7629
- .append('g')
7630
- .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
7631
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
7632
- .attr('transform', 'translate(0,0)')
7633
- .call(yAxis)
7634
- .selectAll('text')
7635
- .style('fill', 'var(--chart-text-color)');
7636
- svgYAxisRight
7637
- .append('g')
7638
- .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
7639
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
7640
- .attr('transform', 'translate(0,0)')
7641
- .call(yAxis)
7642
- .style('display', 'none');
6782
+ .attr('class', 'grid')
6783
+ .attr('transform', `translate(${scales.xScale.bandwidth() / 2},${dimensions.height})`)
6784
+ .call(d3.axisBottom(scales.xScale).tickSize(-dimensions.height).tickFormat(''))
6785
+ .style('stroke-dasharray', '5 5')
6786
+ .style('color', '#999999')
6787
+ .call((g) => g.select('.domain').remove());
7643
6788
  }
7644
- else {
6789
+ if (this.chartConfiguration.yAxisGrid) {
7645
6790
  svg
7646
6791
  .append('g')
7647
- .attr('transform', 'translate(0,' + height + ')')
7648
- .attr('class', 'lib-stacked-x-axis-text multichart')
7649
- .attr('transform', 'translate(0,' + height + ')')
7650
- .call(xAxis)
7651
- .selectAll('text')
7652
- .style('fill', 'var(--chart-text-color)');
6792
+ .attr('class', 'grid')
6793
+ .call(d3
6794
+ .axisLeft(scales.yScale)
6795
+ .ticks(this.chartConfiguration.numberOfYTicks)
6796
+ .tickSize(-dimensions.width)
6797
+ .tickFormat(''))
6798
+ .style('color', 'var(--chart-grid-color)')
6799
+ .style('opacity', '1');
6800
+ }
6801
+ if (this.chartConfiguration.xAxisGrid) {
6802
+ for (let j = 0; j < this.chartConfiguration.xAxisGrid.length; j++) {
6803
+ svg
6804
+ .append('g')
6805
+ .attr('class', `x${j + 2} axis${j + 2}`)
6806
+ .style('color', 'var(--chart-grid-color)')
6807
+ .attr('transform', `translate(0,${dimensions.height * this.chartConfiguration.xAxisGrid[j]})`)
6808
+ .call(d3.axisBottom(scales.xScale).tickSize(0).ticks(5).tickFormat(''))
6809
+ .style('fill', 'var(--chart-text-color)');
6810
+ }
6811
+ }
6812
+ }
6813
+ renderAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions, device, data) {
6814
+ if (this.chartConfiguration.showXaxisTop) {
7653
6815
  svg
7654
6816
  .append('g')
7655
- .attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
7656
- .attr('style', self.chartConfiguration.yAxisCustomTextStyles)
7657
- .attr('transform', 'translate(0,0)')
7658
- .call(yAxis)
7659
- .selectAll('text')
7660
- .style('fill', 'var(--chart-text-color)');
6817
+ .attr('class', 'lib-line-axis-text lib-line-x-axis-text x-axis')
6818
+ .attr('style', this.chartConfiguration.xAxisCustomTextStyles)
6819
+ .call(d3.axisBottom(scales.xScale).tickSize(0));
6820
+ svg.selectAll('.x-axis > g > text').attr('class', 'lib-display-hidden');
7661
6821
  }
7662
- /**
7663
- * for existing charts, place xaxis labels nearer to xaxis
7664
- * used by existing charts
7665
- */
7666
- if (this.chartConfiguration.isMultiChartGridLine == undefined) {
7667
- d3.selectAll('g.lib-stacked-x-axis-text g.tick text').attr('y', function () {
7668
- if (alternate_text) {
7669
- alternate_text = false;
7670
- return long_tick_length + 1;
7671
- }
7672
- else {
7673
- alternate_text = true;
7674
- return short_tick_length + 1;
7675
- }
7676
- });
6822
+ if (!this.chartConfiguration.isMultiChartGridLine) {
6823
+ this.renderStandardAxes(svg, axes, scales, dimensions, device, data);
6824
+ }
6825
+ else if (this.chartConfiguration.isDrilldownChart) {
6826
+ this.renderDrilldownAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions);
7677
6827
  }
7678
6828
  else {
7679
- d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
6829
+ this.renderMultiChartAxes(svg, axes, scales, dimensions);
7680
6830
  }
7681
- /**
7682
- * based of the flag, hide or show xaxis texts
7683
- * used by weekly charts
7684
- */
7685
- if (this.chartConfiguration.isXaxisLabelHidden != undefined &&
7686
- this.chartConfiguration.isXaxisLabelHidden) {
7687
- d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
6831
+ this.applyAxisStyling(svg, svgYAxisLeft, svgYAxisRight);
6832
+ this.applyAxisConfigurations(svg, scales, dimensions, data);
6833
+ }
6834
+ renderStandardAxes(svg, axes, scales, dimensions, device, data) {
6835
+ if (device.isMobile) {
6836
+ this.renderMobileXAxis(svg, data, dimensions);
7688
6837
  }
7689
- else if (this.chartConfiguration.isXaxisLabelHidden != undefined) {
7690
- svg
7691
- .append('g')
7692
- .attr('class', 'x1 axis1')
7693
- .attr('transform', 'translate(0,' + height + ')')
7694
- .style('color', '#000')
7695
- .call(d3.axisBottom(xScale).tickSize(0))
7696
- .call((g) => g.select('.domain').attr('fill', 'none'));
6838
+ else {
7697
6839
  svg
7698
6840
  .append('g')
7699
- .attr('class', 'x2 axis2')
7700
- .attr('transform', 'translate(0,' + height + ')')
7701
- .style('color', '#000')
7702
- .call(d3.axisBottom(xScaleFromOrigin).tickSize(0))
7703
- .call((g) => g.select('.domain').attr('fill', 'none'));
7704
- svg.selectAll('.axis2 > g > text').attr('class', 'lib-display-hidden');
7705
- // svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
7706
- svg.selectAll('.x1.axis1 .tick line').attr('y2', function () {
7707
- if (self.chartConfiguration.hideXaxisTick) {
7708
- return 0;
7709
- }
7710
- /**
7711
- * isNoAlternateXaxisText is used to prevent x-axis label to be displayed in alternate fashion
7712
- * for future use
7713
- */
7714
- if (alternate_text &&
7715
- self.chartConfiguration.isNoAlternateXaxisText == undefined) {
7716
- alternate_text = false;
7717
- return long_tick_length_bg - 7;
7718
- }
7719
- else {
7720
- alternate_text = true;
7721
- return short_tick_length_bg - 4;
7722
- }
7723
- });
7724
- /**
7725
- * reset the flag so that texts also follow the pattern of ticks
7726
- * used by weekly charts
7727
- */
7728
- alternate_text = false;
7729
- svg
7730
- .selectAll('g.x1.axis1 g.tick text')
7731
- // .attr('class', 'lib-xaxis-labels-texts-weeklycharts')
7732
- .attr('class', function () {
7733
- if (self.chartConfiguration.isDrilldownChart) {
7734
- if (data && data.length > 8) {
7735
- return 'lib-xaxis-labels-texts-drilldown-alt';
7736
- }
7737
- return 'lib-xaxis-labels-texts-drilldown';
7738
- }
7739
- else
7740
- return 'lib-xaxis-labels-texts-weeklycharts';
7741
- })
7742
- .attr('y', function () {
7743
- if (alternate_text) {
7744
- alternate_text = false;
7745
- return long_tick_length_bg;
7746
- }
7747
- else {
7748
- alternate_text = true;
7749
- return short_tick_length_bg;
7750
- }
7751
- });
6841
+ .attr('transform', `translate(0,${dimensions.height})`)
6842
+ .attr('class', 'lib-stacked-x-axis-text')
6843
+ .call(axes.xAxis)
6844
+ .selectAll('text')
6845
+ .style('fill', 'var(--chart-text-color)')
6846
+ .style('font-size', '12px')
6847
+ .attr('text-anchor', 'middle')
6848
+ .attr('dx', '0')
6849
+ .attr('dy', '0.71em')
6850
+ .attr('transform', null);
7752
6851
  }
7753
- if (self.chartConfiguration.xLabelsOnSameLine) {
7754
- svg
7755
- .selectAll('g.x1.axis1 g.tick text')
7756
- .attr('class', 'lib-xaxis-labels-texts-drilldown')
7757
- .attr('y', short_tick_length_bg)
7758
- .text(function (d, i) {
7759
- if (isMobile) {
7760
- // If label has more than one word, show only first 3 letters of first word
7761
- var firstWord = d.split(' ')[0];
7762
- return firstWord.substring(0, 3);
7763
- }
7764
- if (d.trim().indexOf(' ') > -1) {
7765
- return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
7766
- }
7767
- return d.toLowerCase();
7768
- })
7769
- .attr('transform', function (d, i) {
7770
- if (isMobile) {
7771
- var totalBars = 0;
7772
- if (this.parentNode && this.parentNode.parentNode) {
7773
- totalBars = d3.select(this.parentNode.parentNode).selectAll('g.tick').size();
7774
- }
7775
- if (totalBars === 2) {
7776
- return 'translate(0,0)';
7777
- }
7778
- else {
7779
- return 'translate(' + (i * 30) + ',0)';
7780
- }
7781
- }
7782
- return null;
7783
- });
6852
+ svg
6853
+ .append('g')
6854
+ .attr('class', 'lib-stacked-y-axis-text')
6855
+ .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
6856
+ .call(axes.yAxis)
6857
+ .selectAll('text')
6858
+ .style('fill', 'var(--chart-text-color)');
6859
+ }
6860
+ renderMobileXAxis(svg, data, dimensions) {
6861
+ svg.selectAll('.custom-x-label').remove();
6862
+ data.forEach((d, i) => {
6863
+ const xVal = this.CONSTANTS.LEFT_RIGHT_SPACES +
6864
+ i * (dimensions.barWidth + dimensions.barPadding) +
6865
+ dimensions.barWidth / 2;
7784
6866
  svg
7785
- .selectAll('g.x1.axis1 g.tick')
7786
6867
  .append('text')
7787
- .attr('class', 'lib-xaxis-labels-texts-drilldown')
7788
- .attr('y', long_tick_length_bg)
7789
- .attr('fill', 'currentColor')
7790
- .text(function (d) {
7791
- // For mobile, do not print the second word at all
7792
- if (isMobile) {
7793
- return '';
7794
- }
7795
- if (d.trim().indexOf(' ') > -1) {
7796
- return d.trim().substring(d.indexOf(' '), d.length).toLowerCase();
7797
- }
7798
- return '';
7799
- })
7800
- .attr('transform', function (d, i) {
7801
- if (isMobile && i === 0) {
7802
- return 'translate(20,0)';
7803
- }
7804
- return null;
7805
- });
7806
- }
7807
- /**
7808
- * hide yaxis values
7809
- * used by weekly charts
7810
- */
7811
- if (this.chartConfiguration.isYaxisLabelHidden != undefined &&
7812
- this.chartConfiguration.isYaxisLabelHidden) {
7813
- svg
7814
- .selectAll('.yaxis-dashed > g > text')
7815
- .attr('class', 'lib-display-hidden');
7816
- }
7817
- /** hide y axis labels
7818
- * config is there for future use
7819
- */
7820
- if (this.chartConfiguration.isYaxisHidden != undefined &&
7821
- this.chartConfiguration.isYaxisHidden) {
7822
- d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
7823
- }
7824
- /**
7825
- * dashed y axis
7826
- * used by weekly charts
7827
- */
7828
- if (this.chartConfiguration.isYaxisDashed != undefined &&
7829
- this.chartConfiguration.isYaxisDashed) {
6868
+ .attr('class', 'custom-x-label')
6869
+ .attr('x', 0)
6870
+ .attr('y', dimensions.height + 18)
6871
+ .attr('text-anchor', 'middle')
6872
+ .attr('transform', `translate(${xVal + 20},0)`)
6873
+ .style('font-size', '10px')
6874
+ .style('fill', 'var(--chart-text-color)')
6875
+ .style('writing-mode', 'sideways-lr')
6876
+ .text(d.name.substring(0, 3));
6877
+ });
6878
+ }
6879
+ renderDrilldownAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions) {
6880
+ svg
6881
+ .append('g')
6882
+ .attr('transform', `translate(0,${dimensions.height})`)
6883
+ .attr('class', 'lib-stacked-x-axis-text multichart1')
6884
+ .call(axes.xAxis)
6885
+ .style('display', 'none');
6886
+ svgYAxisLeft
6887
+ .append('g')
6888
+ .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
6889
+ .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
6890
+ .call(axes.yAxis)
6891
+ .selectAll('text')
6892
+ .style('fill', 'var(--chart-text-color)');
6893
+ svgYAxisRight
6894
+ .append('g')
6895
+ .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
6896
+ .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
6897
+ .call(axes.yAxis)
6898
+ .style('display', 'none');
6899
+ }
6900
+ renderMultiChartAxes(svg, axes, scales, dimensions) {
6901
+ svg
6902
+ .append('g')
6903
+ .attr('transform', `translate(0,${dimensions.height})`)
6904
+ .attr('class', 'lib-stacked-x-axis-text multichart')
6905
+ .call(axes.xAxis)
6906
+ .selectAll('text')
6907
+ .style('fill', 'var(--chart-text-color)');
6908
+ svg
6909
+ .append('g')
6910
+ .attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
6911
+ .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
6912
+ .call(axes.yAxis)
6913
+ .selectAll('text')
6914
+ .style('fill', 'var(--chart-text-color)');
6915
+ }
6916
+ applyAxisStyling(svg, svgYAxisLeft, svgYAxisRight) {
6917
+ const styleAxisDomain = (container) => {
6918
+ container.selectAll('.domain')
6919
+ .style('stroke', 'var(--chart-axis-color)')
6920
+ .style('stroke-width', '1px');
6921
+ };
6922
+ styleAxisDomain(svg);
6923
+ styleAxisDomain(svgYAxisLeft);
6924
+ styleAxisDomain(svgYAxisRight);
6925
+ if (this.chartConfiguration.isYaxisDashed) {
7830
6926
  d3.selectAll('.yaxis-dashed')
7831
6927
  .style('stroke-dasharray', '5 5')
7832
- .style('color', 'var(--chart-grid-color)'); // Use CSS variable
6928
+ .style('color', 'var(--chart-grid-color)');
7833
6929
  }
7834
- /**
7835
- * x axis color
7836
- * used by weekly charts
7837
- */
7838
- if (this.chartConfiguration.isXaxisColor != undefined) {
6930
+ if (this.chartConfiguration.isXaxisColor) {
7839
6931
  d3.selectAll('.multichart').style('color', this.chartConfiguration.isXaxisColor || 'var(--chart-text-color)');
7840
6932
  }
7841
- /**
7842
- * used to display y label
7843
- */
7844
- if (this.isZoomedOut && this.chartData.data.length > 9) {
6933
+ }
6934
+ applyAxisConfigurations(svg, scales, dimensions, data) {
6935
+ if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
6936
+ d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
6937
+ }
6938
+ if (this.chartConfiguration.isXaxisLabelHidden) {
6939
+ d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
6940
+ }
6941
+ else if (this.chartConfiguration.isXaxisLabelHidden !== undefined) {
6942
+ this.renderCustomXAxis(svg, scales, dimensions, data);
6943
+ }
6944
+ if (this.chartConfiguration.isYaxisLabelHidden) {
6945
+ svg.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
6946
+ }
6947
+ if (this.chartConfiguration.isYaxisHidden) {
6948
+ d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
6949
+ }
6950
+ if (this.isZoomedOut && data.length > 9) {
7845
6951
  svg
7846
6952
  .selectAll('.lib-xaxis-labels-texts-drilldown')
7847
6953
  .attr('transform', 'rotate(-90)')
@@ -7849,219 +6955,272 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
7849
6955
  .attr('x', '-5')
7850
6956
  .attr('dy', null);
7851
6957
  }
7852
- function styleAxisDomain() {
7853
- svg.selectAll('.domain')
7854
- .style('stroke', 'var(--chart-axis-color)')
7855
- .style('stroke-width', '1px');
7856
- svgYAxisLeft.selectAll('.domain')
7857
- .style('stroke', 'var(--chart-axis-color)')
7858
- .style('stroke-width', '1px');
7859
- svgYAxisRight.selectAll('.domain')
7860
- .style('stroke', 'var(--chart-axis-color)')
7861
- .style('stroke-width', '1px');
6958
+ }
6959
+ renderCustomXAxis(svg, scales, dimensions, data) {
6960
+ const device = this.getDeviceConfig();
6961
+ svg
6962
+ .append('g')
6963
+ .attr('class', 'x1 axis1')
6964
+ .attr('transform', `translate(0,${dimensions.height})`)
6965
+ .style('color', '#000')
6966
+ .call(d3.axisBottom(scales.xScale).tickSize(0))
6967
+ .call((g) => g.select('.domain').attr('fill', 'none'));
6968
+ this.styleCustomXAxisTicks(svg, data, device);
6969
+ if (this.chartConfiguration.xLabelsOnSameLine) {
6970
+ this.applyXLabelsOnSameLine(svg, device);
7862
6971
  }
7863
- styleAxisDomain();
7864
- if (metaData.yLabel) {
7865
- svgYAxisLeft.selectAll('.lib-axis-group-label, .lib-ylabel-drilldowncharts, .lib-ylabel-weeklyCharts').remove();
7866
- function isAcronym(label) {
7867
- return (label.length <= 4 && /^[A-Z]+$/.test(label)) || (label === label.toUpperCase() && /[A-Z]/.test(label));
6972
+ }
6973
+ styleCustomXAxisTicks(svg, data, device) {
6974
+ let alternateText = false;
6975
+ svg.selectAll('.x1.axis1 .tick line').attr('y2', () => {
6976
+ if (this.chartConfiguration.hideXaxisTick)
6977
+ return 0;
6978
+ if (alternateText && !this.chartConfiguration.isNoAlternateXaxisText) {
6979
+ alternateText = false;
6980
+ return this.CONSTANTS.LONG_TICK_LENGTH_BG - 7;
7868
6981
  }
7869
- const yLabelText = metaData.yLabel;
7870
- const isAcr = isAcronym(yLabelText.replace(/[^A-Za-z]/g, ''));
7871
- const yPosition = isria ? 0 - margin.left / 2 - 30 : 0 - margin.left / 2 - 40;
7872
- svgYAxisLeft
7873
- .append('text')
7874
- .attr('class', function () {
7875
- let baseClass = 'lib-axis-group-label font-size-1';
7876
- if (self.chartConfiguration.isDrilldownChart)
7877
- return baseClass + ' lib-ylabel-drilldowncharts';
7878
- if (self.chartConfiguration.isMultiChartGridLine != undefined)
7879
- return baseClass + ' lib-ylabel-weeklyCharts';
7880
- return baseClass + ' lib-axis-waterfall-label';
7881
- })
7882
- .attr('style', self.chartConfiguration.yAxisCustomlabelStyles)
7883
- .attr('transform', 'rotate(-90)')
7884
- .attr('y', yPosition)
7885
- .attr('x', 0 - height / 2)
7886
- .attr('dy', '1em')
7887
- .style('text-anchor', 'middle')
7888
- .style('fill', 'var(--chart-text-color)')
7889
- .style('color', 'var(--chart-text-color)')
7890
- .text(isAcr ? yLabelText.toUpperCase() : yLabelText.toLowerCase())
7891
- .style('text-transform', isAcr ? 'none' : 'capitalize');
6982
+ alternateText = true;
6983
+ return this.CONSTANTS.SHORT_TICK_LENGTH_BG - 4;
6984
+ });
6985
+ alternateText = false;
6986
+ svg
6987
+ .selectAll('g.x1.axis1 g.tick text')
6988
+ .attr('class', () => {
6989
+ if (this.chartConfiguration.isDrilldownChart) {
6990
+ return data.length > 8
6991
+ ? 'lib-xaxis-labels-texts-drilldown-alt'
6992
+ : 'lib-xaxis-labels-texts-drilldown';
6993
+ }
6994
+ return 'lib-xaxis-labels-texts-weeklycharts';
6995
+ })
6996
+ .attr('y', () => {
6997
+ if (alternateText) {
6998
+ alternateText = false;
6999
+ return this.CONSTANTS.LONG_TICK_LENGTH_BG;
7000
+ }
7001
+ alternateText = true;
7002
+ return this.CONSTANTS.SHORT_TICK_LENGTH_BG;
7003
+ });
7004
+ }
7005
+ applyXLabelsOnSameLine(svg, device) {
7006
+ svg
7007
+ .selectAll('g.x1.axis1 g.tick text')
7008
+ .attr('class', 'lib-xaxis-labels-texts-drilldown')
7009
+ .attr('y', this.CONSTANTS.SHORT_TICK_LENGTH_BG)
7010
+ .text((d) => {
7011
+ if (device.isMobile) {
7012
+ return d.split(' ')[0].substring(0, 3);
7013
+ }
7014
+ const trimmed = d.trim();
7015
+ const spaceIndex = trimmed.indexOf(' ');
7016
+ return spaceIndex > -1
7017
+ ? trimmed.substring(0, spaceIndex).toLowerCase()
7018
+ : trimmed.toLowerCase();
7019
+ })
7020
+ .attr('transform', function (d, i) {
7021
+ if (device.isMobile) {
7022
+ const parent = this.parentNode?.parentNode;
7023
+ const totalBars = parent ? d3.select(parent).selectAll('g.tick').size() : 0;
7024
+ return totalBars === 2 ? 'translate(0,0)' : `translate(${i * 30},0)`;
7025
+ }
7026
+ return null;
7027
+ });
7028
+ svg
7029
+ .selectAll('g.x1.axis1 g.tick')
7030
+ .append('text')
7031
+ .attr('class', 'lib-xaxis-labels-texts-drilldown')
7032
+ .attr('y', this.CONSTANTS.LONG_TICK_LENGTH_BG)
7033
+ .attr('fill', 'currentColor')
7034
+ .text((d) => {
7035
+ if (device.isMobile)
7036
+ return '';
7037
+ const trimmed = d.trim();
7038
+ const spaceIndex = trimmed.indexOf(' ');
7039
+ return spaceIndex > -1
7040
+ ? trimmed.substring(spaceIndex).toLowerCase()
7041
+ : '';
7042
+ })
7043
+ .attr('transform', (d, i) => {
7044
+ return device.isMobile && i === 0 ? 'translate(20,0)' : null;
7045
+ });
7046
+ }
7047
+ renderDataLabels(rect, scales, metaData, dimensions) {
7048
+ if (!this.isCC && !this.chartConfiguration.isMultiChartGridLine) {
7049
+ rect.append('svg:title').text((d) => d[1] - d[0]);
7892
7050
  }
7893
- if (this.chartData.targetLineData) {
7894
- const yZero = yScale(parsedNum);
7895
- svg
7896
- .append('line')
7897
- .attr('x1', 0)
7898
- .attr('x2', width)
7899
- .attr('y1', yZero)
7900
- .attr('y2', yZero)
7901
- .style('stroke-dasharray', '5 5')
7902
- .style('stroke', this.chartData.targetLineData.color);
7903
- // svgYAxisRight
7904
- // .append('line')
7905
- // .attr('x1', 0)
7906
- // .attr('x2', rightSvgWidth)
7907
- // .attr('y1', yZero)
7908
- // .attr('y2', yZero)
7909
- // .style('stroke', this.chartData.targetLineData.color);
7910
- svgYAxisRight
7911
- .append('foreignObject')
7912
- // .attr('transform', 'translate(' + 0 + ',' + (yZero - 30) + ')')
7913
- .attr('transform', 'translate(' + 0 + ',' + (yZero - 13) + ')')
7914
- .attr('width', rightSvgWidth)
7915
- .attr('height', 50)
7916
- .append('xhtml:div')
7917
- .attr('class', 'target-display')
7918
- .style('color', 'var(--chart-text-color)')
7919
- .html(function (d, i) {
7920
- let dataTypeTemp = '';
7921
- let targetLineName = 'target';
7922
- if (metaData.dataType) {
7923
- dataTypeTemp = metaData.dataType;
7051
+ if (this.chartConfiguration.showTotalOnTop) {
7052
+ this.renderTopLabels(rect, scales, metaData);
7053
+ }
7054
+ if (this.chartConfiguration.showAngledLabels) {
7055
+ this.renderAngledLabels(rect, scales, metaData);
7056
+ }
7057
+ }
7058
+ renderTopLabels(rect, scales, metaData) {
7059
+ const formatFromBackend = this.chartConfiguration.textFormatter
7060
+ ? ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter)
7061
+ : (d) => d;
7062
+ const formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
7063
+ rect
7064
+ .append('text')
7065
+ .attr('x', (d) => scales.xScale(d.data.name) + scales.xScale.bandwidth() / 2)
7066
+ .attr('class', 'lib-verticalstack-labels-ontop-weklycharts')
7067
+ .attr('y', (d) => scales.yScale(d[1]) - 3)
7068
+ .text((d) => {
7069
+ const value = d[1] - d[0];
7070
+ if (isNaN(value) || value === 0)
7071
+ return;
7072
+ const formattedValue = value <= 999
7073
+ ? formatFromBackend(value)
7074
+ : formatForHugeNumbers(value);
7075
+ return metaData.unit ? metaData.unit + formattedValue : formattedValue;
7076
+ });
7077
+ }
7078
+ renderAngledLabels(rect, scales, metaData) {
7079
+ const formatFromBackend = this.chartConfiguration.textFormatter
7080
+ ? ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter)
7081
+ : (d) => d;
7082
+ const formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
7083
+ const tempObjectHolder = {};
7084
+ rect
7085
+ .append('text')
7086
+ .attr('x', 0)
7087
+ .attr('y', 0)
7088
+ .attr('fill', (d) => metaData.colors[d.key])
7089
+ .attr('class', 'lib-data-labels-angled-weeklycharts')
7090
+ .text((d) => {
7091
+ const value = d[1] - d[0];
7092
+ if (isNaN(value) || value <= 0)
7093
+ return;
7094
+ const formattedValue = value <= 999
7095
+ ? formatFromBackend(value)
7096
+ : formatForHugeNumbers(value);
7097
+ return metaData.unit ? metaData.unit + formattedValue : formattedValue;
7098
+ })
7099
+ .attr('transform', (d) => {
7100
+ const value = d[1] - d[0];
7101
+ if (isNaN(value) || value <= 0)
7102
+ return 'rotate(0)';
7103
+ let total = 0;
7104
+ let incrementer = 1;
7105
+ metaData.keyList.forEach(key => {
7106
+ if (d.data[key]) {
7107
+ total += d.data[key];
7924
7108
  }
7925
- if (self.chartData.targetLineData &&
7926
- self.chartData.targetLineData.targetName) {
7927
- targetLineName = self.chartData.targetLineData.targetName;
7109
+ else {
7110
+ incrementer = 2;
7928
7111
  }
7929
- return (`<div>${targetLineName}</div>` +
7930
- '<div>' +
7931
- self.chartData.targetLineData.target +
7932
- '' +
7933
- dataTypeTemp +
7934
- '</div>');
7935
7112
  });
7936
- }
7937
- rect
7938
- .selectAll('rect')
7939
- .on('mouseenter', handleMouseOver)
7940
- .on('mouseout', handleMouseOut);
7941
- if (metaData.lineyLabel) {
7942
- svg
7943
- .append('text')
7944
- .attr('class', 'lib-axis-group-label lib-line-axis')
7945
- .attr('style', self.chartConfiguration.yAxisCustomlabelStyles)
7946
- .attr('transform', 'translate(' + (width - 20) + ',0) rotate(90)')
7947
- .attr('y', 0 - margin.right * 3)
7948
- .attr('x', height / 2)
7949
- .attr('dy', '5em')
7950
- .style('text-anchor', 'middle')
7951
- .text(metaData.lineyLabel);
7952
- }
7953
- if (metaData.xLabel) {
7954
- function isAcronym(label) {
7955
- return ((label.length <= 4 && /^[A-Z]+$/.test(label)) ||
7956
- (label === label.toUpperCase() && /[A-Z]/.test(label)));
7113
+ tempObjectHolder[d.data.name] = (tempObjectHolder[d.data.name] || 0) + incrementer;
7114
+ const position = tempObjectHolder[d.data.name];
7115
+ const xPos = scales.xScale(d.data.name);
7116
+ const bandwidth = scales.xScale.bandwidth();
7117
+ const yPos = scales.yScale(total) - 3;
7118
+ switch (position) {
7119
+ case 1:
7120
+ return `translate(${xPos + bandwidth / 3},${yPos}) rotate(270)`;
7121
+ case 2:
7122
+ return `translate(${xPos + bandwidth / 2 + 2},${yPos}) rotate(270)`;
7123
+ default:
7124
+ return `translate(${xPos + (bandwidth * 3) / 4},${yPos}) rotate(270)`;
7957
7125
  }
7958
- const xLabelText = metaData.xLabel;
7959
- const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
7960
- const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
7126
+ });
7127
+ }
7128
+ renderTargetLine(svg, svgYAxisRight, scales, dimensions, metaData) {
7129
+ if (!this.chartData.targetLineData)
7130
+ return;
7131
+ const parsedTarget = this.parseTargetValue(this.chartData.targetLineData.target);
7132
+ const yZero = scales.yScale(parsedTarget);
7133
+ svg
7134
+ .append('line')
7135
+ .attr('x1', 0)
7136
+ .attr('x2', dimensions.width)
7137
+ .attr('y1', yZero)
7138
+ .attr('y2', yZero)
7139
+ .style('stroke-dasharray', '5 5')
7140
+ .style('stroke', this.chartData.targetLineData.color);
7141
+ this.renderTargetLabel(svgYAxisRight, yZero, metaData);
7142
+ }
7143
+ parseTargetValue(target) {
7144
+ const parsed = parseFloat(String(target));
7145
+ if (isNaN(parsed))
7146
+ return 0;
7147
+ return Number.isInteger(parsed) ? parseInt(String(target)) : parsed;
7148
+ }
7149
+ renderTargetLabel(svgYAxisRight, yZero, metaData) {
7150
+ const dataType = metaData.dataType || '';
7151
+ const targetName = this.chartData.targetLineData.targetName || 'target';
7152
+ svgYAxisRight
7153
+ .append('foreignObject')
7154
+ .attr('transform', `translate(0,${yZero - 13})`)
7155
+ .attr('width', this.CONSTANTS.RIGHT_SVG_WIDTH)
7156
+ .attr('height', 50)
7157
+ .append('xhtml:div')
7158
+ .attr('class', 'target-display')
7159
+ .style('color', 'var(--chart-text-color)')
7160
+ .html(`<div>${targetName}</div><div>${this.chartData.targetLineData.target}${dataType}</div>`);
7161
+ }
7162
+ renderLineChart(svg, lineData, scales, colors, metaData) {
7163
+ if (!lineData || !colors)
7164
+ return;
7165
+ const dataGroup = d3
7166
+ .nest()
7167
+ .key((d) => d.category)
7168
+ .entries(lineData);
7169
+ const lineGen = d3
7170
+ .line()
7171
+ .x((d) => scales.xScale(d.name) + scales.xScale.bandwidth() / 2)
7172
+ .y((d) => scales.lineYscale(d.value));
7173
+ dataGroup.forEach((group) => {
7961
7174
  svg
7962
- .append('text')
7963
- .attr('class', function () {
7964
- let baseClass = 'lib-axis-group-label font-size-1';
7965
- if (self.chartConfiguration.isDrilldownChart)
7966
- return baseClass + ' lib-xlabel-drilldowncharts';
7967
- if (self.chartConfiguration.isMultiChartGridLine != undefined)
7968
- return baseClass + ' lib-xlabel-weeklyCharts';
7969
- return baseClass + ' lib-axis-waterfall-label';
7970
- })
7971
- .attr('style', self.chartConfiguration.xAxisCustomlabelStyles)
7972
- .attr('transform', 'translate(' + width / 2 + ' ,' + xPosition + ')')
7973
- .style('text-anchor', 'middle')
7974
- .style('fill', 'var(--chart-text-color)')
7975
- .text(isAcr ? xLabelText.toUpperCase() : xLabelText.toLowerCase())
7976
- .style('text-transform', isAcr ? 'none' : 'capitalize');
7977
- }
7978
- if (lineData && colors) {
7979
- var dataGroup = d3
7980
- .nest()
7981
- .key(function (d) {
7982
- return d.category;
7983
- })
7984
- .entries(lineData);
7985
- var lineGen = d3
7986
- .line()
7987
- .x(function (d) {
7988
- return xScale(d.name) + xScale.bandwidth() / 2;
7175
+ .append('path')
7176
+ .datum(group.values)
7177
+ .attr('fill', 'none')
7178
+ .attr('stroke', (d) => {
7179
+ return d[0]?.category
7180
+ ? colors[d[0].category]
7181
+ : this.chartConfiguration.lineGraphColor;
7989
7182
  })
7990
- .y(function (d) {
7991
- return lineYscale(d.value);
7992
- });
7993
- var calculateCX = (d) => {
7994
- return xScale(d.name) + xScale.bandwidth() / 2;
7995
- };
7996
- var calculateCY = (d) => {
7997
- return lineYscale(d.value);
7998
- };
7999
- dataGroup.forEach(function (d, i) {
8000
- svg
8001
- .append('path')
8002
- .datum(d.values)
8003
- .attr('fill', 'none')
8004
- .attr('stroke', function (d) {
8005
- if ('category' in d[0]) {
8006
- return colors[d[0].category];
8007
- }
8008
- else {
8009
- return self.chartConfiguration.lineGraphColor;
8010
- }
8011
- })
8012
- .attr('stroke-width', 2.5) /**line thinkness */
8013
- .attr('d', lineGen(d.values));
8014
- var dot = svg
8015
- .selectAll('myCircles')
8016
- .data(d.values)
8017
- .enter()
8018
- .append('g')
8019
- .on('click', function (d) {
8020
- self.handleClick(d);
8021
- });
8022
- dot
8023
- .append('circle')
8024
- .attr('fill', function (d) {
8025
- if ('category' in d) {
8026
- return colors[d.category];
8027
- }
8028
- else {
8029
- return self.chartConfiguration.lineGraphColor;
8030
- }
8031
- })
8032
- .attr('stroke', 'none')
8033
- .attr('cx', function (d, i) {
8034
- return xScale(d.name) + xScale.bandwidth() / 2;
8035
- })
8036
- .attr('cy', function (d, i) {
8037
- return lineYscale(d.value);
8038
- })
8039
- .attr('r', 3) /**radius of circle=5 */
8040
- .style('cursor', 'pointer');
8041
- if (self.chartConfiguration.lineGraphColor) {
8042
- dot
8043
- .append('text')
8044
- .attr('class', 'dots')
8045
- .attr('fill', self.chartConfiguration.lineGraphColor)
8046
- .attr('style', 'font-size: ' + '.85em;' + 'font-weight:' + 'bold')
8047
- .attr('x', function (d, i) {
8048
- return xScale(d.name) + xScale.bandwidth() / 2;
8049
- })
8050
- .attr('y', function (d, i) {
8051
- return lineYscale(d.value);
8052
- })
8053
- .attr('dy', '-1em')
8054
- .text(function (d, i) {
8055
- return self.chartConfiguration.labelFormatter(d.value);
8056
- });
8057
- }
8058
- });
7183
+ .attr('stroke-width', 2.5)
7184
+ .attr('d', lineGen);
7185
+ this.renderLineDots(svg, group.values, scales, colors);
7186
+ });
7187
+ }
7188
+ renderLineDots(svg, values, scales, colors) {
7189
+ const dot = svg
7190
+ .selectAll('.line-dots')
7191
+ .data(values)
7192
+ .enter()
7193
+ .append('g')
7194
+ .on('click', (d) => this.handleClick(d));
7195
+ dot
7196
+ .append('circle')
7197
+ .attr('fill', (d) => {
7198
+ return d.category
7199
+ ? colors[d.category]
7200
+ : this.chartConfiguration.lineGraphColor;
7201
+ })
7202
+ .attr('stroke', 'none')
7203
+ .attr('cx', (d) => scales.xScale(d.name) + scales.xScale.bandwidth() / 2)
7204
+ .attr('cy', (d) => scales.lineYscale(d.value))
7205
+ .attr('r', 3)
7206
+ .style('cursor', 'pointer');
7207
+ if (this.chartConfiguration.lineGraphColor) {
7208
+ dot
7209
+ .append('text')
7210
+ .attr('class', 'dots')
7211
+ .attr('fill', this.chartConfiguration.lineGraphColor)
7212
+ .style('font-size', '.85em')
7213
+ .style('font-weight', 'bold')
7214
+ .attr('x', (d) => scales.xScale(d.name) + scales.xScale.bandwidth() / 2)
7215
+ .attr('y', (d) => scales.lineYscale(d.value))
7216
+ .attr('dy', '-1em')
7217
+ .text((d) => this.chartConfiguration.labelFormatter(d.value));
8059
7218
  }
8060
- // svg.attr('width', 150).style('max-width', 150).style('overflow-x', 'auto');
8061
7219
  }
8062
7220
  handleClick(d) {
8063
- if (this.chartData?.metaData?.hasDrillDown || d?.toggleFrom)
7221
+ if (this.chartData?.metaData?.hasDrillDown || d?.toggleFrom) {
8064
7222
  this.clickEvent.emit(d);
7223
+ }
8065
7224
  }
8066
7225
  handleHeaderMenuClick(id) {
8067
7226
  this.headerMenuclickEvent.emit(id);
@@ -8070,15 +7229,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
8070
7229
  this.clickEvent.emit(event);
8071
7230
  }
8072
7231
  handleZoominZoomoutClick({ isZoomOut, event }) {
8073
- // this.isZoomOutSelected(isZoomOut, event);
8074
7232
  this.isZoomOutSelected(isZoomOut);
8075
7233
  }
8076
7234
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8077
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: HorizontalBarsWithScrollZoomComponent, selector: "lib-horizontal-bars-with-scroll-zoom", inputs: { chartData: "chartData", customChartConfiguration: "customChartConfiguration" }, outputs: { clickEvent: "clickEvent", headerMenuclickEvent: "headerMenuclickEvent" }, viewQueries: [{ propertyName: "containerElt", first: true, predicate: ["verticalstackedchartcontainer"], descendants: true, static: true }, { propertyName: "verticalstackedcontainerElt", first: true, predicate: ["verticalstackedcontainer"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<meta http-equiv=\"CACHE-CONTROL\" content=\"NO-CACHE\" />\r\n<meta http-equiv=\"EXPIRES\" content=\"Sat, 01 Jun 2004 11:12:01 GMT\" />\r\n<div\r\n #verticalstackedcontainer\r\n class=\"lib-chart-wrapper\"\r\n [ngClass]=\"{ 'lib-no-background': isTransparentBackground }\"\r\n style=\"background-color: var(--card-bg);\"\r\n\r\n (resized)=\"onResized($event)\"\r\n>\r\n <div class=\"header-alt\" *ngIf=\"!isHeaderVisible\">\r\n <lib-chart-header-v2\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (clickEvent)=\"handleClick($event)\"\r\n ></lib-chart-header-v2>\r\n\r\n <!-- <span *ngIf=\"chartConfiguration.isComparebyDropdownVisible\">\r\n <lib-dropdown></lib-dropdown>\r\n </span> -->\r\n <lib-chart-header-v3\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (compareByFilterSelection)=\"handleCompareByFilterSelection($event)\"\r\n (zoomInZoomOutClick)=\"handleZoominZoomoutClick($event)\"\r\n ></lib-chart-header-v3>\r\n </div>\r\n <div\r\n [style.height]=\"chartConfiguration.svgHeight\"\r\n id=\"verticalstackedchartcontainer\"\r\n #verticalstackedchartcontainer\r\n class=\"lib-chart-svg\"\r\n ></div>\r\n</div>\r\n", styles: [".lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1;font-size:1.2em}.lib-axis-group-label{font-size:.85em;font-weight:600;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.dots{font-size:10px}.inline__display{display:flex;justify-content:space-around;padding-top:2%}.verticalbar__text{font-style:normal;font-variant:normal;font-weight:400;font-size:13px;line-height:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;opacity:1}.lib-line-label-item{display:inline-block!important;font-size:.85em;margin-right:10px;font-weight:600}.lib-line-label-wrapper-vertical{display:flex;justify-content:center}.target-display{font-size:12px;line-height:14.52px;font-weight:700;text-transform:uppercase;float:right}.title{background-color:#d9d9d9;height:40px;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:3px;line-height:1}.title-top-text{color:var(--font-color)!important;font-size:14px;font-weight:600}.title-bar-name{color:var(--font-color)!important;font-size:17px;font-weight:700;text-transform:capitalize}.title-bottom-text{color:var(--font-color)!important;font-size:12px}.zoomIcons-holder{display:flex;align-items:center;margin-right:15px}.zoomIcons{border:.5px solid #b6b6b6;cursor:pointer;display:flex;justify-content:center;align-items:center;width:30px;height:30px;color:var(--color)!important}.zoom-active{background-color:#2d5ca0;opacity:1}.zoom-inactive{background-color:#d9d9d9;opacity:.5}@media (max-width: 575px){.lib-xaxis-labels-texts-drilldown{writing-mode:sideways-lr}}@media screen and (min-width: 1024px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1366px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1920px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 2560px) and (min-height: 500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}}.bottom__text{position:absolute!important;bottom:0!important;display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important}.box__heightwidth{opacity:1;height:10px;width:10px;border:none!important;border-radius:50%}.label__text{margin-right:10px;display:flex;justify-content:center;align-items:center;font-style:normal;font-variant:normal;font-weight:400;font-size:10px;line-height:13px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:.2px;color:#707070!important}.lib-verticalstack-labels-ontop-weklycharts{font-style:normal;font-variant:normal;font-weight:700;font-size:10px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.lib-verticalstack-title-ontop{font-style:normal;font-variant:normal;font-size:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.marginLeft-20{margin-left:20px}.flex-inline{display:flex;justify-content:center;align-items:center;font-size:14px}\n", ".lib-chart-wrapper{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;background:#fff 0% 0% no-repeat padding-box;position:relative}.lib-chart-wrapper-wo-shadow{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background){background-color:#2e3640}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background) .chart-title{color:#fff}.lib-chart-svg{width:100%}.lib-chart-header{text-align:center;background-color:#052340;color:#fff;width:100%;height:17%;word-spacing:.5px;line-height:1.8;font-weight:700;padding-top:2%;letter-spacing:0;font-size:1.2em}.lib-donut-chart-footer{width:100%;text-align:right}.lib-donut-label-text{font-size:.9em;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1}.lib-donut-label-icon{display:inline-block;width:10px;height:10px;margin-right:20px;border-radius:3px}.lib-donut-label-item{font-weight:400;font-size:.85em;color:#2f2f2f}.lib-donut-justified-label-wrapper{width:100%;display:inline-block;text-align:center;list-style-type:none}.lib-donut-justified-label-item{font-weight:400;font-size:.85em;color:#2f2f2f;display:inline-block;text-align:left;padding:0 10px}.lib-donut-justified-label-icon{display:inline-block;width:10px;height:10px;margin-right:5px;border-radius:3px}.lib-no-background{background:none!important}.lib-display-hidden{display:none}.lib-ylabel-weeklyCharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:12px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.07px;text-transform:capitalize;color:#000}.lib-data-labels-weeklycharts{font-style:normal;font-variant:normal;font-weight:400;font-size:12px;line-height:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.06px;color:#000}.lib-data-labels-angled-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:9.5px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:.4px;text-anchor:start}.lib-xaxis-labels-texts-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:11px;letter-spacing:-.05px;fill:#000}.lib-xaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:-1px;color:#000;opacity:1;text-transform:capitalize}.lib-white-space-nowrap{white-space:nowrap}.lib-xaxis-labels-texts-drilldown-alt{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:10px;letter-spacing:0px;color:#000;opacity:1;text-transform:capitalize}.lib-yaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:0px;color:#000!important;opacity:1}.lib-ylabel-drilldowncharts,.lib-xlabel-drilldowncharts{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:16px;letter-spacing:-.1px;color:#000!important;opacity:1}.lib-donut-justified-label-icon-drilldown{display:inline-block;width:14px;height:14px;margin-right:10px;border-radius:50%}.marginright-2{margin-right:2%}.margintop-5{margin-top:5%}.width-100{width:100%}.float-right{float:right}.marginBottom-10{margin-bottom:10px}.header-alt{align-items:center;margin-bottom:10px}input::placeholder{font-size:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.padding-5{padding:5px}.hidden{visibility:hidden}.font-weight-bold{font-weight:900}.textalign-center{text-align:center}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.font-weight-600{font-weight:600}.marginRight-15{margin-right:15px}.marginRight-20{margin-right:20px}.switch{position:relative;display:inline-block;width:46px;height:24px;margin-left:5px;margin-right:5px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;inset:0;background-color:#2d5ca0;-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:\"\";height:18px;width:18px;right:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider.round{border-radius:18px}.slider.round:before{border-radius:50%}.slider1{position:absolute;cursor:pointer;inset:0;background-color:#015ba2cf;-webkit-transition:.4s;transition:.4s}.slider1:before{position:absolute;content:\"\";height:18px;width:18px;left:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider1.round1{border-radius:18px}.slider1.round1:before{border-radius:50%}.lib-display-flex{display:flex}.lib-align-items-center{align-items:center}.lib-flex-direction-column{flex-direction:column}.lib-justify-content-space-between{justify-content:space-between}.lib-justify-content-space-around{justify-content:space-around}.lib-justify-content-center{justify-content:center}.lib-justify-content-start{justify-content:start}.lib-justify-content-end{justify-content:end}.lib-ml-20{margin-left:20px}.lib-position-absolute{position:absolute}.lib-z-index-9{z-index:9}.marginright-3{margin-right:3px}@media (min-height: 900px){.lib-chart-wrapper{border-radius:8px}.header-font-size-1{font-size:18px!important}.font-size-1{font-size:14px!important}.font-size-2{font-size:16px!important}.font-size-3{font-size:14px!important}.font-size-4{font-size:22px!important}.font-size-5{font-size:24px!important}}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ResizedDirective, selector: "[resized]", outputs: ["resized"] }, { kind: "component", type: ChartHeaderV2Component, selector: "lib-chart-header-v2", inputs: ["chartData", "chartConfiguration"], outputs: ["clickEvent", "zoomInZoomOutClick"] }, { kind: "component", type: ChartHeaderV3Component, selector: "lib-chart-header-v3", inputs: ["chartData", "chartConfiguration"], outputs: ["compareByFilterSelection", "zoomInZoomOutClick"] }], encapsulation: i0.ViewEncapsulation.None }); }
7235
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: HorizontalBarsWithScrollZoomComponent, selector: "lib-horizontal-bars-with-scroll-zoom", inputs: { chartData: "chartData", customChartConfiguration: "customChartConfiguration" }, outputs: { clickEvent: "clickEvent", headerMenuclickEvent: "headerMenuclickEvent" }, viewQueries: [{ propertyName: "containerElt", first: true, predicate: ["verticalstackedchartcontainer"], descendants: true, static: true }, { propertyName: "verticalstackedcontainerElt", first: true, predicate: ["verticalstackedcontainer"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<meta http-equiv=\"CACHE-CONTROL\" content=\"NO-CACHE\" />\r\n<meta http-equiv=\"EXPIRES\" content=\"Sat, 01 Jun 2004 11:12:01 GMT\" />\r\n<div\r\n #verticalstackedcontainer\r\n class=\"lib-chart-wrapper\"\r\n [ngClass]=\"{ 'lib-no-background': isTransparentBackground }\"\r\n style=\"background-color: var(--card-bg);\"\r\n\r\n (resized)=\"onResized($event)\"\r\n>\r\n <div class=\"header-alt\" *ngIf=\"!isHeaderVisible\">\r\n <lib-chart-header-v2\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (clickEvent)=\"handleClick($event)\"\r\n ></lib-chart-header-v2>\r\n\r\n <lib-chart-header-v3\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (compareByFilterSelection)=\"handleCompareByFilterSelection($event)\"\r\n (zoomInZoomOutClick)=\"handleZoominZoomoutClick($event)\"\r\n ></lib-chart-header-v3>\r\n </div>\r\n <div\r\n [style.height]=\"chartConfiguration.svgHeight\"\r\n id=\"verticalstackedchartcontainer\"\r\n #verticalstackedchartcontainer\r\n class=\"lib-chart-svg\"\r\n ></div>\r\n</div>\r\n", styles: [".lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1;font-size:1.2em}.lib-axis-group-label{font-size:.85em;font-weight:600;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.dots{font-size:10px}.inline__display{display:flex;justify-content:space-around;padding-top:2%}.verticalbar__text{font-style:normal;font-variant:normal;font-weight:400;font-size:13px;line-height:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;opacity:1}.lib-line-label-item{display:inline-block!important;font-size:.85em;margin-right:10px;font-weight:600}.lib-line-label-wrapper-vertical{display:flex;justify-content:center}.target-display{font-size:12px;line-height:14.52px;font-weight:700;text-transform:uppercase;float:right}.title{background-color:#d9d9d9;height:40px;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:3px;line-height:1}.title-top-text{color:var(--font-color)!important;font-size:14px;font-weight:600}.title-bar-name{color:var(--font-color)!important;font-size:17px;font-weight:700;text-transform:capitalize}.title-bottom-text{color:var(--font-color)!important;font-size:12px}.zoomIcons-holder{display:flex;align-items:center;margin-right:15px}.zoomIcons{border:.5px solid #b6b6b6;cursor:pointer;display:flex;justify-content:center;align-items:center;width:30px;height:30px;color:var(--color)!important}.zoom-active{background-color:#2d5ca0;opacity:1}.zoom-inactive{background-color:#d9d9d9;opacity:.5}@media (max-width: 575px){.lib-xaxis-labels-texts-drilldown{writing-mode:sideways-lr}}@media screen and (min-width: 1024px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1366px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1920px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 2560px) and (min-height: 500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}}.bottom__text{position:absolute!important;bottom:0!important;display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important}.box__heightwidth{opacity:1;height:10px;width:10px;border:none!important;border-radius:50%}.label__text{margin-right:10px;display:flex;justify-content:center;align-items:center;font-style:normal;font-variant:normal;font-weight:400;font-size:10px;line-height:13px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:.2px;color:#707070!important}.lib-verticalstack-labels-ontop-weklycharts{font-style:normal;font-variant:normal;font-weight:700;font-size:10px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.lib-verticalstack-title-ontop{font-style:normal;font-variant:normal;font-size:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.marginLeft-20{margin-left:20px}.flex-inline{display:flex;justify-content:center;align-items:center;font-size:14px}\n", ".lib-chart-wrapper{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;background:#fff 0% 0% no-repeat padding-box;position:relative}.lib-chart-wrapper-wo-shadow{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background){background-color:#2e3640}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background) .chart-title{color:#fff}.lib-chart-svg{width:100%}.lib-chart-header{text-align:center;background-color:#052340;color:#fff;width:100%;height:17%;word-spacing:.5px;line-height:1.8;font-weight:700;padding-top:2%;letter-spacing:0;font-size:1.2em}.lib-donut-chart-footer{width:100%;text-align:right}.lib-donut-label-text{font-size:.9em;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1}.lib-donut-label-icon{display:inline-block;width:10px;height:10px;margin-right:20px;border-radius:3px}.lib-donut-label-item{font-weight:400;font-size:.85em;color:#2f2f2f}.lib-donut-justified-label-wrapper{width:100%;display:inline-block;text-align:center;list-style-type:none}.lib-donut-justified-label-item{font-weight:400;font-size:.85em;color:#2f2f2f;display:inline-block;text-align:left;padding:0 10px}.lib-donut-justified-label-icon{display:inline-block;width:10px;height:10px;margin-right:5px;border-radius:3px}.lib-no-background{background:none!important}.lib-display-hidden{display:none}.lib-ylabel-weeklyCharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:12px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.07px;text-transform:capitalize;color:#000}.lib-data-labels-weeklycharts{font-style:normal;font-variant:normal;font-weight:400;font-size:12px;line-height:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.06px;color:#000}.lib-data-labels-angled-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:9.5px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:.4px;text-anchor:start}.lib-xaxis-labels-texts-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:11px;letter-spacing:-.05px;fill:#000}.lib-xaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:-1px;color:#000;opacity:1;text-transform:capitalize}.lib-white-space-nowrap{white-space:nowrap}.lib-xaxis-labels-texts-drilldown-alt{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:10px;letter-spacing:0px;color:#000;opacity:1;text-transform:capitalize}.lib-yaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:0px;color:#000!important;opacity:1}.lib-ylabel-drilldowncharts,.lib-xlabel-drilldowncharts{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:16px;letter-spacing:-.1px;color:#000!important;opacity:1}.lib-donut-justified-label-icon-drilldown{display:inline-block;width:14px;height:14px;margin-right:10px;border-radius:50%}.marginright-2{margin-right:2%}.margintop-5{margin-top:5%}.width-100{width:100%}.float-right{float:right}.marginBottom-10{margin-bottom:10px}.header-alt{align-items:center;margin-bottom:10px}input::placeholder{font-size:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.padding-5{padding:5px}.hidden{visibility:hidden}.font-weight-bold{font-weight:900}.textalign-center{text-align:center}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.font-weight-600{font-weight:600}.marginRight-15{margin-right:15px}.marginRight-20{margin-right:20px}.switch{position:relative;display:inline-block;width:46px;height:24px;margin-left:5px;margin-right:5px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;inset:0;background-color:#2d5ca0;-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:\"\";height:18px;width:18px;right:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider.round{border-radius:18px}.slider.round:before{border-radius:50%}.slider1{position:absolute;cursor:pointer;inset:0;background-color:#015ba2cf;-webkit-transition:.4s;transition:.4s}.slider1:before{position:absolute;content:\"\";height:18px;width:18px;left:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider1.round1{border-radius:18px}.slider1.round1:before{border-radius:50%}.lib-display-flex{display:flex}.lib-align-items-center{align-items:center}.lib-flex-direction-column{flex-direction:column}.lib-justify-content-space-between{justify-content:space-between}.lib-justify-content-space-around{justify-content:space-around}.lib-justify-content-center{justify-content:center}.lib-justify-content-start{justify-content:start}.lib-justify-content-end{justify-content:end}.lib-ml-20{margin-left:20px}.lib-position-absolute{position:absolute}.lib-z-index-9{z-index:9}.marginright-3{margin-right:3px}@media (min-height: 900px){.lib-chart-wrapper{border-radius:8px}.header-font-size-1{font-size:18px!important}.font-size-1{font-size:14px!important}.font-size-2{font-size:16px!important}.font-size-3{font-size:14px!important}.font-size-4{font-size:22px!important}.font-size-5{font-size:24px!important}}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ResizedDirective, selector: "[resized]", outputs: ["resized"] }, { kind: "component", type: ChartHeaderV2Component, selector: "lib-chart-header-v2", inputs: ["chartData", "chartConfiguration"], outputs: ["clickEvent", "zoomInZoomOutClick"] }, { kind: "component", type: ChartHeaderV3Component, selector: "lib-chart-header-v3", inputs: ["chartData", "chartConfiguration"], outputs: ["compareByFilterSelection", "zoomInZoomOutClick"] }], encapsulation: i0.ViewEncapsulation.None }); }
8078
7236
  }
8079
7237
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, decorators: [{
8080
7238
  type: Component,
8081
- args: [{ selector: 'lib-horizontal-bars-with-scroll-zoom', encapsulation: ViewEncapsulation.None, template: "<meta http-equiv=\"CACHE-CONTROL\" content=\"NO-CACHE\" />\r\n<meta http-equiv=\"EXPIRES\" content=\"Sat, 01 Jun 2004 11:12:01 GMT\" />\r\n<div\r\n #verticalstackedcontainer\r\n class=\"lib-chart-wrapper\"\r\n [ngClass]=\"{ 'lib-no-background': isTransparentBackground }\"\r\n style=\"background-color: var(--card-bg);\"\r\n\r\n (resized)=\"onResized($event)\"\r\n>\r\n <div class=\"header-alt\" *ngIf=\"!isHeaderVisible\">\r\n <lib-chart-header-v2\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (clickEvent)=\"handleClick($event)\"\r\n ></lib-chart-header-v2>\r\n\r\n <!-- <span *ngIf=\"chartConfiguration.isComparebyDropdownVisible\">\r\n <lib-dropdown></lib-dropdown>\r\n </span> -->\r\n <lib-chart-header-v3\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (compareByFilterSelection)=\"handleCompareByFilterSelection($event)\"\r\n (zoomInZoomOutClick)=\"handleZoominZoomoutClick($event)\"\r\n ></lib-chart-header-v3>\r\n </div>\r\n <div\r\n [style.height]=\"chartConfiguration.svgHeight\"\r\n id=\"verticalstackedchartcontainer\"\r\n #verticalstackedchartcontainer\r\n class=\"lib-chart-svg\"\r\n ></div>\r\n</div>\r\n", styles: [".lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1;font-size:1.2em}.lib-axis-group-label{font-size:.85em;font-weight:600;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.dots{font-size:10px}.inline__display{display:flex;justify-content:space-around;padding-top:2%}.verticalbar__text{font-style:normal;font-variant:normal;font-weight:400;font-size:13px;line-height:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;opacity:1}.lib-line-label-item{display:inline-block!important;font-size:.85em;margin-right:10px;font-weight:600}.lib-line-label-wrapper-vertical{display:flex;justify-content:center}.target-display{font-size:12px;line-height:14.52px;font-weight:700;text-transform:uppercase;float:right}.title{background-color:#d9d9d9;height:40px;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:3px;line-height:1}.title-top-text{color:var(--font-color)!important;font-size:14px;font-weight:600}.title-bar-name{color:var(--font-color)!important;font-size:17px;font-weight:700;text-transform:capitalize}.title-bottom-text{color:var(--font-color)!important;font-size:12px}.zoomIcons-holder{display:flex;align-items:center;margin-right:15px}.zoomIcons{border:.5px solid #b6b6b6;cursor:pointer;display:flex;justify-content:center;align-items:center;width:30px;height:30px;color:var(--color)!important}.zoom-active{background-color:#2d5ca0;opacity:1}.zoom-inactive{background-color:#d9d9d9;opacity:.5}@media (max-width: 575px){.lib-xaxis-labels-texts-drilldown{writing-mode:sideways-lr}}@media screen and (min-width: 1024px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1366px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1920px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 2560px) and (min-height: 500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}}.bottom__text{position:absolute!important;bottom:0!important;display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important}.box__heightwidth{opacity:1;height:10px;width:10px;border:none!important;border-radius:50%}.label__text{margin-right:10px;display:flex;justify-content:center;align-items:center;font-style:normal;font-variant:normal;font-weight:400;font-size:10px;line-height:13px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:.2px;color:#707070!important}.lib-verticalstack-labels-ontop-weklycharts{font-style:normal;font-variant:normal;font-weight:700;font-size:10px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.lib-verticalstack-title-ontop{font-style:normal;font-variant:normal;font-size:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.marginLeft-20{margin-left:20px}.flex-inline{display:flex;justify-content:center;align-items:center;font-size:14px}\n", ".lib-chart-wrapper{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;background:#fff 0% 0% no-repeat padding-box;position:relative}.lib-chart-wrapper-wo-shadow{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background){background-color:#2e3640}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background) .chart-title{color:#fff}.lib-chart-svg{width:100%}.lib-chart-header{text-align:center;background-color:#052340;color:#fff;width:100%;height:17%;word-spacing:.5px;line-height:1.8;font-weight:700;padding-top:2%;letter-spacing:0;font-size:1.2em}.lib-donut-chart-footer{width:100%;text-align:right}.lib-donut-label-text{font-size:.9em;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1}.lib-donut-label-icon{display:inline-block;width:10px;height:10px;margin-right:20px;border-radius:3px}.lib-donut-label-item{font-weight:400;font-size:.85em;color:#2f2f2f}.lib-donut-justified-label-wrapper{width:100%;display:inline-block;text-align:center;list-style-type:none}.lib-donut-justified-label-item{font-weight:400;font-size:.85em;color:#2f2f2f;display:inline-block;text-align:left;padding:0 10px}.lib-donut-justified-label-icon{display:inline-block;width:10px;height:10px;margin-right:5px;border-radius:3px}.lib-no-background{background:none!important}.lib-display-hidden{display:none}.lib-ylabel-weeklyCharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:12px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.07px;text-transform:capitalize;color:#000}.lib-data-labels-weeklycharts{font-style:normal;font-variant:normal;font-weight:400;font-size:12px;line-height:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.06px;color:#000}.lib-data-labels-angled-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:9.5px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:.4px;text-anchor:start}.lib-xaxis-labels-texts-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:11px;letter-spacing:-.05px;fill:#000}.lib-xaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:-1px;color:#000;opacity:1;text-transform:capitalize}.lib-white-space-nowrap{white-space:nowrap}.lib-xaxis-labels-texts-drilldown-alt{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:10px;letter-spacing:0px;color:#000;opacity:1;text-transform:capitalize}.lib-yaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:0px;color:#000!important;opacity:1}.lib-ylabel-drilldowncharts,.lib-xlabel-drilldowncharts{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:16px;letter-spacing:-.1px;color:#000!important;opacity:1}.lib-donut-justified-label-icon-drilldown{display:inline-block;width:14px;height:14px;margin-right:10px;border-radius:50%}.marginright-2{margin-right:2%}.margintop-5{margin-top:5%}.width-100{width:100%}.float-right{float:right}.marginBottom-10{margin-bottom:10px}.header-alt{align-items:center;margin-bottom:10px}input::placeholder{font-size:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.padding-5{padding:5px}.hidden{visibility:hidden}.font-weight-bold{font-weight:900}.textalign-center{text-align:center}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.font-weight-600{font-weight:600}.marginRight-15{margin-right:15px}.marginRight-20{margin-right:20px}.switch{position:relative;display:inline-block;width:46px;height:24px;margin-left:5px;margin-right:5px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;inset:0;background-color:#2d5ca0;-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:\"\";height:18px;width:18px;right:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider.round{border-radius:18px}.slider.round:before{border-radius:50%}.slider1{position:absolute;cursor:pointer;inset:0;background-color:#015ba2cf;-webkit-transition:.4s;transition:.4s}.slider1:before{position:absolute;content:\"\";height:18px;width:18px;left:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider1.round1{border-radius:18px}.slider1.round1:before{border-radius:50%}.lib-display-flex{display:flex}.lib-align-items-center{align-items:center}.lib-flex-direction-column{flex-direction:column}.lib-justify-content-space-between{justify-content:space-between}.lib-justify-content-space-around{justify-content:space-around}.lib-justify-content-center{justify-content:center}.lib-justify-content-start{justify-content:start}.lib-justify-content-end{justify-content:end}.lib-ml-20{margin-left:20px}.lib-position-absolute{position:absolute}.lib-z-index-9{z-index:9}.marginright-3{margin-right:3px}@media (min-height: 900px){.lib-chart-wrapper{border-radius:8px}.header-font-size-1{font-size:18px!important}.font-size-1{font-size:14px!important}.font-size-2{font-size:16px!important}.font-size-3{font-size:14px!important}.font-size-4{font-size:22px!important}.font-size-5{font-size:24px!important}}\n"] }]
7239
+ args: [{ selector: 'lib-horizontal-bars-with-scroll-zoom', encapsulation: ViewEncapsulation.None, template: "<meta http-equiv=\"CACHE-CONTROL\" content=\"NO-CACHE\" />\r\n<meta http-equiv=\"EXPIRES\" content=\"Sat, 01 Jun 2004 11:12:01 GMT\" />\r\n<div\r\n #verticalstackedcontainer\r\n class=\"lib-chart-wrapper\"\r\n [ngClass]=\"{ 'lib-no-background': isTransparentBackground }\"\r\n style=\"background-color: var(--card-bg);\"\r\n\r\n (resized)=\"onResized($event)\"\r\n>\r\n <div class=\"header-alt\" *ngIf=\"!isHeaderVisible\">\r\n <lib-chart-header-v2\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (clickEvent)=\"handleClick($event)\"\r\n ></lib-chart-header-v2>\r\n\r\n <lib-chart-header-v3\r\n [chartData]=\"chartData\"\r\n [chartConfiguration]=\"chartConfiguration\"\r\n (compareByFilterSelection)=\"handleCompareByFilterSelection($event)\"\r\n (zoomInZoomOutClick)=\"handleZoominZoomoutClick($event)\"\r\n ></lib-chart-header-v3>\r\n </div>\r\n <div\r\n [style.height]=\"chartConfiguration.svgHeight\"\r\n id=\"verticalstackedchartcontainer\"\r\n #verticalstackedchartcontainer\r\n class=\"lib-chart-svg\"\r\n ></div>\r\n</div>\r\n", styles: [".lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1;font-size:1.2em}.lib-axis-group-label{font-size:.85em;font-weight:600;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.dots{font-size:10px}.inline__display{display:flex;justify-content:space-around;padding-top:2%}.verticalbar__text{font-style:normal;font-variant:normal;font-weight:400;font-size:13px;line-height:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;opacity:1}.lib-line-label-item{display:inline-block!important;font-size:.85em;margin-right:10px;font-weight:600}.lib-line-label-wrapper-vertical{display:flex;justify-content:center}.target-display{font-size:12px;line-height:14.52px;font-weight:700;text-transform:uppercase;float:right}.title{background-color:#d9d9d9;height:40px;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:3px;line-height:1}.title-top-text{color:var(--font-color)!important;font-size:14px;font-weight:600}.title-bar-name{color:var(--font-color)!important;font-size:17px;font-weight:700;text-transform:capitalize}.title-bottom-text{color:var(--font-color)!important;font-size:12px}.zoomIcons-holder{display:flex;align-items:center;margin-right:15px}.zoomIcons{border:.5px solid #b6b6b6;cursor:pointer;display:flex;justify-content:center;align-items:center;width:30px;height:30px;color:var(--color)!important}.zoom-active{background-color:#2d5ca0;opacity:1}.zoom-inactive{background-color:#d9d9d9;opacity:.5}@media (max-width: 575px){.lib-xaxis-labels-texts-drilldown{writing-mode:sideways-lr}}@media screen and (min-width: 1024px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1024px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:10px!important}.dots{font-size:10px!important}}@media screen and (min-width: 1366px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1366px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:12px!important}.dots{font-size:12px!important}}@media screen and (min-width: 1920px) and (min-height: 400px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 1920px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:14px!important}.dots{font-size:14px!important}}@media screen and (min-width: 2560px) and (min-height: 500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1000px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}.dots{font-size:16px!important}}@media screen and (min-width: 2560px) and (min-height: 1500px){.lib-stacked-y-axis-text text,.lib-stacked-x-axis-text text{font-size:16px!important}}.bottom__text{position:absolute!important;bottom:0!important;display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important}.box__heightwidth{opacity:1;height:10px;width:10px;border:none!important;border-radius:50%}.label__text{margin-right:10px;display:flex;justify-content:center;align-items:center;font-style:normal;font-variant:normal;font-weight:400;font-size:10px;line-height:13px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:.2px;color:#707070!important}.lib-verticalstack-labels-ontop-weklycharts{font-style:normal;font-variant:normal;font-weight:700;font-size:10px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.lib-verticalstack-title-ontop{font-style:normal;font-variant:normal;font-size:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.05px;text-anchor:middle;fill:#000}.marginLeft-20{margin-left:20px}.flex-inline{display:flex;justify-content:center;align-items:center;font-size:14px}\n", ".lib-chart-wrapper{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;background:#fff 0% 0% no-repeat padding-box;position:relative}.lib-chart-wrapper-wo-shadow{width:100%;height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background){background-color:#2e3640}.lib-chart-wrapper:hover .chart-header-v1:not(.header-no-background) .chart-title{color:#fff}.lib-chart-svg{width:100%}.lib-chart-header{text-align:center;background-color:#052340;color:#fff;width:100%;height:17%;word-spacing:.5px;line-height:1.8;font-weight:700;padding-top:2%;letter-spacing:0;font-size:1.2em}.lib-donut-chart-footer{width:100%;text-align:right}.lib-donut-label-text{font-size:.9em;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-weight:400;letter-spacing:0px;color:#000;opacity:1}.lib-donut-label-icon{display:inline-block;width:10px;height:10px;margin-right:20px;border-radius:3px}.lib-donut-label-item{font-weight:400;font-size:.85em;color:#2f2f2f}.lib-donut-justified-label-wrapper{width:100%;display:inline-block;text-align:center;list-style-type:none}.lib-donut-justified-label-item{font-weight:400;font-size:.85em;color:#2f2f2f;display:inline-block;text-align:left;padding:0 10px}.lib-donut-justified-label-icon{display:inline-block;width:10px;height:10px;margin-right:5px;border-radius:3px}.lib-no-background{background:none!important}.lib-display-hidden{display:none}.lib-ylabel-weeklyCharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:12px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.07px;text-transform:capitalize;color:#000}.lib-data-labels-weeklycharts{font-style:normal;font-variant:normal;font-weight:400;font-size:12px;line-height:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:-.06px;color:#000}.lib-data-labels-angled-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:9.5px;line-height:11px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:.4px;text-anchor:start}.lib-xaxis-labels-texts-weeklycharts{font-style:normal;font-variant:normal;font-weight:800;font-size:10px;line-height:11px;letter-spacing:-.05px;fill:#000}.lib-xaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:-1px;color:#000;opacity:1;text-transform:capitalize}.lib-white-space-nowrap{white-space:nowrap}.lib-xaxis-labels-texts-drilldown-alt{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:10px;letter-spacing:0px;color:#000;opacity:1;text-transform:capitalize}.lib-yaxis-labels-texts-drilldown{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:14px;letter-spacing:0px;color:#000!important;opacity:1}.lib-ylabel-drilldowncharts,.lib-xlabel-drilldowncharts{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;font-size:16px;letter-spacing:-.1px;color:#000!important;opacity:1}.lib-donut-justified-label-icon-drilldown{display:inline-block;width:14px;height:14px;margin-right:10px;border-radius:50%}.marginright-2{margin-right:2%}.margintop-5{margin-top:5%}.width-100{width:100%}.float-right{float:right}.marginBottom-10{margin-bottom:10px}.header-alt{align-items:center;margin-bottom:10px}input::placeholder{font-size:20px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto;letter-spacing:0px;color:#000;opacity:1}.padding-5{padding:5px}.hidden{visibility:hidden}.font-weight-bold{font-weight:900}.textalign-center{text-align:center}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.font-weight-600{font-weight:600}.marginRight-15{margin-right:15px}.marginRight-20{margin-right:20px}.switch{position:relative;display:inline-block;width:46px;height:24px;margin-left:5px;margin-right:5px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;inset:0;background-color:#2d5ca0;-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:\"\";height:18px;width:18px;right:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider.round{border-radius:18px}.slider.round:before{border-radius:50%}.slider1{position:absolute;cursor:pointer;inset:0;background-color:#015ba2cf;-webkit-transition:.4s;transition:.4s}.slider1:before{position:absolute;content:\"\";height:18px;width:18px;left:3px;bottom:3px;background-color:#fff;-webkit-transition:.4s;transition:.4s}.slider1.round1{border-radius:18px}.slider1.round1:before{border-radius:50%}.lib-display-flex{display:flex}.lib-align-items-center{align-items:center}.lib-flex-direction-column{flex-direction:column}.lib-justify-content-space-between{justify-content:space-between}.lib-justify-content-space-around{justify-content:space-around}.lib-justify-content-center{justify-content:center}.lib-justify-content-start{justify-content:start}.lib-justify-content-end{justify-content:end}.lib-ml-20{margin-left:20px}.lib-position-absolute{position:absolute}.lib-z-index-9{z-index:9}.marginright-3{margin-right:3px}@media (min-height: 900px){.lib-chart-wrapper{border-radius:8px}.header-font-size-1{font-size:18px!important}.font-size-1{font-size:14px!important}.font-size-2{font-size:16px!important}.font-size-3{font-size:14px!important}.font-size-4{font-size:22px!important}.font-size-5{font-size:24px!important}}\n"] }]
8082
7240
  }], ctorParameters: () => [], propDecorators: { containerElt: [{
8083
7241
  type: ViewChild,
8084
7242
  args: ['verticalstackedchartcontainer', { static: true }]