axidio-styleguide-library1-v2 0.2.25 → 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 +1037 -779
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +275 -446
- package/fesm2022/axidio-styleguide-library1-v2.mjs +1567 -1293
- 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 +8 -133
- 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,21 +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.CONSTANTS = {
|
|
6644
|
-
RIGHT_SVG_WIDTH: 60,
|
|
6645
|
-
LEFT_RIGHT_SPACES: 50,
|
|
6646
|
-
SHORT_TICK_LENGTH: 4,
|
|
6647
|
-
LONG_TICK_LENGTH: 16,
|
|
6648
|
-
SHORT_TICK_LENGTH_BG: 5,
|
|
6649
|
-
LONG_TICK_LENGTH_BG: 30,
|
|
6650
|
-
MIN_MOBILE_BAR_WIDTH: 32,
|
|
6651
|
-
DESKTOP_MIN_BAR_WIDTH: 40,
|
|
6652
|
-
MOBILE_BAR_PADDING: 12,
|
|
6653
|
-
ZOOM_THRESHOLD: 30,
|
|
6654
|
-
ZOOM_IN_THRESHOLD: 8,
|
|
6655
|
-
};
|
|
6656
6828
|
this.defaultConfiguration = {
|
|
6657
6829
|
margin: { top: 20, right: 20, bottom: 20, left: 40 },
|
|
6658
6830
|
svgHeight: 70,
|
|
@@ -6668,7 +6840,6 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6668
6840
|
forComparison: true,
|
|
6669
6841
|
headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
|
|
6670
6842
|
yAxisGrid: false,
|
|
6671
|
-
// Optional configs with undefined defaults
|
|
6672
6843
|
isHeaderVisible: undefined,
|
|
6673
6844
|
isTransparentBackground: undefined,
|
|
6674
6845
|
isTopCaptionVisible: undefined,
|
|
@@ -6696,40 +6867,56 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6696
6867
|
isToggleVisible: undefined,
|
|
6697
6868
|
isTitleHidden: undefined,
|
|
6698
6869
|
};
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
ngOnChanges() {
|
|
6702
|
-
this.removeExistingChart();
|
|
6703
|
-
this.initializeStackedChart();
|
|
6704
|
-
}
|
|
6705
|
-
onResized(event) {
|
|
6706
|
-
setTimeout(() => {
|
|
6707
|
-
this.removeExistingChart();
|
|
6708
|
-
this.initializeStackedChart();
|
|
6709
|
-
}, 10);
|
|
6870
|
+
this.isCC = false;
|
|
6871
|
+
this.isZoomedOut = true;
|
|
6710
6872
|
}
|
|
6711
6873
|
isZoomOutSelected(isZoomOut) {
|
|
6712
6874
|
this.isZoomedOut = isZoomOut;
|
|
6713
6875
|
this.ngOnChanges();
|
|
6714
6876
|
}
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6877
|
+
ngOnChanges() {
|
|
6878
|
+
let self = this;
|
|
6879
|
+
d3.select('#' + self.uniqueId).remove();
|
|
6880
|
+
this.initializeStackedChart();
|
|
6881
|
+
}
|
|
6882
|
+
onResized(event) {
|
|
6883
|
+
let self = this;
|
|
6884
|
+
setTimeout(function () {
|
|
6885
|
+
d3.select('#' + self.uniqueId).remove();
|
|
6886
|
+
self.initializeStackedChart();
|
|
6887
|
+
}.bind(self), 10);
|
|
6725
6888
|
}
|
|
6726
|
-
|
|
6727
|
-
|
|
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) {
|
|
6728
6915
|
this.chartConfiguration.margin = { top: 20, right: 10, bottom: 40, left: 30 };
|
|
6729
6916
|
this.chartConfiguration.numberOfYTicks = 4;
|
|
6730
6917
|
this.chartConfiguration.svgHeight = 60;
|
|
6731
6918
|
}
|
|
6732
|
-
else if (
|
|
6919
|
+
else if (isTablet) {
|
|
6733
6920
|
this.chartConfiguration.margin = { top: 25, right: 20, bottom: 45, left: 40 };
|
|
6734
6921
|
this.chartConfiguration.numberOfYTicks = 6;
|
|
6735
6922
|
this.chartConfiguration.svgHeight = 70;
|
|
@@ -6739,612 +6926,922 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6739
6926
|
this.chartConfiguration.numberOfYTicks = 7;
|
|
6740
6927
|
this.chartConfiguration.svgHeight = 80;
|
|
6741
6928
|
}
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
for (const key in this.defaultConfiguration) {
|
|
6745
|
-
this.chartConfiguration[key] = ChartHelper.getValueByConfigurationType(key, this.defaultConfiguration, this.customChartConfiguration);
|
|
6929
|
+
for (var i in this.defaultConfiguration) {
|
|
6930
|
+
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
6746
6931
|
}
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
if (
|
|
6932
|
+
data = this.chartData.data;
|
|
6933
|
+
metaData = this.chartData.metaData;
|
|
6934
|
+
if (metaData.unit == undefined)
|
|
6750
6935
|
metaData.unit = '';
|
|
6751
|
-
if (metaData.isCC)
|
|
6936
|
+
if (metaData.isCC) {
|
|
6752
6937
|
this.isCC = metaData.isCC;
|
|
6753
|
-
|
|
6754
|
-
|
|
6938
|
+
}
|
|
6939
|
+
if (metaData.barWithoutClick && metaData.barWithoutClick.length) {
|
|
6940
|
+
metaData.barWithoutClick = metaData.barWithoutClick.map((ele) => ele.toLowerCase());
|
|
6755
6941
|
}
|
|
6756
6942
|
else {
|
|
6757
6943
|
metaData.barWithoutClick = [];
|
|
6758
6944
|
}
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
let
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
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
|
+
}
|
|
6958
|
+
}
|
|
6959
|
+
var margin = this.chartConfiguration.margin;
|
|
6960
|
+
// Responsive width and height
|
|
6961
|
+
var containerWidth = chartContainer.node().getBoundingClientRect().width;
|
|
6962
|
+
var containerHeight = verticalstackedcontainer.node().getBoundingClientRect().height;
|
|
6963
|
+
var width = containerWidth - margin.left - margin.right;
|
|
6964
|
+
var height = containerHeight * (self.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
|
|
6965
|
+
// Adjust width for large datasets and zoom
|
|
6966
|
+
if (this.chartData.data.length > 30 && this.isZoomedOut) {
|
|
6967
|
+
width = width > this.chartData.data.length * (isMobile ? 15 : 25)
|
|
6968
|
+
? width
|
|
6969
|
+
: this.chartData.data.length * (isMobile ? 15 : 25);
|
|
6970
|
+
}
|
|
6971
|
+
if (this.chartData.data.length > 8 && !this.isZoomedOut) {
|
|
6972
|
+
width = this.chartData.data.length * (isMobile ? 60 : 130);
|
|
6973
|
+
}
|
|
6974
|
+
// Fullscreen and drilldown adjustments
|
|
6975
|
+
if (this.chartConfiguration.isFullScreen != undefined && this.chartConfiguration.isFullScreen) {
|
|
6976
|
+
height = this.chartConfiguration.svgHeight != 80
|
|
6778
6977
|
? this.chartConfiguration.svgHeight
|
|
6779
6978
|
: containerHeight;
|
|
6780
6979
|
}
|
|
6781
|
-
// Handle drilldown
|
|
6782
6980
|
if (this.chartConfiguration.isDrilldownChart) {
|
|
6783
|
-
height = containerHeight - margin.top - margin.bottom - (
|
|
6981
|
+
height = containerHeight - margin.top - margin.bottom - (isMobile ? 60 : 130);
|
|
6784
6982
|
}
|
|
6785
|
-
//
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
requiredSvgWidth = Math.max(width - this.CONSTANTS.RIGHT_SVG_WIDTH, (barWidth + barPadding) * dataLength + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 +
|
|
6793
|
-
this.CONSTANTS.RIGHT_SVG_WIDTH - barPadding);
|
|
6983
|
+
// ...existing code...
|
|
6984
|
+
/**
|
|
6985
|
+
* for hiding header
|
|
6986
|
+
* used by weekly charts
|
|
6987
|
+
*/
|
|
6988
|
+
if (this.chartConfiguration.isHeaderVisible != undefined) {
|
|
6989
|
+
this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
|
|
6794
6990
|
}
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6991
|
+
/**
|
|
6992
|
+
* for hiding legends
|
|
6993
|
+
* used by weekly charts
|
|
6994
|
+
*/
|
|
6995
|
+
if (this.chartConfiguration.isTopCaptionVisible != undefined) {
|
|
6996
|
+
//UPDATENAME
|
|
6997
|
+
this.isTopCaptionVisible = this.chartConfiguration.isTopCaptionVisible;
|
|
6998
|
+
}
|
|
6999
|
+
/**
|
|
7000
|
+
* for removing background color so that it can take parents color
|
|
7001
|
+
*
|
|
7002
|
+
*/
|
|
7003
|
+
if (this.chartConfiguration.isTransparentBackground != undefined) {
|
|
7004
|
+
this.isTransparentBackground =
|
|
7005
|
+
this.chartConfiguration.isTransparentBackground;
|
|
7006
|
+
}
|
|
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');
|
|
7013
|
+
}
|
|
7014
|
+
var outerContainer = chartContainer
|
|
6812
7015
|
.append('div')
|
|
6813
|
-
.attr('id',
|
|
7016
|
+
.attr('id', self.uniqueId)
|
|
6814
7017
|
.attr('class', 'outer-container')
|
|
6815
7018
|
.style('width', '100%')
|
|
6816
|
-
.style('height',
|
|
7019
|
+
.style('height', height)
|
|
6817
7020
|
.style('overflow-x', 'hidden')
|
|
6818
7021
|
.style('padding-left', `${margin.left}px`)
|
|
6819
7022
|
.style('margin-left', '10px')
|
|
6820
|
-
.style('padding-right', `${
|
|
6821
|
-
|
|
7023
|
+
.style('padding-right', `${rightSvgWidth}px`);
|
|
7024
|
+
var svgYAxisLeft = outerContainer
|
|
6822
7025
|
.append('svg')
|
|
6823
7026
|
.attr('width', '80')
|
|
6824
|
-
.attr('height',
|
|
7027
|
+
.attr('height', height + margin.top + margin.bottom)
|
|
6825
7028
|
.style('position', 'absolute')
|
|
6826
7029
|
.style('left', '0')
|
|
6827
7030
|
.style('z-index', 1)
|
|
6828
7031
|
.append('g')
|
|
6829
|
-
.attr('transform',
|
|
6830
|
-
|
|
7032
|
+
.attr('transform', 'translate(' + (margin.left + 10) + ',' + margin.top + ')');
|
|
7033
|
+
var svgYAxisRight = outerContainer
|
|
6831
7034
|
.append('svg')
|
|
6832
|
-
.attr('width',
|
|
6833
|
-
.attr('height',
|
|
7035
|
+
.attr('width', rightSvgWidth)
|
|
7036
|
+
.attr('height', height + margin.top + margin.bottom)
|
|
6834
7037
|
.style('position', 'absolute')
|
|
6835
7038
|
.style('right', '2px')
|
|
6836
7039
|
.style('z-index', 1)
|
|
6837
7040
|
.append('g')
|
|
6838
|
-
.attr('transform',
|
|
6839
|
-
|
|
7041
|
+
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7042
|
+
var innerContainer = outerContainer
|
|
6840
7043
|
.append('div')
|
|
6841
7044
|
.attr('class', 'inner-container')
|
|
6842
7045
|
.style('width', '100%')
|
|
6843
7046
|
.style('overflow-x', 'auto');
|
|
6844
|
-
|
|
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
|
|
6845
7065
|
.append('svg')
|
|
6846
|
-
.attr('width',
|
|
6847
|
-
.attr('height',
|
|
7066
|
+
.attr('width', requiredSvgWidth)
|
|
7067
|
+
.attr('height', height + margin.top + margin.bottom + 30)
|
|
6848
7068
|
.append('g')
|
|
6849
|
-
.attr('transform',
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
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
|
|
6855
7095
|
.scaleBand()
|
|
6856
7096
|
.rangeRound([
|
|
6857
|
-
|
|
6858
|
-
width -
|
|
7097
|
+
leftAndRightSpaces,
|
|
7098
|
+
width - rightSvgWidth - leftAndRightSpaces
|
|
6859
7099
|
])
|
|
6860
|
-
.domain(data.map(
|
|
6861
|
-
|
|
6862
|
-
|
|
7100
|
+
.domain(data.map(function (d) {
|
|
7101
|
+
return d.name;
|
|
7102
|
+
}).reverse())
|
|
7103
|
+
.padding(isMobile ? 0.2 : 0.5);
|
|
7104
|
+
var xScaleFromOrigin = d3
|
|
6863
7105
|
.scaleBand()
|
|
6864
|
-
.rangeRound([width -
|
|
6865
|
-
.domain(data.map(
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
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
|
+
}
|
|
6872
7157
|
}
|
|
6873
7158
|
if (this.chartConfiguration.customYscale) {
|
|
6874
|
-
maxValue
|
|
7159
|
+
maxValue = maxValue * this.chartConfiguration.customYscale;
|
|
6875
7160
|
}
|
|
6876
|
-
if (this.chartData.targetLineData &&
|
|
6877
|
-
|
|
6878
|
-
maxValue =
|
|
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;
|
|
6879
7167
|
}
|
|
6880
7168
|
yScale.domain([0, maxValue]).nice();
|
|
6881
|
-
let
|
|
6882
|
-
|
|
6883
|
-
lineYscale = d3
|
|
6884
|
-
.scaleLinear()
|
|
6885
|
-
.domain([0, d3.max(lineData, d => +d.value)])
|
|
6886
|
-
.range([height, 0]);
|
|
6887
|
-
}
|
|
6888
|
-
return { xScale, xScaleFromOrigin, yScale, lineYscale };
|
|
6889
|
-
}
|
|
6890
|
-
createAxes(scales) {
|
|
6891
|
-
const xAxis = d3
|
|
6892
|
-
.axisBottom(scales.xScale)
|
|
7169
|
+
let xAxis = d3
|
|
7170
|
+
.axisBottom(xScale)
|
|
6893
7171
|
.tickSize(0)
|
|
6894
|
-
.tickFormat(
|
|
6895
|
-
|
|
6896
|
-
.axisLeft(
|
|
6897
|
-
.ticks(
|
|
7172
|
+
.tickFormat(self.chartConfiguration.xAxisLabelFomatter);
|
|
7173
|
+
let yAxis = d3
|
|
7174
|
+
.axisLeft(yScale)
|
|
7175
|
+
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
6898
7176
|
.tickSize(0)
|
|
6899
|
-
.tickFormat(
|
|
6900
|
-
let yLineAxis
|
|
6901
|
-
if (
|
|
7177
|
+
.tickFormat(self.chartConfiguration.yAxisLabelFomatter);
|
|
7178
|
+
let yLineAxis;
|
|
7179
|
+
if (lineYscale != null) {
|
|
6902
7180
|
yLineAxis = d3
|
|
6903
|
-
.axisRight(
|
|
6904
|
-
.ticks(
|
|
7181
|
+
.axisRight(lineYscale)
|
|
7182
|
+
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
6905
7183
|
.tickSize(0)
|
|
6906
|
-
.tickFormat(
|
|
7184
|
+
.tickFormat(self.chartConfiguration.yLineAxisLabelFomatter);
|
|
6907
7185
|
}
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
7186
|
+
/**
|
|
7187
|
+
* between x-axis label used by weekly charts
|
|
7188
|
+
* isXgridBetweenLabels will be undefined for dashboard charts
|
|
7189
|
+
*/
|
|
7190
|
+
if (self.chartConfiguration.isXgridBetweenLabels) {
|
|
7191
|
+
svg
|
|
7192
|
+
.append('g')
|
|
7193
|
+
.attr('class', 'grid')
|
|
7194
|
+
.attr('transform', 'translate(' + xScale.bandwidth() / 2 + ',' + height + ')')
|
|
7195
|
+
.call(d3.axisBottom(xScale).tickSize(-height).tickFormat(''))
|
|
7196
|
+
.style('stroke-dasharray', '5 5')
|
|
7197
|
+
.style('color', '#999999')
|
|
7198
|
+
// .style("opacity", "0.5")
|
|
7199
|
+
.call((g) => g.select('.domain').remove());
|
|
7200
|
+
}
|
|
7201
|
+
/**
|
|
7202
|
+
* used to draw y-axis grid
|
|
7203
|
+
*/
|
|
7204
|
+
if (self.chartConfiguration.yAxisGrid) {
|
|
7205
|
+
svg
|
|
7206
|
+
.append('g')
|
|
7207
|
+
.attr('class', 'grid')
|
|
7208
|
+
.call(d3
|
|
7209
|
+
.axisLeft(yScale)
|
|
7210
|
+
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
7211
|
+
.tickSize(-width)
|
|
7212
|
+
.tickFormat(''))
|
|
7213
|
+
// Remove hardcoded colors and use CSS variables
|
|
7214
|
+
.style('color', 'var(--chart-grid-color)')
|
|
7215
|
+
.style('opacity', '1');
|
|
7216
|
+
// .call((g) => g.select('.domain').remove());
|
|
7217
|
+
}
|
|
7218
|
+
var layer = svg
|
|
6912
7219
|
.selectAll('.layer')
|
|
6913
7220
|
.data(layers)
|
|
6914
7221
|
.enter()
|
|
6915
7222
|
.append('g')
|
|
6916
7223
|
.attr('class', 'layer')
|
|
6917
|
-
.style('fill', (d)
|
|
6918
|
-
|
|
7224
|
+
.style('fill', function (d, i) {
|
|
7225
|
+
return metaData.colors[d.key];
|
|
7226
|
+
});
|
|
7227
|
+
var rect = layer
|
|
6919
7228
|
.selectAll('rect')
|
|
6920
|
-
.data((d)
|
|
7229
|
+
.data(function (d) {
|
|
7230
|
+
return d;
|
|
7231
|
+
})
|
|
6921
7232
|
.enter();
|
|
6922
|
-
this.appendRectangles(rect, scales, metaData, dimensions, device);
|
|
6923
|
-
this.addInteractions(rect, svg, metaData, scales);
|
|
6924
|
-
return rect;
|
|
6925
|
-
}
|
|
6926
|
-
appendRectangles(rect, scales, metaData, dimensions, device) {
|
|
6927
|
-
const { barWidth, barPadding } = dimensions;
|
|
6928
|
-
const { xScale, yScale } = scales;
|
|
6929
7233
|
rect
|
|
6930
7234
|
.append('rect')
|
|
6931
|
-
.on('click', (d)
|
|
6932
|
-
if (!
|
|
6933
|
-
if (!metaData.barWithoutClick
|
|
6934
|
-
|
|
6935
|
-
|
|
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);
|
|
6936
7241
|
}
|
|
6937
7242
|
})
|
|
6938
|
-
.attr('y', (d)
|
|
7243
|
+
.attr('y', function (d) {
|
|
6939
7244
|
if (!isNaN(d[0]) && !isNaN(d[1])) {
|
|
6940
7245
|
const actualHeight = yScale(d[0]) - yScale(d[1]);
|
|
6941
7246
|
return actualHeight < 3 ? yScale(d[0]) - 3 : yScale(d[1]);
|
|
6942
7247
|
}
|
|
6943
7248
|
return 0;
|
|
6944
7249
|
})
|
|
6945
|
-
.attr('x', (d, i)
|
|
6946
|
-
if (
|
|
6947
|
-
|
|
7250
|
+
.attr('x', function (d, i) {
|
|
7251
|
+
if (isMobile) {
|
|
7252
|
+
// On mobile, position bars with padding
|
|
7253
|
+
return leftAndRightSpaces + i * (barWidth + barPadding);
|
|
6948
7254
|
}
|
|
6949
|
-
if (
|
|
7255
|
+
if (self.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
6950
7256
|
return xScale(d.data.name);
|
|
6951
7257
|
}
|
|
6952
|
-
|
|
6953
|
-
|
|
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;
|
|
6954
7264
|
}
|
|
6955
|
-
return xScale(d.data.name) + xScale.bandwidth() * 0.1;
|
|
6956
7265
|
})
|
|
6957
|
-
.attr('height', (d)
|
|
7266
|
+
.attr('height', function (d) {
|
|
6958
7267
|
if (!isNaN(d[0]) && !isNaN(d[1])) {
|
|
6959
7268
|
const actualHeight = yScale(d[0]) - yScale(d[1]);
|
|
6960
7269
|
return actualHeight < 3 ? 3 : actualHeight;
|
|
6961
7270
|
}
|
|
6962
7271
|
return 0;
|
|
6963
7272
|
})
|
|
6964
|
-
.attr('width', (d)
|
|
6965
|
-
|
|
7273
|
+
.attr('width', function (d) {
|
|
7274
|
+
// Use calculated barWidth for mobile, otherwise scale
|
|
7275
|
+
if (isMobile) {
|
|
6966
7276
|
return barWidth;
|
|
6967
|
-
if (!this.chartConfiguration.isMultiChartGridLine)
|
|
6968
|
-
return xScale.bandwidth();
|
|
6969
|
-
if (this.chartConfiguration.isDrilldownChart && this.chartData.data.length <= 3) {
|
|
6970
|
-
return 70;
|
|
6971
7277
|
}
|
|
6972
|
-
return
|
|
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;
|
|
6973
7284
|
})
|
|
6974
|
-
.style('cursor',
|
|
7285
|
+
// .style('cursor', 'pointer');
|
|
7286
|
+
.style('cursor', function (d) {
|
|
6975
7287
|
if (metaData.hasDrillDown) {
|
|
6976
|
-
if (metaData.barWithoutClick
|
|
7288
|
+
if (metaData.barWithoutClick.length > 0 &&
|
|
7289
|
+
metaData.barWithoutClick.includes(d.data.name.toLowerCase())) {
|
|
6977
7290
|
return 'default';
|
|
6978
7291
|
}
|
|
6979
7292
|
return 'pointer';
|
|
6980
7293
|
}
|
|
6981
|
-
|
|
7294
|
+
else
|
|
7295
|
+
return 'default';
|
|
6982
7296
|
})
|
|
6983
|
-
.style('fill', (d)
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
return
|
|
6991
|
-
}
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
if (!this.chartConfiguration.displayTitleOnTop)
|
|
7002
|
-
return;
|
|
7003
|
-
svg.selectAll('rect')
|
|
7004
|
-
.filter((data) => data === d)
|
|
7005
|
-
.style('fill', (d) => this.getHoverColor(d, metaData));
|
|
7006
|
-
this.displayTooltip(d, svg, metaData, scales);
|
|
7007
|
-
}
|
|
7008
|
-
getHoverColor(d, metaData) {
|
|
7009
|
-
if (!isNaN(d[0]) &&
|
|
7010
|
-
!isNaN(d[1]) &&
|
|
7011
|
-
this.chartData.targetLineData &&
|
|
7012
|
-
parseFloat(d[1]) - parseFloat(d[0]) >= parseFloat(String(this.chartData.targetLineData.target))) {
|
|
7013
|
-
return this.chartData.targetLineData.barAboveTargetHoverColor ||
|
|
7014
|
-
this.chartData.targetLineData.barAboveTargetColor ||
|
|
7015
|
-
metaData.colors[d.key];
|
|
7016
|
-
}
|
|
7017
|
-
return metaData.hoverColor || metaData.colors[d.key];
|
|
7018
|
-
}
|
|
7019
|
-
displayTooltip(d, svg, metaData, scales) {
|
|
7020
|
-
const { xScale, yScale } = scales;
|
|
7021
|
-
const value = d[1] - d[0];
|
|
7022
|
-
if (isNaN(value))
|
|
7023
|
-
return;
|
|
7024
|
-
const width = /week/i.test(d.data.name) && /\d{4}-\d{2}-\d{2}/.test(d.data.name)
|
|
7025
|
-
? '250px'
|
|
7026
|
-
: xScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 > 180
|
|
7027
|
-
? '180px'
|
|
7028
|
-
: xScale.bandwidth() + this.CONSTANTS.LEFT_RIGHT_SPACES * 2;
|
|
7029
|
-
svg
|
|
7030
|
-
.append('foreignObject')
|
|
7031
|
-
.attr('x', this.calculateTooltipX(d, xScale, width))
|
|
7032
|
-
.attr('class', 'lib-verticalstack-title-ontop')
|
|
7033
|
-
.attr('y', yScale(d[1]) - 51)
|
|
7034
|
-
.attr('width', width)
|
|
7035
|
-
.attr('height', 40)
|
|
7036
|
-
.append('xhtml:div')
|
|
7037
|
-
.attr('class', 'title')
|
|
7038
|
-
.style('z-index', 99)
|
|
7039
|
-
.html(this.generateTooltipHtml(d, metaData, value));
|
|
7040
|
-
}
|
|
7041
|
-
calculateTooltipX(d, xScale, width) {
|
|
7042
|
-
const bandwidth = xScale.bandwidth();
|
|
7043
|
-
const numericWidth = typeof width === 'string' ? parseInt(width) : width;
|
|
7044
|
-
if (bandwidth + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 > 180) {
|
|
7045
|
-
return xScale(d.data.name) - this.CONSTANTS.LEFT_RIGHT_SPACES +
|
|
7046
|
-
(bandwidth + this.CONSTANTS.LEFT_RIGHT_SPACES * 2 - 180) / 2;
|
|
7047
|
-
}
|
|
7048
|
-
return xScale(d.data.name) - this.CONSTANTS.LEFT_RIGHT_SPACES;
|
|
7049
|
-
}
|
|
7050
|
-
generateTooltipHtml(d, metaData, value) {
|
|
7051
|
-
if (value === 0)
|
|
7052
|
-
return '<span class="title-top-text">0</span>';
|
|
7053
|
-
const dataType = metaData.dataType || '';
|
|
7054
|
-
const name = d.data.name ? `<span class="title-bar-name">${d.data.name}</span>` : '';
|
|
7055
|
-
const valueText = metaData.unit
|
|
7056
|
-
? `${metaData.unit}${value} ${dataType}`
|
|
7057
|
-
: `${value} ${dataType}`;
|
|
7058
|
-
return `${name}<span class="title-top-text">${valueText}</span>`;
|
|
7059
|
-
}
|
|
7060
|
-
handleMouseOut(svg, metaData) {
|
|
7061
|
-
if (!this.chartConfiguration.displayTitleOnTop)
|
|
7062
|
-
return;
|
|
7063
|
-
svg.selectAll('rect')
|
|
7064
|
-
.style('fill', (d) => this.getBarColor(d, metaData));
|
|
7065
|
-
svg.selectAll('.lib-verticalstack-title-ontop').remove();
|
|
7066
|
-
}
|
|
7067
|
-
renderAxisLabels(svg, svgYAxisLeft, metaData, dimensions, margin) {
|
|
7068
|
-
if (metaData.yLabel) {
|
|
7069
|
-
this.addYAxisLabel(svgYAxisLeft, metaData.yLabel, dimensions.height, margin);
|
|
7070
|
-
}
|
|
7071
|
-
if (metaData.xLabel) {
|
|
7072
|
-
this.addXAxisLabel(svg, metaData.xLabel, dimensions.width, dimensions.height, margin);
|
|
7073
|
-
}
|
|
7074
|
-
}
|
|
7075
|
-
addYAxisLabel(svgYAxisLeft, label, height, margin) {
|
|
7076
|
-
const isria = this.customChartConfiguration?.isRia;
|
|
7077
|
-
const isAcronym = this.isAcronymLabel(label);
|
|
7078
|
-
const yPosition = isria ? -margin.left / 2 - 30 : -margin.left / 2 - 40;
|
|
7079
|
-
svgYAxisLeft.selectAll('.lib-axis-group-label, .lib-ylabel-drilldowncharts, .lib-ylabel-weeklyCharts').remove();
|
|
7080
|
-
svgYAxisLeft
|
|
7081
|
-
.append('text')
|
|
7082
|
-
.attr('class', this.getYAxisLabelClass())
|
|
7083
|
-
.attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
|
|
7084
|
-
.attr('transform', 'rotate(-90)')
|
|
7085
|
-
.attr('y', yPosition)
|
|
7086
|
-
.attr('x', -height / 2)
|
|
7087
|
-
.attr('dy', '1em')
|
|
7088
|
-
.style('text-anchor', 'middle')
|
|
7089
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7090
|
-
.text(isAcronym ? label.toUpperCase() : label.toLowerCase())
|
|
7091
|
-
.style('text-transform', isAcronym ? 'none' : 'capitalize');
|
|
7092
|
-
}
|
|
7093
|
-
addXAxisLabel(svg, label, width, height, margin) {
|
|
7094
|
-
const isria = this.customChartConfiguration?.isRia;
|
|
7095
|
-
const isAcronym = this.isAcronymLabel(label);
|
|
7096
|
-
const xPosition = isria
|
|
7097
|
-
? height + margin.top + margin.bottom
|
|
7098
|
-
: height + margin.top + margin.bottom + 10;
|
|
7099
|
-
svg
|
|
7100
|
-
.append('text')
|
|
7101
|
-
.attr('class', this.getXAxisLabelClass())
|
|
7102
|
-
.attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
|
|
7103
|
-
.attr('transform', `translate(${width / 2},${xPosition})`)
|
|
7104
|
-
.style('text-anchor', 'middle')
|
|
7105
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7106
|
-
.text(isAcronym ? label.toUpperCase() : label.toLowerCase())
|
|
7107
|
-
.style('text-transform', isAcronym ? 'none' : 'capitalize');
|
|
7108
|
-
}
|
|
7109
|
-
isAcronymLabel(label) {
|
|
7110
|
-
const cleanLabel = label.replace(/[^A-Za-z]/g, '');
|
|
7111
|
-
return (label.length <= 4 && /^[A-Z]+$/.test(label)) ||
|
|
7112
|
-
(label === label.toUpperCase() && /[A-Z]/.test(label));
|
|
7113
|
-
}
|
|
7114
|
-
getYAxisLabelClass() {
|
|
7115
|
-
let baseClass = 'lib-axis-group-label font-size-1';
|
|
7116
|
-
if (this.chartConfiguration.isDrilldownChart) {
|
|
7117
|
-
return `${baseClass} lib-ylabel-drilldowncharts`;
|
|
7118
|
-
}
|
|
7119
|
-
if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
|
|
7120
|
-
return `${baseClass} lib-ylabel-weeklyCharts`;
|
|
7121
|
-
}
|
|
7122
|
-
return `${baseClass} lib-axis-waterfall-label`;
|
|
7123
|
-
}
|
|
7124
|
-
getXAxisLabelClass() {
|
|
7125
|
-
let baseClass = 'lib-axis-group-label font-size-1';
|
|
7126
|
-
if (this.chartConfiguration.isDrilldownChart) {
|
|
7127
|
-
return `${baseClass} lib-xlabel-drilldowncharts`;
|
|
7128
|
-
}
|
|
7129
|
-
if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
|
|
7130
|
-
return `${baseClass} lib-xlabel-weeklyCharts`;
|
|
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
|
+
});
|
|
7131
7315
|
}
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7316
|
+
if (this.isCC) {
|
|
7317
|
+
rect
|
|
7318
|
+
.append('text')
|
|
7319
|
+
.attr('x', function (d) {
|
|
7320
|
+
return xScale(d.data.name);
|
|
7321
|
+
})
|
|
7322
|
+
.attr('text-anchor', function (d) {
|
|
7323
|
+
if (!d[0]) {
|
|
7324
|
+
return 'end';
|
|
7325
|
+
}
|
|
7326
|
+
else {
|
|
7327
|
+
return 'start';
|
|
7328
|
+
}
|
|
7329
|
+
})
|
|
7330
|
+
.attr('class', 'verticalbar__text')
|
|
7331
|
+
.attr('y', function (d) {
|
|
7332
|
+
if (!d[0]) {
|
|
7333
|
+
return yScale(d[1]);
|
|
7334
|
+
}
|
|
7335
|
+
else {
|
|
7336
|
+
return yScale(d[1]) - 7;
|
|
7337
|
+
}
|
|
7338
|
+
})
|
|
7339
|
+
// .attr("y", function (d) { return yScale(d[0]) - yScale(d[1]); })
|
|
7340
|
+
.attr('dy', function (d) {
|
|
7341
|
+
return d.class;
|
|
7342
|
+
})
|
|
7343
|
+
.text(function (d) {
|
|
7344
|
+
if (!d[0]) {
|
|
7345
|
+
if (!isNaN(d[1] - d[0])) {
|
|
7346
|
+
return Math.round((d[1] - d[0]) * 100) / 100;
|
|
7347
|
+
}
|
|
7348
|
+
else
|
|
7349
|
+
return;
|
|
7350
|
+
}
|
|
7351
|
+
else {
|
|
7352
|
+
if (!isNaN(d[1])) {
|
|
7353
|
+
return Math.round(d[1] * 100) / 100;
|
|
7354
|
+
}
|
|
7355
|
+
else
|
|
7356
|
+
return;
|
|
7357
|
+
}
|
|
7358
|
+
});
|
|
7137
7359
|
}
|
|
7138
|
-
|
|
7139
|
-
|
|
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
|
+
}
|
|
7377
|
+
svg
|
|
7378
|
+
.selectAll('rect')
|
|
7379
|
+
.filter(function (data) {
|
|
7380
|
+
return data == d;
|
|
7381
|
+
})
|
|
7382
|
+
.style('fill', function (d) {
|
|
7383
|
+
if (!isNaN(d[0]) &&
|
|
7384
|
+
!isNaN(d[1]) &&
|
|
7385
|
+
self.chartData.targetLineData &&
|
|
7386
|
+
parseFloat(d[1]) - parseFloat(d[0]) >=
|
|
7387
|
+
parseFloat(self.chartData.targetLineData.target))
|
|
7388
|
+
return self.chartData.targetLineData.barAboveTargetHoverColor
|
|
7389
|
+
? self.chartData.targetLineData.barAboveTargetHoverColor
|
|
7390
|
+
: self.chartData?.targetLineData?.barAboveTargetColor
|
|
7391
|
+
? self.chartData?.targetLineData?.barAboveTargetColor
|
|
7392
|
+
: '';
|
|
7393
|
+
return metaData.hoverColor ? metaData.hoverColor : '';
|
|
7394
|
+
});
|
|
7395
|
+
svg
|
|
7396
|
+
.append('foreignObject')
|
|
7397
|
+
.attr('x', function () {
|
|
7398
|
+
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7399
|
+
return (xScale(d.data.name) -
|
|
7400
|
+
leftAndRightSpaces +
|
|
7401
|
+
(xScale.bandwidth() + leftAndRightSpaces * 2 - 180) / 2);
|
|
7402
|
+
}
|
|
7403
|
+
return xScale(d.data.name) - leftAndRightSpaces;
|
|
7404
|
+
})
|
|
7405
|
+
.attr('class', 'lib-verticalstack-title-ontop')
|
|
7406
|
+
.attr('y', function () {
|
|
7407
|
+
// Increase the gap between the bar and the tooltip (was -1 - 40)
|
|
7408
|
+
return yScale(d[1]) - 1 - 50; // 10px more gap
|
|
7409
|
+
})
|
|
7410
|
+
.attr('dy', function () {
|
|
7411
|
+
return d.class;
|
|
7412
|
+
})
|
|
7413
|
+
.attr('width', function () {
|
|
7414
|
+
if (d.data.name && /week/i.test(d.data.name) && /\d{4}-\d{2}-\d{2}/.test(d.data.name)) {
|
|
7415
|
+
return '250px'; // increase for week + date
|
|
7416
|
+
}
|
|
7417
|
+
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7418
|
+
return '180px';
|
|
7419
|
+
}
|
|
7420
|
+
return xScale.bandwidth() + leftAndRightSpaces * 2;
|
|
7421
|
+
})
|
|
7422
|
+
.attr('height', 40)
|
|
7423
|
+
.append('xhtml:div')
|
|
7424
|
+
.attr('class', 'title')
|
|
7425
|
+
.style('z-index', 99)
|
|
7426
|
+
.html(function () {
|
|
7427
|
+
// Tooltip content without any arrow mark
|
|
7428
|
+
if (!isNaN(d[1] - d[0])) {
|
|
7429
|
+
if (d[1] - d[0] === 0) {
|
|
7430
|
+
return '<span class="title-top-text">0</span>';
|
|
7431
|
+
}
|
|
7432
|
+
var dataType = metaData.dataType ? metaData.dataType : '';
|
|
7433
|
+
var desiredText = '';
|
|
7434
|
+
// Always show the full x-axis label (category name) in the tooltip
|
|
7435
|
+
desiredText =
|
|
7436
|
+
'<span class="title-bar-name">' +
|
|
7437
|
+
(d.data.name ? d.data.name : '') +
|
|
7438
|
+
'</span>';
|
|
7439
|
+
desiredText += metaData.unit
|
|
7440
|
+
? '<span class="title-top-text">' +
|
|
7441
|
+
metaData.unit +
|
|
7442
|
+
(d[1] - d[0]) + ' ' +
|
|
7443
|
+
dataType +
|
|
7444
|
+
'</span>'
|
|
7445
|
+
: '<span class="title-top-text">' +
|
|
7446
|
+
(d[1] - d[0]) + ' ' +
|
|
7447
|
+
dataType +
|
|
7448
|
+
'</span>';
|
|
7449
|
+
// No arrow mark or arrow HTML/CSS in tooltip
|
|
7450
|
+
return desiredText;
|
|
7451
|
+
}
|
|
7452
|
+
else
|
|
7453
|
+
return;
|
|
7454
|
+
});
|
|
7140
7455
|
}
|
|
7141
|
-
|
|
7142
|
-
|
|
7456
|
+
function handleMouseOut(d, i) {
|
|
7457
|
+
if (!self.chartConfiguration.displayTitleOnTop) {
|
|
7458
|
+
return;
|
|
7459
|
+
}
|
|
7460
|
+
// svg.selectAll('rect').style('fill', metaData.colors[d.key]);
|
|
7461
|
+
svg.selectAll('rect').style('fill', function (d) {
|
|
7462
|
+
if (!isNaN(d[0]) &&
|
|
7463
|
+
!isNaN(d[1]) &&
|
|
7464
|
+
self.chartData.targetLineData &&
|
|
7465
|
+
parseFloat(d[1]) - parseFloat(d[0]) >=
|
|
7466
|
+
parseFloat(self.chartData.targetLineData.target))
|
|
7467
|
+
return self.chartData?.targetLineData?.barAboveTargetColor;
|
|
7468
|
+
return metaData.colors[d.key];
|
|
7469
|
+
});
|
|
7470
|
+
svg.selectAll('.lib-verticalstack-title-ontop').remove();
|
|
7143
7471
|
}
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
this.
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
.attr('class', 'grid')
|
|
7180
|
-
.attr('transform', `translate(${scales.xScale.bandwidth() / 2},${dimensions.height})`)
|
|
7181
|
-
.call(d3.axisBottom(scales.xScale).tickSize(-dimensions.height).tickFormat(''))
|
|
7182
|
-
.style('stroke-dasharray', '5 5')
|
|
7183
|
-
.style('color', '#999999')
|
|
7184
|
-
.call((g) => g.select('.domain').remove());
|
|
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
|
+
});
|
|
7185
7507
|
}
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
.
|
|
7193
|
-
.
|
|
7194
|
-
.
|
|
7195
|
-
.
|
|
7196
|
-
|
|
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
|
+
});
|
|
7197
7576
|
}
|
|
7198
|
-
if (this.chartConfiguration.
|
|
7199
|
-
|
|
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 {
|
|
7200
7596
|
svg
|
|
7201
7597
|
.append('g')
|
|
7202
|
-
.attr('
|
|
7203
|
-
.
|
|
7204
|
-
.
|
|
7205
|
-
.
|
|
7206
|
-
.style('fill', 'var(--chart-text-color)')
|
|
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
|
+
});
|
|
7207
7611
|
}
|
|
7208
|
-
}
|
|
7209
|
-
}
|
|
7210
|
-
renderAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions, device, data) {
|
|
7211
|
-
if (this.chartConfiguration.showXaxisTop) {
|
|
7212
7612
|
svg
|
|
7213
7613
|
.append('g')
|
|
7214
|
-
.attr('class', 'lib-
|
|
7215
|
-
.attr('style',
|
|
7216
|
-
.
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
this.renderStandardAxes(svg, axes, scales, dimensions, device, data);
|
|
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)');
|
|
7221
7620
|
}
|
|
7222
7621
|
else if (this.chartConfiguration.isDrilldownChart) {
|
|
7223
|
-
this.renderDrilldownAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions);
|
|
7224
|
-
}
|
|
7225
|
-
else {
|
|
7226
|
-
this.renderMultiChartAxes(svg, axes, scales, dimensions);
|
|
7227
|
-
}
|
|
7228
|
-
this.applyAxisStyling(svg, svgYAxisLeft, svgYAxisRight);
|
|
7229
|
-
this.applyAxisConfigurations(svg, scales, dimensions, data);
|
|
7230
|
-
}
|
|
7231
|
-
renderStandardAxes(svg, axes, scales, dimensions, device, data) {
|
|
7232
|
-
if (device.isMobile) {
|
|
7233
|
-
this.renderMobileXAxis(svg, data, dimensions);
|
|
7234
|
-
}
|
|
7235
|
-
else {
|
|
7236
7622
|
svg
|
|
7237
7623
|
.append('g')
|
|
7238
|
-
.attr('transform',
|
|
7239
|
-
.attr('class', 'lib-stacked-x-axis-text')
|
|
7240
|
-
.call(
|
|
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)
|
|
7241
7634
|
.selectAll('text')
|
|
7242
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7243
|
-
|
|
7244
|
-
.
|
|
7245
|
-
.attr('
|
|
7246
|
-
.attr('
|
|
7247
|
-
.attr('transform',
|
|
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');
|
|
7248
7643
|
}
|
|
7249
|
-
|
|
7250
|
-
.append('g')
|
|
7251
|
-
.attr('class', 'lib-stacked-y-axis-text')
|
|
7252
|
-
.attr('style', this.chartConfiguration.yAxisCustomTextStyles)
|
|
7253
|
-
.call(axes.yAxis)
|
|
7254
|
-
.selectAll('text')
|
|
7255
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7256
|
-
}
|
|
7257
|
-
renderMobileXAxis(svg, data, dimensions) {
|
|
7258
|
-
svg.selectAll('.custom-x-label').remove();
|
|
7259
|
-
data.forEach((d, i) => {
|
|
7260
|
-
const xVal = this.CONSTANTS.LEFT_RIGHT_SPACES +
|
|
7261
|
-
i * (dimensions.barWidth + dimensions.barPadding) +
|
|
7262
|
-
dimensions.barWidth / 2;
|
|
7644
|
+
else {
|
|
7263
7645
|
svg
|
|
7264
|
-
.append('
|
|
7265
|
-
.attr('
|
|
7266
|
-
.attr('
|
|
7267
|
-
.attr('
|
|
7268
|
-
.
|
|
7269
|
-
.
|
|
7270
|
-
.style('
|
|
7271
|
-
|
|
7272
|
-
.
|
|
7273
|
-
.
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
.attr('transform', `translate(0,${dimensions.height})`)
|
|
7280
|
-
.attr('class', 'lib-stacked-x-axis-text multichart1')
|
|
7281
|
-
.call(axes.xAxis)
|
|
7282
|
-
.style('display', 'none');
|
|
7283
|
-
svgYAxisLeft
|
|
7284
|
-
.append('g')
|
|
7285
|
-
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
7286
|
-
.attr('style', this.chartConfiguration.yAxisCustomTextStyles)
|
|
7287
|
-
.call(axes.yAxis)
|
|
7288
|
-
.selectAll('text')
|
|
7289
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7290
|
-
svgYAxisRight
|
|
7291
|
-
.append('g')
|
|
7292
|
-
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
7293
|
-
.attr('style', this.chartConfiguration.yAxisCustomTextStyles)
|
|
7294
|
-
.call(axes.yAxis)
|
|
7295
|
-
.style('display', 'none');
|
|
7296
|
-
}
|
|
7297
|
-
renderMultiChartAxes(svg, axes, scales, dimensions) {
|
|
7298
|
-
svg
|
|
7299
|
-
.append('g')
|
|
7300
|
-
.attr('transform', `translate(0,${dimensions.height})`)
|
|
7301
|
-
.attr('class', 'lib-stacked-x-axis-text multichart')
|
|
7302
|
-
.call(axes.xAxis)
|
|
7303
|
-
.selectAll('text')
|
|
7304
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7305
|
-
svg
|
|
7306
|
-
.append('g')
|
|
7307
|
-
.attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
|
|
7308
|
-
.attr('style', this.chartConfiguration.yAxisCustomTextStyles)
|
|
7309
|
-
.call(axes.yAxis)
|
|
7310
|
-
.selectAll('text')
|
|
7311
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7312
|
-
}
|
|
7313
|
-
applyAxisStyling(svg, svgYAxisLeft, svgYAxisRight) {
|
|
7314
|
-
const styleAxisDomain = (container) => {
|
|
7315
|
-
container.selectAll('.domain')
|
|
7316
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
7317
|
-
.style('stroke-width', '1px');
|
|
7318
|
-
};
|
|
7319
|
-
styleAxisDomain(svg);
|
|
7320
|
-
styleAxisDomain(svgYAxisLeft);
|
|
7321
|
-
styleAxisDomain(svgYAxisRight);
|
|
7322
|
-
if (this.chartConfiguration.isYaxisDashed) {
|
|
7323
|
-
d3.selectAll('.yaxis-dashed')
|
|
7324
|
-
.style('stroke-dasharray', '5 5')
|
|
7325
|
-
.style('color', 'var(--chart-grid-color)');
|
|
7646
|
+
.append('g')
|
|
7647
|
+
.attr('transform', 'translate(0,' + height + ')')
|
|
7648
|
+
.attr('class', 'lib-stacked-x-axis-text multichart')
|
|
7649
|
+
.attr('transform', 'translate(0,' + height + ')')
|
|
7650
|
+
.call(xAxis)
|
|
7651
|
+
.selectAll('text')
|
|
7652
|
+
.style('fill', 'var(--chart-text-color)');
|
|
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)');
|
|
7326
7661
|
}
|
|
7327
|
-
|
|
7328
|
-
|
|
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
|
+
});
|
|
7329
7677
|
}
|
|
7330
|
-
|
|
7331
|
-
applyAxisConfigurations(svg, scales, dimensions, data) {
|
|
7332
|
-
if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
|
|
7678
|
+
else {
|
|
7333
7679
|
d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
|
|
7334
7680
|
}
|
|
7335
|
-
|
|
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) {
|
|
7336
7687
|
d3.selectAll('.multichart > g > text').attr('class', 'lib-display-hidden');
|
|
7337
7688
|
}
|
|
7338
|
-
else if (this.chartConfiguration.isXaxisLabelHidden
|
|
7339
|
-
|
|
7689
|
+
else if (this.chartConfiguration.isXaxisLabelHidden != undefined) {
|
|
7690
|
+
svg
|
|
7691
|
+
.append('g')
|
|
7692
|
+
.attr('class', 'x1 axis1')
|
|
7693
|
+
.attr('transform', 'translate(0,' + height + ')')
|
|
7694
|
+
.style('color', '#000')
|
|
7695
|
+
.call(d3.axisBottom(xScale).tickSize(0))
|
|
7696
|
+
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
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
|
+
*/
|
|
7714
|
+
if (alternate_text &&
|
|
7715
|
+
self.chartConfiguration.isNoAlternateXaxisText == undefined) {
|
|
7716
|
+
alternate_text = false;
|
|
7717
|
+
return long_tick_length_bg - 7;
|
|
7718
|
+
}
|
|
7719
|
+
else {
|
|
7720
|
+
alternate_text = true;
|
|
7721
|
+
return short_tick_length_bg - 4;
|
|
7722
|
+
}
|
|
7723
|
+
});
|
|
7724
|
+
/**
|
|
7725
|
+
* reset the flag so that texts also follow the pattern of ticks
|
|
7726
|
+
* used by weekly charts
|
|
7727
|
+
*/
|
|
7728
|
+
alternate_text = false;
|
|
7729
|
+
svg
|
|
7730
|
+
.selectAll('g.x1.axis1 g.tick text')
|
|
7731
|
+
// .attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
7732
|
+
.attr('class', function () {
|
|
7733
|
+
if (self.chartConfiguration.isDrilldownChart) {
|
|
7734
|
+
if (data && data.length > 8) {
|
|
7735
|
+
return 'lib-xaxis-labels-texts-drilldown-alt';
|
|
7736
|
+
}
|
|
7737
|
+
return 'lib-xaxis-labels-texts-drilldown';
|
|
7738
|
+
}
|
|
7739
|
+
else
|
|
7740
|
+
return 'lib-xaxis-labels-texts-weeklycharts';
|
|
7741
|
+
})
|
|
7742
|
+
.attr('y', function () {
|
|
7743
|
+
if (alternate_text) {
|
|
7744
|
+
alternate_text = false;
|
|
7745
|
+
return long_tick_length_bg;
|
|
7746
|
+
}
|
|
7747
|
+
else {
|
|
7748
|
+
alternate_text = true;
|
|
7749
|
+
return short_tick_length_bg;
|
|
7750
|
+
}
|
|
7751
|
+
});
|
|
7752
|
+
}
|
|
7753
|
+
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
7754
|
+
svg
|
|
7755
|
+
.selectAll('g.x1.axis1 g.tick text')
|
|
7756
|
+
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
7757
|
+
.attr('y', short_tick_length_bg)
|
|
7758
|
+
.text(function (d, i) {
|
|
7759
|
+
if (isMobile) {
|
|
7760
|
+
// If label has more than one word, show only first 3 letters of first word
|
|
7761
|
+
var firstWord = d.split(' ')[0];
|
|
7762
|
+
return firstWord.substring(0, 3);
|
|
7763
|
+
}
|
|
7764
|
+
if (d.trim().indexOf(' ') > -1) {
|
|
7765
|
+
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
7766
|
+
}
|
|
7767
|
+
return d.toLowerCase();
|
|
7768
|
+
})
|
|
7769
|
+
.attr('transform', function (d, i) {
|
|
7770
|
+
if (isMobile) {
|
|
7771
|
+
var totalBars = 0;
|
|
7772
|
+
if (this.parentNode && this.parentNode.parentNode) {
|
|
7773
|
+
totalBars = d3.select(this.parentNode.parentNode).selectAll('g.tick').size();
|
|
7774
|
+
}
|
|
7775
|
+
if (totalBars === 2) {
|
|
7776
|
+
return 'translate(0,0)';
|
|
7777
|
+
}
|
|
7778
|
+
else {
|
|
7779
|
+
return 'translate(' + (i * 30) + ',0)';
|
|
7780
|
+
}
|
|
7781
|
+
}
|
|
7782
|
+
return null;
|
|
7783
|
+
});
|
|
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();
|
|
7797
|
+
}
|
|
7798
|
+
return '';
|
|
7799
|
+
})
|
|
7800
|
+
.attr('transform', function (d, i) {
|
|
7801
|
+
if (isMobile && i === 0) {
|
|
7802
|
+
return 'translate(20,0)';
|
|
7803
|
+
}
|
|
7804
|
+
return null;
|
|
7805
|
+
});
|
|
7340
7806
|
}
|
|
7341
|
-
|
|
7342
|
-
|
|
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');
|
|
7343
7816
|
}
|
|
7344
|
-
|
|
7817
|
+
/** hide y axis labels
|
|
7818
|
+
* config is there for future use
|
|
7819
|
+
*/
|
|
7820
|
+
if (this.chartConfiguration.isYaxisHidden != undefined &&
|
|
7821
|
+
this.chartConfiguration.isYaxisHidden) {
|
|
7345
7822
|
d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
|
|
7346
7823
|
}
|
|
7347
|
-
|
|
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) {
|
|
7348
7845
|
svg
|
|
7349
7846
|
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
7350
7847
|
.attr('transform', 'rotate(-90)')
|
|
@@ -7352,272 +7849,219 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7352
7849
|
.attr('x', '-5')
|
|
7353
7850
|
.attr('dy', null);
|
|
7354
7851
|
}
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
.
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
.
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
this.styleCustomXAxisTicks(svg, data, device);
|
|
7366
|
-
if (this.chartConfiguration.xLabelsOnSameLine) {
|
|
7367
|
-
this.applyXLabelsOnSameLine(svg, device);
|
|
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');
|
|
7368
7862
|
}
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
return 0;
|
|
7375
|
-
if (alternateText && !this.chartConfiguration.isNoAlternateXaxisText) {
|
|
7376
|
-
alternateText = false;
|
|
7377
|
-
return this.CONSTANTS.LONG_TICK_LENGTH_BG - 7;
|
|
7378
|
-
}
|
|
7379
|
-
alternateText = true;
|
|
7380
|
-
return this.CONSTANTS.SHORT_TICK_LENGTH_BG - 4;
|
|
7381
|
-
});
|
|
7382
|
-
alternateText = false;
|
|
7383
|
-
svg
|
|
7384
|
-
.selectAll('g.x1.axis1 g.tick text')
|
|
7385
|
-
.attr('class', () => {
|
|
7386
|
-
if (this.chartConfiguration.isDrilldownChart) {
|
|
7387
|
-
return data.length > 8
|
|
7388
|
-
? 'lib-xaxis-labels-texts-drilldown-alt'
|
|
7389
|
-
: 'lib-xaxis-labels-texts-drilldown';
|
|
7390
|
-
}
|
|
7391
|
-
return 'lib-xaxis-labels-texts-weeklycharts';
|
|
7392
|
-
})
|
|
7393
|
-
.attr('y', () => {
|
|
7394
|
-
if (alternateText) {
|
|
7395
|
-
alternateText = false;
|
|
7396
|
-
return this.CONSTANTS.LONG_TICK_LENGTH_BG;
|
|
7397
|
-
}
|
|
7398
|
-
alternateText = true;
|
|
7399
|
-
return this.CONSTANTS.SHORT_TICK_LENGTH_BG;
|
|
7400
|
-
});
|
|
7401
|
-
}
|
|
7402
|
-
applyXLabelsOnSameLine(svg, device) {
|
|
7403
|
-
svg
|
|
7404
|
-
.selectAll('g.x1.axis1 g.tick text')
|
|
7405
|
-
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
7406
|
-
.attr('y', this.CONSTANTS.SHORT_TICK_LENGTH_BG)
|
|
7407
|
-
.text((d) => {
|
|
7408
|
-
if (device.isMobile) {
|
|
7409
|
-
return d.split(' ')[0].substring(0, 3);
|
|
7410
|
-
}
|
|
7411
|
-
const trimmed = d.trim();
|
|
7412
|
-
const spaceIndex = trimmed.indexOf(' ');
|
|
7413
|
-
return spaceIndex > -1
|
|
7414
|
-
? trimmed.substring(0, spaceIndex).toLowerCase()
|
|
7415
|
-
: trimmed.toLowerCase();
|
|
7416
|
-
})
|
|
7417
|
-
.attr('transform', function (d, i) {
|
|
7418
|
-
if (device.isMobile) {
|
|
7419
|
-
const parent = this.parentNode?.parentNode;
|
|
7420
|
-
const totalBars = parent ? d3.select(parent).selectAll('g.tick').size() : 0;
|
|
7421
|
-
return totalBars === 2 ? 'translate(0,0)' : `translate(${i * 30},0)`;
|
|
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));
|
|
7422
7868
|
}
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
rect.append('svg:title').text((d) => d[1] - d[0]);
|
|
7447
|
-
}
|
|
7448
|
-
if (this.chartConfiguration.showTotalOnTop) {
|
|
7449
|
-
this.renderTopLabels(rect, scales, metaData);
|
|
7450
|
-
}
|
|
7451
|
-
if (this.chartConfiguration.showAngledLabels) {
|
|
7452
|
-
this.renderAngledLabels(rect, scales, metaData);
|
|
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');
|
|
7453
7892
|
}
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
.
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
.attr('fill', (d) => metaData.colors[d.key])
|
|
7486
|
-
.attr('class', 'lib-data-labels-angled-weeklycharts')
|
|
7487
|
-
.text((d) => {
|
|
7488
|
-
const value = d[1] - d[0];
|
|
7489
|
-
if (isNaN(value) || value <= 0)
|
|
7490
|
-
return;
|
|
7491
|
-
const formattedValue = value <= 999
|
|
7492
|
-
? formatFromBackend(value)
|
|
7493
|
-
: formatForHugeNumbers(value);
|
|
7494
|
-
return metaData.unit ? metaData.unit + formattedValue : formattedValue;
|
|
7495
|
-
})
|
|
7496
|
-
.attr('transform', (d) => {
|
|
7497
|
-
const value = d[1] - d[0];
|
|
7498
|
-
if (isNaN(value) || value <= 0)
|
|
7499
|
-
return 'rotate(0)';
|
|
7500
|
-
let total = 0;
|
|
7501
|
-
let incrementer = 1;
|
|
7502
|
-
metaData.keyList.forEach(key => {
|
|
7503
|
-
if (d.data[key]) {
|
|
7504
|
-
total += d.data[key];
|
|
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;
|
|
7505
7924
|
}
|
|
7506
|
-
|
|
7507
|
-
|
|
7925
|
+
if (self.chartData.targetLineData &&
|
|
7926
|
+
self.chartData.targetLineData.targetName) {
|
|
7927
|
+
targetLineName = self.chartData.targetLineData.targetName;
|
|
7508
7928
|
}
|
|
7929
|
+
return (`<div>${targetLineName}</div>` +
|
|
7930
|
+
'<div>' +
|
|
7931
|
+
self.chartData.targetLineData.target +
|
|
7932
|
+
'' +
|
|
7933
|
+
dataTypeTemp +
|
|
7934
|
+
'</div>');
|
|
7509
7935
|
});
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
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)));
|
|
7522
7957
|
}
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
if (!this.chartData.targetLineData)
|
|
7527
|
-
return;
|
|
7528
|
-
const parsedTarget = this.parseTargetValue(this.chartData.targetLineData.target);
|
|
7529
|
-
const yZero = scales.yScale(parsedTarget);
|
|
7530
|
-
svg
|
|
7531
|
-
.append('line')
|
|
7532
|
-
.attr('x1', 0)
|
|
7533
|
-
.attr('x2', dimensions.width)
|
|
7534
|
-
.attr('y1', yZero)
|
|
7535
|
-
.attr('y2', yZero)
|
|
7536
|
-
.style('stroke-dasharray', '5 5')
|
|
7537
|
-
.style('stroke', this.chartData.targetLineData.color);
|
|
7538
|
-
this.renderTargetLabel(svgYAxisRight, yZero, metaData);
|
|
7539
|
-
}
|
|
7540
|
-
parseTargetValue(target) {
|
|
7541
|
-
const parsed = parseFloat(String(target));
|
|
7542
|
-
if (isNaN(parsed))
|
|
7543
|
-
return 0;
|
|
7544
|
-
return Number.isInteger(parsed) ? parseInt(String(target)) : parsed;
|
|
7545
|
-
}
|
|
7546
|
-
renderTargetLabel(svgYAxisRight, yZero, metaData) {
|
|
7547
|
-
const dataType = metaData.dataType || '';
|
|
7548
|
-
const targetName = this.chartData.targetLineData.targetName || 'target';
|
|
7549
|
-
svgYAxisRight
|
|
7550
|
-
.append('foreignObject')
|
|
7551
|
-
.attr('transform', `translate(0,${yZero - 13})`)
|
|
7552
|
-
.attr('width', this.CONSTANTS.RIGHT_SVG_WIDTH)
|
|
7553
|
-
.attr('height', 50)
|
|
7554
|
-
.append('xhtml:div')
|
|
7555
|
-
.attr('class', 'target-display')
|
|
7556
|
-
.style('color', 'var(--chart-text-color)')
|
|
7557
|
-
.html(`<div>${targetName}</div><div>${this.chartData.targetLineData.target}${dataType}</div>`);
|
|
7558
|
-
}
|
|
7559
|
-
renderLineChart(svg, lineData, scales, colors, metaData) {
|
|
7560
|
-
if (!lineData || !colors)
|
|
7561
|
-
return;
|
|
7562
|
-
const dataGroup = d3
|
|
7563
|
-
.nest()
|
|
7564
|
-
.key((d) => d.category)
|
|
7565
|
-
.entries(lineData);
|
|
7566
|
-
const lineGen = d3
|
|
7567
|
-
.line()
|
|
7568
|
-
.x((d) => scales.xScale(d.name) + scales.xScale.bandwidth() / 2)
|
|
7569
|
-
.y((d) => scales.lineYscale(d.value));
|
|
7570
|
-
dataGroup.forEach((group) => {
|
|
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);
|
|
7571
7961
|
svg
|
|
7572
|
-
.append('path')
|
|
7573
|
-
.datum(group.values)
|
|
7574
|
-
.attr('fill', 'none')
|
|
7575
|
-
.attr('stroke', (d) => {
|
|
7576
|
-
return d[0]?.category
|
|
7577
|
-
? colors[d[0].category]
|
|
7578
|
-
: this.chartConfiguration.lineGraphColor;
|
|
7579
|
-
})
|
|
7580
|
-
.attr('stroke-width', 2.5)
|
|
7581
|
-
.attr('d', lineGen);
|
|
7582
|
-
this.renderLineDots(svg, group.values, scales, colors);
|
|
7583
|
-
});
|
|
7584
|
-
}
|
|
7585
|
-
renderLineDots(svg, values, scales, colors) {
|
|
7586
|
-
const dot = svg
|
|
7587
|
-
.selectAll('.line-dots')
|
|
7588
|
-
.data(values)
|
|
7589
|
-
.enter()
|
|
7590
|
-
.append('g')
|
|
7591
|
-
.on('click', (d) => this.handleClick(d));
|
|
7592
|
-
dot
|
|
7593
|
-
.append('circle')
|
|
7594
|
-
.attr('fill', (d) => {
|
|
7595
|
-
return d.category
|
|
7596
|
-
? colors[d.category]
|
|
7597
|
-
: this.chartConfiguration.lineGraphColor;
|
|
7598
|
-
})
|
|
7599
|
-
.attr('stroke', 'none')
|
|
7600
|
-
.attr('cx', (d) => scales.xScale(d.name) + scales.xScale.bandwidth() / 2)
|
|
7601
|
-
.attr('cy', (d) => scales.lineYscale(d.value))
|
|
7602
|
-
.attr('r', 3)
|
|
7603
|
-
.style('cursor', 'pointer');
|
|
7604
|
-
if (this.chartConfiguration.lineGraphColor) {
|
|
7605
|
-
dot
|
|
7606
7962
|
.append('text')
|
|
7607
|
-
.attr('class',
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7963
|
+
.attr('class', function () {
|
|
7964
|
+
let baseClass = 'lib-axis-group-label font-size-1';
|
|
7965
|
+
if (self.chartConfiguration.isDrilldownChart)
|
|
7966
|
+
return baseClass + ' lib-xlabel-drilldowncharts';
|
|
7967
|
+
if (self.chartConfiguration.isMultiChartGridLine != undefined)
|
|
7968
|
+
return baseClass + ' lib-xlabel-weeklyCharts';
|
|
7969
|
+
return baseClass + ' lib-axis-waterfall-label';
|
|
7970
|
+
})
|
|
7971
|
+
.attr('style', self.chartConfiguration.xAxisCustomlabelStyles)
|
|
7972
|
+
.attr('transform', 'translate(' + width / 2 + ' ,' + xPosition + ')')
|
|
7973
|
+
.style('text-anchor', 'middle')
|
|
7974
|
+
.style('fill', 'var(--chart-text-color)')
|
|
7975
|
+
.text(isAcr ? xLabelText.toUpperCase() : xLabelText.toLowerCase())
|
|
7976
|
+
.style('text-transform', isAcr ? 'none' : 'capitalize');
|
|
7977
|
+
}
|
|
7978
|
+
if (lineData && colors) {
|
|
7979
|
+
var dataGroup = d3
|
|
7980
|
+
.nest()
|
|
7981
|
+
.key(function (d) {
|
|
7982
|
+
return d.category;
|
|
7983
|
+
})
|
|
7984
|
+
.entries(lineData);
|
|
7985
|
+
var lineGen = d3
|
|
7986
|
+
.line()
|
|
7987
|
+
.x(function (d) {
|
|
7988
|
+
return xScale(d.name) + xScale.bandwidth() / 2;
|
|
7989
|
+
})
|
|
7990
|
+
.y(function (d) {
|
|
7991
|
+
return lineYscale(d.value);
|
|
7992
|
+
});
|
|
7993
|
+
var calculateCX = (d) => {
|
|
7994
|
+
return xScale(d.name) + xScale.bandwidth() / 2;
|
|
7995
|
+
};
|
|
7996
|
+
var calculateCY = (d) => {
|
|
7997
|
+
return lineYscale(d.value);
|
|
7998
|
+
};
|
|
7999
|
+
dataGroup.forEach(function (d, i) {
|
|
8000
|
+
svg
|
|
8001
|
+
.append('path')
|
|
8002
|
+
.datum(d.values)
|
|
8003
|
+
.attr('fill', 'none')
|
|
8004
|
+
.attr('stroke', function (d) {
|
|
8005
|
+
if ('category' in d[0]) {
|
|
8006
|
+
return colors[d[0].category];
|
|
8007
|
+
}
|
|
8008
|
+
else {
|
|
8009
|
+
return self.chartConfiguration.lineGraphColor;
|
|
8010
|
+
}
|
|
8011
|
+
})
|
|
8012
|
+
.attr('stroke-width', 2.5) /**line thinkness */
|
|
8013
|
+
.attr('d', lineGen(d.values));
|
|
8014
|
+
var dot = svg
|
|
8015
|
+
.selectAll('myCircles')
|
|
8016
|
+
.data(d.values)
|
|
8017
|
+
.enter()
|
|
8018
|
+
.append('g')
|
|
8019
|
+
.on('click', function (d) {
|
|
8020
|
+
self.handleClick(d);
|
|
8021
|
+
});
|
|
8022
|
+
dot
|
|
8023
|
+
.append('circle')
|
|
8024
|
+
.attr('fill', function (d) {
|
|
8025
|
+
if ('category' in d) {
|
|
8026
|
+
return colors[d.category];
|
|
8027
|
+
}
|
|
8028
|
+
else {
|
|
8029
|
+
return self.chartConfiguration.lineGraphColor;
|
|
8030
|
+
}
|
|
8031
|
+
})
|
|
8032
|
+
.attr('stroke', 'none')
|
|
8033
|
+
.attr('cx', function (d, i) {
|
|
8034
|
+
return xScale(d.name) + xScale.bandwidth() / 2;
|
|
8035
|
+
})
|
|
8036
|
+
.attr('cy', function (d, i) {
|
|
8037
|
+
return lineYscale(d.value);
|
|
8038
|
+
})
|
|
8039
|
+
.attr('r', 3) /**radius of circle=5 */
|
|
8040
|
+
.style('cursor', 'pointer');
|
|
8041
|
+
if (self.chartConfiguration.lineGraphColor) {
|
|
8042
|
+
dot
|
|
8043
|
+
.append('text')
|
|
8044
|
+
.attr('class', 'dots')
|
|
8045
|
+
.attr('fill', self.chartConfiguration.lineGraphColor)
|
|
8046
|
+
.attr('style', 'font-size: ' + '.85em;' + 'font-weight:' + 'bold')
|
|
8047
|
+
.attr('x', function (d, i) {
|
|
8048
|
+
return xScale(d.name) + xScale.bandwidth() / 2;
|
|
8049
|
+
})
|
|
8050
|
+
.attr('y', function (d, i) {
|
|
8051
|
+
return lineYscale(d.value);
|
|
8052
|
+
})
|
|
8053
|
+
.attr('dy', '-1em')
|
|
8054
|
+
.text(function (d, i) {
|
|
8055
|
+
return self.chartConfiguration.labelFormatter(d.value);
|
|
8056
|
+
});
|
|
8057
|
+
}
|
|
8058
|
+
});
|
|
7615
8059
|
}
|
|
8060
|
+
// svg.attr('width', 150).style('max-width', 150).style('overflow-x', 'auto');
|
|
7616
8061
|
}
|
|
7617
8062
|
handleClick(d) {
|
|
7618
|
-
if (this.chartData?.metaData?.hasDrillDown || d?.toggleFrom)
|
|
8063
|
+
if (this.chartData?.metaData?.hasDrillDown || d?.toggleFrom)
|
|
7619
8064
|
this.clickEvent.emit(d);
|
|
7620
|
-
}
|
|
7621
8065
|
}
|
|
7622
8066
|
handleHeaderMenuClick(id) {
|
|
7623
8067
|
this.headerMenuclickEvent.emit(id);
|
|
@@ -7626,14 +8070,15 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7626
8070
|
this.clickEvent.emit(event);
|
|
7627
8071
|
}
|
|
7628
8072
|
handleZoominZoomoutClick({ isZoomOut, event }) {
|
|
8073
|
+
// this.isZoomOutSelected(isZoomOut, event);
|
|
7629
8074
|
this.isZoomOutSelected(isZoomOut);
|
|
7630
8075
|
}
|
|
7631
8076
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7632
|
-
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 }); }
|
|
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 }); }
|
|
7633
8078
|
}
|
|
7634
8079
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HorizontalBarsWithScrollZoomComponent, decorators: [{
|
|
7635
8080
|
type: Component,
|
|
7636
|
-
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"] }]
|
|
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"] }]
|
|
7637
8082
|
}], ctorParameters: () => [], propDecorators: { containerElt: [{
|
|
7638
8083
|
type: ViewChild,
|
|
7639
8084
|
args: ['verticalstackedchartcontainer', { static: true }]
|
|
@@ -7757,484 +8202,78 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7757
8202
|
let isria = this.customChartConfiguration.isRia;
|
|
7758
8203
|
var x;
|
|
7759
8204
|
var alternate_text = false;
|
|
7760
|
-
var short_tick_length = 4;
|
|
7761
|
-
var long_tick_length = 16;
|
|
7762
|
-
/**
|
|
7763
|
-
* longer tick length needed for weekly charts
|
|
7764
|
-
*/
|
|
7765
|
-
var short_tick_length_bg = 5;
|
|
7766
|
-
var long_tick_length_bg = 30;
|
|
7767
|
-
var leftAndRightSpaces = 50;
|
|
7768
|
-
var rightSvgWidth = 60;
|
|
7769
|
-
var tempScale;
|
|
7770
|
-
for (var i in this.defaultConfiguration) {
|
|
7771
|
-
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
7772
|
-
}
|
|
7773
|
-
data = this.chartData.data;
|
|
7774
|
-
metaData = this.chartData.metaData;
|
|
7775
|
-
lineData = this.chartData.lineData;
|
|
7776
|
-
// if (lineData || this.chartData.targetLineData) {
|
|
7777
|
-
// rightSvgWidth = 60;
|
|
7778
|
-
// }
|
|
7779
|
-
if (!metaData.colorAboveTarget) {
|
|
7780
|
-
metaData['colorAboveTarget'] = metaData.colors;
|
|
7781
|
-
}
|
|
7782
|
-
colorMap = metaData.colors;
|
|
7783
|
-
keyList = metaData.keyList;
|
|
7784
|
-
var chartContainer = d3.select(this.containerElt.nativeElement);
|
|
7785
|
-
var verticalstackedcontainer = d3.select(this.groupcontainerElt.nativeElement);
|
|
7786
|
-
var margin = this.chartConfiguration.margin;
|
|
7787
|
-
var width = parseInt(chartContainer.style('width')) - margin.left - margin.right;
|
|
7788
|
-
if (this.chartData.data.length > 30 && this.isZoomedOut) {
|
|
7789
|
-
width =
|
|
7790
|
-
width > this.chartData.data.length * 40
|
|
7791
|
-
? this.chartData.dropdownData1
|
|
7792
|
-
? this.chartData.data.length * 60
|
|
7793
|
-
: width
|
|
7794
|
-
: this.chartData.dropdownData1
|
|
7795
|
-
? this.chartData.data.length * 60
|
|
7796
|
-
: this.chartData.data.length * 40;
|
|
7797
|
-
width =
|
|
7798
|
-
width > this.chartData.data.length * 40
|
|
7799
|
-
? width
|
|
7800
|
-
: this.chartData.data.length * 40;
|
|
7801
|
-
}
|
|
7802
|
-
if (this.chartData.dropdownData2 &&
|
|
7803
|
-
width < this.chartData.data.length * 120 &&
|
|
7804
|
-
this.isZoomedOut) {
|
|
7805
|
-
width = this.chartData.data.length * 120;
|
|
7806
|
-
}
|
|
7807
|
-
if (this.chartData.data.length > 8 && !this.isZoomedOut) {
|
|
7808
|
-
if (this.chartData.dropdownData2 &&
|
|
7809
|
-
width < this.chartData.data.length * 250) {
|
|
7810
|
-
width = this.chartData.data.length * 250;
|
|
7811
|
-
}
|
|
7812
|
-
else
|
|
7813
|
-
width = this.chartData.data.length * 160;
|
|
7814
|
-
}
|
|
7815
|
-
// if (this.chartData.data.length > 8) {
|
|
7816
|
-
// width = this.chartData.data.length * 140;
|
|
7817
|
-
// }
|
|
7818
|
-
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
7819
|
-
(self.chartConfiguration.svgHeight / 100) -
|
|
7820
|
-
margin.top -
|
|
7821
|
-
margin.bottom;
|
|
7822
|
-
/**
|
|
7823
|
-
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
7824
|
-
*/
|
|
7825
|
-
if (this.chartConfiguration.isFullScreen != undefined &&
|
|
7826
|
-
this.chartConfiguration.isFullScreen) {
|
|
7827
|
-
height =
|
|
7828
|
-
this.chartConfiguration.svgHeight != 70
|
|
7829
|
-
? this.chartConfiguration.svgHeight
|
|
7830
|
-
: parseInt(verticalstackedcontainer.style('height'));
|
|
7831
|
-
}
|
|
7832
|
-
if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
|
|
7833
|
-
height =
|
|
7834
|
-
parseInt(verticalstackedcontainer.style('height')) -
|
|
7835
|
-
margin.top -
|
|
7836
|
-
margin.bottom -
|
|
7837
|
-
130;
|
|
7838
|
-
}
|
|
7839
|
-
if (this.chartConfiguration.isHeaderVisible) {
|
|
7840
|
-
height =
|
|
7841
|
-
parseInt(verticalstackedcontainer.style('height')) -
|
|
7842
|
-
margin.top -
|
|
7843
|
-
margin.bottom -
|
|
7844
|
-
100;
|
|
7845
|
-
}
|
|
7846
|
-
/**
|
|
7847
|
-
* for hiding header
|
|
7848
|
-
* used by weekly charts
|
|
7849
|
-
*/
|
|
7850
|
-
if (this.chartConfiguration.isHeaderVisible != undefined)
|
|
7851
|
-
this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
|
|
7852
|
-
/**
|
|
7853
|
-
* for hiding legends
|
|
7854
|
-
* used by weekly charts
|
|
7855
|
-
*/
|
|
7856
|
-
if (this.chartConfiguration.legendVisible != undefined) {
|
|
7857
|
-
this.legendVisible = this.chartConfiguration.legendVisible;
|
|
7858
|
-
}
|
|
7859
|
-
/**
|
|
7860
|
-
* for removing background color so that it can take parents color
|
|
7861
|
-
*
|
|
7862
|
-
*/
|
|
7863
|
-
if (this.chartConfiguration.isTransparentBackground != undefined) {
|
|
7864
|
-
this.isTransparentBackground =
|
|
7865
|
-
this.chartConfiguration.isTransparentBackground;
|
|
7866
|
-
}
|
|
7867
|
-
/**
|
|
7868
|
-
* format data values based on configuration received
|
|
7869
|
-
*/
|
|
7870
|
-
if (this.chartConfiguration.textFormatter != undefined) {
|
|
7871
|
-
formatFromBackend = ChartHelper.dataValueFormatter(this.chartConfiguration.textFormatter);
|
|
7872
|
-
formatForHugeNumbers = ChartHelper.dataValueFormatter('.2s');
|
|
7873
|
-
}
|
|
7874
|
-
var outerContainer = chartContainer
|
|
7875
|
-
.append('div')
|
|
7876
|
-
.attr('id', self.uniqueId)
|
|
7877
|
-
.attr('class', 'outer-container')
|
|
7878
|
-
.style('width', '100%')
|
|
7879
|
-
.style('height', height)
|
|
7880
|
-
.style('overflow-x', 'hidden')
|
|
7881
|
-
.style('padding-left', `${margin.left}px`)
|
|
7882
|
-
// .call(ChartHelper.responsivefy)
|
|
7883
|
-
.style('padding-right', `${rightSvgWidth}px`)
|
|
7884
|
-
.style('margin-left', '15px');
|
|
7885
|
-
var svgYAxisLeft = outerContainer
|
|
7886
|
-
.append('svg')
|
|
7887
|
-
.attr('width', '100')
|
|
7888
|
-
.attr('height', height + margin.top + margin.bottom + 10)
|
|
7889
|
-
.style('position', 'absolute')
|
|
7890
|
-
.style('left', '0')
|
|
7891
|
-
.style('z-index', 1)
|
|
7892
|
-
.append('g')
|
|
7893
|
-
.attr('transform', 'translate(' + (margin.left + 15) + ',' + margin.top + ')');
|
|
7894
|
-
var svgYAxisRight = outerContainer
|
|
7895
|
-
.append('svg')
|
|
7896
|
-
.attr('width', rightSvgWidth)
|
|
7897
|
-
.attr('height', height + margin.top + margin.bottom + 10)
|
|
7898
|
-
.style('position', 'absolute')
|
|
7899
|
-
.style('right', '12px')
|
|
7900
|
-
.style('z-index', 1)
|
|
7901
|
-
.append('g')
|
|
7902
|
-
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7903
|
-
var innerContainer = outerContainer
|
|
7904
|
-
.append('div')
|
|
7905
|
-
.attr('class', 'inner-container')
|
|
7906
|
-
.style('width', '100%')
|
|
7907
|
-
.style('overflow-x', 'auto');
|
|
7908
|
-
var svg = innerContainer
|
|
7909
|
-
.append('svg')
|
|
7910
|
-
// .attr('id', self.uniqueId)
|
|
7911
|
-
.attr('width', width - rightSvgWidth)
|
|
7912
|
-
.attr('height', height + margin.top + margin.bottom + 60)
|
|
7913
|
-
// .call(ChartHelper.responsivefy)
|
|
7914
|
-
.append('g')
|
|
7915
|
-
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7916
|
-
var subgroups = keyList;
|
|
7917
|
-
var groups = d3
|
|
7918
|
-
.map(data, function (d) {
|
|
7919
|
-
return d.name;
|
|
7920
|
-
})
|
|
7921
|
-
.keys();
|
|
7922
|
-
/**
|
|
7923
|
-
* x axis range made similar to line chart or vertical stack so that all the charts will get aligned with each other.
|
|
7924
|
-
*/
|
|
7925
|
-
if (this.chartConfiguration.isMultiChartGridLine != undefined) {
|
|
7926
|
-
x = d3
|
|
7927
|
-
.scaleBand()
|
|
7928
|
-
.rangeRound([width, 0])
|
|
7929
|
-
.align(0.5)
|
|
7930
|
-
.padding([0.5])
|
|
7931
|
-
.domain(data.map(function (d) {
|
|
7932
|
-
return d.name.toLowerCase();
|
|
7933
|
-
}));
|
|
7934
|
-
}
|
|
7935
|
-
else {
|
|
7936
|
-
x = d3
|
|
7937
|
-
.scaleBand()
|
|
7938
|
-
.domain(groups)
|
|
7939
|
-
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
7940
|
-
.padding([0.3]);
|
|
7941
|
-
}
|
|
7942
|
-
// x.bandwidth(96);
|
|
7943
|
-
var xScaleFromOrigin = d3
|
|
7944
|
-
.scaleBand()
|
|
7945
|
-
.domain(groups)
|
|
7946
|
-
.range([0, width - rightSvgWidth]);
|
|
7947
|
-
// .padding([0.2]);
|
|
7948
|
-
/**
|
|
7949
|
-
* draw second x axis on top
|
|
7950
|
-
*/
|
|
7951
|
-
// if (self.chartConfiguration.showXaxisTop) {
|
|
7952
|
-
// svg
|
|
7953
|
-
// .append('g')
|
|
7954
|
-
// .attr('class', 'lib-line-axis-text lib-line-x-axis-text x-axis')
|
|
7955
|
-
// .attr('style', self.chartConfiguration.xAxisCustomTextStyles)
|
|
7956
|
-
// .call(d3.axisBottom(x).tickSize(0));
|
|
7957
|
-
// }
|
|
7958
|
-
// d3.svg.axis().scale(x).orient('bottom').ticks(1).innerTickSize(-height);
|
|
7959
|
-
if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7960
|
-
/**
|
|
7961
|
-
* normal ticks for all dashboard charts
|
|
7962
|
-
*/
|
|
7963
|
-
svg
|
|
7964
|
-
.append('g')
|
|
7965
|
-
.attr('class', 'x1 axis1')
|
|
7966
|
-
.attr('transform', 'translate(0,' + height + ')')
|
|
7967
|
-
.call(d3.axisBottom(x))
|
|
7968
|
-
.call((g) => g.select('.domain').remove());
|
|
7969
|
-
svg.selectAll('g.x1.axis1 g.tick line').remove();
|
|
7970
|
-
// Only move x-axis labels further down for grouped charts if there is no xLabel
|
|
7971
|
-
if (subgroups.length > 1 && !metaData.xLabel) {
|
|
7972
|
-
svg
|
|
7973
|
-
.selectAll('g.x1.axis1 g.tick text')
|
|
7974
|
-
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
7975
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7976
|
-
.attr('y', 32); // Increase distance from bars (default is ~9)
|
|
7977
|
-
}
|
|
7978
|
-
else {
|
|
7979
|
-
svg
|
|
7980
|
-
.selectAll('g.x1.axis1 g.tick text')
|
|
7981
|
-
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
7982
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7983
|
-
}
|
|
7984
|
-
// .attr('y', function () {
|
|
7985
|
-
// if (alternate_text) {
|
|
7986
|
-
// alternate_text = false;
|
|
7987
|
-
// return long_tick_length + 1;
|
|
7988
|
-
// } else {
|
|
7989
|
-
// alternate_text = true;
|
|
7990
|
-
// return short_tick_length + 1;
|
|
7991
|
-
// }
|
|
7992
|
-
// });
|
|
7993
|
-
}
|
|
7994
|
-
else {
|
|
7995
|
-
/**
|
|
7996
|
-
* bigger ticks for weekly charts and more space from x axis to labels
|
|
7997
|
-
*/
|
|
7998
|
-
/**
|
|
7999
|
-
* draw x axis
|
|
8000
|
-
*/
|
|
8001
|
-
svg
|
|
8002
|
-
.append('g')
|
|
8003
|
-
.attr('class', 'x1 axis1')
|
|
8004
|
-
.attr('transform', 'translate(0,' + height + ')')
|
|
8005
|
-
.call(d3.axisBottom(x).tickSize(0))
|
|
8006
|
-
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
8007
|
-
/**
|
|
8008
|
-
* tick line size in alternate fashion
|
|
8009
|
-
*/
|
|
8010
|
-
svg.selectAll('g.x1.axis1 g.tick line').attr('y2', function () {
|
|
8011
|
-
if (alternate_text &&
|
|
8012
|
-
self.chartConfiguration.isNoAlternateXaxisText == undefined) {
|
|
8013
|
-
alternate_text = false;
|
|
8014
|
-
return long_tick_length_bg - 7;
|
|
8015
|
-
}
|
|
8016
|
-
else {
|
|
8017
|
-
alternate_text = true;
|
|
8018
|
-
return short_tick_length_bg - 4;
|
|
8019
|
-
}
|
|
8020
|
-
});
|
|
8021
|
-
/**
|
|
8022
|
-
* reset the flag so that values can be shown in same alternate fashion
|
|
8023
|
-
*/
|
|
8024
|
-
alternate_text = false;
|
|
8025
|
-
/**
|
|
8026
|
-
* print x-axis label texts
|
|
8027
|
-
* used by weekly charts
|
|
8028
|
-
*/
|
|
8029
|
-
svg
|
|
8030
|
-
.selectAll('g.x1.axis1 g.tick text')
|
|
8031
|
-
.attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
8032
|
-
.attr('y', function () {
|
|
8033
|
-
// Minimize gap in maximized (fullscreen) view for weekly charts
|
|
8034
|
-
if (self.chartConfiguration.isFullScreen) {
|
|
8035
|
-
return short_tick_length_bg;
|
|
8036
|
-
}
|
|
8037
|
-
if (alternate_text) {
|
|
8038
|
-
alternate_text = false;
|
|
8039
|
-
return long_tick_length_bg;
|
|
8040
|
-
}
|
|
8041
|
-
else {
|
|
8042
|
-
alternate_text = true;
|
|
8043
|
-
return short_tick_length_bg;
|
|
8044
|
-
}
|
|
8045
|
-
});
|
|
8046
|
-
}
|
|
8047
|
-
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
8048
|
-
const xAxisLabels = svg
|
|
8049
|
-
.selectAll('g.x1.axis1 g.tick text')
|
|
8050
|
-
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8051
|
-
.style('font-size', this.isHeaderVisible ? '18px' : '14px')
|
|
8052
|
-
.attr('text-anchor', 'middle')
|
|
8053
|
-
.attr('y', function (d) {
|
|
8054
|
-
// For grouped bar charts with many bars and xLabel present, only add 5 if the label is a date
|
|
8055
|
-
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
8056
|
-
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8057
|
-
if (self.chartConfiguration.isFullScreen) {
|
|
8058
|
-
return isDateLabel ? short_tick_length_bg + 14 : short_tick_length_bg;
|
|
8059
|
-
}
|
|
8060
|
-
return isDateLabel ? short_tick_length_bg + 14 : short_tick_length_bg;
|
|
8061
|
-
}
|
|
8062
|
-
// For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
|
|
8063
|
-
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
8064
|
-
const chartHasExtraBottom = (self.chartConfiguration.margin && self.chartConfiguration.margin.bottom >= 40);
|
|
8065
|
-
if (self.chartConfiguration.isFullScreen) {
|
|
8066
|
-
// Reduce extra gap in maximized view
|
|
8067
|
-
return short_tick_length_bg + 2;
|
|
8068
|
-
}
|
|
8069
|
-
return chartHasExtraBottom ? short_tick_length_bg : short_tick_length_bg + 10;
|
|
8070
|
-
}
|
|
8071
|
-
// Default/fallback logic for other cases
|
|
8072
|
-
let baseY = self.isHeaderVisible ? short_tick_length_bg + 25 : short_tick_length_bg;
|
|
8073
|
-
if (subgroups.length > 1 &&
|
|
8074
|
-
!metaData.xLabel &&
|
|
8075
|
-
(/\d{2,4}[-\/]\d{2}[-\/]\d{2,4}/.test(d) || /\d{2,4}[-\/]\d{2,4}/.test(d))) {
|
|
8076
|
-
baseY = self.isHeaderVisible ? short_tick_length_bg + 15 : short_tick_length_bg + 25;
|
|
8077
|
-
}
|
|
8078
|
-
if (/\d{2,4}[-\/]\d{2,4}/.test(d) && d.indexOf(' ') > -1) {
|
|
8079
|
-
baseY += 4;
|
|
8080
|
-
}
|
|
8081
|
-
// In maximized view, reduce baseY slightly for grouped bars
|
|
8082
|
-
if (self.chartConfiguration.isFullScreen && subgroups.length > 1) {
|
|
8083
|
-
baseY = Math.max(short_tick_length_bg, baseY - 10);
|
|
8084
|
-
}
|
|
8085
|
-
return baseY;
|
|
8086
|
-
})
|
|
8087
|
-
.attr('x', function (d) {
|
|
8088
|
-
if (self.chartData.data.length > 8 && !self.isZoomedOut) {
|
|
8089
|
-
return 1; // Move first line text slightly to the left in zoom-in view for better alignment
|
|
8090
|
-
}
|
|
8091
|
-
return 0; // Default position
|
|
8092
|
-
})
|
|
8093
|
-
.text(function (d) {
|
|
8094
|
-
var isValueToBeIgnored = false;
|
|
8095
|
-
if (isMobile && !self.isHeaderVisible) {
|
|
8096
|
-
let firstPart = d.split(/[\s\-]+/)[0];
|
|
8097
|
-
return firstPart.substring(0, 3).toLowerCase();
|
|
8098
|
-
}
|
|
8099
|
-
data.map((indiv) => {
|
|
8100
|
-
if (indiv.name &&
|
|
8101
|
-
indiv.name.toLowerCase() == d.trim().toLowerCase() &&
|
|
8102
|
-
indiv[metaData.keyList[0]] == -1) {
|
|
8103
|
-
isValueToBeIgnored = true;
|
|
8104
|
-
}
|
|
8105
|
-
});
|
|
8106
|
-
if (isValueToBeIgnored) {
|
|
8107
|
-
return '';
|
|
8108
|
-
}
|
|
8109
|
-
// Always add space before and after hyphen for date range labels, even when header is visible and label is single line
|
|
8110
|
-
// Apply for grouped bar charts and single bar charts, header visible, single line
|
|
8111
|
-
const dateRangeRegex = /(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})\s*-\s*(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})/;
|
|
8112
|
-
if (dateRangeRegex.test(d.trim())) {
|
|
8113
|
-
return d.trim().replace(dateRangeRegex, (m, d1, d2) => `${d1} - ${d2}`);
|
|
8114
|
-
}
|
|
8115
|
-
// Split date and week labels into two lines in grouped bar zoom-in view (and minimized view)
|
|
8116
|
-
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8117
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
8118
|
-
if (subgroups.length > 1 && !self.isZoomedOut && data.length > 8 && d.indexOf(' ') > -1 && (isDateLabel || isWeekLabel)) {
|
|
8119
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
8120
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
8121
|
-
return first + '\n' + second;
|
|
8122
|
-
}
|
|
8123
|
-
// Also keep previous logic for minimized view
|
|
8124
|
-
if (isDateLabel) {
|
|
8125
|
-
if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
|
|
8126
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
8127
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
8128
|
-
return first + '\n' + second;
|
|
8129
|
-
}
|
|
8130
|
-
else {
|
|
8131
|
-
return d;
|
|
8132
|
-
}
|
|
8133
|
-
}
|
|
8134
|
-
if (d.trim().indexOf(' ') > -1) {
|
|
8135
|
-
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8136
|
-
}
|
|
8137
|
-
return d.toLowerCase();
|
|
8138
|
-
// If label looks like a date (contains digits and - or /)
|
|
8139
|
-
const isDateLabel2 = /\d{2,4}[-\/]/.test(d);
|
|
8140
|
-
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
8141
|
-
if (isDateLabel) {
|
|
8142
|
-
if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
|
|
8143
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
8144
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
8145
|
-
return first + '\n' + second;
|
|
8146
|
-
}
|
|
8147
|
-
else {
|
|
8148
|
-
return d;
|
|
8149
|
-
}
|
|
8150
|
-
}
|
|
8151
|
-
if (d.trim().indexOf(' ') > -1) {
|
|
8152
|
-
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8153
|
-
}
|
|
8154
|
-
return d.toLowerCase();
|
|
8155
|
-
});
|
|
8156
|
-
// Now apply writing-mode: sideways-lr for grouped charts with date labels in zoomed-out view and many bars
|
|
8157
|
-
xAxisLabels.each(function (d) {
|
|
8158
|
-
// Only apply writing-mode for exact date labels, not those containing 'week' or similar
|
|
8159
|
-
const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
|
|
8160
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
8161
|
-
if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
|
|
8162
|
-
d3.select(this).style('writing-mode', 'sideways-lr');
|
|
8163
|
-
}
|
|
8164
|
-
});
|
|
8165
|
-
if (!isMobile) {
|
|
8166
|
-
svg
|
|
8167
|
-
.selectAll('g.x1.axis1 g.tick')
|
|
8168
|
-
.filter(function (d) {
|
|
8169
|
-
return !/\d{2,4}[-\/]/.test(d); // Only process non-date labels
|
|
8170
|
-
})
|
|
8171
|
-
.append('text')
|
|
8172
|
-
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8173
|
-
.attr('y', long_tick_length_bg)
|
|
8174
|
-
.attr('fill', 'var(--chart-text-color)')
|
|
8175
|
-
.attr('x', function (d) {
|
|
8176
|
-
if (self.chartData.data.length > 8 && !self.isZoomedOut) {
|
|
8177
|
-
return 1; // Move text slightly to the left
|
|
8178
|
-
}
|
|
8179
|
-
return 0; // Default position
|
|
8180
|
-
})
|
|
8181
|
-
.text(function (d) {
|
|
8182
|
-
if (d.trim().indexOf(' ') > -1) {
|
|
8183
|
-
return d.trim().substring(d.indexOf(' '), d.length).toLowerCase();
|
|
8184
|
-
}
|
|
8185
|
-
return '';
|
|
8186
|
-
});
|
|
8187
|
-
}
|
|
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);
|
|
8188
8217
|
}
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
return d.substring(0, 3);
|
|
8195
|
-
})
|
|
8196
|
-
.style('font-size', '12px')
|
|
8197
|
-
.attr('y', 5)
|
|
8198
|
-
.attr('x', 5)
|
|
8199
|
-
.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;
|
|
8200
8223
|
}
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
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;
|
|
8205
8234
|
}
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
if (maxValue == 0) {
|
|
8210
|
-
if (this.chartData.targetLineData) {
|
|
8211
|
-
maxValue = this.chartData.targetLineData.target + 20;
|
|
8212
|
-
}
|
|
8213
|
-
else {
|
|
8214
|
-
maxValue = 100;
|
|
8215
|
-
}
|
|
8235
|
+
if (this.chartConfiguration.isTransparentBackground != undefined) {
|
|
8236
|
+
this.isTransparentBackground =
|
|
8237
|
+
this.chartConfiguration.isTransparentBackground;
|
|
8216
8238
|
}
|
|
8217
|
-
if (
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
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]);
|
|
8232
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);
|
|
8273
|
+
var y = d3.scaleLinear().rangeRound([height, 0]);
|
|
8274
|
+
var maxValue = d3.max(data, (d) => d3.max(keyList, (key) => +d[key]));
|
|
8275
|
+
maxValue = this.calculateMaxValue(maxValue);
|
|
8233
8276
|
if (this.chartConfiguration.customYscale) {
|
|
8234
|
-
/**
|
|
8235
|
-
* increase y-scale so that values wont cross or exceed out of range
|
|
8236
|
-
* used in weekly charts
|
|
8237
|
-
*/
|
|
8238
8277
|
maxValue = maxValue * this.chartConfiguration.customYscale;
|
|
8239
8278
|
}
|
|
8240
8279
|
if (this.chartData.targetLineData &&
|
|
@@ -8272,10 +8311,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8272
8311
|
.tickSize(0)
|
|
8273
8312
|
.tickFormat(self.chartConfiguration.yLineAxisLabelFomatter);
|
|
8274
8313
|
}
|
|
8275
|
-
/**
|
|
8276
|
-
* show x-axis grid between labels
|
|
8277
|
-
* used by weekly charts
|
|
8278
|
-
*/
|
|
8279
8314
|
if (self.chartConfiguration.isXgridBetweenLabels) {
|
|
8280
8315
|
svg
|
|
8281
8316
|
.append('g')
|
|
@@ -8283,7 +8318,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8283
8318
|
.attr('transform', 'translate(' + x.bandwidth() / 2 + ',' + height + ')')
|
|
8284
8319
|
.call(d3.axisBottom(x).tickSize(-height).tickFormat(''))
|
|
8285
8320
|
.style('stroke-dasharray', '5 5')
|
|
8286
|
-
.style('color', 'var(--chart-grid-color, #999999)')
|
|
8321
|
+
.style('color', 'var(--chart-grid-color, #999999)')
|
|
8287
8322
|
.call((g) => g.select('.domain').remove());
|
|
8288
8323
|
}
|
|
8289
8324
|
if (this.chartConfiguration.yAxisGrid) {
|
|
@@ -8298,7 +8333,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8298
8333
|
.call((g) => {
|
|
8299
8334
|
g.select('.domain')
|
|
8300
8335
|
.remove()
|
|
8301
|
-
.style('stroke', 'var(--chart-domain-color, #000000)');
|
|
8336
|
+
.style('stroke', 'var(--chart-domain-color, #000000)');
|
|
8302
8337
|
});
|
|
8303
8338
|
}
|
|
8304
8339
|
else {
|
|
@@ -8309,36 +8344,27 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8309
8344
|
.style('opacity', '0.5')
|
|
8310
8345
|
.call((g) => {
|
|
8311
8346
|
g.select('.domain')
|
|
8312
|
-
.style('stroke', 'var(--chart-domain-color, #000000)')
|
|
8313
|
-
.style('stroke-width', '1px');
|
|
8347
|
+
.style('stroke', 'var(--chart-domain-color, #000000)')
|
|
8348
|
+
.style('stroke-width', '1px');
|
|
8314
8349
|
});
|
|
8315
8350
|
}
|
|
8316
8351
|
var xSubgroup = d3.scaleBand().domain(subgroups);
|
|
8317
8352
|
if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
8318
|
-
// For grouped bar charts in zoom-in view, use full x.bandwidth() for subgroups
|
|
8319
8353
|
xSubgroup.range([0, x.bandwidth()]);
|
|
8320
8354
|
}
|
|
8321
8355
|
else if (subgroups.length === 1 && !this.isZoomedOut) {
|
|
8322
|
-
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 100 (increased from 80)
|
|
8323
8356
|
xSubgroup.range([0, 100]);
|
|
8324
8357
|
}
|
|
8325
8358
|
else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
8326
8359
|
xSubgroup.range([0, x.bandwidth()]);
|
|
8327
8360
|
}
|
|
8328
8361
|
else {
|
|
8329
|
-
// used to make grouped bars with lesser width as we are not using padding for width
|
|
8330
8362
|
xSubgroup.range([0, x.bandwidth()]);
|
|
8331
8363
|
}
|
|
8332
|
-
// if (this.chartConfiguration.isDrilldownChart) {
|
|
8333
|
-
// }
|
|
8334
8364
|
var color = d3
|
|
8335
8365
|
.scaleOrdinal()
|
|
8336
8366
|
.domain(subgroups)
|
|
8337
8367
|
.range(Object.values(metaData.colors));
|
|
8338
|
-
// var colorAboveTarget = d3
|
|
8339
|
-
// .scaleOrdinal()
|
|
8340
|
-
// .domain(subgroups)
|
|
8341
|
-
// .range(Object.values(metaData.colorAboveTarget));
|
|
8342
8368
|
var state = svg
|
|
8343
8369
|
.append('g')
|
|
8344
8370
|
.selectAll('.state')
|
|
@@ -8499,7 +8525,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8499
8525
|
d.value >= parseFloat(self.chartData.targetLineData.target) &&
|
|
8500
8526
|
self.chartData.metaData.colorAboveTarget) {
|
|
8501
8527
|
const key = d.key.toLowerCase();
|
|
8502
|
-
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);
|
|
8503
8529
|
if (colorAboveTarget) {
|
|
8504
8530
|
return self.chartData.metaData.colorAboveTarget[colorAboveTarget];
|
|
8505
8531
|
}
|
|
@@ -8630,8 +8656,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8630
8656
|
.on('mouseover', handleMouseOver);
|
|
8631
8657
|
}
|
|
8632
8658
|
}
|
|
8633
|
-
if (this.chartConfiguration.displayTitleOnTop ||
|
|
8634
|
-
this.chartConfiguration.
|
|
8659
|
+
if (this.chartConfiguration.displayTitleOnTop ||
|
|
8660
|
+
(this.chartConfiguration.textsOnBar == undefined &&
|
|
8661
|
+
this.chartConfiguration.displayTitleOnTop == undefined)) {
|
|
8635
8662
|
if (!isria) {
|
|
8636
8663
|
state
|
|
8637
8664
|
.selectAll('rect')
|
|
@@ -8849,31 +8876,23 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8849
8876
|
// .attr('class', 'lib-display-hidden');
|
|
8850
8877
|
// }
|
|
8851
8878
|
if (this.isZoomedOut) {
|
|
8852
|
-
// svg
|
|
8853
|
-
// .selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
8854
|
-
// .attr('transform', 'rotate(-30)')
|
|
8855
|
-
// .attr('text-anchor', 'end')
|
|
8856
|
-
// .attr('x', '-5')
|
|
8857
|
-
// .attr('dy', null)
|
|
8858
|
-
// .style('fill', 'var(--chart-text-color)');
|
|
8859
8879
|
svg
|
|
8860
8880
|
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
8861
8881
|
.each((d, i, nodes) => {
|
|
8862
8882
|
const text = d3.select(nodes[i]);
|
|
8863
8883
|
const label = text.text();
|
|
8864
|
-
// If label contains \n, split and use tspan for each line
|
|
8865
8884
|
if (label.indexOf('\n') > -1) {
|
|
8866
8885
|
const lines = label.split('\n');
|
|
8867
8886
|
text.text(null);
|
|
8868
8887
|
lines.forEach((line, idx) => {
|
|
8869
|
-
text
|
|
8888
|
+
text
|
|
8889
|
+
.append('tspan')
|
|
8870
8890
|
.text(line)
|
|
8871
8891
|
.attr('x', 0)
|
|
8872
8892
|
.attr('dy', idx === 0 ? '1em' : '1.1em');
|
|
8873
8893
|
});
|
|
8874
8894
|
}
|
|
8875
8895
|
else {
|
|
8876
|
-
// Fallback: split by space for other labels
|
|
8877
8896
|
const words = label.split(' ');
|
|
8878
8897
|
text.text(null);
|
|
8879
8898
|
words.forEach((word, index) => {
|
|
@@ -8882,8 +8901,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8882
8901
|
}
|
|
8883
8902
|
})
|
|
8884
8903
|
.style('fill', 'var(--chart-text-color)')
|
|
8885
|
-
.attr('transform', null);
|
|
8886
|
-
// Optional: Adjust bottom margin or chart layout
|
|
8904
|
+
.attr('transform', null);
|
|
8887
8905
|
svg
|
|
8888
8906
|
.select('.x-axis')
|
|
8889
8907
|
.attr('transform', `translate(0, ${height - margin.bottom + 10})`);
|
|
@@ -8892,7 +8910,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8892
8910
|
* used to write y labels based on configuration
|
|
8893
8911
|
*/
|
|
8894
8912
|
if (metaData.yLabel) {
|
|
8895
|
-
const yPosition = isria
|
|
8913
|
+
const yPosition = isria
|
|
8914
|
+
? 0 - margin.left / 2 - 30
|
|
8915
|
+
: 0 - margin.left / 2 - 40;
|
|
8896
8916
|
svgYAxisLeft
|
|
8897
8917
|
.append('text')
|
|
8898
8918
|
.attr('class', 'lib-axis-group-label font-size-1')
|
|
@@ -8976,7 +8996,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8976
8996
|
}
|
|
8977
8997
|
const xLabelText = metaData.xLabel;
|
|
8978
8998
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
8979
|
-
const xPosition = isria
|
|
8999
|
+
const xPosition = isria
|
|
9000
|
+
? height + margin.top + margin.bottom
|
|
9001
|
+
: height + margin.top + margin.bottom + 40;
|
|
8980
9002
|
svg
|
|
8981
9003
|
.append('text')
|
|
8982
9004
|
.attr('class', function () {
|
|
@@ -9069,6 +9091,258 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9069
9091
|
}
|
|
9070
9092
|
}
|
|
9071
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
|
+
}
|
|
9072
9346
|
handleClick(d) {
|
|
9073
9347
|
if (this.chartData.metaData.hasDrillDown || d?.toggleFrom)
|
|
9074
9348
|
this.clickEvent.emit(d);
|