axidio-styleguide-library1-v2 0.4.15 → 0.4.17

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.
@@ -3388,10 +3388,10 @@ class GroupChartComponent extends ComponentUniqueId {
3388
3388
  this.objectKeys = Object.keys;
3389
3389
  this.defaultConfiguration = {
3390
3390
  margin: {
3391
- top: 20, // FIXED: Reduced top margin
3391
+ top: 10, // FIXED: Further reduced for tighter fit
3392
3392
  right: 40,
3393
- bottom: 60, // FIXED: Reduced from 80 to 60 to fit in 300px
3394
- left: 100 // FIXED: Increased to 100 for Y-axis label + values spacing
3393
+ bottom: 45, // FIXED: Reduced for chart to fit inside box
3394
+ left: 110 // FIXED: Increased to accommodate label + gap + values
3395
3395
  },
3396
3396
  labelFormatter: ChartHelper.defaultFormatter,
3397
3397
  svgHeight: 70,
@@ -3458,12 +3458,6 @@ class GroupChartComponent extends ComponentUniqueId {
3458
3458
  for (const key in this.defaultConfiguration) {
3459
3459
  this.chartConfiguration[key] = ChartHelper.getValueByConfigurationType(key, this.defaultConfiguration, this.customChartConfiguration);
3460
3460
  }
3461
- if (this.customChartConfiguration?.margin) {
3462
- this.chartConfiguration.margin = {
3463
- ...this.defaultConfiguration.margin,
3464
- ...this.customChartConfiguration.margin
3465
- };
3466
- }
3467
3461
  if (this.chartConfiguration.isHeaderVisible !== undefined) {
3468
3462
  this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
3469
3463
  }
@@ -3520,36 +3514,28 @@ class GroupChartComponent extends ComponentUniqueId {
3520
3514
  return width;
3521
3515
  }
3522
3516
  calculateHeight(verticalstackedcontainer, margin) {
3523
- // FIXED: Remove minimum height constraint to respect container size
3524
- let containerHeight = parseInt(verticalstackedcontainer.style('height'));
3525
- let height = containerHeight *
3517
+ let height = parseInt(verticalstackedcontainer.style('height')) *
3526
3518
  (this.chartConfiguration.svgHeight / 100) -
3527
3519
  margin.top -
3528
3520
  margin.bottom;
3529
3521
  if (this.chartConfiguration.isFullScreen && this.chartConfiguration.svgHeight !== 70) {
3530
- height = this.chartConfiguration.svgHeight - margin.top - margin.bottom;
3522
+ height = this.chartConfiguration.svgHeight;
3531
3523
  }
3532
3524
  else if (this.chartConfiguration.isFullScreen) {
3533
- height = containerHeight - margin.top - margin.bottom;
3525
+ height = parseInt(verticalstackedcontainer.style('height'));
3534
3526
  }
3535
3527
  if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
3536
- height = containerHeight - margin.top - margin.bottom - 130;
3528
+ height = parseInt(verticalstackedcontainer.style('height')) - margin.top - margin.bottom - 130;
3537
3529
  }
3538
3530
  if (this.chartConfiguration.isHeaderVisible) {
3539
- height = containerHeight - margin.top - margin.bottom - 100;
3540
- }
3541
- // FIXED: For fixed height containers (like 300px), ensure it fits
3542
- if (!this.chartConfiguration.isFullScreen && !this.chartConfiguration.isDrilldownChart) {
3543
- height = containerHeight - margin.top - margin.bottom;
3531
+ height = parseInt(verticalstackedcontainer.style('height')) - margin.top - margin.bottom - 100;
3544
3532
  }
3545
3533
  return height;
3546
3534
  }
3547
3535
  createScales(chartContext, dimensions) {
3548
3536
  const { data, metaData, lineData, keyList } = chartContext;
3549
3537
  const { width, height, margin } = dimensions;
3550
- // FIXED: Reduce spaces for better bar distribution
3551
- const dataLength = data.length;
3552
- const leftAndRightSpaces = dataLength <= 5 ? 20 : (dataLength <= 10 ? 35 : 50);
3538
+ const leftAndRightSpaces = 50;
3553
3539
  const rightSvgWidth = 60;
3554
3540
  const groups = d3.map(data, (d) => d.name).keys();
3555
3541
  let x;
@@ -3566,7 +3552,7 @@ class GroupChartComponent extends ComponentUniqueId {
3566
3552
  .scaleBand()
3567
3553
  .domain(groups)
3568
3554
  .range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
3569
- .padding(dataLength <= 5 ? 0.4 : 0.3); // FIXED: Better padding for fewer bars
3555
+ .padding(0.3);
3570
3556
  }
3571
3557
  const xScaleFromOrigin = d3.scaleBand().domain(groups).range([0, width - rightSvgWidth]);
3572
3558
  const xSubgroup = d3.scaleBand().domain(keyList).range([0, x.bandwidth()]);
@@ -3617,33 +3603,37 @@ class GroupChartComponent extends ComponentUniqueId {
3617
3603
  createSVGStructure(dimensions) {
3618
3604
  const { chartContainer, height, margin } = dimensions;
3619
3605
  const rightSvgWidth = 60;
3606
+ // Calculate proper left SVG width to include label
3607
+ const leftSvgWidth = margin.left + 20;
3620
3608
  const outerContainer = chartContainer
3621
3609
  .append('div')
3622
3610
  .attr('id', this.uniqueId)
3623
3611
  .attr('class', 'outer-container')
3624
3612
  .style('width', '100%')
3625
- .style('height', `${height + margin.top + margin.bottom}px`) // FIXED: Explicit height
3626
- .style('overflow-x', 'hidden')
3627
- .style('overflow-y', 'hidden') // FIXED: Prevent vertical overflow
3613
+ .style('height', `${height + margin.top + margin.bottom}px`)
3614
+ .style('overflow', 'hidden') // FIXED: Prevent all overflow
3628
3615
  .style('padding-left', `${margin.left}px`)
3629
3616
  .style('padding-right', `${rightSvgWidth}px`)
3630
- .style('margin-left', '15px');
3631
- // FIXED: Increased width for Y-axis to prevent overlap
3617
+ .style('margin-left', '15px')
3618
+ .style('position', 'relative'); // FIXED: For absolute positioning
3619
+ // FIXED: Create proper Y-axis SVG with enough space for label
3632
3620
  const svgYAxisLeft = outerContainer
3633
3621
  .append('svg')
3634
- .attr('width', 100) // Keep at 100
3622
+ .attr('width', leftSvgWidth)
3635
3623
  .attr('height', height + margin.top + margin.bottom)
3636
3624
  .style('position', 'absolute')
3637
3625
  .style('left', '0')
3626
+ .style('top', '0')
3638
3627
  .style('z-index', 1)
3639
3628
  .append('g')
3640
- .attr('transform', `translate(${margin.left - 5},${margin.top})`); // FIXED: Adjusted transform
3629
+ .attr('transform', `translate(${margin.left + 5},${margin.top})`);
3641
3630
  const svgYAxisRight = outerContainer
3642
3631
  .append('svg')
3643
3632
  .attr('width', rightSvgWidth)
3644
3633
  .attr('height', height + margin.top + margin.bottom)
3645
3634
  .style('position', 'absolute')
3646
3635
  .style('right', '12px')
3636
+ .style('top', '0')
3647
3637
  .style('z-index', 1)
3648
3638
  .append('g')
3649
3639
  .attr('transform', `translate(0,${margin.top})`);
@@ -3651,13 +3641,13 @@ class GroupChartComponent extends ComponentUniqueId {
3651
3641
  .append('div')
3652
3642
  .attr('class', 'inner-container')
3653
3643
  .style('width', '100%')
3654
- .style('height', '100%') // FIXED: Full height
3644
+ .style('height', '100%')
3655
3645
  .style('overflow-x', 'auto')
3656
- .style('overflow-y', 'hidden'); // FIXED: Prevent vertical scroll
3646
+ .style('overflow-y', 'hidden');
3657
3647
  const svg = innerContainer
3658
3648
  .append('svg')
3659
3649
  .attr('width', dimensions.width - rightSvgWidth)
3660
- .attr('height', height + margin.top + margin.bottom) // FIXED: Exact height
3650
+ .attr('height', height + margin.top + margin.bottom)
3661
3651
  .append('g')
3662
3652
  .attr('transform', `translate(0,${margin.top})`);
3663
3653
  return { outerContainer, svgYAxisLeft, svgYAxisRight, svg };
@@ -3682,17 +3672,26 @@ class GroupChartComponent extends ComponentUniqueId {
3682
3672
  renderXAxis(svg, x, xScaleFromOrigin, height, chartContext, keyList) {
3683
3673
  const { data, metaData } = chartContext;
3684
3674
  if (this.chartConfiguration.isMultiChartGridLine === undefined) {
3685
- svg
3675
+ const xAxis = svg
3686
3676
  .append('g')
3687
3677
  .attr('class', 'x1 axis1')
3688
3678
  .attr('transform', `translate(0,${height})`)
3689
- .call(d3.axisBottom(x))
3690
- .call((g) => g.select('.domain').remove());
3691
- svg.selectAll('g.x1.axis1 g.tick line').remove();
3679
+ .call(d3.axisBottom(x).tickSize(0));
3680
+ // FIXED: Show X-axis line
3681
+ xAxis
3682
+ .select('.domain')
3683
+ .style('stroke', 'var(--chart-axis-color, #CCCCCC)')
3684
+ .style('stroke-width', '1px')
3685
+ .style('display', 'block');
3686
+ xAxis.selectAll('g.tick line').remove();
3692
3687
  const textClass = 'lib-xaxis-labels-texts-drilldown';
3693
- const textSelection = svg.selectAll('g.x1.axis1 g.tick text').attr('class', textClass).style('fill', 'var(--chart-text-color)');
3688
+ const textSelection = xAxis
3689
+ .selectAll('g.tick text')
3690
+ .attr('class', textClass)
3691
+ .style('fill', 'var(--chart-text-color, #666666)')
3692
+ .style('font-size', '11px');
3694
3693
  if (keyList.length > 1 && !metaData.xLabel) {
3695
- textSelection.attr('y', 32);
3694
+ textSelection.attr('y', 28);
3696
3695
  }
3697
3696
  }
3698
3697
  else {
@@ -3701,14 +3700,18 @@ class GroupChartComponent extends ComponentUniqueId {
3701
3700
  if (this.chartConfiguration.xLabelsOnSameLine) {
3702
3701
  this.renderXLabelsOnSameLine(svg, data, metaData);
3703
3702
  }
3704
- // Render bottom x-axis
3705
- svg
3703
+ // Bottom x-axis
3704
+ const xAxis2 = svg
3706
3705
  .append('g')
3707
3706
  .attr('class', 'x2 axis2')
3708
3707
  .attr('transform', `translate(0,${height})`)
3709
3708
  .style('color', '#000')
3710
- .call(d3.axisBottom(xScaleFromOrigin).tickSize(0))
3711
- .call((g) => g.select('.domain').attr('fill', 'none'));
3709
+ .call(d3.axisBottom(xScaleFromOrigin).tickSize(0));
3710
+ xAxis2
3711
+ .select('.domain')
3712
+ .style('stroke', 'var(--chart-axis-color, #CCCCCC)')
3713
+ .style('stroke-width', '1px')
3714
+ .attr('fill', 'none');
3712
3715
  svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
3713
3716
  if (this.isZoomedOut) {
3714
3717
  svg.selectAll('.lib-xaxis-labels-texts-drilldown').attr('class', 'lib-display-hidden');
@@ -3777,6 +3780,7 @@ class GroupChartComponent extends ComponentUniqueId {
3777
3780
  });
3778
3781
  }
3779
3782
  renderYAxis(svg, svgYAxisLeft, svgYAxisRight, y, dimensions) {
3783
+ // Main Y-axis in chart area (hidden)
3780
3784
  svg
3781
3785
  .append('g')
3782
3786
  .attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
@@ -3784,26 +3788,34 @@ class GroupChartComponent extends ComponentUniqueId {
3784
3788
  .attr('transform', 'translate(0,0)')
3785
3789
  .call(y)
3786
3790
  .style('display', 'none');
3791
+ // FIXED: Left Y-axis with visible line
3787
3792
  const yAxisLeft = d3
3788
3793
  .axisLeft(y)
3789
3794
  .tickSize(0)
3790
3795
  .ticks(this.chartConfiguration.numberOfYTicks)
3791
3796
  .tickFormat(this.chartConfiguration.yAxisLabelFomatter);
3792
- svgYAxisLeft
3793
- .append('g')
3797
+ const yAxisGroup = svgYAxisLeft
3794
3798
  .append('g')
3795
3799
  .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
3796
3800
  .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
3797
3801
  .attr('transform', 'translate(0,0)')
3798
- .call(yAxisLeft)
3799
- .call((g) => g.select('.domain').remove())
3802
+ .call(yAxisLeft);
3803
+ // FIXED: Show Y-axis vertical line
3804
+ yAxisGroup
3805
+ .select('.domain')
3806
+ .style('stroke', 'var(--chart-axis-color, #CCCCCC)')
3807
+ .style('stroke-width', '1px')
3808
+ .style('display', 'block');
3809
+ // FIXED: Position Y-axis values with proper spacing
3810
+ yAxisGroup
3800
3811
  .selectAll('text')
3801
- .style('fill', 'var(--chart-text-color)')
3802
- .style('font-size', '12px')
3812
+ .style('fill', 'var(--chart-text-color, #666666)')
3813
+ .style('font-size', '11px')
3803
3814
  .style('font-weight', '400')
3804
- .attr('x', -10) // FIXED: Move Y-axis values slightly right to create gap
3815
+ .attr('x', -6) // FIXED: Small gap from axis line
3816
+ .attr('text-anchor', 'end')
3805
3817
  .attr('dy', '0.32em');
3806
- svgYAxisLeft.selectAll('.tick line').remove();
3818
+ // Right Y-axis (hidden)
3807
3819
  svgYAxisRight
3808
3820
  .append('g')
3809
3821
  .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
@@ -3819,12 +3831,16 @@ class GroupChartComponent extends ComponentUniqueId {
3819
3831
  }
3820
3832
  if (this.chartConfiguration.isYaxisLabelHidden) {
3821
3833
  d3.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
3834
+ // FIXED: Don't hide the Y-axis label element
3835
+ d3.selectAll('.lib-ylabel-visible').style('display', 'block');
3822
3836
  }
3823
3837
  if (this.chartConfiguration.isYaxisHidden) {
3824
3838
  d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
3839
+ // FIXED: Keep Y-axis label visible
3840
+ d3.selectAll('.lib-ylabel-visible').style('display', 'block');
3825
3841
  }
3826
3842
  if (this.chartConfiguration.isYaxisDashed) {
3827
- d3.selectAll('.yaxis-dashed').style('stroke-dasharray', '5 5').style('color', '#999999');
3843
+ d3.selectAll('.yaxis-dashed .domain').style('stroke-dasharray', '5 5').style('color', '#999999');
3828
3844
  }
3829
3845
  }
3830
3846
  renderYAxisGrid(svg, y, width) {
@@ -3835,12 +3851,12 @@ class GroupChartComponent extends ComponentUniqueId {
3835
3851
  .ticks(this.chartConfiguration.numberOfYTicks)
3836
3852
  .tickSize(-width)
3837
3853
  .tickFormat(''))
3838
- .style('color', '#E8E8E8') // FIXED: Very light gray
3839
- .style('opacity', '0.8')
3854
+ .style('color', '#EEEEEE') // FIXED: Lighter grid
3855
+ .style('opacity', '0.7')
3840
3856
  .style('stroke-dasharray', 'none')
3841
3857
  .call((g) => g.select('.domain').remove())
3842
3858
  .selectAll('line')
3843
- .style('stroke-width', '0.5px'); // FIXED: Thinner lines
3859
+ .style('stroke-width', '0.5px');
3844
3860
  }
3845
3861
  renderXAxisGrid(svg, x, height) {
3846
3862
  svg
@@ -4111,25 +4127,26 @@ class GroupChartComponent extends ComponentUniqueId {
4111
4127
  }
4112
4128
  }
4113
4129
  renderYAxisLabel(svgYAxisLeft, yLabel, height, margin) {
4130
+ // FIXED: Proper Y-axis label with correct positioning
4114
4131
  svgYAxisLeft
4115
4132
  .append('text')
4116
- .attr('class', 'lib-axis-group-label font-size-1')
4133
+ .attr('class', 'lib-axis-group-label lib-ylabel-visible')
4117
4134
  .attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
4118
4135
  .attr('transform', 'rotate(-90)')
4119
- // FIXED: Proper positioning with adequate spacing from Y-axis values
4120
- .attr('y', -65) // FIXED: Moved further left to avoid overlap (was: -margin.left + 10)
4136
+ .attr('y', -margin.left + 15) // FIXED: Position relative to left margin
4121
4137
  .attr('x', 0 - height / 2)
4122
4138
  .attr('dy', '1em')
4123
4139
  .style('text-anchor', 'middle')
4124
- .style('font-size', '13px')
4125
- .attr('fill', 'var(--chart-text-color)');
4140
+ .style('font-size', '11px')
4141
+ .style('font-weight', '400')
4142
+ .style('fill', 'var(--chart-text-color, #666666)');
4126
4143
  if (this.chartConfiguration.isMultiChartGridLine === undefined) {
4127
4144
  svgYAxisLeft.selectAll('.lib-axis-group-label').text(yLabel);
4128
4145
  }
4129
4146
  else {
4130
4147
  svgYAxisLeft
4131
4148
  .selectAll('.lib-axis-group-label')
4132
- .attr('class', 'lib-ylabel-weeklyCharts')
4149
+ .attr('class', 'lib-ylabel-weeklyCharts lib-ylabel-visible')
4133
4150
  .text(yLabel.toLowerCase());
4134
4151
  }
4135
4152
  }
@@ -4149,11 +4166,11 @@ class GroupChartComponent extends ComponentUniqueId {
4149
4166
  .append('text')
4150
4167
  .attr('class', baseClass)
4151
4168
  .attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
4152
- // FIXED: Adjusted for smaller bottom margin
4153
- .attr('transform', `translate(${width / 2},${height + 40})`)
4169
+ // FIXED: Adjusted for reduced bottom margin
4170
+ .attr('transform', `translate(${width / 2},${height + 32})`)
4154
4171
  .style('text-anchor', 'middle')
4155
- .style('fill', 'var(--chart-text-color)')
4156
- .style('font-size', '13px')
4172
+ .style('fill', 'var(--chart-text-color, #666666)')
4173
+ .style('font-size', '11px')
4157
4174
  .text(isAcronym ? xLabel.toUpperCase() : xLabel.toLowerCase())
4158
4175
  .style('text-transform', isAcronym ? 'none' : 'capitalize');
4159
4176
  }