axidio-styleguide-library1-v2 0.4.14 → 0.4.16

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,14 +3388,14 @@ class GroupChartComponent extends ComponentUniqueId {
3388
3388
  this.objectKeys = Object.keys;
3389
3389
  this.defaultConfiguration = {
3390
3390
  margin: {
3391
- top: 30, // Space for top
3392
- right: 40, // Right space
3393
- bottom: 80, // FIXED: Increased from 20 to 80 for more space below X-axis label
3394
- left: 80 // FIXED: Increased from 40 to 80 for Y-axis labels
3391
+ top: 15, // FIXED: Reduced for 250px height
3392
+ right: 40,
3393
+ bottom: 50, // FIXED: Reduced for 250px height
3394
+ left: 95 // FIXED: Enough space for label + values
3395
3395
  },
3396
3396
  labelFormatter: ChartHelper.defaultFormatter,
3397
3397
  svgHeight: 70,
3398
- numberOfYTicks: 6, // FIXED: More ticks for better spacing
3398
+ numberOfYTicks: 6,
3399
3399
  legendJustified: true,
3400
3400
  yLineAxisLabelFomatter: ChartHelper.defaultFormatter,
3401
3401
  yAxisLabelFomatter: ChartHelper.defaultFormatter,
@@ -3403,7 +3403,7 @@ class GroupChartComponent extends ComponentUniqueId {
3403
3403
  showLineChartAxis: true,
3404
3404
  showValues: true,
3405
3405
  headerMenuOptions: HeaderConfigHelper.headerConfig.headerMenuOptions,
3406
- yAxisGrid: true, // FIXED: Changed from false to true to show grid
3406
+ yAxisGrid: true,
3407
3407
  legendVisible: true,
3408
3408
  isYaxisLabelHidden: false,
3409
3409
  backgroundColor: '#FFFFFF',
@@ -3520,26 +3520,29 @@ class GroupChartComponent extends ComponentUniqueId {
3520
3520
  return width;
3521
3521
  }
3522
3522
  calculateHeight(verticalstackedcontainer, margin) {
3523
- let height = parseInt(verticalstackedcontainer.style('height')) *
3523
+ // FIXED: Remove minimum height constraint to respect container size
3524
+ let containerHeight = parseInt(verticalstackedcontainer.style('height'));
3525
+ let height = containerHeight *
3524
3526
  (this.chartConfiguration.svgHeight / 100) -
3525
3527
  margin.top -
3526
3528
  margin.bottom;
3527
- // FIXED: Ensure minimum height for proper Y-axis spacing
3528
- const minHeight = 350; // Minimum height for good spacing
3529
3529
  if (this.chartConfiguration.isFullScreen && this.chartConfiguration.svgHeight !== 70) {
3530
- height = Math.max(this.chartConfiguration.svgHeight, minHeight);
3530
+ height = this.chartConfiguration.svgHeight - margin.top - margin.bottom;
3531
3531
  }
3532
3532
  else if (this.chartConfiguration.isFullScreen) {
3533
- height = Math.max(parseInt(verticalstackedcontainer.style('height')), minHeight);
3533
+ height = containerHeight - margin.top - margin.bottom;
3534
3534
  }
3535
3535
  if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
3536
- height = Math.max(parseInt(verticalstackedcontainer.style('height')) - margin.top - margin.bottom - 130, minHeight);
3536
+ height = containerHeight - margin.top - margin.bottom - 130;
3537
3537
  }
3538
3538
  if (this.chartConfiguration.isHeaderVisible) {
3539
- height = Math.max(parseInt(verticalstackedcontainer.style('height')) - margin.top - margin.bottom - 100, minHeight);
3539
+ height = containerHeight - margin.top - margin.bottom - 100;
3540
3540
  }
3541
- // FIXED: If calculated height is too small, use minimum
3542
- return Math.max(height, minHeight);
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;
3544
+ }
3545
+ return height;
3543
3546
  }
3544
3547
  createScales(chartContext, dimensions) {
3545
3548
  const { data, metaData, lineData, keyList } = chartContext;
@@ -3619,24 +3622,26 @@ class GroupChartComponent extends ComponentUniqueId {
3619
3622
  .attr('id', this.uniqueId)
3620
3623
  .attr('class', 'outer-container')
3621
3624
  .style('width', '100%')
3622
- .style('height', height)
3625
+ .style('height', `${height + margin.top + margin.bottom}px`)
3623
3626
  .style('overflow-x', 'hidden')
3627
+ .style('overflow-y', 'hidden')
3624
3628
  .style('padding-left', `${margin.left}px`)
3625
3629
  .style('padding-right', `${rightSvgWidth}px`)
3626
3630
  .style('margin-left', '15px');
3631
+ // FIXED: Position Y-axis to show label properly
3627
3632
  const svgYAxisLeft = outerContainer
3628
3633
  .append('svg')
3629
- .attr('width', 100)
3630
- .attr('height', height + margin.top + margin.bottom + 10)
3634
+ .attr('width', margin.left + 15) // FIXED: Width matches left margin
3635
+ .attr('height', height + margin.top + margin.bottom)
3631
3636
  .style('position', 'absolute')
3632
- .style('left', '0')
3637
+ .style('left', '-15px') // FIXED: Position to include label
3633
3638
  .style('z-index', 1)
3634
3639
  .append('g')
3635
- .attr('transform', `translate(${margin.left + 15},${margin.top})`);
3640
+ .attr('transform', `translate(${margin.left},${margin.top})`); // FIXED: Proper transform
3636
3641
  const svgYAxisRight = outerContainer
3637
3642
  .append('svg')
3638
3643
  .attr('width', rightSvgWidth)
3639
- .attr('height', height + margin.top + margin.bottom + 10)
3644
+ .attr('height', height + margin.top + margin.bottom)
3640
3645
  .style('position', 'absolute')
3641
3646
  .style('right', '12px')
3642
3647
  .style('z-index', 1)
@@ -3646,11 +3651,13 @@ class GroupChartComponent extends ComponentUniqueId {
3646
3651
  .append('div')
3647
3652
  .attr('class', 'inner-container')
3648
3653
  .style('width', '100%')
3649
- .style('overflow-x', 'auto');
3654
+ .style('height', '100%')
3655
+ .style('overflow-x', 'auto')
3656
+ .style('overflow-y', 'hidden');
3650
3657
  const svg = innerContainer
3651
3658
  .append('svg')
3652
3659
  .attr('width', dimensions.width - rightSvgWidth)
3653
- .attr('height', height + margin.top + margin.bottom + 30)
3660
+ .attr('height', height + margin.top + margin.bottom)
3654
3661
  .append('g')
3655
3662
  .attr('transform', `translate(0,${margin.top})`);
3656
3663
  return { outerContainer, svgYAxisLeft, svgYAxisRight, svg };
@@ -3675,15 +3682,24 @@ class GroupChartComponent extends ComponentUniqueId {
3675
3682
  renderXAxis(svg, x, xScaleFromOrigin, height, chartContext, keyList) {
3676
3683
  const { data, metaData } = chartContext;
3677
3684
  if (this.chartConfiguration.isMultiChartGridLine === undefined) {
3678
- svg
3685
+ // FIXED: X-axis with bottom line
3686
+ const xAxis = svg
3679
3687
  .append('g')
3680
3688
  .attr('class', 'x1 axis1')
3681
3689
  .attr('transform', `translate(0,${height})`)
3682
- .call(d3.axisBottom(x))
3683
- .call((g) => g.select('.domain').remove());
3684
- svg.selectAll('g.x1.axis1 g.tick line').remove();
3690
+ .call(d3.axisBottom(x).tickSize(0));
3691
+ // FIXED: Keep X-axis line visible
3692
+ xAxis
3693
+ .select('.domain')
3694
+ .style('stroke', 'var(--chart-axis-color, #999999)')
3695
+ .style('stroke-width', '1px');
3696
+ xAxis.selectAll('g.tick line').remove();
3685
3697
  const textClass = 'lib-xaxis-labels-texts-drilldown';
3686
- const textSelection = svg.selectAll('g.x1.axis1 g.tick text').attr('class', textClass).style('fill', 'var(--chart-text-color)');
3698
+ const textSelection = xAxis
3699
+ .selectAll('g.tick text')
3700
+ .attr('class', textClass)
3701
+ .style('fill', 'var(--chart-text-color)')
3702
+ .style('font-size', '12px');
3687
3703
  if (keyList.length > 1 && !metaData.xLabel) {
3688
3704
  textSelection.attr('y', 32);
3689
3705
  }
@@ -3694,14 +3710,19 @@ class GroupChartComponent extends ComponentUniqueId {
3694
3710
  if (this.chartConfiguration.xLabelsOnSameLine) {
3695
3711
  this.renderXLabelsOnSameLine(svg, data, metaData);
3696
3712
  }
3697
- // Render bottom x-axis
3698
- svg
3713
+ // Bottom x-axis with line
3714
+ const xAxis2 = svg
3699
3715
  .append('g')
3700
3716
  .attr('class', 'x2 axis2')
3701
3717
  .attr('transform', `translate(0,${height})`)
3702
3718
  .style('color', '#000')
3703
- .call(d3.axisBottom(xScaleFromOrigin).tickSize(0))
3704
- .call((g) => g.select('.domain').attr('fill', 'none'));
3719
+ .call(d3.axisBottom(xScaleFromOrigin).tickSize(0));
3720
+ // FIXED: Show X-axis line
3721
+ xAxis2
3722
+ .select('.domain')
3723
+ .style('stroke', 'var(--chart-axis-color, #999999)')
3724
+ .style('stroke-width', '1px')
3725
+ .attr('fill', 'none');
3705
3726
  svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
3706
3727
  if (this.isZoomedOut) {
3707
3728
  svg.selectAll('.lib-xaxis-labels-texts-drilldown').attr('class', 'lib-display-hidden');
@@ -3770,7 +3791,7 @@ class GroupChartComponent extends ComponentUniqueId {
3770
3791
  });
3771
3792
  }
3772
3793
  renderYAxis(svg, svgYAxisLeft, svgYAxisRight, y, dimensions) {
3773
- // Hide the main Y-axis in the chart area (to avoid overlapping lines)
3794
+ // Main Y-axis in chart area (hidden)
3774
3795
  svg
3775
3796
  .append('g')
3776
3797
  .attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
@@ -3778,26 +3799,32 @@ class GroupChartComponent extends ComponentUniqueId {
3778
3799
  .attr('transform', 'translate(0,0)')
3779
3800
  .call(y)
3780
3801
  .style('display', 'none');
3781
- // FIXED: Render clean Y-axis on the left without domain line
3802
+ // FIXED: Left Y-axis with proper positioning
3782
3803
  const yAxisLeft = d3
3783
3804
  .axisLeft(y)
3784
- .tickSize(0) // FIXED: No tick lines
3805
+ .tickSize(0)
3785
3806
  .ticks(this.chartConfiguration.numberOfYTicks)
3786
3807
  .tickFormat(this.chartConfiguration.yAxisLabelFomatter);
3787
- svgYAxisLeft
3788
- .append('g')
3808
+ const yAxisGroup = svgYAxisLeft
3789
3809
  .append('g')
3790
3810
  .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
3791
3811
  .attr('style', this.chartConfiguration.yAxisCustomTextStyles)
3792
3812
  .attr('transform', 'translate(0,0)')
3793
- .call(yAxisLeft)
3794
- .call((g) => g.select('.domain').remove()) // FIXED: Remove Y-axis line
3813
+ .call(yAxisLeft);
3814
+ // FIXED: Add Y-axis vertical line
3815
+ yAxisGroup
3816
+ .select('.domain')
3817
+ .style('stroke', 'var(--chart-axis-color, #999999)')
3818
+ .style('stroke-width', '1px');
3819
+ // FIXED: Style Y-axis text with proper positioning
3820
+ yAxisGroup
3795
3821
  .selectAll('text')
3796
3822
  .style('fill', 'var(--chart-text-color)')
3797
- .style('font-size', '13px')
3823
+ .style('font-size', '12px')
3824
+ .style('font-weight', '400')
3825
+ .attr('x', -8) // FIXED: Slight offset from axis line
3798
3826
  .attr('dy', '0.32em');
3799
- // Remove tick lines from left axis
3800
- svgYAxisLeft.selectAll('.tick line').remove(); // FIXED: Remove all tick lines
3827
+ // Right Y-axis (hidden)
3801
3828
  svgYAxisRight
3802
3829
  .append('g')
3803
3830
  .attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
@@ -3822,21 +3849,19 @@ class GroupChartComponent extends ComponentUniqueId {
3822
3849
  }
3823
3850
  }
3824
3851
  renderYAxisGrid(svg, y, width) {
3825
- // FIXED: Improved grid styling
3826
3852
  svg
3827
3853
  .append('g')
3828
3854
  .attr('class', 'y-axis-grid')
3829
3855
  .call(d3.axisLeft(y)
3830
3856
  .ticks(this.chartConfiguration.numberOfYTicks)
3831
- .tickSize(-width) // Full width grid lines
3832
- .tickFormat('') // No labels on grid
3833
- )
3834
- .style('color', 'var(--chart-axis-color, #E0E0E0)') // FIXED: Lighter grid color
3835
- .style('opacity', '0.7') // FIXED: Semi-transparent
3836
- .style('stroke-dasharray', 'none') // FIXED: Solid lines instead of dashed
3837
- .call((g) => g.select('.domain').remove()) // FIXED: Remove domain line
3857
+ .tickSize(-width)
3858
+ .tickFormat(''))
3859
+ .style('color', '#E8E8E8')
3860
+ .style('opacity', '0.8')
3861
+ .style('stroke-dasharray', 'none')
3862
+ .call((g) => g.select('.domain').remove())
3838
3863
  .selectAll('line')
3839
- .style('stroke-width', '1px'); // FIXED: Thin lines
3864
+ .style('stroke-width', '0.5px');
3840
3865
  }
3841
3866
  renderXAxisGrid(svg, x, height) {
3842
3867
  svg
@@ -4112,12 +4137,13 @@ class GroupChartComponent extends ComponentUniqueId {
4112
4137
  .attr('class', 'lib-axis-group-label font-size-1')
4113
4138
  .attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
4114
4139
  .attr('transform', 'rotate(-90)')
4115
- // FIXED: Better positioning for Y-axis label
4116
- .attr('y', 0 - margin.left + 10) // Adjusted for new margin
4140
+ // FIXED: Proper positioning for label
4141
+ .attr('y', -70) // FIXED: Distance from Y-axis
4117
4142
  .attr('x', 0 - height / 2)
4118
4143
  .attr('dy', '1em')
4119
4144
  .style('text-anchor', 'middle')
4120
- .style('font-size', '14px') // FIXED: Explicit font size
4145
+ .style('font-size', '12px')
4146
+ .style('font-weight', '400')
4121
4147
  .attr('fill', 'var(--chart-text-color)');
4122
4148
  if (this.chartConfiguration.isMultiChartGridLine === undefined) {
4123
4149
  svgYAxisLeft.selectAll('.lib-axis-group-label').text(yLabel);
@@ -4145,11 +4171,11 @@ class GroupChartComponent extends ComponentUniqueId {
4145
4171
  .append('text')
4146
4172
  .attr('class', baseClass)
4147
4173
  .attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
4148
- // FIXED: Increased spacing below chart (was margin.top + 20, now margin.top + 45)
4149
- .attr('transform', `translate(${width / 2},${height + margin.top + 45})`)
4174
+ // FIXED: Adjusted for 250px height
4175
+ .attr('transform', `translate(${width / 2},${height + 35})`)
4150
4176
  .style('text-anchor', 'middle')
4151
4177
  .style('fill', 'var(--chart-text-color)')
4152
- .style('font-size', '14px') // FIXED: Explicit font size
4178
+ .style('font-size', '12px')
4153
4179
  .text(isAcronym ? xLabel.toUpperCase() : xLabel.toLowerCase())
4154
4180
  .style('text-transform', isAcronym ? 'none' : 'capitalize');
4155
4181
  }