axidio-styleguide-library1-v2 0.2.24 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/group-chart/group-chart.component.mjs +189 -2
- package/esm2022/lib/horizontal-bars-with-scroll-zoom/horizontal-bars-with-scroll-zoom.component.mjs +1081 -519
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +348 -314
- package/fesm2022/axidio-styleguide-library1-v2.mjs +1767 -984
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/lib/horizontal-bars-with-scroll-zoom/horizontal-bars-with-scroll-zoom.component.d.ts +12 -74
- package/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.d.ts +10 -0
- package/package.json +1 -1
|
@@ -3481,6 +3481,9 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3481
3481
|
var alternate_text = false;
|
|
3482
3482
|
var short_tick_length = 4;
|
|
3483
3483
|
var long_tick_length = 16;
|
|
3484
|
+
/**
|
|
3485
|
+
* longer tick length needed for weekly charts
|
|
3486
|
+
*/
|
|
3484
3487
|
var short_tick_length_bg = 5;
|
|
3485
3488
|
var long_tick_length_bg = 30;
|
|
3486
3489
|
var leftAndRightSpaces = 50;
|
|
@@ -3492,6 +3495,9 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3492
3495
|
data = this.chartData.data;
|
|
3493
3496
|
metaData = this.chartData.metaData;
|
|
3494
3497
|
lineData = this.chartData.lineData;
|
|
3498
|
+
// if (lineData || this.chartData.targetLineData) {
|
|
3499
|
+
// rightSvgWidth = 60;
|
|
3500
|
+
// }
|
|
3495
3501
|
if (!metaData.colorAboveTarget) {
|
|
3496
3502
|
metaData['colorAboveTarget'] = metaData.colors;
|
|
3497
3503
|
}
|
|
@@ -3528,10 +3534,16 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3528
3534
|
else
|
|
3529
3535
|
width = this.chartData.data.length * 160;
|
|
3530
3536
|
}
|
|
3537
|
+
// if (this.chartData.data.length > 8) {
|
|
3538
|
+
// width = this.chartData.data.length * 140;
|
|
3539
|
+
// }
|
|
3531
3540
|
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
3532
3541
|
(self.chartConfiguration.svgHeight / 100) -
|
|
3533
3542
|
margin.top -
|
|
3534
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
|
+
*/
|
|
3535
3547
|
if (this.chartConfiguration.isFullScreen != undefined &&
|
|
3536
3548
|
this.chartConfiguration.isFullScreen) {
|
|
3537
3549
|
height =
|
|
@@ -3553,15 +3565,30 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3553
3565
|
margin.bottom -
|
|
3554
3566
|
100;
|
|
3555
3567
|
}
|
|
3568
|
+
/**
|
|
3569
|
+
* for hiding header
|
|
3570
|
+
* used by weekly charts
|
|
3571
|
+
*/
|
|
3556
3572
|
if (this.chartConfiguration.isHeaderVisible != undefined)
|
|
3557
3573
|
this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
|
|
3574
|
+
/**
|
|
3575
|
+
* for hiding legends
|
|
3576
|
+
* used by weekly charts
|
|
3577
|
+
*/
|
|
3558
3578
|
if (this.chartConfiguration.legendVisible != undefined) {
|
|
3559
3579
|
this.legendVisible = this.chartConfiguration.legendVisible;
|
|
3560
3580
|
}
|
|
3581
|
+
/**
|
|
3582
|
+
* for removing background color so that it can take parents color
|
|
3583
|
+
*
|
|
3584
|
+
*/
|
|
3561
3585
|
if (this.chartConfiguration.isTransparentBackground != undefined) {
|
|
3562
3586
|
this.isTransparentBackground =
|
|
3563
3587
|
this.chartConfiguration.isTransparentBackground;
|
|
3564
3588
|
}
|
|
3589
|
+
/**
|
|
3590
|
+
* format data values based on configuration received
|
|
3591
|
+
*/
|
|
3565
3592
|
if (this.chartConfiguration.textFormatter != undefined) {
|
|
3566
3593
|
formatFromBackend = ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter);
|
|
3567
3594
|
formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
|
|
@@ -3574,6 +3601,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3574
3601
|
.style('height', height)
|
|
3575
3602
|
.style('overflow-x', 'hidden')
|
|
3576
3603
|
.style('padding-left', `${margin.left}px`)
|
|
3604
|
+
// .call(ChartHelper.responsivefy)
|
|
3577
3605
|
.style('padding-right', `${rightSvgWidth}px`)
|
|
3578
3606
|
.style('margin-left', '15px');
|
|
3579
3607
|
var svgYAxisLeft = outerContainer
|
|
@@ -3601,8 +3629,10 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3601
3629
|
.style('overflow-x', 'auto');
|
|
3602
3630
|
var svg = innerContainer
|
|
3603
3631
|
.append('svg')
|
|
3632
|
+
// .attr('id', self.uniqueId)
|
|
3604
3633
|
.attr('width', width - rightSvgWidth)
|
|
3605
3634
|
.attr('height', height + margin.top + margin.bottom + 30)
|
|
3635
|
+
// .call(ChartHelper.responsivefy)
|
|
3606
3636
|
.append('g')
|
|
3607
3637
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
3608
3638
|
var subgroups = keyList;
|
|
@@ -3611,6 +3641,9 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3611
3641
|
return d.name;
|
|
3612
3642
|
})
|
|
3613
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
|
+
*/
|
|
3614
3647
|
if (this.chartConfiguration.isMultiChartGridLine != undefined) {
|
|
3615
3648
|
x = d3
|
|
3616
3649
|
.scaleBand()
|
|
@@ -3628,11 +3661,27 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3628
3661
|
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
3629
3662
|
.padding([0.3]);
|
|
3630
3663
|
}
|
|
3664
|
+
// x.bandwidth(96);
|
|
3631
3665
|
var xScaleFromOrigin = d3
|
|
3632
3666
|
.scaleBand()
|
|
3633
3667
|
.domain(groups)
|
|
3634
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);
|
|
3635
3681
|
if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
3682
|
+
/**
|
|
3683
|
+
* normal ticks for all dashboard charts
|
|
3684
|
+
*/
|
|
3636
3685
|
svg
|
|
3637
3686
|
.append('g')
|
|
3638
3687
|
.attr('class', 'x1 axis1')
|
|
@@ -3645,7 +3694,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3645
3694
|
.selectAll('g.x1.axis1 g.tick text')
|
|
3646
3695
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
3647
3696
|
.style('fill', 'var(--chart-text-color)')
|
|
3648
|
-
.attr('y', 32);
|
|
3697
|
+
.attr('y', 32); // Increase distance from bars (default is ~9)
|
|
3649
3698
|
}
|
|
3650
3699
|
else {
|
|
3651
3700
|
svg
|
|
@@ -3653,14 +3702,32 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3653
3702
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
3654
3703
|
.style('fill', 'var(--chart-text-color)');
|
|
3655
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
|
+
// });
|
|
3656
3714
|
}
|
|
3657
3715
|
else {
|
|
3716
|
+
/**
|
|
3717
|
+
* bigger ticks for weekly charts and more space from x axis to labels
|
|
3718
|
+
*/
|
|
3719
|
+
/**
|
|
3720
|
+
* draw x axis
|
|
3721
|
+
*/
|
|
3658
3722
|
svg
|
|
3659
3723
|
.append('g')
|
|
3660
3724
|
.attr('class', 'x1 axis1')
|
|
3661
3725
|
.attr('transform', 'translate(0,' + height + ')')
|
|
3662
3726
|
.call(d3.axisBottom(x).tickSize(0))
|
|
3663
3727
|
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
3728
|
+
/**
|
|
3729
|
+
* tick line size in alternate fashion
|
|
3730
|
+
*/
|
|
3664
3731
|
svg.selectAll('g.x1.axis1 g.tick line').attr('y2', function () {
|
|
3665
3732
|
if (alternate_text &&
|
|
3666
3733
|
self.chartConfiguration.isNoAlternateXaxisText == undefined) {
|
|
@@ -3672,7 +3739,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3672
3739
|
return short_tick_length_bg - 4;
|
|
3673
3740
|
}
|
|
3674
3741
|
});
|
|
3742
|
+
/**
|
|
3743
|
+
* reset the flag so that values can be shown in same alternate fashion
|
|
3744
|
+
*/
|
|
3675
3745
|
alternate_text = false;
|
|
3746
|
+
/**
|
|
3747
|
+
* print x-axis label texts
|
|
3748
|
+
* used by weekly charts
|
|
3749
|
+
*/
|
|
3676
3750
|
svg
|
|
3677
3751
|
.selectAll('g.x1.axis1 g.tick text')
|
|
3678
3752
|
.attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
@@ -3721,6 +3795,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3721
3795
|
return '';
|
|
3722
3796
|
});
|
|
3723
3797
|
}
|
|
3798
|
+
/**y scale for left y axis */
|
|
3724
3799
|
var y = d3.scaleLinear().rangeRound([height, 0]);
|
|
3725
3800
|
var maxValue = d3.max(data, (d) => d3.max(keyList, (key) => +d[key]));
|
|
3726
3801
|
if (maxValue == 0) {
|
|
@@ -3731,7 +3806,27 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3731
3806
|
maxValue = 100;
|
|
3732
3807
|
}
|
|
3733
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
|
+
}
|
|
3734
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
|
+
*/
|
|
3735
3830
|
maxValue = maxValue * this.chartConfiguration.customYscale;
|
|
3736
3831
|
}
|
|
3737
3832
|
if (this.chartData.targetLineData &&
|
|
@@ -3769,6 +3864,10 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3769
3864
|
.tickSize(0)
|
|
3770
3865
|
.tickFormat(self.chartConfiguration.yLineAxisLabelFomatter);
|
|
3771
3866
|
}
|
|
3867
|
+
/**
|
|
3868
|
+
* show x-axis grid between labels
|
|
3869
|
+
* used by weekly charts
|
|
3870
|
+
*/
|
|
3772
3871
|
if (self.chartConfiguration.isXgridBetweenLabels) {
|
|
3773
3872
|
svg
|
|
3774
3873
|
.append('g')
|
|
@@ -3780,6 +3879,9 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3780
3879
|
.call((g) => g.select('.domain').remove());
|
|
3781
3880
|
}
|
|
3782
3881
|
if (this.chartConfiguration.yAxisGrid) {
|
|
3882
|
+
/**
|
|
3883
|
+
* draw y axis
|
|
3884
|
+
*/
|
|
3783
3885
|
svg
|
|
3784
3886
|
.append('g')
|
|
3785
3887
|
.call(d3
|
|
@@ -3803,12 +3905,22 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3803
3905
|
xSubgroup.range([0, x.bandwidth()]);
|
|
3804
3906
|
}
|
|
3805
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
|
+
*/
|
|
3806
3912
|
xSubgroup.range([0, x.bandwidth()]);
|
|
3807
3913
|
}
|
|
3914
|
+
// if (this.chartConfiguration.isDrilldownChart) {
|
|
3915
|
+
// }
|
|
3808
3916
|
var color = d3
|
|
3809
3917
|
.scaleOrdinal()
|
|
3810
3918
|
.domain(subgroups)
|
|
3811
3919
|
.range(Object.values(metaData.colors));
|
|
3920
|
+
// var colorAboveTarget = d3
|
|
3921
|
+
// .scaleOrdinal()
|
|
3922
|
+
// .domain(subgroups)
|
|
3923
|
+
// .range(Object.values(metaData.colorAboveTarget));
|
|
3812
3924
|
var state = svg
|
|
3813
3925
|
.append('g')
|
|
3814
3926
|
.selectAll('.state')
|
|
@@ -3823,8 +3935,10 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3823
3935
|
.data(function (d) {
|
|
3824
3936
|
let newList = [];
|
|
3825
3937
|
subgroups.map(function (key) {
|
|
3938
|
+
// if (key !== "group") {
|
|
3826
3939
|
let obj = { key: key, value: d[key], name: d.name };
|
|
3827
3940
|
newList.push(obj);
|
|
3941
|
+
// }
|
|
3828
3942
|
});
|
|
3829
3943
|
return newList;
|
|
3830
3944
|
})
|
|
@@ -3837,6 +3951,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3837
3951
|
!metaData.barWithoutClick.length ||
|
|
3838
3952
|
(!metaData.barWithoutClick.includes(d?.name) &&
|
|
3839
3953
|
!metaData.barWithoutClick.includes(d?.key)))
|
|
3954
|
+
// self.handleClick(d.data.name);
|
|
3840
3955
|
self.handleClick(d);
|
|
3841
3956
|
}
|
|
3842
3957
|
})
|
|
@@ -3853,12 +3968,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3853
3968
|
0 + (x.bandwidth() - 200) / 2,
|
|
3854
3969
|
x.bandwidth() - (x.bandwidth() - 200) / 2,
|
|
3855
3970
|
]);
|
|
3971
|
+
// .padding(0.05);
|
|
3856
3972
|
}
|
|
3857
3973
|
else
|
|
3858
3974
|
tempScale.range([
|
|
3859
3975
|
0 + (x.bandwidth() - 300) / 2,
|
|
3860
3976
|
x.bandwidth() - (x.bandwidth() - 300) / 2,
|
|
3861
3977
|
]);
|
|
3978
|
+
// .padding(0.05);
|
|
3862
3979
|
}
|
|
3863
3980
|
else
|
|
3864
3981
|
tempScale.range([
|
|
@@ -3877,6 +3994,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3877
3994
|
})
|
|
3878
3995
|
.attr('width', function (d) {
|
|
3879
3996
|
if (self.chartConfiguration.isDrilldownChart) {
|
|
3997
|
+
// var tempScale;
|
|
3880
3998
|
data.map((indiv) => {
|
|
3881
3999
|
if (indiv.name == d.name) {
|
|
3882
4000
|
let keys = Object.keys(indiv).filter((temp, i) => i != 0);
|
|
@@ -3889,12 +4007,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3889
4007
|
0 + (x.bandwidth() - 200) / 2,
|
|
3890
4008
|
x.bandwidth() - (x.bandwidth() - 200) / 2,
|
|
3891
4009
|
]);
|
|
4010
|
+
// .padding(0.05);
|
|
3892
4011
|
}
|
|
3893
4012
|
else
|
|
3894
4013
|
tempScale.range([
|
|
3895
4014
|
0 + (x.bandwidth() - 300) / 2,
|
|
3896
4015
|
x.bandwidth() - (x.bandwidth() - 300) / 2,
|
|
3897
4016
|
]);
|
|
4017
|
+
// .padding(0.05);
|
|
3898
4018
|
}
|
|
3899
4019
|
else
|
|
3900
4020
|
tempScale.range([
|
|
@@ -3916,6 +4036,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3916
4036
|
return height - y(d.value);
|
|
3917
4037
|
return height - y(0);
|
|
3918
4038
|
})
|
|
4039
|
+
// .style('cursor', 'pointer')
|
|
3919
4040
|
.style('cursor', function (d) {
|
|
3920
4041
|
if (metaData.hasDrillDown && !isria)
|
|
3921
4042
|
return 'pointer';
|
|
@@ -3930,6 +4051,9 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3930
4051
|
return self.chartData.metaData.colorAboveTarget[d.key];
|
|
3931
4052
|
return self.chartData.metaData.colors[d.key];
|
|
3932
4053
|
});
|
|
4054
|
+
/**
|
|
4055
|
+
* display angled texts on the bars
|
|
4056
|
+
*/
|
|
3933
4057
|
if (this.chartConfiguration.textsOnBar != undefined && !this.isZoomedOut) {
|
|
3934
4058
|
state
|
|
3935
4059
|
.selectAll('text')
|
|
@@ -3990,12 +4114,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3990
4114
|
0 + (x.bandwidth() - 200) / 2,
|
|
3991
4115
|
x.bandwidth() - (x.bandwidth() - 200) / 2,
|
|
3992
4116
|
]);
|
|
4117
|
+
// .padding(0.05);
|
|
3993
4118
|
}
|
|
3994
4119
|
else
|
|
3995
4120
|
tempScale.range([
|
|
3996
4121
|
0 + (x.bandwidth() - 300) / 2,
|
|
3997
4122
|
x.bandwidth() - (x.bandwidth() - 300) / 2,
|
|
3998
4123
|
]);
|
|
4124
|
+
// .padding(0.05);
|
|
3999
4125
|
}
|
|
4000
4126
|
else
|
|
4001
4127
|
tempScale.range([
|
|
@@ -4005,9 +4131,16 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4005
4131
|
}
|
|
4006
4132
|
}
|
|
4007
4133
|
});
|
|
4134
|
+
/**
|
|
4135
|
+
* if set, then all texts ll be horizontal
|
|
4136
|
+
*/
|
|
4008
4137
|
if (self.chartConfiguration.textAlwaysHorizontal) {
|
|
4009
4138
|
return ('translate(' + xSubgroup(d.key) + ',' + (y(d.value) - 3) + ')');
|
|
4010
4139
|
}
|
|
4140
|
+
/**
|
|
4141
|
+
* rotate texts having more than one digits
|
|
4142
|
+
*/
|
|
4143
|
+
// if (d.value > 9)
|
|
4011
4144
|
if (!isNaN(tempScale(d.key)))
|
|
4012
4145
|
return ('translate(' +
|
|
4013
4146
|
(tempScale(d.key) + tempScale.bandwidth() * 0.55) +
|
|
@@ -4015,6 +4148,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4015
4148
|
(y(0) - 10) +
|
|
4016
4149
|
') rotate(270)');
|
|
4017
4150
|
return 'translate(0,0)';
|
|
4151
|
+
// else
|
|
4152
|
+
// return (
|
|
4153
|
+
// 'translate(' +
|
|
4154
|
+
// (tempScale(d.key) + tempScale.bandwidth() / 2) +
|
|
4155
|
+
// ',' +
|
|
4156
|
+
// y(0) +
|
|
4157
|
+
// ')'
|
|
4158
|
+
// );
|
|
4018
4159
|
})
|
|
4019
4160
|
.on('click', function (d) {
|
|
4020
4161
|
if (!metaData.barWithoutClick ||
|
|
@@ -4043,6 +4184,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4043
4184
|
svg
|
|
4044
4185
|
.append('foreignObject')
|
|
4045
4186
|
.attr('x', function () {
|
|
4187
|
+
// var tempScale;
|
|
4046
4188
|
var elementsCounter;
|
|
4047
4189
|
data.map((indiv) => {
|
|
4048
4190
|
if (indiv.name == d.name) {
|
|
@@ -4056,12 +4198,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4056
4198
|
0 + (x.bandwidth() - 200) / 2,
|
|
4057
4199
|
x.bandwidth() - (x.bandwidth() - 200) / 2,
|
|
4058
4200
|
]);
|
|
4201
|
+
// .padding(0.05);
|
|
4059
4202
|
}
|
|
4060
4203
|
else
|
|
4061
4204
|
tempScale.range([
|
|
4062
4205
|
0 + (x.bandwidth() - 300) / 2,
|
|
4063
4206
|
x.bandwidth() - (x.bandwidth() - 300) / 2,
|
|
4064
4207
|
]);
|
|
4208
|
+
// .padding(0.05);
|
|
4065
4209
|
}
|
|
4066
4210
|
else
|
|
4067
4211
|
tempScale.range([
|
|
@@ -4091,6 +4235,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4091
4235
|
return d.class;
|
|
4092
4236
|
})
|
|
4093
4237
|
.attr('width', function () {
|
|
4238
|
+
// var tempScale;
|
|
4094
4239
|
data.map((indiv) => {
|
|
4095
4240
|
if (indiv.name == d.name) {
|
|
4096
4241
|
let keys = Object.keys(indiv).filter((temp, i) => i != 0);
|
|
@@ -4102,12 +4247,14 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4102
4247
|
0 + (x.bandwidth() - 200) / 2,
|
|
4103
4248
|
x.bandwidth() - (x.bandwidth() - 200) / 2,
|
|
4104
4249
|
]);
|
|
4250
|
+
// .padding(0.05);
|
|
4105
4251
|
}
|
|
4106
4252
|
else
|
|
4107
4253
|
tempScale.range([
|
|
4108
4254
|
0 + (x.bandwidth() - 300) / 2,
|
|
4109
4255
|
x.bandwidth() - (x.bandwidth() - 300) / 2,
|
|
4110
4256
|
]);
|
|
4257
|
+
// .padding(0.05);
|
|
4111
4258
|
}
|
|
4112
4259
|
else
|
|
4113
4260
|
tempScale.range([
|
|
@@ -4194,18 +4341,35 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4194
4341
|
.attr('transform', 'translate(0,0)')
|
|
4195
4342
|
.call(y)
|
|
4196
4343
|
.style('display', 'none');
|
|
4344
|
+
/**
|
|
4345
|
+
* hide x axis labels
|
|
4346
|
+
* config is there for future use
|
|
4347
|
+
* used by weekly charts
|
|
4348
|
+
*/
|
|
4197
4349
|
if (this.chartConfiguration.isXaxisLabelHidden != undefined &&
|
|
4198
4350
|
this.chartConfiguration.isXaxisLabelHidden) {
|
|
4199
4351
|
d3.selectAll('g.lib-line-x-axis-text > g > text').attr('class', 'lib-display-hidden');
|
|
4200
4352
|
}
|
|
4353
|
+
/**
|
|
4354
|
+
* hide y axis labels
|
|
4355
|
+
* used by weekly charts
|
|
4356
|
+
*/
|
|
4201
4357
|
if (this.chartConfiguration.isYaxisLabelHidden != undefined &&
|
|
4202
4358
|
this.chartConfiguration.isYaxisLabelHidden) {
|
|
4203
4359
|
d3.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
|
|
4204
4360
|
}
|
|
4361
|
+
/**
|
|
4362
|
+
* hide y axis labels
|
|
4363
|
+
* config is there for future use
|
|
4364
|
+
*/
|
|
4205
4365
|
if (this.chartConfiguration.isYaxisHidden != undefined &&
|
|
4206
4366
|
this.chartConfiguration.isYaxisHidden) {
|
|
4207
4367
|
d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
|
|
4208
4368
|
}
|
|
4369
|
+
/**
|
|
4370
|
+
* dashed y axis
|
|
4371
|
+
* used by weekly charts
|
|
4372
|
+
*/
|
|
4209
4373
|
if (this.chartConfiguration.isYaxisDashed != undefined &&
|
|
4210
4374
|
this.chartConfiguration.isYaxisDashed) {
|
|
4211
4375
|
d3.selectAll('.yaxis-dashed')
|
|
@@ -4222,11 +4386,17 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4222
4386
|
.call(yLineAxis);
|
|
4223
4387
|
}
|
|
4224
4388
|
}
|
|
4389
|
+
/**
|
|
4390
|
+
* used to display y label
|
|
4391
|
+
*/
|
|
4225
4392
|
if (this.isZoomedOut) {
|
|
4226
4393
|
svg
|
|
4227
4394
|
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
4228
4395
|
.attr('class', 'lib-display-hidden');
|
|
4229
4396
|
}
|
|
4397
|
+
/**
|
|
4398
|
+
* used to write y labels based on configuration
|
|
4399
|
+
*/
|
|
4230
4400
|
if (metaData.yLabel) {
|
|
4231
4401
|
svgYAxisLeft
|
|
4232
4402
|
.append('text')
|
|
@@ -4245,6 +4415,9 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4245
4415
|
.text(metaData.yLabel);
|
|
4246
4416
|
}
|
|
4247
4417
|
else {
|
|
4418
|
+
/**
|
|
4419
|
+
* used by weekly charts
|
|
4420
|
+
*/
|
|
4248
4421
|
svg
|
|
4249
4422
|
.selectAll('.lib-axis-group-label')
|
|
4250
4423
|
.attr('class', 'lib-ylabel-weeklyCharts')
|
|
@@ -4285,6 +4458,13 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4285
4458
|
.attr('y2', yZero)
|
|
4286
4459
|
.style('stroke-dasharray', '5 5')
|
|
4287
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);
|
|
4288
4468
|
svgYAxisRight
|
|
4289
4469
|
.append('foreignObject')
|
|
4290
4470
|
.attr('transform', 'translate(' + 0 + ',' + (yZero - 30) + ')')
|
|
@@ -4312,6 +4492,13 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4312
4492
|
});
|
|
4313
4493
|
}
|
|
4314
4494
|
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());
|
|
4315
4502
|
svg.selectAll('g.x1.axis1 g.tick line').style('display', 'none');
|
|
4316
4503
|
}
|
|
4317
4504
|
if (metaData.lineyLabel) {
|
|
@@ -6638,18 +6825,6 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6638
6825
|
this.isTopCaptionVisible = true;
|
|
6639
6826
|
this.uniqueId = this.getUniqueId();
|
|
6640
6827
|
this.isTransparentBackground = false;
|
|
6641
|
-
this.isCC = false;
|
|
6642
|
-
this.isZoomedOut = true;
|
|
6643
|
-
this.TICK_LENGTHS = {
|
|
6644
|
-
short: 4,
|
|
6645
|
-
long: 16,
|
|
6646
|
-
shortBg: 5,
|
|
6647
|
-
longBg: 30,
|
|
6648
|
-
};
|
|
6649
|
-
this.SPACING = {
|
|
6650
|
-
rightSvgWidth: 60,
|
|
6651
|
-
leftAndRight: 50,
|
|
6652
|
-
};
|
|
6653
6828
|
this.defaultConfiguration = {
|
|
6654
6829
|
margin: { top: 20, right: 20, bottom: 20, left: 40 },
|
|
6655
6830
|
svgHeight: 70,
|
|
@@ -6665,38 +6840,83 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6665
6840
|
forComparison: true,
|
|
6666
6841
|
headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
|
|
6667
6842
|
yAxisGrid: false,
|
|
6843
|
+
isHeaderVisible: undefined,
|
|
6844
|
+
isTransparentBackground: undefined,
|
|
6845
|
+
isTopCaptionVisible: undefined,
|
|
6846
|
+
isMultiChartGridLine: undefined,
|
|
6847
|
+
isFullScreen: undefined,
|
|
6848
|
+
customYscale: undefined,
|
|
6849
|
+
isXaxisLabelHidden: undefined,
|
|
6850
|
+
isYaxisLabelHidden: undefined,
|
|
6851
|
+
isYaxisHidden: undefined,
|
|
6852
|
+
isYaxisDashed: undefined,
|
|
6853
|
+
isXaxisColor: undefined,
|
|
6854
|
+
textFormatter: undefined,
|
|
6855
|
+
showTotalOnTop: undefined,
|
|
6856
|
+
backendFormatterHasPriority: undefined,
|
|
6857
|
+
showAngledLabels: undefined,
|
|
6858
|
+
isNoAlternateXaxisText: undefined,
|
|
6859
|
+
isXgridBetweenLabels: undefined,
|
|
6860
|
+
showXaxisTop: undefined,
|
|
6861
|
+
xAxisGrid: undefined,
|
|
6862
|
+
xLabelsOnSameLine: undefined,
|
|
6863
|
+
hideXaxisTick: undefined,
|
|
6864
|
+
isDrilldownChart: undefined,
|
|
6865
|
+
isTargetLine: undefined,
|
|
6866
|
+
displayTitleOnTop: undefined,
|
|
6867
|
+
isToggleVisible: undefined,
|
|
6868
|
+
isTitleHidden: undefined,
|
|
6668
6869
|
};
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
ngOnChanges(changes) {
|
|
6672
|
-
this.redrawChart();
|
|
6673
|
-
}
|
|
6674
|
-
onResized(event) {
|
|
6675
|
-
setTimeout(() => this.redrawChart(), 10);
|
|
6870
|
+
this.isCC = false;
|
|
6871
|
+
this.isZoomedOut = true;
|
|
6676
6872
|
}
|
|
6677
6873
|
isZoomOutSelected(isZoomOut) {
|
|
6678
6874
|
this.isZoomedOut = isZoomOut;
|
|
6679
|
-
this.
|
|
6875
|
+
this.ngOnChanges();
|
|
6680
6876
|
}
|
|
6681
|
-
|
|
6682
|
-
|
|
6877
|
+
ngOnChanges() {
|
|
6878
|
+
let self = this;
|
|
6879
|
+
d3.select('#' + self.uniqueId).remove();
|
|
6683
6880
|
this.initializeStackedChart();
|
|
6684
6881
|
}
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
};
|
|
6882
|
+
onResized(event) {
|
|
6883
|
+
let self = this;
|
|
6884
|
+
setTimeout(function () {
|
|
6885
|
+
d3.select('#' + self.uniqueId).remove();
|
|
6886
|
+
self.initializeStackedChart();
|
|
6887
|
+
}.bind(self), 10);
|
|
6692
6888
|
}
|
|
6693
|
-
|
|
6694
|
-
|
|
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) {
|
|
6695
6915
|
this.chartConfiguration.margin = { top: 20, right: 10, bottom: 40, left: 30 };
|
|
6696
6916
|
this.chartConfiguration.numberOfYTicks = 4;
|
|
6697
6917
|
this.chartConfiguration.svgHeight = 60;
|
|
6698
6918
|
}
|
|
6699
|
-
else if (
|
|
6919
|
+
else if (isTablet) {
|
|
6700
6920
|
this.chartConfiguration.margin = { top: 25, right: 20, bottom: 45, left: 40 };
|
|
6701
6921
|
this.chartConfiguration.numberOfYTicks = 6;
|
|
6702
6922
|
this.chartConfiguration.svgHeight = 70;
|
|
@@ -6706,199 +6926,102 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6706
6926
|
this.chartConfiguration.numberOfYTicks = 7;
|
|
6707
6927
|
this.chartConfiguration.svgHeight = 80;
|
|
6708
6928
|
}
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
prepareMetaData(metaData) {
|
|
6716
|
-
if (!metaData.unit)
|
|
6929
|
+
for (var i in this.defaultConfiguration) {
|
|
6930
|
+
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
6931
|
+
}
|
|
6932
|
+
data = this.chartData.data;
|
|
6933
|
+
metaData = this.chartData.metaData;
|
|
6934
|
+
if (metaData.unit == undefined)
|
|
6717
6935
|
metaData.unit = '';
|
|
6718
|
-
if (metaData.isCC)
|
|
6936
|
+
if (metaData.isCC) {
|
|
6719
6937
|
this.isCC = metaData.isCC;
|
|
6720
|
-
|
|
6721
|
-
|
|
6938
|
+
}
|
|
6939
|
+
if (metaData.barWithoutClick && metaData.barWithoutClick.length) {
|
|
6940
|
+
metaData.barWithoutClick = metaData.barWithoutClick.map((ele) => ele.toLowerCase());
|
|
6722
6941
|
}
|
|
6723
6942
|
else {
|
|
6724
6943
|
metaData.barWithoutClick = [];
|
|
6725
6944
|
}
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
if (isNaN(parsedNum))
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
let width = containerWidth - margin.left - margin.right;
|
|
6740
|
-
let height = containerHeight * (this.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
|
|
6741
|
-
// Adjust width for zoom levels
|
|
6742
|
-
const dataLength = this.chartData.data.length;
|
|
6743
|
-
if (dataLength > 30 && this.isZoomedOut) {
|
|
6744
|
-
const minWidth = dataLength * (device.isMobile ? 15 : 25);
|
|
6745
|
-
width = Math.max(width, minWidth);
|
|
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
|
+
}
|
|
6746
6958
|
}
|
|
6747
|
-
|
|
6748
|
-
|
|
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);
|
|
6749
6970
|
}
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
height = this.chartConfiguration.svgHeight;
|
|
6971
|
+
if (this.chartData.data.length > 8 && !this.isZoomedOut) {
|
|
6972
|
+
width = this.chartData.data.length * (isMobile ? 60 : 130);
|
|
6753
6973
|
}
|
|
6754
|
-
|
|
6755
|
-
|
|
6974
|
+
// Fullscreen and drilldown adjustments
|
|
6975
|
+
if (this.chartConfiguration.isFullScreen != undefined && this.chartConfiguration.isFullScreen) {
|
|
6976
|
+
height = this.chartConfiguration.svgHeight != 80
|
|
6977
|
+
? this.chartConfiguration.svgHeight
|
|
6978
|
+
: containerHeight;
|
|
6756
6979
|
}
|
|
6757
6980
|
if (this.chartConfiguration.isDrilldownChart) {
|
|
6758
|
-
height = containerHeight - margin.top - margin.bottom - (
|
|
6759
|
-
}
|
|
6760
|
-
return { width, height };
|
|
6761
|
-
}
|
|
6762
|
-
calculateBarDimensions(width, dataLength, device) {
|
|
6763
|
-
let barWidth;
|
|
6764
|
-
let barPadding;
|
|
6765
|
-
let requiredSvgWidth;
|
|
6766
|
-
if (device.isMobile) {
|
|
6767
|
-
const minBarWidth = 32;
|
|
6768
|
-
barWidth = minBarWidth;
|
|
6769
|
-
barPadding = 12;
|
|
6770
|
-
requiredSvgWidth = Math.max(width - this.SPACING.rightSvgWidth, (barWidth + barPadding) * dataLength + this.SPACING.leftAndRight * 2 +
|
|
6771
|
-
this.SPACING.rightSvgWidth - barPadding);
|
|
6772
|
-
}
|
|
6773
|
-
else {
|
|
6774
|
-
barWidth = Math.max(40, (width - this.SPACING.rightSvgWidth - this.SPACING.leftAndRight * 2) / dataLength);
|
|
6775
|
-
barPadding = 0;
|
|
6776
|
-
requiredSvgWidth = width - this.SPACING.rightSvgWidth;
|
|
6981
|
+
height = containerHeight - margin.top - margin.bottom - (isMobile ? 60 : 130);
|
|
6777
6982
|
}
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
this.SPACING.leftAndRight,
|
|
6785
|
-
width - this.SPACING.rightSvgWidth - this.SPACING.leftAndRight
|
|
6786
|
-
])
|
|
6787
|
-
.domain(data.map(d => d.name).reverse())
|
|
6788
|
-
.padding(device.isMobile ? 0.2 : 0.5);
|
|
6789
|
-
const yScale = d3.scaleLinear().rangeRound([height, 0]);
|
|
6790
|
-
return { xScale, yScale };
|
|
6791
|
-
}
|
|
6792
|
-
calculateYScaleDomain(layers, targetValue) {
|
|
6793
|
-
let maxValue = d3.max(layers, (d) => d3.max(d, (d) => d[1])) || 0;
|
|
6794
|
-
if (maxValue === 0) {
|
|
6795
|
-
maxValue = targetValue ? targetValue + 20 : 100;
|
|
6796
|
-
}
|
|
6797
|
-
if (this.chartConfiguration.customYscale) {
|
|
6798
|
-
maxValue *= this.chartConfiguration.customYscale;
|
|
6799
|
-
}
|
|
6800
|
-
if (targetValue && maxValue < targetValue) {
|
|
6801
|
-
maxValue = maxValue < 10 && targetValue < 10
|
|
6802
|
-
? targetValue + 3
|
|
6803
|
-
: targetValue + 20;
|
|
6804
|
-
}
|
|
6805
|
-
return maxValue;
|
|
6806
|
-
}
|
|
6807
|
-
shouldShowTargetLineColor(d, targetValue) {
|
|
6808
|
-
return !!(!isNaN(d[0]) &&
|
|
6809
|
-
!isNaN(d[1]) &&
|
|
6810
|
-
this.chartData.targetLineData &&
|
|
6811
|
-
targetValue &&
|
|
6812
|
-
parseFloat(d[1]) - parseFloat(d[0]) >= targetValue);
|
|
6813
|
-
}
|
|
6814
|
-
getBarFillColor(d, key, metaData, targetValue) {
|
|
6815
|
-
if (this.shouldShowTargetLineColor(d, targetValue)) {
|
|
6816
|
-
return this.chartData.targetLineData?.barAboveTargetColor || metaData.colors[key];
|
|
6817
|
-
}
|
|
6818
|
-
return metaData.colors[key];
|
|
6819
|
-
}
|
|
6820
|
-
isAcronym(label) {
|
|
6821
|
-
const alphaOnly = label.replace(/[^A-Za-z]/g, '');
|
|
6822
|
-
return (label.length <= 4 && /^[A-Z]+$/.test(label)) ||
|
|
6823
|
-
(label === label.toUpperCase() && /[A-Z]/.test(label));
|
|
6824
|
-
}
|
|
6825
|
-
formatAxisLabel(text) {
|
|
6826
|
-
const isAcr = this.isAcronym(text);
|
|
6827
|
-
return {
|
|
6828
|
-
formatted: isAcr ? text.toUpperCase() : text.toLowerCase(),
|
|
6829
|
-
isAcronym: isAcr
|
|
6830
|
-
};
|
|
6831
|
-
}
|
|
6832
|
-
initializeStackedChart() {
|
|
6833
|
-
const device = this.getDeviceBreakpoints();
|
|
6834
|
-
this.applyResponsiveConfig(device);
|
|
6835
|
-
this.mergeConfigurations();
|
|
6836
|
-
const { data, metaData, lineData } = this.chartData;
|
|
6837
|
-
const preparedMetaData = this.prepareMetaData(metaData);
|
|
6838
|
-
const targetValue = this.parseTargetValue(this.chartData.targetLineData);
|
|
6839
|
-
const chartContainer = d3.select(this.containerElt.nativeElement);
|
|
6840
|
-
const verticalstackedcontainer = d3.select(this.verticalstackedcontainerElt.nativeElement);
|
|
6841
|
-
const margin = this.chartConfiguration.margin;
|
|
6842
|
-
const containerWidth = chartContainer.node().getBoundingClientRect().width;
|
|
6843
|
-
const containerHeight = verticalstackedcontainer.node().getBoundingClientRect().height;
|
|
6844
|
-
const { width, height } = this.calculateDimensions(containerWidth, containerHeight, margin, device);
|
|
6845
|
-
// Apply visibility configurations
|
|
6846
|
-
if (this.chartConfiguration.isHeaderVisible !== undefined) {
|
|
6983
|
+
// ...existing code...
|
|
6984
|
+
/**
|
|
6985
|
+
* for hiding header
|
|
6986
|
+
* used by weekly charts
|
|
6987
|
+
*/
|
|
6988
|
+
if (this.chartConfiguration.isHeaderVisible != undefined) {
|
|
6847
6989
|
this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
|
|
6848
6990
|
}
|
|
6849
|
-
|
|
6991
|
+
/**
|
|
6992
|
+
* for hiding legends
|
|
6993
|
+
* used by weekly charts
|
|
6994
|
+
*/
|
|
6995
|
+
if (this.chartConfiguration.isTopCaptionVisible != undefined) {
|
|
6996
|
+
//UPDATENAME
|
|
6850
6997
|
this.isTopCaptionVisible = this.chartConfiguration.isTopCaptionVisible;
|
|
6851
6998
|
}
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
const formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
|
|
6860
|
-
// Create SVG containers
|
|
6861
|
-
const { barWidth, barPadding, requiredSvgWidth } = this.calculateBarDimensions(width, data.length, device);
|
|
6862
|
-
const outerContainer = this.createOuterContainer(chartContainer, height, margin);
|
|
6863
|
-
const { svgYAxisLeft, svgYAxisRight } = this.createAxisContainers(outerContainer, height, margin);
|
|
6864
|
-
const { innerContainer, svg } = this.createInnerContainer(outerContainer, requiredSvgWidth, height, margin, device);
|
|
6865
|
-
// Create scales
|
|
6866
|
-
const { xScale, yScale } = this.createScales(data, height, width, device);
|
|
6867
|
-
// Stack data
|
|
6868
|
-
const stack = d3
|
|
6869
|
-
.stack()
|
|
6870
|
-
.keys(preparedMetaData.keyList)
|
|
6871
|
-
.offset(d3.stackOffsetNone);
|
|
6872
|
-
const layers = stack(data);
|
|
6873
|
-
// Set Y scale domain
|
|
6874
|
-
const maxValue = this.calculateYScaleDomain(layers, targetValue || undefined);
|
|
6875
|
-
yScale.domain([0, maxValue]).nice();
|
|
6876
|
-
// Render chart elements
|
|
6877
|
-
this.renderGrids(svg, xScale, yScale, height, width);
|
|
6878
|
-
this.renderBars(svg, layers, xScale, yScale, preparedMetaData, device, barWidth, barPadding, targetValue, formatFromBackend, formatForHugeNumbers);
|
|
6879
|
-
this.renderAxes(svg, svgYAxisLeft, svgYAxisRight, xScale, yScale, data, height, width, device);
|
|
6880
|
-
this.renderLabels(svg, svgYAxisLeft, preparedMetaData, height, width, margin);
|
|
6881
|
-
if (this.chartData.targetLineData && targetValue) {
|
|
6882
|
-
this.renderTargetLine(svg, svgYAxisRight, yScale, width, targetValue, preparedMetaData);
|
|
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;
|
|
6883
7006
|
}
|
|
6884
|
-
|
|
6885
|
-
|
|
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');
|
|
6886
7013
|
}
|
|
6887
|
-
|
|
6888
|
-
createOuterContainer(chartContainer, height, margin) {
|
|
6889
|
-
return chartContainer
|
|
7014
|
+
var outerContainer = chartContainer
|
|
6890
7015
|
.append('div')
|
|
6891
|
-
.attr('id',
|
|
7016
|
+
.attr('id', self.uniqueId)
|
|
6892
7017
|
.attr('class', 'outer-container')
|
|
6893
7018
|
.style('width', '100%')
|
|
6894
7019
|
.style('height', height)
|
|
6895
7020
|
.style('overflow-x', 'hidden')
|
|
6896
7021
|
.style('padding-left', `${margin.left}px`)
|
|
6897
7022
|
.style('margin-left', '10px')
|
|
6898
|
-
.style('padding-right', `${
|
|
6899
|
-
|
|
6900
|
-
createAxisContainers(outerContainer, height, margin) {
|
|
6901
|
-
const svgYAxisLeft = outerContainer
|
|
7023
|
+
.style('padding-right', `${rightSvgWidth}px`);
|
|
7024
|
+
var svgYAxisLeft = outerContainer
|
|
6902
7025
|
.append('svg')
|
|
6903
7026
|
.attr('width', '80')
|
|
6904
7027
|
.attr('height', height + margin.top + margin.bottom)
|
|
@@ -6906,736 +7029,688 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6906
7029
|
.style('left', '0')
|
|
6907
7030
|
.style('z-index', 1)
|
|
6908
7031
|
.append('g')
|
|
6909
|
-
.attr('transform',
|
|
6910
|
-
|
|
7032
|
+
.attr('transform', 'translate(' + (margin.left + 10) + ',' + margin.top + ')');
|
|
7033
|
+
var svgYAxisRight = outerContainer
|
|
6911
7034
|
.append('svg')
|
|
6912
|
-
.attr('width',
|
|
7035
|
+
.attr('width', rightSvgWidth)
|
|
6913
7036
|
.attr('height', height + margin.top + margin.bottom)
|
|
6914
7037
|
.style('position', 'absolute')
|
|
6915
7038
|
.style('right', '2px')
|
|
6916
7039
|
.style('z-index', 1)
|
|
6917
7040
|
.append('g')
|
|
6918
|
-
.attr('transform',
|
|
6919
|
-
|
|
6920
|
-
}
|
|
6921
|
-
createInnerContainer(outerContainer, requiredSvgWidth, height, margin, device) {
|
|
6922
|
-
const innerContainer = outerContainer
|
|
7041
|
+
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7042
|
+
var innerContainer = outerContainer
|
|
6923
7043
|
.append('div')
|
|
6924
7044
|
.attr('class', 'inner-container')
|
|
6925
7045
|
.style('width', '100%')
|
|
6926
|
-
.style('overflow-x',
|
|
6927
|
-
|
|
7046
|
+
.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
|
|
6928
7065
|
.append('svg')
|
|
6929
7066
|
.attr('width', requiredSvgWidth)
|
|
6930
7067
|
.attr('height', height + margin.top + margin.bottom + 30)
|
|
6931
7068
|
.append('g')
|
|
6932
|
-
.attr('transform',
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
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
|
|
7095
|
+
.scaleBand()
|
|
7096
|
+
.rangeRound([
|
|
7097
|
+
leftAndRightSpaces,
|
|
7098
|
+
width - rightSvgWidth - leftAndRightSpaces
|
|
7099
|
+
])
|
|
7100
|
+
.domain(data.map(function (d) {
|
|
7101
|
+
return d.name;
|
|
7102
|
+
}).reverse())
|
|
7103
|
+
.padding(isMobile ? 0.2 : 0.5);
|
|
7104
|
+
var xScaleFromOrigin = d3
|
|
7105
|
+
.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
|
+
}
|
|
7157
|
+
}
|
|
7158
|
+
if (this.chartConfiguration.customYscale) {
|
|
7159
|
+
maxValue = maxValue * this.chartConfiguration.customYscale;
|
|
7160
|
+
}
|
|
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;
|
|
7167
|
+
}
|
|
7168
|
+
yScale.domain([0, maxValue]).nice();
|
|
7169
|
+
let xAxis = d3
|
|
7170
|
+
.axisBottom(xScale)
|
|
7171
|
+
.tickSize(0)
|
|
7172
|
+
.tickFormat(self.chartConfiguration.xAxisLabelFomatter);
|
|
7173
|
+
let yAxis = d3
|
|
7174
|
+
.axisLeft(yScale)
|
|
7175
|
+
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
7176
|
+
.tickSize(0)
|
|
7177
|
+
.tickFormat(self.chartConfiguration.yAxisLabelFomatter);
|
|
7178
|
+
let yLineAxis;
|
|
7179
|
+
if (lineYscale != null) {
|
|
7180
|
+
yLineAxis = d3
|
|
7181
|
+
.axisRight(lineYscale)
|
|
7182
|
+
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
7183
|
+
.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) {
|
|
6937
7191
|
svg
|
|
6938
7192
|
.append('g')
|
|
6939
7193
|
.attr('class', 'grid')
|
|
6940
|
-
.attr('transform',
|
|
7194
|
+
.attr('transform', 'translate(' + xScale.bandwidth() / 2 + ',' + height + ')')
|
|
6941
7195
|
.call(d3.axisBottom(xScale).tickSize(-height).tickFormat(''))
|
|
6942
7196
|
.style('stroke-dasharray', '5 5')
|
|
6943
7197
|
.style('color', '#999999')
|
|
7198
|
+
// .style("opacity", "0.5")
|
|
6944
7199
|
.call((g) => g.select('.domain').remove());
|
|
6945
7200
|
}
|
|
6946
|
-
|
|
7201
|
+
/**
|
|
7202
|
+
* used to draw y-axis grid
|
|
7203
|
+
*/
|
|
7204
|
+
if (self.chartConfiguration.yAxisGrid) {
|
|
6947
7205
|
svg
|
|
6948
7206
|
.append('g')
|
|
6949
7207
|
.attr('class', 'grid')
|
|
6950
7208
|
.call(d3
|
|
6951
7209
|
.axisLeft(yScale)
|
|
6952
|
-
.ticks(
|
|
7210
|
+
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
6953
7211
|
.tickSize(-width)
|
|
6954
7212
|
.tickFormat(''))
|
|
7213
|
+
// Remove hardcoded colors and use CSS variables
|
|
6955
7214
|
.style('color', 'var(--chart-grid-color)')
|
|
6956
7215
|
.style('opacity', '1');
|
|
7216
|
+
// .call((g) => g.select('.domain').remove());
|
|
6957
7217
|
}
|
|
6958
|
-
|
|
6959
|
-
this.chartConfiguration.xAxisGrid.forEach((gridPos, index) => {
|
|
6960
|
-
svg
|
|
6961
|
-
.append('g')
|
|
6962
|
-
.attr('class', `x${index + 2} axis${index + 2}`)
|
|
6963
|
-
.style('color', 'var(--chart-grid-color)')
|
|
6964
|
-
.attr('transform', `translate(0,${height * gridPos})`)
|
|
6965
|
-
.call(d3.axisBottom(xScale).tickSize(0).ticks(5).tickFormat(''))
|
|
6966
|
-
.style('fill', 'var(--chart-text-color)');
|
|
6967
|
-
});
|
|
6968
|
-
}
|
|
6969
|
-
}
|
|
6970
|
-
renderBars(svg, layers, xScale, yScale, metaData, device, barWidth, barPadding, targetValue, formatFromBackend, formatForHugeNumbers) {
|
|
6971
|
-
const layer = svg
|
|
7218
|
+
var layer = svg
|
|
6972
7219
|
.selectAll('.layer')
|
|
6973
7220
|
.data(layers)
|
|
6974
7221
|
.enter()
|
|
6975
7222
|
.append('g')
|
|
6976
7223
|
.attr('class', 'layer')
|
|
6977
|
-
.style('fill', (d)
|
|
6978
|
-
|
|
7224
|
+
.style('fill', function (d, i) {
|
|
7225
|
+
return metaData.colors[d.key];
|
|
7226
|
+
});
|
|
7227
|
+
var rect = layer
|
|
7228
|
+
.selectAll('rect')
|
|
7229
|
+
.data(function (d) {
|
|
7230
|
+
return d;
|
|
7231
|
+
})
|
|
7232
|
+
.enter();
|
|
6979
7233
|
rect
|
|
6980
7234
|
.append('rect')
|
|
6981
|
-
.on('click', (d)
|
|
6982
|
-
if (!
|
|
6983
|
-
if (!metaData.barWithoutClick
|
|
6984
|
-
|
|
6985
|
-
|
|
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);
|
|
6986
7241
|
}
|
|
6987
7242
|
})
|
|
6988
|
-
.attr('y', (d)
|
|
7243
|
+
.attr('y', function (d) {
|
|
6989
7244
|
if (!isNaN(d[0]) && !isNaN(d[1])) {
|
|
6990
7245
|
const actualHeight = yScale(d[0]) - yScale(d[1]);
|
|
6991
7246
|
return actualHeight < 3 ? yScale(d[0]) - 3 : yScale(d[1]);
|
|
6992
7247
|
}
|
|
6993
7248
|
return 0;
|
|
6994
7249
|
})
|
|
6995
|
-
.attr('x', (d, i)
|
|
6996
|
-
if (
|
|
6997
|
-
|
|
7250
|
+
.attr('x', function (d, i) {
|
|
7251
|
+
if (isMobile) {
|
|
7252
|
+
// On mobile, position bars with padding
|
|
7253
|
+
return leftAndRightSpaces + i * (barWidth + barPadding);
|
|
6998
7254
|
}
|
|
6999
|
-
if (
|
|
7255
|
+
if (self.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7000
7256
|
return xScale(d.data.name);
|
|
7001
7257
|
}
|
|
7002
|
-
|
|
7003
|
-
|
|
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;
|
|
7004
7264
|
}
|
|
7005
|
-
return xScale(d.data.name) + xScale.bandwidth() * 0.1;
|
|
7006
7265
|
})
|
|
7007
|
-
.attr('height', (d)
|
|
7266
|
+
.attr('height', function (d) {
|
|
7008
7267
|
if (!isNaN(d[0]) && !isNaN(d[1])) {
|
|
7009
7268
|
const actualHeight = yScale(d[0]) - yScale(d[1]);
|
|
7010
7269
|
return actualHeight < 3 ? 3 : actualHeight;
|
|
7011
7270
|
}
|
|
7012
7271
|
return 0;
|
|
7013
7272
|
})
|
|
7014
|
-
.attr('width', (d)
|
|
7015
|
-
|
|
7273
|
+
.attr('width', function (d) {
|
|
7274
|
+
// Use calculated barWidth for mobile, otherwise scale
|
|
7275
|
+
if (isMobile) {
|
|
7016
7276
|
return barWidth;
|
|
7017
|
-
if (this.chartConfiguration.isMultiChartGridLine === undefined) {
|
|
7018
|
-
return xScale.bandwidth();
|
|
7019
7277
|
}
|
|
7020
|
-
return
|
|
7021
|
-
?
|
|
7022
|
-
:
|
|
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;
|
|
7023
7284
|
})
|
|
7024
|
-
.style('cursor',
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7285
|
+
// .style('cursor', 'pointer');
|
|
7286
|
+
.style('cursor', function (d) {
|
|
7287
|
+
if (metaData.hasDrillDown) {
|
|
7288
|
+
if (metaData.barWithoutClick.length > 0 &&
|
|
7289
|
+
metaData.barWithoutClick.includes(d.data.name.toLowerCase())) {
|
|
7290
|
+
return 'default';
|
|
7291
|
+
}
|
|
7292
|
+
return 'pointer';
|
|
7029
7293
|
}
|
|
7030
|
-
|
|
7294
|
+
else
|
|
7295
|
+
return 'default';
|
|
7031
7296
|
})
|
|
7032
|
-
.style('fill', (d)
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
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
|
+
});
|
|
7036
7315
|
}
|
|
7037
|
-
this.
|
|
7038
|
-
}
|
|
7039
|
-
addBarLabels(rect, xScale, yScale, metaData, formatFromBackend, formatForHugeNumbers) {
|
|
7040
|
-
if (this.chartConfiguration.showTotalOnTop) {
|
|
7316
|
+
if (this.isCC) {
|
|
7041
7317
|
rect
|
|
7042
7318
|
.append('text')
|
|
7043
|
-
.attr('x',
|
|
7044
|
-
.
|
|
7045
|
-
|
|
7046
|
-
.text(
|
|
7047
|
-
if (!
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
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;
|
|
7051
7357
|
}
|
|
7052
7358
|
});
|
|
7053
7359
|
}
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
.
|
|
7058
|
-
.
|
|
7059
|
-
.
|
|
7060
|
-
|
|
7061
|
-
.
|
|
7062
|
-
.
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
}
|
|
7072
|
-
else {
|
|
7073
|
-
this.renderMultiChartAxes(svg, xAxis, yAxis, height);
|
|
7074
|
-
}
|
|
7075
|
-
this.styleAxisDomains(svg, svgYAxisLeft, svgYAxisRight);
|
|
7076
|
-
}
|
|
7077
|
-
renderStandardAxes(svg, xAxis, yAxis, data, height, device) {
|
|
7078
|
-
if (device.isMobile) {
|
|
7079
|
-
this.renderMobileXAxis(svg, data, height, device);
|
|
7080
|
-
}
|
|
7081
|
-
else {
|
|
7360
|
+
/**
|
|
7361
|
+
svg
|
|
7362
|
+
.append('foreignObject')
|
|
7363
|
+
.attr('transform', 'translate(' + 0 + ',' + (yZero - 25) + ')')
|
|
7364
|
+
.attr('width', width)
|
|
7365
|
+
.attr('height', 30)
|
|
7366
|
+
.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
|
+
}
|
|
7082
7377
|
svg
|
|
7083
|
-
.
|
|
7084
|
-
.
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
.
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
const barWidth = 32;
|
|
7101
|
-
const barPadding = 12;
|
|
7102
|
-
svg.selectAll('.custom-x-label').remove();
|
|
7103
|
-
data.forEach((d, i) => {
|
|
7104
|
-
const xVal = this.SPACING.leftAndRight + i * (barWidth + barPadding) + barWidth / 2;
|
|
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
|
+
});
|
|
7105
7395
|
svg
|
|
7106
|
-
.append('
|
|
7107
|
-
.attr('
|
|
7108
|
-
.
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
.style('font-size', '10px')
|
|
7113
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7114
|
-
.style('writing-mode', 'sideways-lr')
|
|
7115
|
-
.text(d.name.substring(0, 3));
|
|
7116
|
-
});
|
|
7117
|
-
}
|
|
7118
|
-
renderDrilldownAxes(svg, svgYAxisLeft, svgYAxisRight, xAxis, yAxis, height) {
|
|
7119
|
-
svg
|
|
7120
|
-
.append('g')
|
|
7121
|
-
.attr('transform', `translate(0,${height})`)
|
|
7122
|
-
.attr('class', 'lib-stacked-x-axis-text multichart1')
|
|
7123
|
-
.call(xAxis)
|
|
7124
|
-
.style('display', 'none');
|
|
7125
|
-
svgYAxisLeft
|
|
7126
|
-
.append('g')
|
|
7127
|
-
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
7128
|
-
.call(yAxis)
|
|
7129
|
-
.selectAll('text')
|
|
7130
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7131
|
-
svgYAxisRight
|
|
7132
|
-
.append('g')
|
|
7133
|
-
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
7134
|
-
.call(yAxis)
|
|
7135
|
-
.style('display', 'none');
|
|
7136
|
-
}
|
|
7137
|
-
renderMultiChartAxes(svg, xAxis, yAxis, height) {
|
|
7138
|
-
svg
|
|
7139
|
-
.append('g')
|
|
7140
|
-
.attr('transform', `translate(0,${height})`)
|
|
7141
|
-
.attr('class', 'lib-stacked-x-axis-text multichart')
|
|
7142
|
-
.call(xAxis)
|
|
7143
|
-
.selectAll('text')
|
|
7144
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7145
|
-
svg
|
|
7146
|
-
.append('g')
|
|
7147
|
-
.attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
|
|
7148
|
-
.call(yAxis)
|
|
7149
|
-
.selectAll('text')
|
|
7150
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7151
|
-
}
|
|
7152
|
-
styleAxisDomains(svg, svgYAxisLeft, svgYAxisRight) {
|
|
7153
|
-
const axisStyle = {
|
|
7154
|
-
stroke: 'var(--chart-axis-color)',
|
|
7155
|
-
'stroke-width': '1px'
|
|
7156
|
-
};
|
|
7157
|
-
[svg, svgYAxisLeft, svgYAxisRight].forEach(element => {
|
|
7158
|
-
element.selectAll('.domain')
|
|
7159
|
-
.style('stroke', axisStyle.stroke)
|
|
7160
|
-
.style('stroke-width', axisStyle['stroke-width']);
|
|
7161
|
-
});
|
|
7162
|
-
}
|
|
7163
|
-
renderLabels(svg, svgYAxisLeft, metaData, height, width, margin) {
|
|
7164
|
-
if (metaData.yLabel) {
|
|
7165
|
-
this.renderYAxisLabel(svgYAxisLeft, metaData.yLabel, height, margin);
|
|
7166
|
-
}
|
|
7167
|
-
if (metaData.xLabel) {
|
|
7168
|
-
this.renderXAxisLabel(svg, metaData.xLabel, height, width, margin);
|
|
7169
|
-
}
|
|
7170
|
-
}
|
|
7171
|
-
renderYAxisLabel(svgYAxisLeft, yLabel, height, margin) {
|
|
7172
|
-
svgYAxisLeft.selectAll('.lib-axis-group-label, .lib-ylabel-drilldowncharts, .lib-ylabel-weeklyCharts').remove();
|
|
7173
|
-
const { formatted, isAcronym } = this.formatAxisLabel(yLabel);
|
|
7174
|
-
const isRia = this.customChartConfiguration?.isRia;
|
|
7175
|
-
const yPosition = isRia ? -margin.left / 2 - 30 : -margin.left / 2 - 40;
|
|
7176
|
-
let labelClass = 'lib-axis-group-label font-size-1';
|
|
7177
|
-
if (this.chartConfiguration.isDrilldownChart) {
|
|
7178
|
-
labelClass += ' lib-ylabel-drilldowncharts';
|
|
7179
|
-
}
|
|
7180
|
-
else if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
|
|
7181
|
-
labelClass += ' lib-ylabel-weeklyCharts';
|
|
7182
|
-
}
|
|
7183
|
-
else {
|
|
7184
|
-
labelClass += ' lib-axis-waterfall-label';
|
|
7185
|
-
}
|
|
7186
|
-
svgYAxisLeft
|
|
7187
|
-
.append('text')
|
|
7188
|
-
.attr('class', labelClass)
|
|
7189
|
-
.attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
|
|
7190
|
-
.attr('transform', 'rotate(-90)')
|
|
7191
|
-
.attr('y', yPosition)
|
|
7192
|
-
.attr('x', -height / 2)
|
|
7193
|
-
.attr('dy', '1em')
|
|
7194
|
-
.style('text-anchor', 'middle')
|
|
7195
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7196
|
-
.text(formatted)
|
|
7197
|
-
.style('text-transform', isAcronym ? 'none' : 'capitalize');
|
|
7198
|
-
}
|
|
7199
|
-
renderXAxisLabel(svg, xLabel, height, width, margin) {
|
|
7200
|
-
const { formatted, isAcronym } = this.formatAxisLabel(xLabel);
|
|
7201
|
-
const isRia = this.customChartConfiguration?.isRia;
|
|
7202
|
-
const xPosition = isRia
|
|
7203
|
-
? height + margin.top + margin.bottom
|
|
7204
|
-
: height + margin.top + margin.bottom + 10;
|
|
7205
|
-
let labelClass = 'lib-axis-group-label font-size-1';
|
|
7206
|
-
if (this.chartConfiguration.isDrilldownChart) {
|
|
7207
|
-
labelClass += ' lib-xlabel-drilldowncharts';
|
|
7208
|
-
}
|
|
7209
|
-
else if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
|
|
7210
|
-
labelClass += ' lib-xlabel-weeklyCharts';
|
|
7211
|
-
}
|
|
7212
|
-
else {
|
|
7213
|
-
labelClass += ' lib-axis-waterfall-label';
|
|
7214
|
-
}
|
|
7215
|
-
svg
|
|
7216
|
-
.append('text')
|
|
7217
|
-
.attr('class', labelClass)
|
|
7218
|
-
.attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
|
|
7219
|
-
.attr('transform', `translate(${width / 2},${xPosition})`)
|
|
7220
|
-
.style('text-anchor', 'middle')
|
|
7221
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7222
|
-
.text(formatted)
|
|
7223
|
-
.style('text-transform', isAcronym ? 'none' : 'capitalize');
|
|
7224
|
-
}
|
|
7225
|
-
renderTargetLine(svg, svgYAxisRight, yScale, width, targetValue, metaData) {
|
|
7226
|
-
const yZero = yScale(targetValue);
|
|
7227
|
-
// Draw target line
|
|
7228
|
-
svg
|
|
7229
|
-
.append('line')
|
|
7230
|
-
.attr('x1', 0)
|
|
7231
|
-
.attr('x2', width)
|
|
7232
|
-
.attr('y1', yZero)
|
|
7233
|
-
.attr('y2', yZero)
|
|
7234
|
-
.style('stroke-dasharray', '5 5')
|
|
7235
|
-
.style('stroke', this.chartData.targetLineData.color);
|
|
7236
|
-
// Add target label
|
|
7237
|
-
const targetLineName = this.chartData.targetLineData?.targetName || 'target';
|
|
7238
|
-
const dataType = metaData.dataType || '';
|
|
7239
|
-
svgYAxisRight
|
|
7240
|
-
.append('foreignObject')
|
|
7241
|
-
.attr('transform', `translate(0,${yZero - 13})`)
|
|
7242
|
-
.attr('width', this.SPACING.rightSvgWidth)
|
|
7243
|
-
.attr('height', 50)
|
|
7244
|
-
.append('xhtml:div')
|
|
7245
|
-
.attr('class', 'target-display')
|
|
7246
|
-
.style('color', 'var(--chart-text-color)')
|
|
7247
|
-
.html(`
|
|
7248
|
-
<div>${targetLineName}</div>
|
|
7249
|
-
<div>${targetValue}${dataType}</div>
|
|
7250
|
-
`);
|
|
7251
|
-
}
|
|
7252
|
-
renderLineChart(svg, lineData, xScale, height, colors) {
|
|
7253
|
-
const lineYscale = d3
|
|
7254
|
-
.scaleLinear()
|
|
7255
|
-
.domain([0, d3.max(lineData, (d) => +d.value) || 0])
|
|
7256
|
-
.range([height, 0]);
|
|
7257
|
-
const dataGroup = d3
|
|
7258
|
-
.nest()
|
|
7259
|
-
.key((d) => d.category)
|
|
7260
|
-
.entries(lineData);
|
|
7261
|
-
const lineGen = d3
|
|
7262
|
-
.line()
|
|
7263
|
-
.x((d) => xScale(d.name) + xScale.bandwidth() / 2)
|
|
7264
|
-
.y((d) => lineYscale(d.value));
|
|
7265
|
-
dataGroup.forEach((group) => {
|
|
7266
|
-
// Draw line
|
|
7267
|
-
svg
|
|
7268
|
-
.append('path')
|
|
7269
|
-
.datum(group.values)
|
|
7270
|
-
.attr('fill', 'none')
|
|
7271
|
-
.attr('stroke', (d) => {
|
|
7272
|
-
if (d[0] && 'category' in d[0]) {
|
|
7273
|
-
return colors[d[0].category];
|
|
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);
|
|
7274
7402
|
}
|
|
7275
|
-
return
|
|
7403
|
+
return xScale(d.data.name) - leftAndRightSpaces;
|
|
7276
7404
|
})
|
|
7277
|
-
.attr('
|
|
7278
|
-
.attr('
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
.
|
|
7283
|
-
.
|
|
7284
|
-
|
|
7285
|
-
.
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
.attr('fill', (d) => {
|
|
7289
|
-
if ('category' in d) {
|
|
7290
|
-
return colors[d.category];
|
|
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
|
|
7291
7416
|
}
|
|
7292
|
-
|
|
7417
|
+
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7418
|
+
return '180px';
|
|
7419
|
+
}
|
|
7420
|
+
return xScale.bandwidth() + leftAndRightSpaces * 2;
|
|
7293
7421
|
})
|
|
7294
|
-
.attr('
|
|
7295
|
-
.
|
|
7296
|
-
.attr('
|
|
7297
|
-
.
|
|
7298
|
-
.
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
.
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7328
|
-
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 }); }
|
|
7329
|
-
}
|
|
7330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, decorators: [{
|
|
7331
|
-
type: Component,
|
|
7332
|
-
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"] }]
|
|
7333
|
-
}], ctorParameters: () => [], propDecorators: { containerElt: [{
|
|
7334
|
-
type: ViewChild,
|
|
7335
|
-
args: ['verticalstackedchartcontainer', { static: true }]
|
|
7336
|
-
}], verticalstackedcontainerElt: [{
|
|
7337
|
-
type: ViewChild,
|
|
7338
|
-
args: ['verticalstackedcontainer', { static: true }]
|
|
7339
|
-
}], chartData: [{
|
|
7340
|
-
type: Input
|
|
7341
|
-
}], customChartConfiguration: [{
|
|
7342
|
-
type: Input
|
|
7343
|
-
}], clickEvent: [{
|
|
7344
|
-
type: Output
|
|
7345
|
-
}], headerMenuclickEvent: [{
|
|
7346
|
-
type: Output
|
|
7347
|
-
}] } });
|
|
7348
|
-
|
|
7349
|
-
class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
7350
|
-
constructor() {
|
|
7351
|
-
super();
|
|
7352
|
-
this.clickEvent = new EventEmitter();
|
|
7353
|
-
this.headerMenuclickEvent = new EventEmitter();
|
|
7354
|
-
this.isHeaderVisible = true;
|
|
7355
|
-
this.legendVisible = true;
|
|
7356
|
-
this.isTransparentBackground = false;
|
|
7357
|
-
this.chartConfiguration = {};
|
|
7358
|
-
this.objectKeys = Object.keys;
|
|
7359
|
-
this.defaultConfiguration = {
|
|
7360
|
-
margin: { top: 20, right: 20, bottom: 20, left: 40 },
|
|
7361
|
-
labelFormatter: ChartHelper.defaultFormatter,
|
|
7362
|
-
svgHeight: 70,
|
|
7363
|
-
numberOfYTicks: 5,
|
|
7364
|
-
legendJustified: true,
|
|
7365
|
-
yLineAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
7366
|
-
yAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
7367
|
-
lineGraphColor: '#F6D283',
|
|
7368
|
-
showLineChartAxis: true,
|
|
7369
|
-
showValues: true,
|
|
7370
|
-
headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
|
|
7371
|
-
xAxisGrid: undefined,
|
|
7372
|
-
yAxisGrid: false,
|
|
7373
|
-
legendVisible: false,
|
|
7374
|
-
isHeaderVisible: undefined,
|
|
7375
|
-
isTransparentBackground: undefined,
|
|
7376
|
-
isMultiChartGridLine: undefined,
|
|
7377
|
-
isFullScreen: undefined,
|
|
7378
|
-
customYscale: undefined,
|
|
7379
|
-
textsOnBar: undefined,
|
|
7380
|
-
isXaxisLabelHidden: undefined,
|
|
7381
|
-
isYaxisLabelHidden: false,
|
|
7382
|
-
isYaxisHidden: undefined,
|
|
7383
|
-
isYaxisDashed: undefined,
|
|
7384
|
-
textFormatter: undefined,
|
|
7385
|
-
isNoAlternateXaxisText: undefined,
|
|
7386
|
-
isXgridBetweenLabels: undefined,
|
|
7387
|
-
backgroundColor: '#FFFFFF',
|
|
7388
|
-
hideLegendOnTop: true,
|
|
7389
|
-
isXaxisColor: '#999999',
|
|
7390
|
-
labelOverlapMinorFix: true,
|
|
7391
|
-
noHoverEffect: true,
|
|
7392
|
-
noHoverDisplayData: true,
|
|
7393
|
-
showXaxisTop: true,
|
|
7394
|
-
displayYaxisLabels: undefined,
|
|
7395
|
-
xLabelsOnSameLine: undefined,
|
|
7396
|
-
textAlwaysHorizontal: undefined,
|
|
7397
|
-
legendAtTopRight: undefined,
|
|
7398
|
-
isDrilldownChart: true,
|
|
7399
|
-
displayTitleOnTop: undefined,
|
|
7400
|
-
isToggleVisible: undefined,
|
|
7401
|
-
isTitleHidden: undefined,
|
|
7402
|
-
isDisplayBarDetailsAtBottom: undefined,
|
|
7403
|
-
howmanyBarDetailsToDisplay: 0,
|
|
7404
|
-
barVauleColor: undefined,
|
|
7405
|
-
defaultBarHeight: 2,
|
|
7406
|
-
};
|
|
7407
|
-
this.uniqueId = this.getUniqueId();
|
|
7408
|
-
this.isZoomedOut = true;
|
|
7409
|
-
this.isDD1Open = false;
|
|
7410
|
-
this.isDD2Open = false;
|
|
7411
|
-
this.keepOrder = (a, b) => {
|
|
7412
|
-
return a;
|
|
7413
|
-
};
|
|
7414
|
-
}
|
|
7415
|
-
onResized(event) {
|
|
7416
|
-
let self = this;
|
|
7417
|
-
setTimeout(function () {
|
|
7418
|
-
d3.select('#' + self.uniqueId).remove();
|
|
7419
|
-
self.initializegroupChart();
|
|
7420
|
-
}.bind(self), 10);
|
|
7421
|
-
}
|
|
7422
|
-
isZoomOutSelected(isZoomOut, event) {
|
|
7423
|
-
this.isZoomedOut = isZoomOut;
|
|
7424
|
-
this.onResized(event);
|
|
7425
|
-
}
|
|
7426
|
-
handleZoominZoomoutClick({ isZoomOut, event }) {
|
|
7427
|
-
this.isZoomOutSelected(isZoomOut, event);
|
|
7428
|
-
}
|
|
7429
|
-
ngOnInit() { }
|
|
7430
|
-
isLegendVisible() {
|
|
7431
|
-
if (this.chartData &&
|
|
7432
|
-
this.chartData.metaData.colors &&
|
|
7433
|
-
Object.keys(this.chartData.metaData.colors).length > 1) {
|
|
7434
|
-
return true;
|
|
7435
|
-
}
|
|
7436
|
-
return false;
|
|
7437
|
-
}
|
|
7438
|
-
get isAlertEnabled() {
|
|
7439
|
-
return this.chartConfiguration?.headerMenuOptions?.some((option) => option.id === 'editAlert');
|
|
7440
|
-
}
|
|
7441
|
-
initializegroupChart() {
|
|
7442
|
-
var self = this;
|
|
7443
|
-
let data = [];
|
|
7444
|
-
let metaData = null;
|
|
7445
|
-
let keyList = null;
|
|
7446
|
-
let lineData = null;
|
|
7447
|
-
let colorMap = {};
|
|
7448
|
-
var formatFromBackend;
|
|
7449
|
-
var formatForHugeNumbers;
|
|
7450
|
-
const isMobile = window.innerWidth < 576;
|
|
7451
|
-
const isTablet = window.innerWidth >= 576 && window.innerWidth < 992;
|
|
7452
|
-
const isDesktop = window.innerWidth >= 992;
|
|
7453
|
-
let isria = this.customChartConfiguration.isRia;
|
|
7454
|
-
var x;
|
|
7455
|
-
var alternate_text = false;
|
|
7456
|
-
var short_tick_length = 4;
|
|
7457
|
-
var long_tick_length = 16;
|
|
7458
|
-
var short_tick_length_bg = 5;
|
|
7459
|
-
var long_tick_length_bg = 30;
|
|
7460
|
-
var leftAndRightSpaces = 50;
|
|
7461
|
-
var rightSvgWidth = 60;
|
|
7462
|
-
var tempScale;
|
|
7463
|
-
for (var i in this.defaultConfiguration) {
|
|
7464
|
-
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
7465
|
-
}
|
|
7466
|
-
data = this.chartData.data;
|
|
7467
|
-
metaData = this.chartData.metaData;
|
|
7468
|
-
lineData = this.chartData.lineData;
|
|
7469
|
-
if (!metaData.colorAboveTarget) {
|
|
7470
|
-
metaData['colorAboveTarget'] = metaData.colors;
|
|
7471
|
-
}
|
|
7472
|
-
colorMap = metaData.colors;
|
|
7473
|
-
keyList = metaData.keyList;
|
|
7474
|
-
var chartContainer = d3.select(this.containerElt.nativeElement);
|
|
7475
|
-
var verticalstackedcontainer = d3.select(this.groupcontainerElt.nativeElement);
|
|
7476
|
-
var margin = this.chartConfiguration.margin;
|
|
7477
|
-
var width = parseInt(chartContainer.style('width')) - margin.left - margin.right;
|
|
7478
|
-
if (this.chartData.data.length > 30 && this.isZoomedOut) {
|
|
7479
|
-
width =
|
|
7480
|
-
width > this.chartData.data.length * 40
|
|
7481
|
-
? this.chartData.dropdownData1
|
|
7482
|
-
? this.chartData.data.length * 60
|
|
7483
|
-
: width
|
|
7484
|
-
: this.chartData.dropdownData1
|
|
7485
|
-
? this.chartData.data.length * 60
|
|
7486
|
-
: this.chartData.data.length * 40;
|
|
7487
|
-
width =
|
|
7488
|
-
width > this.chartData.data.length * 40
|
|
7489
|
-
? width
|
|
7490
|
-
: this.chartData.data.length * 40;
|
|
7491
|
-
}
|
|
7492
|
-
if (this.chartData.dropdownData2 &&
|
|
7493
|
-
width < this.chartData.data.length * 120 &&
|
|
7494
|
-
this.isZoomedOut) {
|
|
7495
|
-
width = this.chartData.data.length * 120;
|
|
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
|
+
});
|
|
7496
7455
|
}
|
|
7497
|
-
|
|
7498
|
-
if (
|
|
7499
|
-
|
|
7500
|
-
width = this.chartData.data.length * 250;
|
|
7456
|
+
function handleMouseOut(d, i) {
|
|
7457
|
+
if (!self.chartConfiguration.displayTitleOnTop) {
|
|
7458
|
+
return;
|
|
7501
7459
|
}
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
? this.chartConfiguration.svgHeight
|
|
7514
|
-
: parseInt(verticalstackedcontainer.style('height'));
|
|
7515
|
-
}
|
|
7516
|
-
if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
|
|
7517
|
-
height =
|
|
7518
|
-
parseInt(verticalstackedcontainer.style('height')) -
|
|
7519
|
-
margin.top -
|
|
7520
|
-
margin.bottom -
|
|
7521
|
-
130;
|
|
7522
|
-
}
|
|
7523
|
-
if (this.chartConfiguration.isHeaderVisible) {
|
|
7524
|
-
height =
|
|
7525
|
-
parseInt(verticalstackedcontainer.style('height')) -
|
|
7526
|
-
margin.top -
|
|
7527
|
-
margin.bottom -
|
|
7528
|
-
100;
|
|
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();
|
|
7529
7471
|
}
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
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
|
+
});
|
|
7534
7507
|
}
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
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
|
+
});
|
|
7538
7576
|
}
|
|
7539
|
-
if (this.chartConfiguration.
|
|
7540
|
-
|
|
7541
|
-
|
|
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)');
|
|
7542
7620
|
}
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
.attr('height', height + margin.top + margin.bottom + 10)
|
|
7566
|
-
.style('position', 'absolute')
|
|
7567
|
-
.style('right', '12px')
|
|
7568
|
-
.style('z-index', 1)
|
|
7569
|
-
.append('g')
|
|
7570
|
-
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7571
|
-
var innerContainer = outerContainer
|
|
7572
|
-
.append('div')
|
|
7573
|
-
.attr('class', 'inner-container')
|
|
7574
|
-
.style('width', '100%')
|
|
7575
|
-
.style('overflow-x', 'auto');
|
|
7576
|
-
var svg = innerContainer
|
|
7577
|
-
.append('svg')
|
|
7578
|
-
.attr('width', width - rightSvgWidth)
|
|
7579
|
-
.attr('height', height + margin.top + margin.bottom + 60)
|
|
7580
|
-
.append('g')
|
|
7581
|
-
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7582
|
-
var subgroups = keyList;
|
|
7583
|
-
var groups = d3
|
|
7584
|
-
.map(data, function (d) {
|
|
7585
|
-
return d.name;
|
|
7586
|
-
})
|
|
7587
|
-
.keys();
|
|
7588
|
-
if (this.chartConfiguration.isMultiChartGridLine != undefined) {
|
|
7589
|
-
x = d3
|
|
7590
|
-
.scaleBand()
|
|
7591
|
-
.rangeRound([width, 0])
|
|
7592
|
-
.align(0.5)
|
|
7593
|
-
.padding([0.5])
|
|
7594
|
-
.domain(data.map(function (d) {
|
|
7595
|
-
return d.name.toLowerCase();
|
|
7596
|
-
}));
|
|
7621
|
+
else if (this.chartConfiguration.isDrilldownChart) {
|
|
7622
|
+
svg
|
|
7623
|
+
.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');
|
|
7597
7643
|
}
|
|
7598
7644
|
else {
|
|
7599
|
-
x = d3
|
|
7600
|
-
.scaleBand()
|
|
7601
|
-
.domain(groups)
|
|
7602
|
-
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
7603
|
-
.padding([0.3]);
|
|
7604
|
-
}
|
|
7605
|
-
var xScaleFromOrigin = d3
|
|
7606
|
-
.scaleBand()
|
|
7607
|
-
.domain(groups)
|
|
7608
|
-
.range([0, width - rightSvgWidth]);
|
|
7609
|
-
if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7610
7645
|
svg
|
|
7611
7646
|
.append('g')
|
|
7612
|
-
.attr('class', 'x1 axis1')
|
|
7613
7647
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7614
|
-
.
|
|
7615
|
-
.
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
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)');
|
|
7653
|
+
svg
|
|
7654
|
+
.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)');
|
|
7661
|
+
}
|
|
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
|
+
});
|
|
7630
7677
|
}
|
|
7631
7678
|
else {
|
|
7679
|
+
d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
|
|
7680
|
+
}
|
|
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');
|
|
7688
|
+
}
|
|
7689
|
+
else if (this.chartConfiguration.isXaxisLabelHidden != undefined) {
|
|
7632
7690
|
svg
|
|
7633
7691
|
.append('g')
|
|
7634
7692
|
.attr('class', 'x1 axis1')
|
|
7635
7693
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7636
|
-
.
|
|
7694
|
+
.style('color', '#000')
|
|
7695
|
+
.call(d3.axisBottom(xScale).tickSize(0))
|
|
7637
7696
|
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
7638
|
-
svg
|
|
7697
|
+
svg
|
|
7698
|
+
.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
|
+
*/
|
|
7639
7714
|
if (alternate_text &&
|
|
7640
7715
|
self.chartConfiguration.isNoAlternateXaxisText == undefined) {
|
|
7641
7716
|
alternate_text = false;
|
|
@@ -7646,14 +7721,25 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7646
7721
|
return short_tick_length_bg - 4;
|
|
7647
7722
|
}
|
|
7648
7723
|
});
|
|
7724
|
+
/**
|
|
7725
|
+
* reset the flag so that texts also follow the pattern of ticks
|
|
7726
|
+
* used by weekly charts
|
|
7727
|
+
*/
|
|
7649
7728
|
alternate_text = false;
|
|
7650
7729
|
svg
|
|
7651
7730
|
.selectAll('g.x1.axis1 g.tick text')
|
|
7652
|
-
.attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
7653
|
-
.attr('
|
|
7654
|
-
if (self.chartConfiguration.
|
|
7655
|
-
|
|
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';
|
|
7656
7738
|
}
|
|
7739
|
+
else
|
|
7740
|
+
return 'lib-xaxis-labels-texts-weeklycharts';
|
|
7741
|
+
})
|
|
7742
|
+
.attr('y', function () {
|
|
7657
7743
|
if (alternate_text) {
|
|
7658
7744
|
alternate_text = false;
|
|
7659
7745
|
return long_tick_length_bg;
|
|
@@ -7665,161 +7751,528 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7665
7751
|
});
|
|
7666
7752
|
}
|
|
7667
7753
|
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
7668
|
-
|
|
7754
|
+
svg
|
|
7669
7755
|
.selectAll('g.x1.axis1 g.tick text')
|
|
7670
7756
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
7671
|
-
.
|
|
7672
|
-
.
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
return
|
|
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();
|
|
7680
7766
|
}
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
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();
|
|
7685
7774
|
}
|
|
7686
|
-
|
|
7775
|
+
if (totalBars === 2) {
|
|
7776
|
+
return 'translate(0,0)';
|
|
7777
|
+
}
|
|
7778
|
+
else {
|
|
7779
|
+
return 'translate(' + (i * 30) + ',0)';
|
|
7780
|
+
}
|
|
7781
|
+
}
|
|
7782
|
+
return null;
|
|
7783
|
+
});
|
|
7784
|
+
svg
|
|
7785
|
+
.selectAll('g.x1.axis1 g.tick')
|
|
7786
|
+
.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();
|
|
7687
7797
|
}
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7798
|
+
return '';
|
|
7799
|
+
})
|
|
7800
|
+
.attr('transform', function (d, i) {
|
|
7801
|
+
if (isMobile && i === 0) {
|
|
7802
|
+
return 'translate(20,0)';
|
|
7693
7803
|
}
|
|
7694
|
-
|
|
7695
|
-
|
|
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) {
|
|
7830
|
+
d3.selectAll('.yaxis-dashed')
|
|
7831
|
+
.style('stroke-dasharray', '5 5')
|
|
7832
|
+
.style('color', 'var(--chart-grid-color)'); // Use CSS variable
|
|
7833
|
+
}
|
|
7834
|
+
/**
|
|
7835
|
+
* x axis color
|
|
7836
|
+
* used by weekly charts
|
|
7837
|
+
*/
|
|
7838
|
+
if (this.chartConfiguration.isXaxisColor != undefined) {
|
|
7839
|
+
d3.selectAll('.multichart').style('color', this.chartConfiguration.isXaxisColor || 'var(--chart-text-color)');
|
|
7840
|
+
}
|
|
7841
|
+
/**
|
|
7842
|
+
* used to display y label
|
|
7843
|
+
*/
|
|
7844
|
+
if (this.isZoomedOut && this.chartData.data.length > 9) {
|
|
7845
|
+
svg
|
|
7846
|
+
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
7847
|
+
.attr('transform', 'rotate(-90)')
|
|
7848
|
+
.attr('text-anchor', 'end')
|
|
7849
|
+
.attr('x', '-5')
|
|
7850
|
+
.attr('dy', null);
|
|
7851
|
+
}
|
|
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');
|
|
7862
|
+
}
|
|
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));
|
|
7868
|
+
}
|
|
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');
|
|
7892
|
+
}
|
|
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;
|
|
7696
7924
|
}
|
|
7697
|
-
if (self.
|
|
7698
|
-
|
|
7925
|
+
if (self.chartData.targetLineData &&
|
|
7926
|
+
self.chartData.targetLineData.targetName) {
|
|
7927
|
+
targetLineName = self.chartData.targetLineData.targetName;
|
|
7699
7928
|
}
|
|
7700
|
-
return
|
|
7929
|
+
return (`<div>${targetLineName}</div>` +
|
|
7930
|
+
'<div>' +
|
|
7931
|
+
self.chartData.targetLineData.target +
|
|
7932
|
+
'' +
|
|
7933
|
+
dataTypeTemp +
|
|
7934
|
+
'</div>');
|
|
7935
|
+
});
|
|
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)));
|
|
7957
|
+
}
|
|
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);
|
|
7961
|
+
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;
|
|
7701
7983
|
})
|
|
7702
|
-
.
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
return
|
|
7984
|
+
.entries(lineData);
|
|
7985
|
+
var lineGen = d3
|
|
7986
|
+
.line()
|
|
7987
|
+
.x(function (d) {
|
|
7988
|
+
return xScale(d.name) + xScale.bandwidth() / 2;
|
|
7707
7989
|
})
|
|
7708
|
-
.
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
if (dateRangeRegex.test(d.trim())) {
|
|
7726
|
-
return d.trim().replace(dateRangeRegex, (m, d1, d2) => `${d1} - ${d2}`);
|
|
7727
|
-
}
|
|
7728
|
-
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
7729
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
7730
|
-
if (subgroups.length > 1 && !self.isZoomedOut && data.length > 8 && d.indexOf(' ') > -1 && (isDateLabel || isWeekLabel)) {
|
|
7731
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
7732
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
7733
|
-
return first + '\n' + second;
|
|
7734
|
-
}
|
|
7735
|
-
if (isDateLabel) {
|
|
7736
|
-
if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
|
|
7737
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
7738
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
7739
|
-
return first + '\n' + second;
|
|
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];
|
|
7740
8007
|
}
|
|
7741
8008
|
else {
|
|
7742
|
-
return
|
|
8009
|
+
return self.chartConfiguration.lineGraphColor;
|
|
7743
8010
|
}
|
|
7744
|
-
}
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
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];
|
|
7755
8027
|
}
|
|
7756
8028
|
else {
|
|
7757
|
-
return
|
|
8029
|
+
return self.chartConfiguration.lineGraphColor;
|
|
7758
8030
|
}
|
|
7759
|
-
}
|
|
7760
|
-
if (d.trim().indexOf(' ') > -1) {
|
|
7761
|
-
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
7762
|
-
}
|
|
7763
|
-
return d.toLowerCase();
|
|
7764
|
-
});
|
|
7765
|
-
xAxisLabels.each(function (d) {
|
|
7766
|
-
const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
|
|
7767
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
7768
|
-
if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
|
|
7769
|
-
d3.select(this).style('writing-mode', 'sideways-lr');
|
|
7770
|
-
}
|
|
7771
|
-
});
|
|
7772
|
-
if (!isMobile) {
|
|
7773
|
-
svg
|
|
7774
|
-
.selectAll('g.x1.axis1 g.tick')
|
|
7775
|
-
.filter(function (d) {
|
|
7776
|
-
return !/\d{2,4}[-\/]/.test(d);
|
|
7777
8031
|
})
|
|
7778
|
-
.
|
|
7779
|
-
.attr('
|
|
7780
|
-
.
|
|
7781
|
-
.attr('fill', 'var(--chart-text-color)')
|
|
7782
|
-
.attr('x', function (d) {
|
|
7783
|
-
if (self.chartData.data.length > 8 && !self.isZoomedOut) {
|
|
7784
|
-
return 1;
|
|
7785
|
-
}
|
|
7786
|
-
return 0;
|
|
8032
|
+
.attr('stroke', 'none')
|
|
8033
|
+
.attr('cx', function (d, i) {
|
|
8034
|
+
return xScale(d.name) + xScale.bandwidth() / 2;
|
|
7787
8035
|
})
|
|
7788
|
-
.
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
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
|
+
});
|
|
8059
|
+
}
|
|
8060
|
+
// svg.attr('width', 150).style('max-width', 150).style('overflow-x', 'auto');
|
|
8061
|
+
}
|
|
8062
|
+
handleClick(d) {
|
|
8063
|
+
if (this.chartData?.metaData?.hasDrillDown || d?.toggleFrom)
|
|
8064
|
+
this.clickEvent.emit(d);
|
|
8065
|
+
}
|
|
8066
|
+
handleHeaderMenuClick(id) {
|
|
8067
|
+
this.headerMenuclickEvent.emit(id);
|
|
8068
|
+
}
|
|
8069
|
+
handleCompareByFilterSelection(event) {
|
|
8070
|
+
this.clickEvent.emit(event);
|
|
8071
|
+
}
|
|
8072
|
+
handleZoominZoomoutClick({ isZoomOut, event }) {
|
|
8073
|
+
// this.isZoomOutSelected(isZoomOut, event);
|
|
8074
|
+
this.isZoomOutSelected(isZoomOut);
|
|
8075
|
+
}
|
|
8076
|
+
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 }); }
|
|
8078
|
+
}
|
|
8079
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, decorators: [{
|
|
8080
|
+
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"] }]
|
|
8082
|
+
}], ctorParameters: () => [], propDecorators: { containerElt: [{
|
|
8083
|
+
type: ViewChild,
|
|
8084
|
+
args: ['verticalstackedchartcontainer', { static: true }]
|
|
8085
|
+
}], verticalstackedcontainerElt: [{
|
|
8086
|
+
type: ViewChild,
|
|
8087
|
+
args: ['verticalstackedcontainer', { static: true }]
|
|
8088
|
+
}], chartData: [{
|
|
8089
|
+
type: Input
|
|
8090
|
+
}], customChartConfiguration: [{
|
|
8091
|
+
type: Input
|
|
8092
|
+
}], clickEvent: [{
|
|
8093
|
+
type: Output
|
|
8094
|
+
}], headerMenuclickEvent: [{
|
|
8095
|
+
type: Output
|
|
8096
|
+
}] } });
|
|
8097
|
+
|
|
8098
|
+
class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
8099
|
+
constructor() {
|
|
8100
|
+
super();
|
|
8101
|
+
this.clickEvent = new EventEmitter();
|
|
8102
|
+
this.headerMenuclickEvent = new EventEmitter();
|
|
8103
|
+
this.isHeaderVisible = true;
|
|
8104
|
+
this.legendVisible = true;
|
|
8105
|
+
this.isTransparentBackground = false;
|
|
8106
|
+
this.chartConfiguration = {};
|
|
8107
|
+
this.objectKeys = Object.keys;
|
|
8108
|
+
this.defaultConfiguration = {
|
|
8109
|
+
margin: { top: 20, right: 20, bottom: 20, left: 40 },
|
|
8110
|
+
labelFormatter: ChartHelper.defaultFormatter,
|
|
8111
|
+
svgHeight: 70,
|
|
8112
|
+
numberOfYTicks: 5,
|
|
8113
|
+
legendJustified: true,
|
|
8114
|
+
yLineAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
8115
|
+
yAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
8116
|
+
lineGraphColor: '#F6D283',
|
|
8117
|
+
showLineChartAxis: true,
|
|
8118
|
+
showValues: true,
|
|
8119
|
+
headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
|
|
8120
|
+
xAxisGrid: undefined,
|
|
8121
|
+
yAxisGrid: false,
|
|
8122
|
+
legendVisible: false,
|
|
8123
|
+
isHeaderVisible: undefined,
|
|
8124
|
+
isTransparentBackground: undefined,
|
|
8125
|
+
isMultiChartGridLine: undefined,
|
|
8126
|
+
isFullScreen: undefined,
|
|
8127
|
+
customYscale: undefined,
|
|
8128
|
+
textsOnBar: undefined,
|
|
8129
|
+
isXaxisLabelHidden: undefined,
|
|
8130
|
+
isYaxisLabelHidden: false,
|
|
8131
|
+
isYaxisHidden: undefined,
|
|
8132
|
+
isYaxisDashed: undefined,
|
|
8133
|
+
textFormatter: undefined,
|
|
8134
|
+
isNoAlternateXaxisText: undefined,
|
|
8135
|
+
isXgridBetweenLabels: undefined,
|
|
8136
|
+
backgroundColor: '#FFFFFF',
|
|
8137
|
+
hideLegendOnTop: true,
|
|
8138
|
+
isXaxisColor: '#999999',
|
|
8139
|
+
labelOverlapMinorFix: true,
|
|
8140
|
+
noHoverEffect: true,
|
|
8141
|
+
noHoverDisplayData: true,
|
|
8142
|
+
showXaxisTop: true,
|
|
8143
|
+
displayYaxisLabels: undefined,
|
|
8144
|
+
xLabelsOnSameLine: undefined,
|
|
8145
|
+
textAlwaysHorizontal: undefined,
|
|
8146
|
+
legendAtTopRight: undefined,
|
|
8147
|
+
isDrilldownChart: true,
|
|
8148
|
+
displayTitleOnTop: undefined,
|
|
8149
|
+
isToggleVisible: undefined,
|
|
8150
|
+
isTitleHidden: undefined,
|
|
8151
|
+
isDisplayBarDetailsAtBottom: undefined,
|
|
8152
|
+
howmanyBarDetailsToDisplay: 0,
|
|
8153
|
+
barVauleColor: undefined,
|
|
8154
|
+
defaultBarHeight: 2,
|
|
8155
|
+
};
|
|
8156
|
+
this.uniqueId = this.getUniqueId();
|
|
8157
|
+
this.isZoomedOut = true;
|
|
8158
|
+
this.isDD1Open = false;
|
|
8159
|
+
this.isDD2Open = false;
|
|
8160
|
+
this.keepOrder = (a, b) => {
|
|
8161
|
+
return a;
|
|
8162
|
+
};
|
|
8163
|
+
}
|
|
8164
|
+
onResized(event) {
|
|
8165
|
+
let self = this;
|
|
8166
|
+
setTimeout(function () {
|
|
8167
|
+
d3.select('#' + self.uniqueId).remove();
|
|
8168
|
+
self.initializegroupChart();
|
|
8169
|
+
}.bind(self), 10);
|
|
8170
|
+
}
|
|
8171
|
+
isZoomOutSelected(isZoomOut, event) {
|
|
8172
|
+
this.isZoomedOut = isZoomOut;
|
|
8173
|
+
this.onResized(event);
|
|
8174
|
+
}
|
|
8175
|
+
handleZoominZoomoutClick({ isZoomOut, event }) {
|
|
8176
|
+
this.isZoomOutSelected(isZoomOut, event);
|
|
8177
|
+
}
|
|
8178
|
+
ngOnInit() { }
|
|
8179
|
+
isLegendVisible() {
|
|
8180
|
+
if (this.chartData &&
|
|
8181
|
+
this.chartData.metaData.colors &&
|
|
8182
|
+
Object.keys(this.chartData.metaData.colors).length > 1) {
|
|
8183
|
+
return true;
|
|
8184
|
+
}
|
|
8185
|
+
return false;
|
|
8186
|
+
}
|
|
8187
|
+
get isAlertEnabled() {
|
|
8188
|
+
return this.chartConfiguration?.headerMenuOptions?.some((option) => option.id === 'editAlert');
|
|
8189
|
+
}
|
|
8190
|
+
initializegroupChart() {
|
|
8191
|
+
var self = this;
|
|
8192
|
+
let data = [];
|
|
8193
|
+
let metaData = null;
|
|
8194
|
+
let keyList = null;
|
|
8195
|
+
let lineData = null;
|
|
8196
|
+
let colorMap = {};
|
|
8197
|
+
var formatFromBackend;
|
|
8198
|
+
var formatForHugeNumbers;
|
|
8199
|
+
const isMobile = window.innerWidth < 576;
|
|
8200
|
+
const isTablet = window.innerWidth >= 576 && window.innerWidth < 992;
|
|
8201
|
+
const isDesktop = window.innerWidth >= 992;
|
|
8202
|
+
let isria = this.customChartConfiguration.isRia;
|
|
8203
|
+
var x;
|
|
8204
|
+
var alternate_text = false;
|
|
8205
|
+
var short_tick_length = 4;
|
|
8206
|
+
var long_tick_length = 16;
|
|
8207
|
+
/**
|
|
8208
|
+
* longer tick length needed for weekly charts
|
|
8209
|
+
*/
|
|
8210
|
+
var short_tick_length_bg = 5;
|
|
8211
|
+
var long_tick_length_bg = 30;
|
|
8212
|
+
var leftAndRightSpaces = 50;
|
|
8213
|
+
var rightSvgWidth = 60;
|
|
8214
|
+
var tempScale;
|
|
8215
|
+
for (var i in this.defaultConfiguration) {
|
|
8216
|
+
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
7795
8217
|
}
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
return d.substring(0, 3);
|
|
7802
|
-
})
|
|
7803
|
-
.style('font-size', '12px')
|
|
7804
|
-
.attr('y', 5)
|
|
7805
|
-
.attr('x', 5)
|
|
7806
|
-
.style('text-anchor', 'middle');
|
|
8218
|
+
data = this.chartData.data;
|
|
8219
|
+
metaData = this.chartData.metaData;
|
|
8220
|
+
lineData = this.chartData.lineData;
|
|
8221
|
+
if (!metaData.colorAboveTarget) {
|
|
8222
|
+
metaData['colorAboveTarget'] = metaData.colors;
|
|
7807
8223
|
}
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
8224
|
+
colorMap = metaData.colors;
|
|
8225
|
+
keyList = metaData.keyList;
|
|
8226
|
+
var chartContainer = d3.select(this.containerElt.nativeElement);
|
|
8227
|
+
var verticalstackedcontainer = d3.select(this.groupcontainerElt.nativeElement);
|
|
8228
|
+
var margin = this.chartConfiguration.margin;
|
|
8229
|
+
const { width, height } = this.calculateChartDimensions(chartContainer, verticalstackedcontainer, margin, self);
|
|
8230
|
+
if (this.chartConfiguration.isHeaderVisible != undefined)
|
|
8231
|
+
this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
|
|
8232
|
+
if (this.chartConfiguration.legendVisible != undefined) {
|
|
8233
|
+
this.legendVisible = this.chartConfiguration.legendVisible;
|
|
7812
8234
|
}
|
|
8235
|
+
if (this.chartConfiguration.isTransparentBackground != undefined) {
|
|
8236
|
+
this.isTransparentBackground =
|
|
8237
|
+
this.chartConfiguration.isTransparentBackground;
|
|
8238
|
+
}
|
|
8239
|
+
if (this.chartConfiguration.textFormatter != undefined) {
|
|
8240
|
+
formatFromBackend = ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter);
|
|
8241
|
+
formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
|
|
8242
|
+
}
|
|
8243
|
+
const { outerContainer, svgYAxisLeft, svgYAxisRight, innerContainer, svg } = this.createChartContainers(chartContainer, margin, height, rightSvgWidth, self, width);
|
|
8244
|
+
var subgroups = keyList;
|
|
8245
|
+
var groups = d3
|
|
8246
|
+
.map(data, function (d) {
|
|
8247
|
+
return d.name;
|
|
8248
|
+
})
|
|
8249
|
+
.keys();
|
|
8250
|
+
if (this.chartConfiguration.isMultiChartGridLine != undefined) {
|
|
8251
|
+
x = d3
|
|
8252
|
+
.scaleBand()
|
|
8253
|
+
.rangeRound([width, 0])
|
|
8254
|
+
.align(0.5)
|
|
8255
|
+
.padding([0.5])
|
|
8256
|
+
.domain(data.map(function (d) {
|
|
8257
|
+
return d.name.toLowerCase();
|
|
8258
|
+
}));
|
|
8259
|
+
}
|
|
8260
|
+
else {
|
|
8261
|
+
x = d3
|
|
8262
|
+
.scaleBand()
|
|
8263
|
+
.domain(groups)
|
|
8264
|
+
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
8265
|
+
.padding([0.3]);
|
|
8266
|
+
}
|
|
8267
|
+
var xScaleFromOrigin = d3
|
|
8268
|
+
.scaleBand()
|
|
8269
|
+
.domain(groups)
|
|
8270
|
+
.range([0, width - rightSvgWidth]);
|
|
8271
|
+
this.renderXAxis(svg, x, height, subgroups, metaData, this.chartConfiguration, alternate_text, short_tick_length_bg, long_tick_length_bg, this);
|
|
8272
|
+
this.renderXAxisLabels(svg, data, subgroups, metaData, this.chartConfiguration, short_tick_length_bg, long_tick_length_bg, isMobile, isria, this);
|
|
7813
8273
|
var y = d3.scaleLinear().rangeRound([height, 0]);
|
|
7814
8274
|
var maxValue = d3.max(data, (d) => d3.max(keyList, (key) => +d[key]));
|
|
7815
|
-
|
|
7816
|
-
if (this.chartData.targetLineData) {
|
|
7817
|
-
maxValue = this.chartData.targetLineData.target + 20;
|
|
7818
|
-
}
|
|
7819
|
-
else {
|
|
7820
|
-
maxValue = 100;
|
|
7821
|
-
}
|
|
7822
|
-
}
|
|
8275
|
+
maxValue = this.calculateMaxValue(maxValue);
|
|
7823
8276
|
if (this.chartConfiguration.customYscale) {
|
|
7824
8277
|
maxValue = maxValue * this.chartConfiguration.customYscale;
|
|
7825
8278
|
}
|
|
@@ -7926,8 +8379,10 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7926
8379
|
.data(function (d) {
|
|
7927
8380
|
let newList = [];
|
|
7928
8381
|
subgroups.map(function (key) {
|
|
8382
|
+
// if (key !== "group") {
|
|
7929
8383
|
let obj = { key: key, value: d[key], name: d.name };
|
|
7930
8384
|
newList.push(obj);
|
|
8385
|
+
// }
|
|
7931
8386
|
});
|
|
7932
8387
|
return newList;
|
|
7933
8388
|
})
|
|
@@ -7940,6 +8395,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7940
8395
|
!metaData.barWithoutClick.length ||
|
|
7941
8396
|
(!metaData.barWithoutClick.includes(d?.name) &&
|
|
7942
8397
|
!metaData.barWithoutClick.includes(d?.key)))
|
|
8398
|
+
// self.handleClick(d.data.name);
|
|
7943
8399
|
self.handleClick(d);
|
|
7944
8400
|
}
|
|
7945
8401
|
})
|
|
@@ -7950,6 +8406,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7950
8406
|
let keys = Object.keys(indiv).filter((temp, i) => i != 0);
|
|
7951
8407
|
tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
|
|
7952
8408
|
if (x.bandwidth() > 100) {
|
|
8409
|
+
// Increase bar width a bit in zoom-in view
|
|
7953
8410
|
let reducedBarWidth = 60;
|
|
7954
8411
|
if (!self.isZoomedOut) {
|
|
7955
8412
|
reducedBarWidth = 30;
|
|
@@ -7991,19 +8448,23 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7991
8448
|
return y(0);
|
|
7992
8449
|
})
|
|
7993
8450
|
.attr('width', function (d) {
|
|
8451
|
+
// For grouped bar charts in zoom-in view, set bar width to 50 for maximum thickness
|
|
7994
8452
|
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
7995
8453
|
return 50;
|
|
7996
8454
|
}
|
|
8455
|
+
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
7997
8456
|
if (subgroups.length === 1 && !self.isZoomedOut) {
|
|
7998
8457
|
return 80;
|
|
7999
8458
|
}
|
|
8000
8459
|
let tempScale = d3.scaleBand().domain([]).range([0, 0]);
|
|
8460
|
+
// Default logic for other chart types
|
|
8001
8461
|
if (self.chartConfiguration.isDrilldownChart) {
|
|
8002
8462
|
data.map((indiv) => {
|
|
8003
8463
|
if (indiv.name == d.name) {
|
|
8004
8464
|
let keys = Object.keys(indiv).filter((temp, i) => i != 0);
|
|
8005
8465
|
tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
|
|
8006
8466
|
if (x.bandwidth() > 100) {
|
|
8467
|
+
// Increase bar width a bit in zoom-in view
|
|
8007
8468
|
let reducedBarWidth = 60;
|
|
8008
8469
|
if (!self.isZoomedOut) {
|
|
8009
8470
|
reducedBarWidth = 100;
|
|
@@ -8064,13 +8525,16 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8064
8525
|
d.value >= parseFloat(self.chartData.targetLineData.target) &&
|
|
8065
8526
|
self.chartData.metaData.colorAboveTarget) {
|
|
8066
8527
|
const key = d.key.toLowerCase();
|
|
8067
|
-
const colorAboveTarget = Object.keys(self.chartData.metaData.colorAboveTarget).find(k => k.toLowerCase() === key);
|
|
8528
|
+
const colorAboveTarget = Object.keys(self.chartData.metaData.colorAboveTarget).find((k) => k.toLowerCase() === key);
|
|
8068
8529
|
if (colorAboveTarget) {
|
|
8069
8530
|
return self.chartData.metaData.colorAboveTarget[colorAboveTarget];
|
|
8070
8531
|
}
|
|
8071
8532
|
}
|
|
8072
8533
|
return self.chartData.metaData.colors[d.key];
|
|
8073
8534
|
});
|
|
8535
|
+
/**
|
|
8536
|
+
* display angled texts on the bars
|
|
8537
|
+
*/
|
|
8074
8538
|
if (this.chartConfiguration.textsOnBar != undefined && !this.isZoomedOut) {
|
|
8075
8539
|
state
|
|
8076
8540
|
.selectAll('text')
|
|
@@ -8105,7 +8569,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8105
8569
|
.style('font-weight', 'bold')
|
|
8106
8570
|
.style('font-size', function (d) {
|
|
8107
8571
|
if (self.isZoomedOut) {
|
|
8108
|
-
return '9px';
|
|
8572
|
+
return '9px'; // 👈 Zoomed out mode
|
|
8109
8573
|
}
|
|
8110
8574
|
if (self.chartConfiguration.isDrilldownChart) {
|
|
8111
8575
|
if (window.innerWidth > 1900) {
|
|
@@ -8135,12 +8599,14 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8135
8599
|
0 + (x.bandwidth() - 200) / 2,
|
|
8136
8600
|
x.bandwidth() - (x.bandwidth() - 200) / 2,
|
|
8137
8601
|
]);
|
|
8602
|
+
// .padding(0.05);
|
|
8138
8603
|
}
|
|
8139
8604
|
else
|
|
8140
8605
|
tempScale.range([
|
|
8141
8606
|
0 + (x.bandwidth() - 300) / 2,
|
|
8142
8607
|
x.bandwidth() - (x.bandwidth() - 300) / 2,
|
|
8143
8608
|
]);
|
|
8609
|
+
// .padding(0.05);
|
|
8144
8610
|
}
|
|
8145
8611
|
else
|
|
8146
8612
|
tempScale.range([
|
|
@@ -8150,9 +8616,16 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8150
8616
|
}
|
|
8151
8617
|
}
|
|
8152
8618
|
});
|
|
8619
|
+
/**
|
|
8620
|
+
* if set, then all texts ll be horizontal
|
|
8621
|
+
*/
|
|
8153
8622
|
if (self.chartConfiguration.textAlwaysHorizontal) {
|
|
8154
8623
|
return ('translate(' + xSubgroup(d.key) + ',' + (y(d.value) - 3) + ')');
|
|
8155
8624
|
}
|
|
8625
|
+
/**
|
|
8626
|
+
* rotate texts having more than one digits
|
|
8627
|
+
*/
|
|
8628
|
+
// if (d.value > 9)
|
|
8156
8629
|
if (!isNaN(tempScale(d.key)))
|
|
8157
8630
|
return ('translate(' +
|
|
8158
8631
|
(tempScale(d.key) + tempScale.bandwidth() * 0.55) +
|
|
@@ -8160,6 +8633,14 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8160
8633
|
(y(0) - 10) +
|
|
8161
8634
|
') rotate(270)');
|
|
8162
8635
|
return 'translate(0,0)';
|
|
8636
|
+
// else
|
|
8637
|
+
// return (
|
|
8638
|
+
// 'translate(' +
|
|
8639
|
+
// (tempScale(d.key) + tempScale.bandwidth() / 2) +
|
|
8640
|
+
// ',' +
|
|
8641
|
+
// y(0) +
|
|
8642
|
+
// ')'
|
|
8643
|
+
// );
|
|
8163
8644
|
})
|
|
8164
8645
|
.on('click', function (d) {
|
|
8165
8646
|
if (!metaData.barWithoutClick ||
|
|
@@ -8175,8 +8656,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8175
8656
|
.on('mouseover', handleMouseOver);
|
|
8176
8657
|
}
|
|
8177
8658
|
}
|
|
8178
|
-
if (this.chartConfiguration.displayTitleOnTop ||
|
|
8179
|
-
this.chartConfiguration.
|
|
8659
|
+
if (this.chartConfiguration.displayTitleOnTop ||
|
|
8660
|
+
(this.chartConfiguration.textsOnBar == undefined &&
|
|
8661
|
+
this.chartConfiguration.displayTitleOnTop == undefined)) {
|
|
8180
8662
|
if (!isria) {
|
|
8181
8663
|
state
|
|
8182
8664
|
.selectAll('rect')
|
|
@@ -8189,6 +8671,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8189
8671
|
svg
|
|
8190
8672
|
.append('foreignObject')
|
|
8191
8673
|
.attr('x', function () {
|
|
8674
|
+
// ...existing code for tempScale calculation...
|
|
8192
8675
|
var elementsCounter;
|
|
8193
8676
|
data.map((indiv) => {
|
|
8194
8677
|
if (indiv.name == d.name) {
|
|
@@ -8297,7 +8780,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8297
8780
|
.append('g')
|
|
8298
8781
|
.attr('class', 'x2 axis2')
|
|
8299
8782
|
.attr('transform', 'translate(0,' + height + ')')
|
|
8300
|
-
.style('color', 'var(--chart-axis-color, #000)')
|
|
8783
|
+
.style('color', 'var(--chart-axis-color, #000)') // Use CSS variable instead of hardcoded #000
|
|
8301
8784
|
.call(d3.axisBottom(xScaleFromOrigin).tickSize(0))
|
|
8302
8785
|
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
8303
8786
|
svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
|
|
@@ -8325,6 +8808,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8325
8808
|
return formatted >= 1000 ? formatted / 1000 + 'k' : formatted;
|
|
8326
8809
|
}))
|
|
8327
8810
|
.call((g) => {
|
|
8811
|
+
// Style the domain line for theme support
|
|
8328
8812
|
g.select('.domain')
|
|
8329
8813
|
.style('stroke', 'var(--chart-domain-color, #000000)')
|
|
8330
8814
|
.style('stroke-width', '1px');
|
|
@@ -8338,23 +8822,40 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8338
8822
|
.attr('transform', 'translate(0,0)')
|
|
8339
8823
|
.call(y)
|
|
8340
8824
|
.style('display', 'none');
|
|
8825
|
+
/**
|
|
8826
|
+
* hide x axis labels
|
|
8827
|
+
* config is there for future use
|
|
8828
|
+
* used by weekly charts
|
|
8829
|
+
*/
|
|
8341
8830
|
if (this.chartConfiguration.isXaxisLabelHidden != undefined &&
|
|
8342
8831
|
this.chartConfiguration.isXaxisLabelHidden) {
|
|
8343
8832
|
d3.selectAll('g.lib-line-x-axis-text > g > text').attr('class', 'lib-display-hidden');
|
|
8344
8833
|
}
|
|
8834
|
+
/**
|
|
8835
|
+
* hide y axis labels
|
|
8836
|
+
* used by weekly charts
|
|
8837
|
+
*/
|
|
8345
8838
|
if (this.chartConfiguration.isYaxisLabelHidden != undefined &&
|
|
8346
8839
|
this.chartConfiguration.isYaxisLabelHidden) {
|
|
8347
8840
|
d3.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
|
|
8348
8841
|
}
|
|
8842
|
+
/**
|
|
8843
|
+
* hide y axis labels
|
|
8844
|
+
* config is there for future use
|
|
8845
|
+
*/
|
|
8349
8846
|
if (this.chartConfiguration.isYaxisHidden != undefined &&
|
|
8350
8847
|
this.chartConfiguration.isYaxisHidden) {
|
|
8351
8848
|
d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
|
|
8352
8849
|
}
|
|
8850
|
+
/**
|
|
8851
|
+
* dashed y axis
|
|
8852
|
+
* used by weekly charts
|
|
8853
|
+
*/
|
|
8353
8854
|
if (this.chartConfiguration.isYaxisDashed != undefined &&
|
|
8354
8855
|
this.chartConfiguration.isYaxisDashed) {
|
|
8355
8856
|
d3.selectAll('.yaxis-dashed')
|
|
8356
8857
|
.style('stroke-dasharray', '5 5')
|
|
8357
|
-
.style('color', 'var(--chart-axis-color, #999999)');
|
|
8858
|
+
.style('color', 'var(--chart-axis-color, #999999)'); // Use CSS variable
|
|
8358
8859
|
}
|
|
8359
8860
|
if (lineData != null) {
|
|
8360
8861
|
if (lineData && self.chartConfiguration.showLineChartAxis) {
|
|
@@ -8366,6 +8867,14 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8366
8867
|
.call(yLineAxis);
|
|
8367
8868
|
}
|
|
8368
8869
|
}
|
|
8870
|
+
/**
|
|
8871
|
+
* used to display y label
|
|
8872
|
+
*/
|
|
8873
|
+
// if (this.isZoomedOut) {
|
|
8874
|
+
// svg
|
|
8875
|
+
// .selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
8876
|
+
// .attr('class', 'lib-display-hidden');
|
|
8877
|
+
// }
|
|
8369
8878
|
if (this.isZoomedOut) {
|
|
8370
8879
|
svg
|
|
8371
8880
|
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
@@ -8376,7 +8885,8 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8376
8885
|
const lines = label.split('\n');
|
|
8377
8886
|
text.text(null);
|
|
8378
8887
|
lines.forEach((line, idx) => {
|
|
8379
|
-
text
|
|
8888
|
+
text
|
|
8889
|
+
.append('tspan')
|
|
8380
8890
|
.text(line)
|
|
8381
8891
|
.attr('x', 0)
|
|
8382
8892
|
.attr('dy', idx === 0 ? '1em' : '1.1em');
|
|
@@ -8396,8 +8906,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8396
8906
|
.select('.x-axis')
|
|
8397
8907
|
.attr('transform', `translate(0, ${height - margin.bottom + 10})`);
|
|
8398
8908
|
}
|
|
8909
|
+
/**
|
|
8910
|
+
* used to write y labels based on configuration
|
|
8911
|
+
*/
|
|
8399
8912
|
if (metaData.yLabel) {
|
|
8400
|
-
const yPosition = isria
|
|
8913
|
+
const yPosition = isria
|
|
8914
|
+
? 0 - margin.left / 2 - 30
|
|
8915
|
+
: 0 - margin.left / 2 - 40;
|
|
8401
8916
|
svgYAxisLeft
|
|
8402
8917
|
.append('text')
|
|
8403
8918
|
.attr('class', 'lib-axis-group-label font-size-1')
|
|
@@ -8431,6 +8946,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8431
8946
|
.attr('y2', yZero)
|
|
8432
8947
|
.style('stroke-dasharray', '5 5')
|
|
8433
8948
|
.style('stroke', this.chartData.targetLineData.color);
|
|
8949
|
+
// svgYAxisRight
|
|
8950
|
+
// .append('line')
|
|
8951
|
+
// .attr('x1', 0)
|
|
8952
|
+
// .attr('x2', rightSvgWidth)
|
|
8953
|
+
// .attr('y1', yZero)
|
|
8954
|
+
// .attr('y2', yZero)
|
|
8955
|
+
// .style('stroke', this.chartData.targetLineData.color);
|
|
8434
8956
|
svgYAxisRight
|
|
8435
8957
|
.append('foreignObject')
|
|
8436
8958
|
.attr('transform', 'translate(' + 0 + ',' + (yZero - 30) + ')')
|
|
@@ -8458,6 +8980,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8458
8980
|
});
|
|
8459
8981
|
}
|
|
8460
8982
|
if (this.chartConfiguration.isDrilldownChart) {
|
|
8983
|
+
/**
|
|
8984
|
+
* used by drilldown charts
|
|
8985
|
+
*/
|
|
8986
|
+
// svg
|
|
8987
|
+
// .selectAll('.lib-axis-group-label')
|
|
8988
|
+
// .attr('class', 'lib-ylabel-drilldowncharts')
|
|
8989
|
+
// .text(metaData.yLabel.toLowerCase());
|
|
8461
8990
|
svg.selectAll('g.x1.axis1 g.tick line').style('display', 'none');
|
|
8462
8991
|
}
|
|
8463
8992
|
if (metaData.xLabel) {
|
|
@@ -8467,7 +8996,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8467
8996
|
}
|
|
8468
8997
|
const xLabelText = metaData.xLabel;
|
|
8469
8998
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
8470
|
-
const xPosition = isria
|
|
8999
|
+
const xPosition = isria
|
|
9000
|
+
? height + margin.top + margin.bottom
|
|
9001
|
+
: height + margin.top + margin.bottom + 40;
|
|
8471
9002
|
svg
|
|
8472
9003
|
.append('text')
|
|
8473
9004
|
.attr('class', function () {
|
|
@@ -8560,6 +9091,258 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8560
9091
|
}
|
|
8561
9092
|
}
|
|
8562
9093
|
}
|
|
9094
|
+
calculateChartDimensions(chartContainer, verticalstackedcontainer, margin, self) {
|
|
9095
|
+
let width = parseInt(chartContainer.style('width')) - margin.left - margin.right;
|
|
9096
|
+
const dataLength = this.chartData.data.length;
|
|
9097
|
+
// ---- Width Logic (no change) ----
|
|
9098
|
+
if (dataLength > 30 && this.isZoomedOut) {
|
|
9099
|
+
width =
|
|
9100
|
+
width > dataLength * 40
|
|
9101
|
+
? this.chartData.dropdownData1
|
|
9102
|
+
? dataLength * 60
|
|
9103
|
+
: width
|
|
9104
|
+
: this.chartData.dropdownData1
|
|
9105
|
+
? dataLength * 60
|
|
9106
|
+
: dataLength * 40;
|
|
9107
|
+
width = width > dataLength * 40 ? width : dataLength * 40;
|
|
9108
|
+
}
|
|
9109
|
+
if (this.chartData.dropdownData2 &&
|
|
9110
|
+
width < dataLength * 120 &&
|
|
9111
|
+
this.isZoomedOut) {
|
|
9112
|
+
width = dataLength * 120;
|
|
9113
|
+
}
|
|
9114
|
+
if (dataLength > 8 && !this.isZoomedOut) {
|
|
9115
|
+
if (this.chartData.dropdownData2 && width < dataLength * 250) {
|
|
9116
|
+
width = dataLength * 250;
|
|
9117
|
+
}
|
|
9118
|
+
else {
|
|
9119
|
+
width = dataLength * 160;
|
|
9120
|
+
}
|
|
9121
|
+
}
|
|
9122
|
+
// ---- Height Logic (no change) ----
|
|
9123
|
+
let height = parseInt(verticalstackedcontainer.style('height')) *
|
|
9124
|
+
(self.chartConfiguration.svgHeight / 100) -
|
|
9125
|
+
margin.top -
|
|
9126
|
+
margin.bottom;
|
|
9127
|
+
if (this.chartConfiguration.isFullScreen !== undefined &&
|
|
9128
|
+
this.chartConfiguration.isFullScreen) {
|
|
9129
|
+
height =
|
|
9130
|
+
this.chartConfiguration.svgHeight !== 70
|
|
9131
|
+
? this.chartConfiguration.svgHeight
|
|
9132
|
+
: parseInt(verticalstackedcontainer.style('height'));
|
|
9133
|
+
}
|
|
9134
|
+
if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
|
|
9135
|
+
height =
|
|
9136
|
+
parseInt(verticalstackedcontainer.style('height')) -
|
|
9137
|
+
margin.top -
|
|
9138
|
+
margin.bottom -
|
|
9139
|
+
130;
|
|
9140
|
+
}
|
|
9141
|
+
if (this.chartConfiguration.isHeaderVisible) {
|
|
9142
|
+
height =
|
|
9143
|
+
parseInt(verticalstackedcontainer.style('height')) -
|
|
9144
|
+
margin.top -
|
|
9145
|
+
margin.bottom -
|
|
9146
|
+
100;
|
|
9147
|
+
}
|
|
9148
|
+
return { width, height };
|
|
9149
|
+
}
|
|
9150
|
+
createChartContainers(chartContainer, margin, height, rightSvgWidth, self, width) {
|
|
9151
|
+
// Outer container
|
|
9152
|
+
const outerContainer = chartContainer
|
|
9153
|
+
.append('div')
|
|
9154
|
+
.attr('id', self.uniqueId)
|
|
9155
|
+
.attr('class', 'outer-container')
|
|
9156
|
+
.style('width', '100%')
|
|
9157
|
+
.style('height', height)
|
|
9158
|
+
.style('overflow-x', 'hidden')
|
|
9159
|
+
.style('padding-left', `${margin.left}px`)
|
|
9160
|
+
.style('padding-right', `${rightSvgWidth}px`)
|
|
9161
|
+
.style('margin-left', '15px');
|
|
9162
|
+
// Left Y-Axis
|
|
9163
|
+
const svgYAxisLeft = outerContainer
|
|
9164
|
+
.append('svg')
|
|
9165
|
+
.attr('width', '100')
|
|
9166
|
+
.attr('height', height + margin.top + margin.bottom + 10)
|
|
9167
|
+
.style('position', 'absolute')
|
|
9168
|
+
.style('left', '0')
|
|
9169
|
+
.style('z-index', 1)
|
|
9170
|
+
.append('g')
|
|
9171
|
+
.attr('transform', `translate(${margin.left + 15},${margin.top})`);
|
|
9172
|
+
// Right Y-Axis
|
|
9173
|
+
const svgYAxisRight = outerContainer
|
|
9174
|
+
.append('svg')
|
|
9175
|
+
.attr('width', rightSvgWidth)
|
|
9176
|
+
.attr('height', height + margin.top + margin.bottom + 10)
|
|
9177
|
+
.style('position', 'absolute')
|
|
9178
|
+
.style('right', '12px')
|
|
9179
|
+
.style('z-index', 1)
|
|
9180
|
+
.append('g')
|
|
9181
|
+
.attr('transform', `translate(0,${margin.top})`);
|
|
9182
|
+
// Inner scrollable container
|
|
9183
|
+
const innerContainer = outerContainer
|
|
9184
|
+
.append('div')
|
|
9185
|
+
.attr('class', 'inner-container')
|
|
9186
|
+
.style('width', '100%')
|
|
9187
|
+
.style('overflow-x', 'auto');
|
|
9188
|
+
// Main SVG
|
|
9189
|
+
const svg = innerContainer
|
|
9190
|
+
.append('svg')
|
|
9191
|
+
.attr('width', width - rightSvgWidth)
|
|
9192
|
+
.attr('height', height + margin.top + margin.bottom + 60)
|
|
9193
|
+
.append('g')
|
|
9194
|
+
.attr('transform', `translate(0,${margin.top})`);
|
|
9195
|
+
return { outerContainer, svgYAxisLeft, svgYAxisRight, innerContainer, svg };
|
|
9196
|
+
}
|
|
9197
|
+
renderXAxis(svg, x, height, subgroups, metaData, chartConfig, alternate_text, short_tick_length_bg, long_tick_length_bg, self) {
|
|
9198
|
+
if (chartConfig.isMultiChartGridLine == undefined) {
|
|
9199
|
+
// Normal dashboard charts
|
|
9200
|
+
svg
|
|
9201
|
+
.append('g')
|
|
9202
|
+
.attr('class', 'x1 axis1')
|
|
9203
|
+
.attr('transform', `translate(0,${height})`)
|
|
9204
|
+
.call(d3.axisBottom(x))
|
|
9205
|
+
.call((g) => g.select('.domain').remove());
|
|
9206
|
+
svg.selectAll('g.x1.axis1 g.tick line').remove();
|
|
9207
|
+
if (subgroups.length > 1 && !metaData.xLabel) {
|
|
9208
|
+
svg
|
|
9209
|
+
.selectAll('g.x1.axis1 g.tick text')
|
|
9210
|
+
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
9211
|
+
.style('fill', 'var(--chart-text-color)')
|
|
9212
|
+
.attr('y', 32);
|
|
9213
|
+
}
|
|
9214
|
+
else {
|
|
9215
|
+
svg
|
|
9216
|
+
.selectAll('g.x1.axis1 g.tick text')
|
|
9217
|
+
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
9218
|
+
.style('fill', 'var(--chart-text-color)');
|
|
9219
|
+
}
|
|
9220
|
+
}
|
|
9221
|
+
else {
|
|
9222
|
+
// Weekly charts / multi-chart
|
|
9223
|
+
svg
|
|
9224
|
+
.append('g')
|
|
9225
|
+
.attr('class', 'x1 axis1')
|
|
9226
|
+
.attr('transform', `translate(0,${height})`)
|
|
9227
|
+
.call(d3.axisBottom(x).tickSize(0))
|
|
9228
|
+
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
9229
|
+
// Tick line size in alternate fashion
|
|
9230
|
+
svg.selectAll('g.x1.axis1 g.tick line').attr('y2', function () {
|
|
9231
|
+
if (alternate_text && chartConfig.isNoAlternateXaxisText == undefined) {
|
|
9232
|
+
alternate_text = false;
|
|
9233
|
+
return long_tick_length_bg - 7;
|
|
9234
|
+
}
|
|
9235
|
+
else {
|
|
9236
|
+
alternate_text = true;
|
|
9237
|
+
return short_tick_length_bg - 4;
|
|
9238
|
+
}
|
|
9239
|
+
});
|
|
9240
|
+
// Reset flag
|
|
9241
|
+
alternate_text = false;
|
|
9242
|
+
// X-axis labels
|
|
9243
|
+
svg
|
|
9244
|
+
.selectAll('g.x1.axis1 g.tick text')
|
|
9245
|
+
.attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
9246
|
+
.attr('y', function () {
|
|
9247
|
+
if (chartConfig.isFullScreen)
|
|
9248
|
+
return short_tick_length_bg;
|
|
9249
|
+
if (alternate_text) {
|
|
9250
|
+
alternate_text = false;
|
|
9251
|
+
return long_tick_length_bg;
|
|
9252
|
+
}
|
|
9253
|
+
else {
|
|
9254
|
+
alternate_text = true;
|
|
9255
|
+
return short_tick_length_bg;
|
|
9256
|
+
}
|
|
9257
|
+
});
|
|
9258
|
+
}
|
|
9259
|
+
}
|
|
9260
|
+
renderXAxisLabels(svg, data, subgroups, metaData, chartConfig, short_tick_length_bg, long_tick_length_bg, isMobile, isria, self) {
|
|
9261
|
+
if (!chartConfig.xLabelsOnSameLine)
|
|
9262
|
+
return;
|
|
9263
|
+
const xAxisLabels = svg.selectAll('g.x1.axis1 g.tick text');
|
|
9264
|
+
this.applyLabelStyles(xAxisLabels, data, subgroups, metaData, chartConfig, short_tick_length_bg, long_tick_length_bg, isMobile, self);
|
|
9265
|
+
this.handleLabelText(xAxisLabels, data, subgroups, metaData, chartConfig, isMobile, self);
|
|
9266
|
+
if (isria && data.length > 8) {
|
|
9267
|
+
this.applyRiaLabelOverride(xAxisLabels);
|
|
9268
|
+
}
|
|
9269
|
+
if (isMobile && !self.isHeaderVisible) {
|
|
9270
|
+
xAxisLabels.classed('mobile-xaxis-override', true);
|
|
9271
|
+
}
|
|
9272
|
+
}
|
|
9273
|
+
applyLabelStyles(labels, data, subgroups, metaData, chartConfig, short_tick_length_bg, long_tick_length_bg, isMobile, self) {
|
|
9274
|
+
labels
|
|
9275
|
+
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
9276
|
+
.style('font-size', self.isHeaderVisible ? '18px' : '14px')
|
|
9277
|
+
.attr('text-anchor', 'middle')
|
|
9278
|
+
.attr('y', (d) => this.calculateLabelY(d, data, subgroups, metaData, chartConfig, short_tick_length_bg, long_tick_length_bg, self))
|
|
9279
|
+
.attr('x', (d) => this.calculateLabelX(d, data, self));
|
|
9280
|
+
}
|
|
9281
|
+
calculateLabelY(d, data, subgroups, metaData, chartConfig, short_tick_length_bg, long_tick_length_bg, self) {
|
|
9282
|
+
// Logic from your original code for y positioning
|
|
9283
|
+
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
9284
|
+
return short_tick_length_bg + 14;
|
|
9285
|
+
}
|
|
9286
|
+
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
9287
|
+
return chartConfig.isFullScreen
|
|
9288
|
+
? short_tick_length_bg + 2
|
|
9289
|
+
: short_tick_length_bg + 10;
|
|
9290
|
+
}
|
|
9291
|
+
let baseY = self.isHeaderVisible
|
|
9292
|
+
? short_tick_length_bg + 25
|
|
9293
|
+
: short_tick_length_bg;
|
|
9294
|
+
return baseY;
|
|
9295
|
+
}
|
|
9296
|
+
calculateLabelX(d, data, self) {
|
|
9297
|
+
if (data.length > 8 && !self.isZoomedOut)
|
|
9298
|
+
return 1;
|
|
9299
|
+
return 0;
|
|
9300
|
+
}
|
|
9301
|
+
handleLabelText(labels, data, subgroups, metaData, chartConfig, isMobile, self) {
|
|
9302
|
+
labels.text((d) => {
|
|
9303
|
+
if (isMobile && !self.isHeaderVisible) {
|
|
9304
|
+
return d
|
|
9305
|
+
.split(/[\s\-]+/)[0]
|
|
9306
|
+
.substring(0, 3)
|
|
9307
|
+
.toLowerCase();
|
|
9308
|
+
}
|
|
9309
|
+
// Split dates or weeks, ignore -1 values, etc.
|
|
9310
|
+
// Keep all your previous text-processing logic here
|
|
9311
|
+
return d.toLowerCase(); // fallback
|
|
9312
|
+
});
|
|
9313
|
+
// Example of handling sideways labels for grouped zoomed-out charts
|
|
9314
|
+
labels.each(function (d) {
|
|
9315
|
+
const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
|
|
9316
|
+
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
9317
|
+
if (subgroups.length > 1 &&
|
|
9318
|
+
self.isZoomedOut &&
|
|
9319
|
+
data.length > 8 &&
|
|
9320
|
+
isDateLabel &&
|
|
9321
|
+
!isWeekLabel) {
|
|
9322
|
+
d3.select(this).style('writing-mode', 'sideways-lr');
|
|
9323
|
+
}
|
|
9324
|
+
});
|
|
9325
|
+
}
|
|
9326
|
+
applyRiaLabelOverride(labels) {
|
|
9327
|
+
labels
|
|
9328
|
+
.classed('mobile-xaxis-override', true)
|
|
9329
|
+
.text((d) => d.substring(0, 3))
|
|
9330
|
+
.style('font-size', '12px')
|
|
9331
|
+
.attr('y', 5)
|
|
9332
|
+
.attr('x', 5)
|
|
9333
|
+
.style('text-anchor', 'middle');
|
|
9334
|
+
}
|
|
9335
|
+
calculateMaxValue(maxValue) {
|
|
9336
|
+
if (maxValue === 0) {
|
|
9337
|
+
if (this.chartData.targetLineData) {
|
|
9338
|
+
return this.chartData.targetLineData.target + 20;
|
|
9339
|
+
}
|
|
9340
|
+
else {
|
|
9341
|
+
return 100;
|
|
9342
|
+
}
|
|
9343
|
+
}
|
|
9344
|
+
return maxValue;
|
|
9345
|
+
}
|
|
8563
9346
|
handleClick(d) {
|
|
8564
9347
|
if (this.chartData.metaData.hasDrillDown || d?.toggleFrom)
|
|
8565
9348
|
this.clickEvent.emit(d);
|