axidio-styleguide-library1-v2 0.4.41 → 0.4.42

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.
@@ -3498,7 +3498,6 @@ class GroupChartComponent extends ComponentUniqueId {
3498
3498
  const containerWidth = parseInt(chartContainer.style('width'));
3499
3499
  const leftSvgWidth = margin.left + 20;
3500
3500
  const rightSvgWidth = 60;
3501
- // Calculate available width excluding fixed y-axis elements
3502
3501
  const baseWidth = containerWidth - leftSvgWidth - rightSvgWidth;
3503
3502
  const dataLength = this.chartData.data.length;
3504
3503
  let width = baseWidth;
@@ -3546,16 +3545,18 @@ class GroupChartComponent extends ComponentUniqueId {
3546
3545
  createScales(chartContext, dimensions) {
3547
3546
  const { data, metaData, lineData, keyList } = chartContext;
3548
3547
  const { width, height, margin } = dimensions;
3549
- const leftAndRightSpaces = 50;
3548
+ // FIXED: Better calculation of available space
3549
+ const leftAndRightSpaces = 60; // Increased for better label spacing
3550
3550
  const rightSvgWidth = 60;
3551
3551
  const groups = d3.map(data, (d) => d.name).keys();
3552
+ // FIXED: Improved X-scale calculation for centered bars
3552
3553
  let x;
3553
3554
  if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
3554
3555
  x = d3
3555
3556
  .scaleBand()
3556
- .rangeRound([width, 0])
3557
+ .rangeRound([0, width - rightSvgWidth]) // FIXED: Start from 0 for proper alignment
3557
3558
  .align(0.5)
3558
- .padding(0.5)
3559
+ .padding(0.3) // FIXED: Consistent padding
3559
3560
  .domain(data.map((d) => d.name.toLowerCase()));
3560
3561
  }
3561
3562
  else {
@@ -3563,11 +3564,22 @@ class GroupChartComponent extends ComponentUniqueId {
3563
3564
  .scaleBand()
3564
3565
  .domain(groups)
3565
3566
  .range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
3566
- .padding(0.3);
3567
+ .padding(0.3) // FIXED: Consistent padding
3568
+ .align(0.5); // FIXED: Center alignment
3567
3569
  }
3568
- const xScaleFromOrigin = d3.scaleBand().domain(groups).range([0, width - rightSvgWidth]);
3569
- const xSubgroup = d3.scaleBand().domain(keyList).range([0, x.bandwidth()]);
3570
- // FIXED: Improved max value calculation that considers height
3570
+ // FIXED: X scale for proper label positioning
3571
+ const xScaleFromOrigin = d3
3572
+ .scaleBand()
3573
+ .domain(groups)
3574
+ .range([0, width - rightSvgWidth])
3575
+ .padding(0.3)
3576
+ .align(0.5);
3577
+ const xSubgroup = d3
3578
+ .scaleBand()
3579
+ .domain(keyList)
3580
+ .range([0, x.bandwidth()])
3581
+ .padding(0.1); // FIXED: Add padding between grouped bars
3582
+ // FIXED: Improved max value calculation
3571
3583
  const maxValue = this.calculateMaxValue(data, keyList, height);
3572
3584
  const y = d3.scaleLinear().domain([0, maxValue]).nice().rangeRound([height, 0]);
3573
3585
  let lineYscale = null;
@@ -3621,8 +3633,8 @@ class GroupChartComponent extends ComponentUniqueId {
3621
3633
  createSVGStructure(dimensions) {
3622
3634
  const { chartContainer, height, margin } = dimensions;
3623
3635
  const rightSvgWidth = 60;
3624
- // FIXED: Calculate total height including margins and extra space
3625
- const totalHeight = height + margin.top + margin.bottom; // Added extra 60px
3636
+ // FIXED: Calculate total height including margins
3637
+ const totalHeight = height + margin.top + margin.bottom + 20; // Added extra space for labels
3626
3638
  const outerContainer = chartContainer
3627
3639
  .append('div')
3628
3640
  .attr('id', this.uniqueId)
@@ -3630,12 +3642,10 @@ class GroupChartComponent extends ComponentUniqueId {
3630
3642
  .style('width', '100%')
3631
3643
  .style('height', `${totalHeight}px`)
3632
3644
  .style('overflow', 'hidden')
3633
- .style('padding-left', '0') // Remove left padding from outer container
3634
3645
  .style('padding-right', `${rightSvgWidth}px`)
3635
- .style('margin-left', '0') // Remove left margin
3636
3646
  .style('position', 'relative');
3637
3647
  const leftSvgWidth = margin.left + 20;
3638
- // FIXED: Y-axis SVG with proper height
3648
+ // FIXED: Y-axis SVG
3639
3649
  const svgYAxisLeft = outerContainer
3640
3650
  .append('svg')
3641
3651
  .attr('width', leftSvgWidth)
@@ -3643,7 +3653,7 @@ class GroupChartComponent extends ComponentUniqueId {
3643
3653
  .style('position', 'absolute')
3644
3654
  .style('left', '0')
3645
3655
  .style('top', '0')
3646
- .style('z-index', 2) // Increased z-index to ensure it stays above
3656
+ .style('z-index', 2)
3647
3657
  .append('g')
3648
3658
  .attr('transform', `translate(${margin.left + 5},${margin.top})`);
3649
3659
  const svgYAxisRight = outerContainer
@@ -3653,20 +3663,20 @@ class GroupChartComponent extends ComponentUniqueId {
3653
3663
  .style('position', 'absolute')
3654
3664
  .style('right', '40px')
3655
3665
  .style('top', '0')
3656
- .style('z-index', 2) // Increased z-index
3666
+ .style('z-index', 2)
3657
3667
  .append('g')
3658
3668
  .attr('transform', `translate(0,${margin.top})`);
3659
- // FIXED: Inner container starts AFTER the y-axis labels
3669
+ // FIXED: Inner container with proper overflow handling
3660
3670
  const innerContainer = outerContainer
3661
3671
  .append('div')
3662
3672
  .attr('class', 'inner-container')
3663
3673
  .style('width', `calc(100% - ${leftSvgWidth}px)`)
3664
3674
  .style('height', `${totalHeight}px`)
3665
- .style('margin-left', `${leftSvgWidth - 15}px`) // Good adjustment for the 15px offset
3675
+ .style('margin-left', `${leftSvgWidth - 15}px`)
3666
3676
  .style('overflow-x', 'auto')
3667
3677
  .style('overflow-y', 'hidden')
3668
- .style('position', 'relative'); // Add this for better positioning context
3669
- // FIXED: Main SVG with increased height and proper positioning
3678
+ .style('position', 'relative');
3679
+ // FIXED: Main SVG with proper dimensions for labels
3670
3680
  const svg = innerContainer
3671
3681
  .append('svg')
3672
3682
  .attr('width', dimensions.width - rightSvgWidth)
@@ -3694,36 +3704,51 @@ class GroupChartComponent extends ComponentUniqueId {
3694
3704
  }
3695
3705
  renderXAxis(svg, x, xScaleFromOrigin, height, chartContext, keyList) {
3696
3706
  const { data, metaData } = chartContext;
3697
- if (this.chartConfiguration.isMultiChartGridLine === undefined) {
3698
- const xAxis = svg
3699
- .append('g')
3700
- .attr('class', 'x1 axis1')
3701
- .attr('transform', `translate(0,${height})`)
3702
- .call(d3.axisBottom(x).tickSize(0));
3703
- // FIXED: Show X-axis line
3704
- xAxis
3705
- .select('.domain')
3706
- .style('stroke', 'var(--chart-axis-color, #000000)')
3707
- .style('stroke-width', '1px')
3708
- .style('display', 'block');
3709
- xAxis.selectAll('g.tick line').remove();
3710
- const textClass = 'lib-xaxis-labels-texts-drilldown';
3711
- const textSelection = xAxis
3712
- .selectAll('g.tick text')
3713
- .attr('class', textClass)
3714
- .style('fill', 'var(--chart-text-color, #666666)')
3715
- .style('font-size', '11px');
3716
- if (keyList.length > 1 && !metaData.xLabel) {
3717
- textSelection.attr('y', 28);
3707
+ // FIXED: Always show X-axis labels regardless of scroll
3708
+ const xAxis = svg
3709
+ .append('g')
3710
+ .attr('class', 'x1 axis1')
3711
+ .attr('transform', `translate(0,${height})`)
3712
+ .call(d3.axisBottom(x).tickSize(0));
3713
+ // FIXED: Ensure X-axis line is visible
3714
+ xAxis
3715
+ .select('.domain')
3716
+ .style('stroke', 'var(--chart-axis-color, #000000)')
3717
+ .style('stroke-width', '1px')
3718
+ .style('display', 'block');
3719
+ xAxis.selectAll('g.tick line').remove();
3720
+ // FIXED: Center align X-axis labels properly
3721
+ const textSelection = xAxis
3722
+ .selectAll('g.tick text')
3723
+ .attr('class', 'lib-xaxis-labels-texts-drilldown')
3724
+ .style('fill', 'var(--chart-text-color, #666666)')
3725
+ .style('font-size', '11px')
3726
+ .style('text-anchor', 'middle') // FIXED: Center alignment
3727
+ .attr('dx', '0') // FIXED: Remove any horizontal offset
3728
+ .attr('dy', '15px') // FIXED: Consistent vertical position
3729
+ .text(d => {
3730
+ // FIXED: Handle label formatting consistently
3731
+ if (typeof d === 'string') {
3732
+ return d.toLowerCase();
3718
3733
  }
3734
+ return d;
3735
+ });
3736
+ // FIXED: Apply consistent positioning for multi-key charts
3737
+ if (keyList.length > 1 && !metaData.xLabel) {
3738
+ textSelection.attr('y', 28);
3719
3739
  }
3720
- else {
3721
- this.renderMultiChartXAxis(svg, x, height, data, metaData);
3740
+ // FIXED: Don't hide labels when zoomed out, just adjust styling
3741
+ if (this.isZoomedOut) {
3742
+ svg.selectAll('.lib-xaxis-labels-texts-drilldown')
3743
+ .style('font-size', '9px')
3744
+ .style('opacity', '0.8');
3722
3745
  }
3723
- if (this.chartConfiguration.xLabelsOnSameLine) {
3724
- this.renderXLabelsOnSameLine(svg, data, metaData);
3746
+ else {
3747
+ svg.selectAll('.lib-xaxis-labels-texts-drilldown')
3748
+ .style('font-size', '11px')
3749
+ .style('opacity', '1');
3725
3750
  }
3726
- // Bottom x-axis
3751
+ // FIXED: Render bottom X-axis with proper positioning
3727
3752
  const xAxis2 = svg
3728
3753
  .append('g')
3729
3754
  .attr('class', 'x2 axis2')
@@ -3735,10 +3760,10 @@ class GroupChartComponent extends ComponentUniqueId {
3735
3760
  .style('stroke', 'var(--chart-axis-color, #000000)')
3736
3761
  .style('stroke-width', '1px')
3737
3762
  .attr('fill', 'none');
3738
- svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
3739
- if (this.isZoomedOut) {
3740
- svg.selectAll('.lib-xaxis-labels-texts-drilldown').attr('class', 'lib-display-hidden');
3741
- }
3763
+ // FIXED: Keep X-axis labels visible but style them appropriately
3764
+ svg.selectAll('g.x2.axis2 g.tick text')
3765
+ .style('opacity', '0.6')
3766
+ .style('font-size', '10px');
3742
3767
  }
3743
3768
  renderMultiChartXAxis(svg, x, height, data, metaData) {
3744
3769
  let alternate_text = false;