axidio-styleguide-library1-v2 0.4.43 → 0.4.45

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.
@@ -3552,7 +3552,7 @@ class GroupChartComponent extends ComponentUniqueId {
3552
3552
  if (this.chartConfiguration.isMultiChartGridLine !== undefined) {
3553
3553
  x = d3
3554
3554
  .scaleBand()
3555
- .rangeRound([0, width]) // FIXED: Changed range to start from 0
3555
+ .rangeRound([width, 0])
3556
3556
  .align(0.5)
3557
3557
  .padding(0.5)
3558
3558
  .domain(data.map((d) => d.name.toLowerCase()));
@@ -3561,22 +3561,11 @@ class GroupChartComponent extends ComponentUniqueId {
3561
3561
  x = d3
3562
3562
  .scaleBand()
3563
3563
  .domain(groups)
3564
- .range([0, width - rightSvgWidth]) // FIXED: Start from 0 for better centering
3565
- .padding(0.3)
3566
- .align(0.5); // FIXED: Center the bands
3567
- }
3568
- if (data.length === 1 && !this.chartConfiguration.isMultiChartGridLine) {
3569
- const singleBarWidth = Math.min(80, (width - rightSvgWidth) * 0.6); // Max 60% of available width
3570
- x.range([
3571
- ((width - rightSvgWidth) - singleBarWidth) / 2,
3572
- ((width - rightSvgWidth) - singleBarWidth) / 2 + singleBarWidth
3573
- ]);
3564
+ .range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
3565
+ .padding(0.3);
3574
3566
  }
3575
3567
  const xScaleFromOrigin = d3.scaleBand().domain(groups).range([0, width - rightSvgWidth]);
3576
- const xSubgroup = d3.scaleBand()
3577
- .domain(keyList)
3578
- .range([0, x.bandwidth()])
3579
- .padding(0.1);
3568
+ const xSubgroup = d3.scaleBand().domain(keyList).range([0, x.bandwidth()]);
3580
3569
  // FIXED: Improved max value calculation that considers height
3581
3570
  const maxValue = this.calculateMaxValue(data, keyList, height);
3582
3571
  const y = d3.scaleLinear().domain([0, maxValue]).nice().rangeRound([height, 0]);
@@ -3710,13 +3699,19 @@ class GroupChartComponent extends ComponentUniqueId {
3710
3699
  .attr('class', 'x1 axis1')
3711
3700
  .attr('transform', `translate(0,${height})`)
3712
3701
  .call(d3.axisBottom(x).tickSize(0));
3702
+ // FIXED: Show X-axis line
3713
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
3714
3711
  .selectAll('g.tick text')
3715
- .attr('class', 'lib-xaxis-labels-texts-drilldown')
3712
+ .attr('class', textClass)
3716
3713
  .style('fill', 'var(--chart-text-color, #666666)')
3717
- .style('font-size', '11px')
3718
- .attr('text-anchor', 'middle')
3719
- .attr('dx', x.bandwidth() / 2);
3714
+ .style('font-size', '11px');
3720
3715
  }
3721
3716
  else {
3722
3717
  this.renderMultiChartXAxis(svg, x, height, data, metaData);
@@ -3909,7 +3904,6 @@ class GroupChartComponent extends ComponentUniqueId {
3909
3904
  const { data, metaData, keyList, isRia } = chartContext;
3910
3905
  const { x, xSubgroup, y } = scales;
3911
3906
  const { height } = dimensions;
3912
- // FIXED: Improved bar group positioning
3913
3907
  const state = svg
3914
3908
  .append('g')
3915
3909
  .selectAll('.state')
@@ -3924,19 +3918,15 @@ class GroupChartComponent extends ComponentUniqueId {
3924
3918
  .append('rect')
3925
3919
  .attr('class', 'bars')
3926
3920
  .on('click', (d) => this.handleBarClick(d, metaData))
3927
- .attr('x', (d) => {
3928
- // FIXED: Improved X positioning for centering
3929
- if (this.chartConfiguration.isDrilldownChart) {
3930
- return this.calculateDrilldownBarX(d, data, x) - (this.getBarWidth(d, data, x, xSubgroup) / 2);
3931
- }
3932
- return xSubgroup(d.key);
3933
- })
3921
+ .attr('x', (d) => this.getBarX(d, data, x, xSubgroup))
3934
3922
  .attr('y', (d) => {
3923
+ // FIXED: Ensure bars start from correct Y position
3935
3924
  const value = d.value === -1 ? 0 : d.value;
3936
3925
  return y(value);
3937
3926
  })
3938
3927
  .attr('width', (d) => this.getBarWidth(d, data, x, xSubgroup))
3939
3928
  .attr('height', (d) => {
3929
+ // FIXED: Improved height calculation
3940
3930
  const value = d.value === -1 ? 0 : d.value;
3941
3931
  return height - y(value);
3942
3932
  })
@@ -3967,10 +3957,7 @@ class GroupChartComponent extends ComponentUniqueId {
3967
3957
  if (this.chartConfiguration.isDrilldownChart) {
3968
3958
  return this.calculateDrilldownBarX(d, data, x);
3969
3959
  }
3970
- // FIXED: For non-drilldown charts, ensure proper positioning
3971
- const basePosition = xSubgroup(d.key);
3972
- const barWidth = xSubgroup.bandwidth();
3973
- return basePosition + (barWidth / 2); // Center of the bar
3960
+ return xSubgroup(d.key);
3974
3961
  }
3975
3962
  calculateDrilldownBarX(d, data, x) {
3976
3963
  let tempScale;
@@ -3978,38 +3965,27 @@ class GroupChartComponent extends ComponentUniqueId {
3978
3965
  if (indiv.name === d.name) {
3979
3966
  const keys = Object.keys(indiv).filter((temp, i) => i !== 0);
3980
3967
  tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
3981
- // FIXED: Better centering for single bar and multiple bars
3982
3968
  if (x.bandwidth() > 100) {
3983
3969
  tempScale = this.adjustDrilldownScale(tempScale, data, x);
3984
3970
  }
3985
3971
  }
3986
3972
  });
3987
- // FIXED: Ensure proper centering
3988
- if (tempScale) {
3989
- const barPosition = tempScale(d.key);
3990
- const barWidth = tempScale.bandwidth();
3991
- return barPosition + (barWidth / 2); // Center of the bar
3992
- }
3993
- return 0;
3973
+ return tempScale ? tempScale(d.key) : 0;
3994
3974
  }
3995
3975
  adjustDrilldownScale(tempScale, data, x) {
3996
- // FIXED: Improved centering logic
3997
3976
  if (this.chartData.data.length === 1) {
3998
- // Single bar - center it properly
3999
- const keysLength = Object.keys(this.chartData.data[0]).length - 1; // Exclude 'name'
4000
- const totalBarWidth = Math.min(keysLength * 40, x.bandwidth() * 0.8); // Max 80% of available width
3977
+ const keysLength = Object.keys(this.chartData.data[0]).length;
3978
+ const offset = keysLength === 2 ? 200 : 300;
4001
3979
  tempScale.range([
4002
- (x.bandwidth() - totalBarWidth) / 2,
4003
- x.bandwidth() - (x.bandwidth() - totalBarWidth) / 2
4004
- ]).padding(0.2);
3980
+ 0 + (x.bandwidth() - offset) / 2,
3981
+ x.bandwidth() - (x.bandwidth() - offset) / 2,
3982
+ ]);
4005
3983
  }
4006
3984
  else {
4007
- // Multiple bars - distribute evenly with proper padding
4008
- const totalBarWidth = Math.min(125, x.bandwidth() * 0.8);
4009
3985
  tempScale.range([
4010
- (x.bandwidth() - totalBarWidth) / 2,
4011
- x.bandwidth() - (x.bandwidth() - totalBarWidth) / 2
4012
- ]).padding(0.3);
3986
+ 0 + (x.bandwidth() - 125) / 2,
3987
+ x.bandwidth() - (x.bandwidth() - 125) / 2,
3988
+ ]);
4013
3989
  }
4014
3990
  return tempScale;
4015
3991
  }