axidio-styleguide-library1-v2 0.4.40 → 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,19 +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
- .style('width', `calc(100% - ${leftSvgWidth}px)`) // Account for y-axis width
3673
+ .style('width', `calc(100% - ${leftSvgWidth}px)`)
3664
3674
  .style('height', `${totalHeight}px`)
3665
- .style('margin-left', `${leftSvgWidth}px`) // Push container to start after y-axis
3675
+ .style('margin-left', `${leftSvgWidth - 15}px`)
3666
3676
  .style('overflow-x', 'auto')
3667
- .style('overflow-y', 'hidden');
3668
- // FIXED: Main SVG with increased height and proper positioning
3677
+ .style('overflow-y', 'hidden')
3678
+ .style('position', 'relative');
3679
+ // FIXED: Main SVG with proper dimensions for labels
3669
3680
  const svg = innerContainer
3670
3681
  .append('svg')
3671
3682
  .attr('width', dimensions.width - rightSvgWidth)
@@ -3693,36 +3704,51 @@ class GroupChartComponent extends ComponentUniqueId {
3693
3704
  }
3694
3705
  renderXAxis(svg, x, xScaleFromOrigin, height, chartContext, keyList) {
3695
3706
  const { data, metaData } = chartContext;
3696
- if (this.chartConfiguration.isMultiChartGridLine === undefined) {
3697
- const xAxis = svg
3698
- .append('g')
3699
- .attr('class', 'x1 axis1')
3700
- .attr('transform', `translate(0,${height})`)
3701
- .call(d3.axisBottom(x).tickSize(0));
3702
- // FIXED: Show X-axis line
3703
- xAxis
3704
- .select('.domain')
3705
- .style('stroke', 'var(--chart-axis-color, #000000)')
3706
- .style('stroke-width', '1px')
3707
- .style('display', 'block');
3708
- xAxis.selectAll('g.tick line').remove();
3709
- const textClass = 'lib-xaxis-labels-texts-drilldown';
3710
- const textSelection = xAxis
3711
- .selectAll('g.tick text')
3712
- .attr('class', textClass)
3713
- .style('fill', 'var(--chart-text-color, #666666)')
3714
- .style('font-size', '11px');
3715
- if (keyList.length > 1 && !metaData.xLabel) {
3716
- 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();
3717
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);
3718
3739
  }
3719
- else {
3720
- 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');
3721
3745
  }
3722
- if (this.chartConfiguration.xLabelsOnSameLine) {
3723
- this.renderXLabelsOnSameLine(svg, data, metaData);
3746
+ else {
3747
+ svg.selectAll('.lib-xaxis-labels-texts-drilldown')
3748
+ .style('font-size', '11px')
3749
+ .style('opacity', '1');
3724
3750
  }
3725
- // Bottom x-axis
3751
+ // FIXED: Render bottom X-axis with proper positioning
3726
3752
  const xAxis2 = svg
3727
3753
  .append('g')
3728
3754
  .attr('class', 'x2 axis2')
@@ -3734,10 +3760,10 @@ class GroupChartComponent extends ComponentUniqueId {
3734
3760
  .style('stroke', 'var(--chart-axis-color, #000000)')
3735
3761
  .style('stroke-width', '1px')
3736
3762
  .attr('fill', 'none');
3737
- svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
3738
- if (this.isZoomedOut) {
3739
- svg.selectAll('.lib-xaxis-labels-texts-drilldown').attr('class', 'lib-display-hidden');
3740
- }
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');
3741
3767
  }
3742
3768
  renderMultiChartXAxis(svg, x, height, data, metaData) {
3743
3769
  let alternate_text = false;