axidio-styleguide-library1-v2 0.1.24 → 0.1.26
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.
- package/esm2022/lib/group-chart/group-chart.component.mjs +22 -21
- package/esm2022/lib/horizontal-bars-with-scroll-zoom/horizontal-bars-with-scroll-zoom.component.mjs +177 -260
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +22 -68
- package/fesm2022/axidio-styleguide-library1-v2.mjs +218 -346
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -3939,8 +3939,8 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3939
3939
|
else {
|
|
3940
3940
|
x = d3
|
|
3941
3941
|
.scaleBand()
|
|
3942
|
-
.domain(groups)
|
|
3943
3942
|
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
3943
|
+
.domain(groups).reverse()
|
|
3944
3944
|
.padding([0.3]);
|
|
3945
3945
|
}
|
|
3946
3946
|
// x.bandwidth(96);
|
|
@@ -4557,29 +4557,30 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4557
4557
|
.attr('class', 'title')
|
|
4558
4558
|
.style('z-index', 99)
|
|
4559
4559
|
.html(function () {
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4560
|
+
if (!isNaN(d[1] - d[0])) {
|
|
4561
|
+
if (d[1] - d[0] === 0) {
|
|
4562
|
+
return '<span class="title-top-text">0</span>';
|
|
4563
|
+
}
|
|
4564
|
+
var dataType = metaData.dataType ? metaData.dataType : '';
|
|
4565
|
+
var desiredText = '';
|
|
4566
|
+
desiredText =
|
|
4567
|
+
'<span class="title-bar-name">' +
|
|
4568
|
+
(d.data.name ? d.data.name : '') +
|
|
4569
|
+
'</span>';
|
|
4570
|
+
desiredText += metaData.unit
|
|
4571
|
+
? '<span class="title-top-text">' +
|
|
4572
|
+
metaData.unit +
|
|
4573
|
+
(d[1] - d[0]) +
|
|
4574
|
+
dataType +
|
|
4575
|
+
'</span>'
|
|
4576
|
+
: '<span class="title-top-text">' +
|
|
4577
|
+
(d[1] - d[0]) +
|
|
4567
4578
|
dataType +
|
|
4568
4579
|
'</span>';
|
|
4569
4580
|
return desiredText;
|
|
4570
4581
|
}
|
|
4571
|
-
else
|
|
4572
|
-
|
|
4573
|
-
let desiredText = '<span class="title-bar-name">' +
|
|
4574
|
-
tempKey +
|
|
4575
|
-
':' +
|
|
4576
|
-
d.Value +
|
|
4577
|
-
dataType +
|
|
4578
|
-
'</span>';
|
|
4579
|
-
desiredText +=
|
|
4580
|
-
'<span class="title-bar-value">' + d.name + '</span>';
|
|
4581
|
-
return desiredText;
|
|
4582
|
-
}
|
|
4582
|
+
else
|
|
4583
|
+
return;
|
|
4583
4584
|
});
|
|
4584
4585
|
}
|
|
4585
4586
|
function handleMouseOut(d, i) {
|
|
@@ -7119,10 +7120,10 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7119
7120
|
this.uniqueId = this.getUniqueId();
|
|
7120
7121
|
this.isTransparentBackground = false;
|
|
7121
7122
|
this.defaultConfiguration = {
|
|
7122
|
-
margin: { top:
|
|
7123
|
-
svgHeight:
|
|
7123
|
+
margin: { top: 30, right: 30, bottom: 50, left: 60 },
|
|
7124
|
+
svgHeight: 80,
|
|
7124
7125
|
legendHeight: '10%',
|
|
7125
|
-
numberOfYTicks:
|
|
7126
|
+
numberOfYTicks: 7,
|
|
7126
7127
|
labelFormatter: ChartHelper.defaultFormatter,
|
|
7127
7128
|
xAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
7128
7129
|
yAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
@@ -7198,27 +7199,6 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7198
7199
|
var tempObjectHolder = {};
|
|
7199
7200
|
var rightSvgWidth = 60;
|
|
7200
7201
|
var leftAndRightSpaces = 50;
|
|
7201
|
-
let isria = this.customChartConfiguration.isRia;
|
|
7202
|
-
// Responsive breakpoints
|
|
7203
|
-
const isMobile = window.innerWidth < 576;
|
|
7204
|
-
const isTablet = window.innerWidth >= 576 && window.innerWidth < 992;
|
|
7205
|
-
const isDesktop = window.innerWidth >= 992;
|
|
7206
|
-
// Adjust margins and font sizes based on device
|
|
7207
|
-
if (isMobile) {
|
|
7208
|
-
this.chartConfiguration.margin = { top: 20, right: 10, bottom: 40, left: 30 };
|
|
7209
|
-
this.chartConfiguration.numberOfYTicks = 4;
|
|
7210
|
-
this.chartConfiguration.svgHeight = 60;
|
|
7211
|
-
}
|
|
7212
|
-
else if (isTablet) {
|
|
7213
|
-
this.chartConfiguration.margin = { top: 25, right: 20, bottom: 45, left: 40 };
|
|
7214
|
-
this.chartConfiguration.numberOfYTicks = 6;
|
|
7215
|
-
this.chartConfiguration.svgHeight = 70;
|
|
7216
|
-
}
|
|
7217
|
-
else {
|
|
7218
|
-
this.chartConfiguration.margin = { top: 30, right: 30, bottom: 50, left: 60 };
|
|
7219
|
-
this.chartConfiguration.numberOfYTicks = 7;
|
|
7220
|
-
this.chartConfiguration.svgHeight = 80;
|
|
7221
|
-
}
|
|
7222
7202
|
for (var i in this.defaultConfiguration) {
|
|
7223
7203
|
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
7224
7204
|
}
|
|
@@ -7250,30 +7230,40 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7250
7230
|
}
|
|
7251
7231
|
}
|
|
7252
7232
|
var margin = this.chartConfiguration.margin;
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
var height = containerHeight * (self.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
|
|
7258
|
-
// Adjust width for large datasets and zoom
|
|
7233
|
+
var width = parseInt(chartContainer.style('width')) - margin.left - margin.right;
|
|
7234
|
+
// if (this.chartData.data.length > 8 && this.isZoomedOut) {
|
|
7235
|
+
// width = this.chartData.data.length * 175;
|
|
7236
|
+
// }
|
|
7259
7237
|
if (this.chartData.data.length > 30 && this.isZoomedOut) {
|
|
7260
|
-
width =
|
|
7261
|
-
|
|
7262
|
-
|
|
7238
|
+
width =
|
|
7239
|
+
width > this.chartData.data.length * 25
|
|
7240
|
+
? width
|
|
7241
|
+
: this.chartData.data.length * 25;
|
|
7263
7242
|
}
|
|
7264
7243
|
if (this.chartData.data.length > 8 && !this.isZoomedOut) {
|
|
7265
|
-
width = this.chartData.data.length *
|
|
7244
|
+
width = this.chartData.data.length * 130;
|
|
7266
7245
|
}
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7246
|
+
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
7247
|
+
(self.chartConfiguration.svgHeight / 100) -
|
|
7248
|
+
margin.top -
|
|
7249
|
+
margin.bottom;
|
|
7250
|
+
/**
|
|
7251
|
+
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
7252
|
+
*/
|
|
7253
|
+
if (this.chartConfiguration.isFullScreen != undefined &&
|
|
7254
|
+
this.chartConfiguration.isFullScreen) {
|
|
7255
|
+
height =
|
|
7256
|
+
this.chartConfiguration.svgHeight != 80
|
|
7257
|
+
? this.chartConfiguration.svgHeight
|
|
7258
|
+
: parseInt(verticalstackedcontainer.style('height'));
|
|
7272
7259
|
}
|
|
7273
7260
|
if (this.chartConfiguration.isDrilldownChart) {
|
|
7274
|
-
height =
|
|
7261
|
+
height =
|
|
7262
|
+
parseInt(verticalstackedcontainer.style('height')) -
|
|
7263
|
+
margin.top -
|
|
7264
|
+
margin.bottom -
|
|
7265
|
+
130;
|
|
7275
7266
|
}
|
|
7276
|
-
// ...existing code...
|
|
7277
7267
|
/**
|
|
7278
7268
|
* for hiding header
|
|
7279
7269
|
* used by weekly charts
|
|
@@ -7312,17 +7302,16 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7312
7302
|
.style('height', height)
|
|
7313
7303
|
.style('overflow-x', 'hidden')
|
|
7314
7304
|
.style('padding-left', `${margin.left}px`)
|
|
7315
|
-
.style('margin-left', '10px')
|
|
7316
7305
|
.style('padding-right', `${rightSvgWidth}px`);
|
|
7317
7306
|
var svgYAxisLeft = outerContainer
|
|
7318
7307
|
.append('svg')
|
|
7319
|
-
.attr('width', '
|
|
7308
|
+
.attr('width', '75')
|
|
7320
7309
|
.attr('height', height + margin.top + margin.bottom)
|
|
7321
7310
|
.style('position', 'absolute')
|
|
7322
7311
|
.style('left', '0')
|
|
7323
7312
|
.style('z-index', 1)
|
|
7324
7313
|
.append('g')
|
|
7325
|
-
.attr('transform', 'translate(' +
|
|
7314
|
+
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
|
|
7326
7315
|
var svgYAxisRight = outerContainer
|
|
7327
7316
|
.append('svg')
|
|
7328
7317
|
.attr('width', rightSvgWidth)
|
|
@@ -7337,27 +7326,12 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7337
7326
|
.attr('class', 'inner-container')
|
|
7338
7327
|
.style('width', '100%')
|
|
7339
7328
|
.style('overflow-x', 'auto');
|
|
7340
|
-
// Calculate bar width and padding for mobile to avoid overlap and add space between bars
|
|
7341
|
-
let barWidth;
|
|
7342
|
-
let barPadding = 12; // px, space between bars on mobile
|
|
7343
|
-
let requiredSvgWidth;
|
|
7344
|
-
if (isMobile) {
|
|
7345
|
-
// Use a minimum width per bar and add padding between bars
|
|
7346
|
-
const minBarWidth = 32; // px, can adjust as needed
|
|
7347
|
-
barWidth = minBarWidth;
|
|
7348
|
-
requiredSvgWidth = Math.max(width - rightSvgWidth, (barWidth + barPadding) * data.length + leftAndRightSpaces * 2 + rightSvgWidth - barPadding // no padding after last bar
|
|
7349
|
-
);
|
|
7350
|
-
innerContainer.style('overflow-x', 'auto');
|
|
7351
|
-
}
|
|
7352
|
-
else {
|
|
7353
|
-
barWidth = Math.max(40, (width - rightSvgWidth - leftAndRightSpaces * 2) / data.length);
|
|
7354
|
-
barPadding = 0;
|
|
7355
|
-
requiredSvgWidth = width - rightSvgWidth;
|
|
7356
|
-
}
|
|
7357
7329
|
var svg = innerContainer
|
|
7358
7330
|
.append('svg')
|
|
7359
|
-
.attr('width',
|
|
7360
|
-
.attr('
|
|
7331
|
+
// .attr('width', 150 * data.length + margin.left + margin.right)
|
|
7332
|
+
.attr('width', width - rightSvgWidth)
|
|
7333
|
+
.attr('height', height + margin.top + margin.bottom)
|
|
7334
|
+
// .call(ChartHelper.responsivefy)
|
|
7361
7335
|
.append('g')
|
|
7362
7336
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7363
7337
|
let stackKey = keyList;
|
|
@@ -7382,25 +7356,31 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7382
7356
|
])
|
|
7383
7357
|
.range([height, 0]);
|
|
7384
7358
|
}
|
|
7385
|
-
// Calculate bar width for mobile to avoid overlap
|
|
7386
|
-
// ...barWidth is now calculated above, remove duplicate...
|
|
7387
7359
|
var xScale = d3
|
|
7388
7360
|
.scaleBand()
|
|
7389
7361
|
.rangeRound([
|
|
7362
|
+
width - rightSvgWidth - leftAndRightSpaces,
|
|
7390
7363
|
leftAndRightSpaces,
|
|
7391
|
-
width - rightSvgWidth - leftAndRightSpaces
|
|
7392
7364
|
])
|
|
7393
7365
|
.domain(data.map(function (d) {
|
|
7394
7366
|
return d.name;
|
|
7395
|
-
}))
|
|
7396
|
-
|
|
7367
|
+
}));
|
|
7368
|
+
// xScale.bandwidth(192);
|
|
7397
7369
|
var xScaleFromOrigin = d3
|
|
7398
7370
|
.scaleBand()
|
|
7399
7371
|
.rangeRound([width - rightSvgWidth, 0])
|
|
7400
7372
|
.domain(data.map(function (d) {
|
|
7401
7373
|
return d.name;
|
|
7402
7374
|
}));
|
|
7403
|
-
|
|
7375
|
+
/**
|
|
7376
|
+
* xScale for weekly charts does not need padding as this padding affects spacing between the dot and y axis
|
|
7377
|
+
*/
|
|
7378
|
+
if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7379
|
+
xScale.padding(0.5);
|
|
7380
|
+
}
|
|
7381
|
+
else {
|
|
7382
|
+
xScale.align(0.5);
|
|
7383
|
+
}
|
|
7404
7384
|
/**
|
|
7405
7385
|
* draw second x axis on top
|
|
7406
7386
|
*/
|
|
@@ -7428,10 +7408,9 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7428
7408
|
svg
|
|
7429
7409
|
.append('g')
|
|
7430
7410
|
.attr('class', `x${j + 2} axis${j + 2}`)
|
|
7431
|
-
.style('color', '
|
|
7411
|
+
.style('color', '#999999')
|
|
7432
7412
|
.attr('transform', 'translate(0,' + height * this.chartConfiguration.xAxisGrid[j] + ')')
|
|
7433
|
-
.call(d3.axisBottom(xScale).tickSize(0).ticks(5).tickFormat(''))
|
|
7434
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7413
|
+
.call(d3.axisBottom(xScale).tickSize(0).ticks(5).tickFormat(''));
|
|
7435
7414
|
}
|
|
7436
7415
|
}
|
|
7437
7416
|
let yScale = d3.scaleLinear().rangeRound([height, 0]);
|
|
@@ -7503,8 +7482,8 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7503
7482
|
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
7504
7483
|
.tickSize(-width)
|
|
7505
7484
|
.tickFormat(''))
|
|
7506
|
-
//
|
|
7507
|
-
.style('color', '
|
|
7485
|
+
// .style('stroke-dasharray', '5 5')
|
|
7486
|
+
.style('color', '#B9B9B9')
|
|
7508
7487
|
.style('opacity', '0.5')
|
|
7509
7488
|
.call((g) => g.select('.domain').remove());
|
|
7510
7489
|
}
|
|
@@ -7534,47 +7513,35 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7534
7513
|
}
|
|
7535
7514
|
})
|
|
7536
7515
|
.attr('y', function (d) {
|
|
7537
|
-
|
|
7538
|
-
const actualHeight = yScale(d[0]) - yScale(d[1]);
|
|
7539
|
-
return actualHeight < 3 ? yScale(d[0]) - 3 : yScale(d[1]);
|
|
7540
|
-
}
|
|
7541
|
-
return 0;
|
|
7516
|
+
return yScale(d[1]);
|
|
7542
7517
|
})
|
|
7543
|
-
.attr('x', function (d
|
|
7544
|
-
if (isMobile) {
|
|
7545
|
-
// On mobile, position bars with padding
|
|
7546
|
-
return leftAndRightSpaces + i * (barWidth + barPadding);
|
|
7547
|
-
}
|
|
7518
|
+
.attr('x', function (d) {
|
|
7548
7519
|
if (self.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7549
7520
|
return xScale(d.data.name);
|
|
7550
7521
|
}
|
|
7551
7522
|
else {
|
|
7552
7523
|
if (self.chartConfiguration.isDrilldownChart &&
|
|
7553
7524
|
self.chartData.data.length <= 3) {
|
|
7554
|
-
return xScale(d.data.name) + xScale.bandwidth() / 2 -
|
|
7525
|
+
return xScale(d.data.name) + xScale.bandwidth() / 2 - 70;
|
|
7555
7526
|
}
|
|
7556
7527
|
return xScale(d.data.name) + xScale.bandwidth() * 0.1;
|
|
7557
7528
|
}
|
|
7558
7529
|
})
|
|
7559
7530
|
.attr('height', function (d) {
|
|
7560
|
-
if (!isNaN(d[0]) && !isNaN(d[1]))
|
|
7561
|
-
|
|
7562
|
-
return actualHeight < 3 ? 3 : actualHeight;
|
|
7563
|
-
}
|
|
7531
|
+
if (!isNaN(d[0]) && !isNaN(d[1]))
|
|
7532
|
+
return yScale(d[0]) - yScale(d[1]);
|
|
7564
7533
|
return 0;
|
|
7565
7534
|
})
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
: xScale.bandwidth() * 0.8;
|
|
7577
|
-
})
|
|
7535
|
+
/**
|
|
7536
|
+
* width of the rect
|
|
7537
|
+
* for weekly charts, there is no paddings; hence we use hald of bandwidth as width of the bars
|
|
7538
|
+
*/
|
|
7539
|
+
.attr('width', self.chartConfiguration.isMultiChartGridLine == undefined
|
|
7540
|
+
? xScale.bandwidth()
|
|
7541
|
+
: self.chartConfiguration.isDrilldownChart &&
|
|
7542
|
+
self.chartData.data.length <= 3
|
|
7543
|
+
? 140
|
|
7544
|
+
: xScale.bandwidth() * 0.8)
|
|
7578
7545
|
// .style('cursor', 'pointer');
|
|
7579
7546
|
.style('cursor', function (d) {
|
|
7580
7547
|
if (metaData.hasDrillDown) {
|
|
@@ -7688,56 +7655,98 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7688
7655
|
svg
|
|
7689
7656
|
.append('foreignObject')
|
|
7690
7657
|
.attr('x', function () {
|
|
7658
|
+
// if (metaData.hasDrillDown) {
|
|
7691
7659
|
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7692
7660
|
return (xScale(d.data.name) -
|
|
7693
7661
|
leftAndRightSpaces +
|
|
7694
7662
|
(xScale.bandwidth() + leftAndRightSpaces * 2 - 180) / 2);
|
|
7695
7663
|
}
|
|
7696
7664
|
return xScale(d.data.name) - leftAndRightSpaces;
|
|
7665
|
+
// } else return xScale(d.data.name) - leftAndRightSpaces;
|
|
7697
7666
|
})
|
|
7698
7667
|
.attr('class', 'lib-verticalstack-title-ontop')
|
|
7699
7668
|
.attr('y', function () {
|
|
7700
|
-
|
|
7701
|
-
return yScale(d[1]) - 1 - 50; // 10px more gap
|
|
7669
|
+
return yScale(d[1]) - 1 - 40;
|
|
7702
7670
|
})
|
|
7703
7671
|
.attr('dy', function () {
|
|
7704
7672
|
return d.class;
|
|
7705
7673
|
})
|
|
7706
7674
|
.attr('width', function () {
|
|
7675
|
+
// if (metaData.hasDrillDown) {
|
|
7707
7676
|
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7708
7677
|
return '180px';
|
|
7709
7678
|
}
|
|
7710
7679
|
return xScale.bandwidth() + leftAndRightSpaces * 2;
|
|
7680
|
+
// } else return xScale.bandwidth() + leftAndRightSpaces * 2;
|
|
7711
7681
|
})
|
|
7712
7682
|
.attr('height', 40)
|
|
7713
7683
|
.append('xhtml:div')
|
|
7714
7684
|
.attr('class', 'title')
|
|
7715
7685
|
.style('z-index', 99)
|
|
7716
7686
|
.html(function () {
|
|
7717
|
-
// Tooltip content without any arrow mark
|
|
7718
7687
|
if (!isNaN(d[1] - d[0])) {
|
|
7719
|
-
if (d[1] - d[0]
|
|
7720
|
-
return
|
|
7688
|
+
if (d[1] - d[0] == 0) {
|
|
7689
|
+
return;
|
|
7721
7690
|
}
|
|
7722
7691
|
var dataType = metaData.dataType ? metaData.dataType : '';
|
|
7723
7692
|
var desiredText = '';
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7693
|
+
if (self.isZoomedOut) {
|
|
7694
|
+
desiredText =
|
|
7695
|
+
'<span class="title-bar-name">' +
|
|
7696
|
+
(d.data.name && d.data.name.length > 12
|
|
7697
|
+
? d.data.name.substring(0, 9) + '...'
|
|
7698
|
+
: d.data.name) +
|
|
7699
|
+
'</span>';
|
|
7700
|
+
}
|
|
7701
|
+
if (d[1] - d[0] <= 999 ||
|
|
7702
|
+
self.chartConfiguration.backendFormatterHasPriority) {
|
|
7703
|
+
desiredText += metaData.unit
|
|
7704
|
+
? '<span class="title-top-text">' +
|
|
7705
|
+
metaData.unit +
|
|
7706
|
+
formatFromBackend(d[1] - d[0]) +
|
|
7707
|
+
dataType +
|
|
7708
|
+
'</span>'
|
|
7709
|
+
: '<span class="title-top-text">' +
|
|
7710
|
+
formatFromBackend(d[1] - d[0]) +
|
|
7711
|
+
dataType +
|
|
7712
|
+
'</span>';
|
|
7713
|
+
if (metaData.hasDrillDown &&
|
|
7714
|
+
!self.isZoomedOut &&
|
|
7715
|
+
(!metaData.barWithoutClick ||
|
|
7716
|
+
!metaData.barWithoutClick.length ||
|
|
7717
|
+
!metaData.barWithoutClick.includes(d.data.name.toLowerCase()))) {
|
|
7718
|
+
desiredText +=
|
|
7719
|
+
'<span class="title-bottom-text">Click for more details</span>';
|
|
7720
|
+
return desiredText;
|
|
7721
|
+
}
|
|
7722
|
+
else {
|
|
7723
|
+
return desiredText;
|
|
7724
|
+
}
|
|
7725
|
+
}
|
|
7726
|
+
else {
|
|
7727
|
+
desiredText += metaData.unit
|
|
7728
|
+
? '<span class="title-top-text">' +
|
|
7729
|
+
metaData.unit +
|
|
7730
|
+
formatForHugeNumbers(d[1] - d[0]) +
|
|
7731
|
+
dataType +
|
|
7732
|
+
'</span>'
|
|
7733
|
+
: '<span class="title-top-text">' +
|
|
7734
|
+
formatForHugeNumbers(d[1] - d[0]) +
|
|
7735
|
+
dataType +
|
|
7736
|
+
'</span>';
|
|
7737
|
+
if (metaData.hasDrillDown &&
|
|
7738
|
+
!self.isZoomedOut &&
|
|
7739
|
+
(!metaData.barWithoutClick ||
|
|
7740
|
+
!metaData.barWithoutClick.length ||
|
|
7741
|
+
!metaData.barWithoutClick.includes(d.data.name.toLowerCase()))) {
|
|
7742
|
+
desiredText +=
|
|
7743
|
+
'<span class="title-bottom-text">Click for more details</span>';
|
|
7744
|
+
return desiredText;
|
|
7745
|
+
}
|
|
7746
|
+
else {
|
|
7747
|
+
return desiredText;
|
|
7748
|
+
}
|
|
7749
|
+
}
|
|
7741
7750
|
}
|
|
7742
7751
|
else
|
|
7743
7752
|
return;
|
|
@@ -7865,54 +7874,25 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7865
7874
|
});
|
|
7866
7875
|
}
|
|
7867
7876
|
if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
.attr('class', 'custom-x-label')
|
|
7875
|
-
.attr('x', 0)
|
|
7876
|
-
.attr('y', height + 18)
|
|
7877
|
-
.attr('text-anchor', 'middle')
|
|
7878
|
-
.attr('transform', 'translate(' + (xVal + 20) + ',0)') // current value + 20
|
|
7879
|
-
.style('font-size', '10px')
|
|
7880
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7881
|
-
.style('writing-mode', 'sideways-lr') // writing mode for mobile
|
|
7882
|
-
.text(d.name.substring(0, 3));
|
|
7883
|
-
});
|
|
7884
|
-
}
|
|
7885
|
-
else {
|
|
7886
|
-
svg
|
|
7887
|
-
.append('g')
|
|
7888
|
-
.attr('transform', 'translate(0,' + height + ')')
|
|
7889
|
-
.attr('class', 'lib-stacked-x-axis-text')
|
|
7890
|
-
.call(xAxis)
|
|
7891
|
-
.selectAll('text')
|
|
7892
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7893
|
-
.style('font-size', '12px')
|
|
7894
|
-
.attr('text-anchor', 'middle')
|
|
7895
|
-
.attr('dx', '0')
|
|
7896
|
-
.attr('dy', '0.71em')
|
|
7897
|
-
.attr('transform', null)
|
|
7898
|
-
.text(function (d) {
|
|
7899
|
-
return d;
|
|
7900
|
-
});
|
|
7901
|
-
}
|
|
7877
|
+
svg
|
|
7878
|
+
.append('g')
|
|
7879
|
+
.attr('transform', 'translate(0,' + height + ')')
|
|
7880
|
+
.attr('class', 'lib-stacked-x-axis-text')
|
|
7881
|
+
.attr('transform', 'translate(0,' + height + ')')
|
|
7882
|
+
.call(xAxis);
|
|
7902
7883
|
svg
|
|
7903
7884
|
.append('g')
|
|
7904
7885
|
.attr('class', 'lib-stacked-y-axis-text')
|
|
7905
7886
|
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
7906
7887
|
.attr('transform', 'translate(0,0)')
|
|
7907
|
-
.call(yAxis)
|
|
7908
|
-
.selectAll('text')
|
|
7909
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7888
|
+
.call(yAxis);
|
|
7910
7889
|
}
|
|
7911
7890
|
else if (this.chartConfiguration.isDrilldownChart) {
|
|
7912
7891
|
svg
|
|
7913
7892
|
.append('g')
|
|
7914
7893
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7915
7894
|
.attr('class', 'lib-stacked-x-axis-text multichart1')
|
|
7895
|
+
// .attr('transform', 'translate(0,' + height + ')')
|
|
7916
7896
|
.call(xAxis)
|
|
7917
7897
|
.style('display', 'none');
|
|
7918
7898
|
svgYAxisLeft
|
|
@@ -7920,9 +7900,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7920
7900
|
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
7921
7901
|
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
7922
7902
|
.attr('transform', 'translate(0,0)')
|
|
7923
|
-
.call(yAxis)
|
|
7924
|
-
.selectAll('text')
|
|
7925
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7903
|
+
.call(yAxis);
|
|
7926
7904
|
svgYAxisRight
|
|
7927
7905
|
.append('g')
|
|
7928
7906
|
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
@@ -7937,17 +7915,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7937
7915
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7938
7916
|
.attr('class', 'lib-stacked-x-axis-text multichart')
|
|
7939
7917
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7940
|
-
.call(xAxis)
|
|
7941
|
-
|
|
7942
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7918
|
+
.call(xAxis);
|
|
7919
|
+
// .call(g => g.select(".domain").remove());
|
|
7943
7920
|
svg
|
|
7944
7921
|
.append('g')
|
|
7945
7922
|
.attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
|
|
7946
7923
|
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
7947
7924
|
.attr('transform', 'translate(0,0)')
|
|
7948
|
-
.call(yAxis)
|
|
7949
|
-
.selectAll('text')
|
|
7950
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7925
|
+
.call(yAxis);
|
|
7951
7926
|
}
|
|
7952
7927
|
/**
|
|
7953
7928
|
* for existing charts, place xaxis labels nearer to xaxis
|
|
@@ -8045,31 +8020,11 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8045
8020
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8046
8021
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8047
8022
|
.attr('y', short_tick_length_bg)
|
|
8048
|
-
.text(function (d
|
|
8049
|
-
if (isMobile) {
|
|
8050
|
-
// If label has more than one word, show only first 3 letters of first word
|
|
8051
|
-
var firstWord = d.split(' ')[0];
|
|
8052
|
-
return firstWord.substring(0, 3);
|
|
8053
|
-
}
|
|
8023
|
+
.text(function (d) {
|
|
8054
8024
|
if (d.trim().indexOf(' ') > -1) {
|
|
8055
8025
|
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8056
8026
|
}
|
|
8057
8027
|
return d.toLowerCase();
|
|
8058
|
-
})
|
|
8059
|
-
.attr('transform', function (d, i) {
|
|
8060
|
-
if (isMobile) {
|
|
8061
|
-
var totalBars = 0;
|
|
8062
|
-
if (this.parentNode && this.parentNode.parentNode) {
|
|
8063
|
-
totalBars = d3.select(this.parentNode.parentNode).selectAll('g.tick').size();
|
|
8064
|
-
}
|
|
8065
|
-
if (totalBars === 2) {
|
|
8066
|
-
return 'translate(0,0)';
|
|
8067
|
-
}
|
|
8068
|
-
else {
|
|
8069
|
-
return 'translate(' + (i * 30) + ',0)';
|
|
8070
|
-
}
|
|
8071
|
-
}
|
|
8072
|
-
return null;
|
|
8073
8028
|
});
|
|
8074
8029
|
svg
|
|
8075
8030
|
.selectAll('g.x1.axis1 g.tick')
|
|
@@ -8078,20 +8033,10 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8078
8033
|
.attr('y', long_tick_length_bg)
|
|
8079
8034
|
.attr('fill', 'currentColor')
|
|
8080
8035
|
.text(function (d) {
|
|
8081
|
-
// For mobile, do not print the second word at all
|
|
8082
|
-
if (isMobile) {
|
|
8083
|
-
return '';
|
|
8084
|
-
}
|
|
8085
8036
|
if (d.trim().indexOf(' ') > -1) {
|
|
8086
8037
|
return d.trim().substring(d.indexOf(' '), d.length).toLowerCase();
|
|
8087
8038
|
}
|
|
8088
8039
|
return '';
|
|
8089
|
-
})
|
|
8090
|
-
.attr('transform', function (d, i) {
|
|
8091
|
-
if (isMobile && i === 0) {
|
|
8092
|
-
return 'translate(20,0)';
|
|
8093
|
-
}
|
|
8094
|
-
return null;
|
|
8095
8040
|
});
|
|
8096
8041
|
}
|
|
8097
8042
|
/**
|
|
@@ -8119,14 +8064,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8119
8064
|
this.chartConfiguration.isYaxisDashed) {
|
|
8120
8065
|
d3.selectAll('.yaxis-dashed')
|
|
8121
8066
|
.style('stroke-dasharray', '5 5')
|
|
8122
|
-
.style('color', '
|
|
8067
|
+
.style('color', '#999999');
|
|
8123
8068
|
}
|
|
8124
8069
|
/**
|
|
8125
8070
|
* x axis color
|
|
8126
8071
|
* used by weekly charts
|
|
8127
8072
|
*/
|
|
8128
8073
|
if (this.chartConfiguration.isXaxisColor != undefined) {
|
|
8129
|
-
d3.selectAll('.multichart').style('color', this.chartConfiguration.isXaxisColor
|
|
8074
|
+
d3.selectAll('.multichart').style('color', this.chartConfiguration.isXaxisColor);
|
|
8130
8075
|
}
|
|
8131
8076
|
/**
|
|
8132
8077
|
* used to display y label
|
|
@@ -8134,51 +8079,30 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8134
8079
|
if (this.isZoomedOut) {
|
|
8135
8080
|
svg
|
|
8136
8081
|
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
8137
|
-
.attr('
|
|
8138
|
-
.attr('text-anchor', 'end')
|
|
8139
|
-
.attr('x', '-5')
|
|
8140
|
-
.attr('dy', null);
|
|
8141
|
-
}
|
|
8142
|
-
function styleAxisDomain() {
|
|
8143
|
-
svg.selectAll('.domain')
|
|
8144
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
8145
|
-
.style('stroke-width', '1px');
|
|
8146
|
-
svgYAxisLeft.selectAll('.domain')
|
|
8147
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
8148
|
-
.style('stroke-width', '1px');
|
|
8149
|
-
svgYAxisRight.selectAll('.domain')
|
|
8150
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
8151
|
-
.style('stroke-width', '1px');
|
|
8082
|
+
.attr('class', 'lib-display-hidden');
|
|
8152
8083
|
}
|
|
8153
|
-
styleAxisDomain();
|
|
8154
8084
|
if (metaData.yLabel) {
|
|
8155
|
-
svgYAxisLeft.selectAll('.lib-axis-group-label, .lib-ylabel-drilldowncharts, .lib-ylabel-weeklyCharts').remove();
|
|
8156
|
-
function isAcronym(label) {
|
|
8157
|
-
return (label.length <= 4 && /^[A-Z]+$/.test(label)) || (label === label.toUpperCase() && /[A-Z]/.test(label));
|
|
8158
|
-
}
|
|
8159
|
-
const yLabelText = metaData.yLabel;
|
|
8160
|
-
const isAcr = isAcronym(yLabelText.replace(/[^A-Za-z]/g, ''));
|
|
8161
|
-
const yPosition = isria ? 0 - margin.left / 2 - 30 : 0 - margin.left / 2 - 40;
|
|
8162
8085
|
svgYAxisLeft
|
|
8163
8086
|
.append('text')
|
|
8164
|
-
.attr('class',
|
|
8165
|
-
let baseClass = 'lib-axis-group-label font-size-1';
|
|
8166
|
-
if (self.chartConfiguration.isDrilldownChart)
|
|
8167
|
-
return baseClass + ' lib-ylabel-drilldowncharts';
|
|
8168
|
-
if (self.chartConfiguration.isMultiChartGridLine != undefined)
|
|
8169
|
-
return baseClass + ' lib-ylabel-weeklyCharts';
|
|
8170
|
-
return baseClass + ' lib-axis-waterfall-label';
|
|
8171
|
-
})
|
|
8087
|
+
.attr('class', 'lib-axis-group-label font-size-1')
|
|
8172
8088
|
.attr('style', self.chartConfiguration.yAxisCustomlabelStyles)
|
|
8173
8089
|
.attr('transform', 'rotate(-90)')
|
|
8174
|
-
.attr('y',
|
|
8090
|
+
.attr('y', 0 - margin.left / 2 - 20 - 15)
|
|
8175
8091
|
.attr('x', 0 - height / 2)
|
|
8176
8092
|
.attr('dy', '1em')
|
|
8177
8093
|
.style('text-anchor', 'middle')
|
|
8178
|
-
.
|
|
8179
|
-
.style('
|
|
8180
|
-
|
|
8181
|
-
|
|
8094
|
+
.text(metaData.yLabel.toLowerCase())
|
|
8095
|
+
.style('text-transform', 'capitalize');
|
|
8096
|
+
if (this.chartConfiguration.isDrilldownChart) {
|
|
8097
|
+
svg
|
|
8098
|
+
.selectAll('.lib-axis-group-label')
|
|
8099
|
+
.attr('class', 'lib-ylabel-drilldowncharts');
|
|
8100
|
+
}
|
|
8101
|
+
else if (this.chartConfiguration.isMultiChartGridLine != undefined) {
|
|
8102
|
+
svg
|
|
8103
|
+
.selectAll('.lib-axis-group-label')
|
|
8104
|
+
.attr('class', 'lib-ylabel-weeklyCharts');
|
|
8105
|
+
}
|
|
8182
8106
|
}
|
|
8183
8107
|
if (this.chartData.targetLineData) {
|
|
8184
8108
|
const yZero = yScale(parsedNum);
|
|
@@ -8204,7 +8128,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8204
8128
|
.attr('height', 50)
|
|
8205
8129
|
.append('xhtml:div')
|
|
8206
8130
|
.attr('class', 'target-display')
|
|
8207
|
-
.style('color',
|
|
8131
|
+
.style('color', this.chartData.targetLineData.color)
|
|
8208
8132
|
.html(function (d, i) {
|
|
8209
8133
|
let dataTypeTemp = '';
|
|
8210
8134
|
let targetLineName = 'target';
|
|
@@ -8240,29 +8164,23 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8240
8164
|
.text(metaData.lineyLabel);
|
|
8241
8165
|
}
|
|
8242
8166
|
if (metaData.xLabel) {
|
|
8243
|
-
function isAcronym(label) {
|
|
8244
|
-
return ((label.length <= 4 && /^[A-Z]+$/.test(label)) ||
|
|
8245
|
-
(label === label.toUpperCase() && /[A-Z]/.test(label)));
|
|
8246
|
-
}
|
|
8247
|
-
const xLabelText = metaData.xLabel;
|
|
8248
|
-
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
8249
|
-
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
|
|
8250
8167
|
svg
|
|
8251
8168
|
.append('text')
|
|
8252
|
-
.attr('class',
|
|
8253
|
-
|
|
8254
|
-
if (self.chartConfiguration.isDrilldownChart)
|
|
8255
|
-
return baseClass + ' lib-xlabel-drilldowncharts';
|
|
8256
|
-
if (self.chartConfiguration.isMultiChartGridLine != undefined)
|
|
8257
|
-
return baseClass + ' lib-xlabel-weeklyCharts';
|
|
8258
|
-
return baseClass + ' lib-axis-waterfall-label';
|
|
8259
|
-
})
|
|
8260
|
-
.attr('style', self.chartConfiguration.xAxisCustomlabelStyles)
|
|
8261
|
-
.attr('transform', 'translate(' + width / 2 + ' ,' + xPosition + ')')
|
|
8169
|
+
.attr('class', 'lib-axis-waterfall-label')
|
|
8170
|
+
.attr('transform', 'translate(' + width / 2 + ' ,' + (height + margin.top + 20) + ')')
|
|
8262
8171
|
.style('text-anchor', 'middle')
|
|
8263
|
-
.
|
|
8264
|
-
.text
|
|
8265
|
-
|
|
8172
|
+
.text(metaData.xLabel.toLowerCase())
|
|
8173
|
+
.style('text-transform', 'capitalize');
|
|
8174
|
+
}
|
|
8175
|
+
if (yLineAxis != null) {
|
|
8176
|
+
if (lineData && self.chartConfiguration.showLineChartAxis) {
|
|
8177
|
+
svg
|
|
8178
|
+
.append('g')
|
|
8179
|
+
.attr('class', 'lib-stacked-y-axis-text')
|
|
8180
|
+
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
8181
|
+
.attr('transform', 'translate(' + width + ',0)')
|
|
8182
|
+
.call(yLineAxis);
|
|
8183
|
+
}
|
|
8266
8184
|
}
|
|
8267
8185
|
if (lineData && colors) {
|
|
8268
8186
|
var dataGroup = d3
|
|
@@ -8551,7 +8469,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8551
8469
|
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
8552
8470
|
(self.chartConfiguration.svgHeight / 100) -
|
|
8553
8471
|
margin.top -
|
|
8554
|
-
margin.bottom;
|
|
8472
|
+
margin.bottom + 30;
|
|
8555
8473
|
/**
|
|
8556
8474
|
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
8557
8475
|
*/
|
|
@@ -8642,7 +8560,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8642
8560
|
.append('svg')
|
|
8643
8561
|
// .attr('id', self.uniqueId)
|
|
8644
8562
|
.attr('width', width - rightSvgWidth)
|
|
8645
|
-
.attr('height', height + margin.top + margin.bottom +
|
|
8563
|
+
.attr('height', height + margin.top + margin.bottom + 30)
|
|
8646
8564
|
// .call(ChartHelper.responsivefy)
|
|
8647
8565
|
.append('g')
|
|
8648
8566
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
@@ -8778,19 +8696,18 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8778
8696
|
});
|
|
8779
8697
|
}
|
|
8780
8698
|
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
8781
|
-
|
|
8699
|
+
svg
|
|
8782
8700
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8783
8701
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8784
8702
|
.style('font-size', this.isHeaderVisible ? '18px' : '14px')
|
|
8785
|
-
.attr('text-anchor', 'middle')
|
|
8786
8703
|
.attr('y', function (d) {
|
|
8787
|
-
// For grouped bar charts with many bars and xLabel present,
|
|
8704
|
+
// For grouped bar charts with many bars and xLabel present, do NOT add extra space (avoid overlap)
|
|
8788
8705
|
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
8789
|
-
|
|
8706
|
+
// In maximized (fullscreen) view, keep the gap minimal
|
|
8790
8707
|
if (self.chartConfiguration.isFullScreen) {
|
|
8791
|
-
return
|
|
8708
|
+
return short_tick_length_bg;
|
|
8792
8709
|
}
|
|
8793
|
-
return
|
|
8710
|
+
return short_tick_length_bg;
|
|
8794
8711
|
}
|
|
8795
8712
|
// For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
|
|
8796
8713
|
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
@@ -8839,37 +8756,8 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8839
8756
|
if (isValueToBeIgnored) {
|
|
8840
8757
|
return '';
|
|
8841
8758
|
}
|
|
8842
|
-
// Always add space before and after hyphen for date range labels, even when header is visible and label is single line
|
|
8843
|
-
// Apply for grouped bar charts and single bar charts, header visible, single line
|
|
8844
|
-
const dateRangeRegex = /(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})\s*-\s*(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})/;
|
|
8845
|
-
if (dateRangeRegex.test(d.trim())) {
|
|
8846
|
-
return d.trim().replace(dateRangeRegex, (m, d1, d2) => `${d1} - ${d2}`);
|
|
8847
|
-
}
|
|
8848
|
-
// Split date and week labels into two lines in grouped bar zoom-in view (and minimized view)
|
|
8849
|
-
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8850
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
8851
|
-
if (subgroups.length > 1 && !self.isZoomedOut && data.length > 8 && d.indexOf(' ') > -1 && (isDateLabel || isWeekLabel)) {
|
|
8852
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
8853
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
8854
|
-
return first + '\n' + second;
|
|
8855
|
-
}
|
|
8856
|
-
// Also keep previous logic for minimized view
|
|
8857
|
-
if (isDateLabel) {
|
|
8858
|
-
if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
|
|
8859
|
-
var first = d.substring(0, d.indexOf(' '));
|
|
8860
|
-
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
8861
|
-
return first + '\n' + second;
|
|
8862
|
-
}
|
|
8863
|
-
else {
|
|
8864
|
-
return d;
|
|
8865
|
-
}
|
|
8866
|
-
}
|
|
8867
|
-
if (d.trim().indexOf(' ') > -1) {
|
|
8868
|
-
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8869
|
-
}
|
|
8870
|
-
return d.toLowerCase();
|
|
8871
8759
|
// If label looks like a date (contains digits and - or /)
|
|
8872
|
-
const
|
|
8760
|
+
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8873
8761
|
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
8874
8762
|
if (isDateLabel) {
|
|
8875
8763
|
if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
|
|
@@ -8886,15 +8774,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8886
8774
|
}
|
|
8887
8775
|
return d.toLowerCase();
|
|
8888
8776
|
});
|
|
8889
|
-
// Now apply writing-mode: sideways-lr for grouped charts with date labels in zoomed-out view and many bars
|
|
8890
|
-
xAxisLabels.each(function (d) {
|
|
8891
|
-
// Only apply writing-mode for exact date labels, not those containing 'week' or similar
|
|
8892
|
-
const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
|
|
8893
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
8894
|
-
if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
|
|
8895
|
-
d3.select(this).style('writing-mode', 'sideways-lr');
|
|
8896
|
-
}
|
|
8897
|
-
});
|
|
8898
8777
|
if (!isMobile) {
|
|
8899
8778
|
svg
|
|
8900
8779
|
.selectAll('g.x1.axis1 g.tick')
|
|
@@ -9047,19 +8926,20 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9047
8926
|
});
|
|
9048
8927
|
}
|
|
9049
8928
|
var xSubgroup = d3.scaleBand().domain(subgroups);
|
|
9050
|
-
|
|
8929
|
+
// Weekly shipped/planned daily grouped chart: increase bar width for both zoom-in and zoom-out views
|
|
8930
|
+
if (subgroups.length > 1 && this.chartConfiguration.isMultiChartGridLine) {
|
|
8931
|
+
xSubgroup.range([0, x.bandwidth() * 1.2]).padding(0.05);
|
|
8932
|
+
}
|
|
8933
|
+
else if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9051
8934
|
// For grouped bar charts in zoom-in view, reduce padding between bars
|
|
9052
|
-
xSubgroup.range([0, x.bandwidth()]);
|
|
8935
|
+
xSubgroup.range([0, x.bandwidth()]).padding(0.05);
|
|
9053
8936
|
}
|
|
9054
8937
|
else if (subgroups.length === 1 && !this.isZoomedOut) {
|
|
9055
|
-
// For single-bar (non-grouped) charts in zoom-in view, set bar width to
|
|
9056
|
-
xSubgroup.range([0,
|
|
9057
|
-
}
|
|
9058
|
-
else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
9059
|
-
xSubgroup.range([0, x.bandwidth()]);
|
|
8938
|
+
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
8939
|
+
xSubgroup.range([0, 80]);
|
|
9060
8940
|
}
|
|
9061
8941
|
else {
|
|
9062
|
-
//
|
|
8942
|
+
// All other cases (including zoomed-out), use full bandwidth
|
|
9063
8943
|
xSubgroup.range([0, x.bandwidth()]);
|
|
9064
8944
|
}
|
|
9065
8945
|
// if (this.chartConfiguration.isDrilldownChart) {
|
|
@@ -9116,7 +8996,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9116
8996
|
// Increase bar width a bit in zoom-in view
|
|
9117
8997
|
let reducedBarWidth = 60;
|
|
9118
8998
|
if (!self.isZoomedOut) {
|
|
9119
|
-
reducedBarWidth =
|
|
8999
|
+
reducedBarWidth = 80;
|
|
9120
9000
|
}
|
|
9121
9001
|
if (self.chartData.data.length == 1) {
|
|
9122
9002
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9141,14 +9021,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9141
9021
|
});
|
|
9142
9022
|
return tempScale(d.key);
|
|
9143
9023
|
}
|
|
9144
|
-
// For grouped bar charts in zoom-in view, increase x value for the first bar only
|
|
9145
|
-
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
9146
|
-
// Find index of this bar in the data array
|
|
9147
|
-
const barIndex = data.findIndex((indiv) => indiv.name === d.name);
|
|
9148
|
-
if (barIndex === 0) {
|
|
9149
|
-
return xSubgroup(d.key) - 10;
|
|
9150
|
-
}
|
|
9151
|
-
}
|
|
9152
9024
|
return xSubgroup(d.key);
|
|
9153
9025
|
})
|
|
9154
9026
|
.attr('y', function (d) {
|
|
@@ -9165,7 +9037,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9165
9037
|
.attr('width', function (d) {
|
|
9166
9038
|
// For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
|
|
9167
9039
|
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
9168
|
-
return xSubgroup.bandwidth() * 0.
|
|
9040
|
+
return xSubgroup.bandwidth() * 0.5;
|
|
9169
9041
|
}
|
|
9170
9042
|
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9171
9043
|
if (subgroups.length === 1 && !self.isZoomedOut) {
|
|
@@ -9181,7 +9053,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9181
9053
|
// Increase bar width a bit in zoom-in view
|
|
9182
9054
|
let reducedBarWidth = 60;
|
|
9183
9055
|
if (!self.isZoomedOut) {
|
|
9184
|
-
reducedBarWidth =
|
|
9056
|
+
reducedBarWidth = 80;
|
|
9185
9057
|
}
|
|
9186
9058
|
if (self.chartData.data.length == 1) {
|
|
9187
9059
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9702,7 +9574,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9702
9574
|
}
|
|
9703
9575
|
const xLabelText = metaData.xLabel;
|
|
9704
9576
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
9705
|
-
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom +
|
|
9577
|
+
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
|
|
9706
9578
|
svg
|
|
9707
9579
|
.append('text')
|
|
9708
9580
|
.attr('class', function () {
|