axidio-styleguide-library1-v2 0.1.25 → 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.
|
@@ -7120,10 +7120,10 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7120
7120
|
this.uniqueId = this.getUniqueId();
|
|
7121
7121
|
this.isTransparentBackground = false;
|
|
7122
7122
|
this.defaultConfiguration = {
|
|
7123
|
-
margin: { top:
|
|
7124
|
-
svgHeight:
|
|
7123
|
+
margin: { top: 30, right: 30, bottom: 50, left: 60 },
|
|
7124
|
+
svgHeight: 80,
|
|
7125
7125
|
legendHeight: '10%',
|
|
7126
|
-
numberOfYTicks:
|
|
7126
|
+
numberOfYTicks: 7,
|
|
7127
7127
|
labelFormatter: ChartHelper.defaultFormatter,
|
|
7128
7128
|
xAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
7129
7129
|
yAxisLabelFomatter: ChartHelper.defaultFormatter,
|
|
@@ -7199,27 +7199,6 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7199
7199
|
var tempObjectHolder = {};
|
|
7200
7200
|
var rightSvgWidth = 60;
|
|
7201
7201
|
var leftAndRightSpaces = 50;
|
|
7202
|
-
let isria = this.customChartConfiguration.isRia;
|
|
7203
|
-
// Responsive breakpoints
|
|
7204
|
-
const isMobile = window.innerWidth < 576;
|
|
7205
|
-
const isTablet = window.innerWidth >= 576 && window.innerWidth < 992;
|
|
7206
|
-
const isDesktop = window.innerWidth >= 992;
|
|
7207
|
-
// Adjust margins and font sizes based on device
|
|
7208
|
-
if (isMobile) {
|
|
7209
|
-
this.chartConfiguration.margin = { top: 20, right: 10, bottom: 40, left: 30 };
|
|
7210
|
-
this.chartConfiguration.numberOfYTicks = 4;
|
|
7211
|
-
this.chartConfiguration.svgHeight = 60;
|
|
7212
|
-
}
|
|
7213
|
-
else if (isTablet) {
|
|
7214
|
-
this.chartConfiguration.margin = { top: 25, right: 20, bottom: 45, left: 40 };
|
|
7215
|
-
this.chartConfiguration.numberOfYTicks = 6;
|
|
7216
|
-
this.chartConfiguration.svgHeight = 70;
|
|
7217
|
-
}
|
|
7218
|
-
else {
|
|
7219
|
-
this.chartConfiguration.margin = { top: 30, right: 30, bottom: 50, left: 60 };
|
|
7220
|
-
this.chartConfiguration.numberOfYTicks = 7;
|
|
7221
|
-
this.chartConfiguration.svgHeight = 80;
|
|
7222
|
-
}
|
|
7223
7202
|
for (var i in this.defaultConfiguration) {
|
|
7224
7203
|
this.chartConfiguration[i] = ChartHelper.getValueByConfigurationType(i, this.defaultConfiguration, this.customChartConfiguration);
|
|
7225
7204
|
}
|
|
@@ -7251,30 +7230,40 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7251
7230
|
}
|
|
7252
7231
|
}
|
|
7253
7232
|
var margin = this.chartConfiguration.margin;
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
var height = containerHeight * (self.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
|
|
7259
|
-
// 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
|
+
// }
|
|
7260
7237
|
if (this.chartData.data.length > 30 && this.isZoomedOut) {
|
|
7261
|
-
width =
|
|
7262
|
-
|
|
7263
|
-
|
|
7238
|
+
width =
|
|
7239
|
+
width > this.chartData.data.length * 25
|
|
7240
|
+
? width
|
|
7241
|
+
: this.chartData.data.length * 25;
|
|
7264
7242
|
}
|
|
7265
7243
|
if (this.chartData.data.length > 8 && !this.isZoomedOut) {
|
|
7266
|
-
width = this.chartData.data.length *
|
|
7244
|
+
width = this.chartData.data.length * 130;
|
|
7267
7245
|
}
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
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'));
|
|
7273
7259
|
}
|
|
7274
7260
|
if (this.chartConfiguration.isDrilldownChart) {
|
|
7275
|
-
height =
|
|
7261
|
+
height =
|
|
7262
|
+
parseInt(verticalstackedcontainer.style('height')) -
|
|
7263
|
+
margin.top -
|
|
7264
|
+
margin.bottom -
|
|
7265
|
+
130;
|
|
7276
7266
|
}
|
|
7277
|
-
// ...existing code...
|
|
7278
7267
|
/**
|
|
7279
7268
|
* for hiding header
|
|
7280
7269
|
* used by weekly charts
|
|
@@ -7313,17 +7302,16 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7313
7302
|
.style('height', height)
|
|
7314
7303
|
.style('overflow-x', 'hidden')
|
|
7315
7304
|
.style('padding-left', `${margin.left}px`)
|
|
7316
|
-
.style('margin-left', '10px')
|
|
7317
7305
|
.style('padding-right', `${rightSvgWidth}px`);
|
|
7318
7306
|
var svgYAxisLeft = outerContainer
|
|
7319
7307
|
.append('svg')
|
|
7320
|
-
.attr('width', '
|
|
7308
|
+
.attr('width', '75')
|
|
7321
7309
|
.attr('height', height + margin.top + margin.bottom)
|
|
7322
7310
|
.style('position', 'absolute')
|
|
7323
7311
|
.style('left', '0')
|
|
7324
7312
|
.style('z-index', 1)
|
|
7325
7313
|
.append('g')
|
|
7326
|
-
.attr('transform', 'translate(' +
|
|
7314
|
+
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
|
|
7327
7315
|
var svgYAxisRight = outerContainer
|
|
7328
7316
|
.append('svg')
|
|
7329
7317
|
.attr('width', rightSvgWidth)
|
|
@@ -7338,27 +7326,12 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7338
7326
|
.attr('class', 'inner-container')
|
|
7339
7327
|
.style('width', '100%')
|
|
7340
7328
|
.style('overflow-x', 'auto');
|
|
7341
|
-
// Calculate bar width and padding for mobile to avoid overlap and add space between bars
|
|
7342
|
-
let barWidth;
|
|
7343
|
-
let barPadding = 12; // px, space between bars on mobile
|
|
7344
|
-
let requiredSvgWidth;
|
|
7345
|
-
if (isMobile) {
|
|
7346
|
-
// Use a minimum width per bar and add padding between bars
|
|
7347
|
-
const minBarWidth = 32; // px, can adjust as needed
|
|
7348
|
-
barWidth = minBarWidth;
|
|
7349
|
-
requiredSvgWidth = Math.max(width - rightSvgWidth, (barWidth + barPadding) * data.length + leftAndRightSpaces * 2 + rightSvgWidth - barPadding // no padding after last bar
|
|
7350
|
-
);
|
|
7351
|
-
innerContainer.style('overflow-x', 'auto');
|
|
7352
|
-
}
|
|
7353
|
-
else {
|
|
7354
|
-
barWidth = Math.max(40, (width - rightSvgWidth - leftAndRightSpaces * 2) / data.length);
|
|
7355
|
-
barPadding = 0;
|
|
7356
|
-
requiredSvgWidth = width - rightSvgWidth;
|
|
7357
|
-
}
|
|
7358
7329
|
var svg = innerContainer
|
|
7359
7330
|
.append('svg')
|
|
7360
|
-
.attr('width',
|
|
7361
|
-
.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)
|
|
7362
7335
|
.append('g')
|
|
7363
7336
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
7364
7337
|
let stackKey = keyList;
|
|
@@ -7383,25 +7356,31 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7383
7356
|
])
|
|
7384
7357
|
.range([height, 0]);
|
|
7385
7358
|
}
|
|
7386
|
-
// Calculate bar width for mobile to avoid overlap
|
|
7387
|
-
// ...barWidth is now calculated above, remove duplicate...
|
|
7388
7359
|
var xScale = d3
|
|
7389
7360
|
.scaleBand()
|
|
7390
7361
|
.rangeRound([
|
|
7362
|
+
width - rightSvgWidth - leftAndRightSpaces,
|
|
7391
7363
|
leftAndRightSpaces,
|
|
7392
|
-
width - rightSvgWidth - leftAndRightSpaces
|
|
7393
7364
|
])
|
|
7394
7365
|
.domain(data.map(function (d) {
|
|
7395
7366
|
return d.name;
|
|
7396
|
-
})
|
|
7397
|
-
|
|
7367
|
+
}));
|
|
7368
|
+
// xScale.bandwidth(192);
|
|
7398
7369
|
var xScaleFromOrigin = d3
|
|
7399
7370
|
.scaleBand()
|
|
7400
7371
|
.rangeRound([width - rightSvgWidth, 0])
|
|
7401
7372
|
.domain(data.map(function (d) {
|
|
7402
7373
|
return d.name;
|
|
7403
|
-
})
|
|
7404
|
-
|
|
7374
|
+
}));
|
|
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
|
+
}
|
|
7405
7384
|
/**
|
|
7406
7385
|
* draw second x axis on top
|
|
7407
7386
|
*/
|
|
@@ -7429,10 +7408,9 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7429
7408
|
svg
|
|
7430
7409
|
.append('g')
|
|
7431
7410
|
.attr('class', `x${j + 2} axis${j + 2}`)
|
|
7432
|
-
.style('color', '
|
|
7411
|
+
.style('color', '#999999')
|
|
7433
7412
|
.attr('transform', 'translate(0,' + height * this.chartConfiguration.xAxisGrid[j] + ')')
|
|
7434
|
-
.call(d3.axisBottom(xScale).tickSize(0).ticks(5).tickFormat(''))
|
|
7435
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7413
|
+
.call(d3.axisBottom(xScale).tickSize(0).ticks(5).tickFormat(''));
|
|
7436
7414
|
}
|
|
7437
7415
|
}
|
|
7438
7416
|
let yScale = d3.scaleLinear().rangeRound([height, 0]);
|
|
@@ -7504,8 +7482,8 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7504
7482
|
.ticks(self.chartConfiguration.numberOfYTicks)
|
|
7505
7483
|
.tickSize(-width)
|
|
7506
7484
|
.tickFormat(''))
|
|
7507
|
-
//
|
|
7508
|
-
.style('color', '
|
|
7485
|
+
// .style('stroke-dasharray', '5 5')
|
|
7486
|
+
.style('color', '#B9B9B9')
|
|
7509
7487
|
.style('opacity', '0.5')
|
|
7510
7488
|
.call((g) => g.select('.domain').remove());
|
|
7511
7489
|
}
|
|
@@ -7535,47 +7513,35 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7535
7513
|
}
|
|
7536
7514
|
})
|
|
7537
7515
|
.attr('y', function (d) {
|
|
7538
|
-
|
|
7539
|
-
const actualHeight = yScale(d[0]) - yScale(d[1]);
|
|
7540
|
-
return actualHeight < 3 ? yScale(d[0]) - 3 : yScale(d[1]);
|
|
7541
|
-
}
|
|
7542
|
-
return 0;
|
|
7516
|
+
return yScale(d[1]);
|
|
7543
7517
|
})
|
|
7544
|
-
.attr('x', function (d
|
|
7545
|
-
if (isMobile) {
|
|
7546
|
-
// On mobile, position bars with padding
|
|
7547
|
-
return leftAndRightSpaces + i * (barWidth + barPadding);
|
|
7548
|
-
}
|
|
7518
|
+
.attr('x', function (d) {
|
|
7549
7519
|
if (self.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7550
7520
|
return xScale(d.data.name);
|
|
7551
7521
|
}
|
|
7552
7522
|
else {
|
|
7553
7523
|
if (self.chartConfiguration.isDrilldownChart &&
|
|
7554
7524
|
self.chartData.data.length <= 3) {
|
|
7555
|
-
return xScale(d.data.name) + xScale.bandwidth() / 2 -
|
|
7525
|
+
return xScale(d.data.name) + xScale.bandwidth() / 2 - 70;
|
|
7556
7526
|
}
|
|
7557
7527
|
return xScale(d.data.name) + xScale.bandwidth() * 0.1;
|
|
7558
7528
|
}
|
|
7559
7529
|
})
|
|
7560
7530
|
.attr('height', function (d) {
|
|
7561
|
-
if (!isNaN(d[0]) && !isNaN(d[1]))
|
|
7562
|
-
|
|
7563
|
-
return actualHeight < 3 ? 3 : actualHeight;
|
|
7564
|
-
}
|
|
7531
|
+
if (!isNaN(d[0]) && !isNaN(d[1]))
|
|
7532
|
+
return yScale(d[0]) - yScale(d[1]);
|
|
7565
7533
|
return 0;
|
|
7566
7534
|
})
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
: xScale.bandwidth() * 0.8;
|
|
7578
|
-
})
|
|
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)
|
|
7579
7545
|
// .style('cursor', 'pointer');
|
|
7580
7546
|
.style('cursor', function (d) {
|
|
7581
7547
|
if (metaData.hasDrillDown) {
|
|
@@ -7689,56 +7655,98 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7689
7655
|
svg
|
|
7690
7656
|
.append('foreignObject')
|
|
7691
7657
|
.attr('x', function () {
|
|
7658
|
+
// if (metaData.hasDrillDown) {
|
|
7692
7659
|
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7693
7660
|
return (xScale(d.data.name) -
|
|
7694
7661
|
leftAndRightSpaces +
|
|
7695
7662
|
(xScale.bandwidth() + leftAndRightSpaces * 2 - 180) / 2);
|
|
7696
7663
|
}
|
|
7697
7664
|
return xScale(d.data.name) - leftAndRightSpaces;
|
|
7665
|
+
// } else return xScale(d.data.name) - leftAndRightSpaces;
|
|
7698
7666
|
})
|
|
7699
7667
|
.attr('class', 'lib-verticalstack-title-ontop')
|
|
7700
7668
|
.attr('y', function () {
|
|
7701
|
-
|
|
7702
|
-
return yScale(d[1]) - 1 - 50; // 10px more gap
|
|
7669
|
+
return yScale(d[1]) - 1 - 40;
|
|
7703
7670
|
})
|
|
7704
7671
|
.attr('dy', function () {
|
|
7705
7672
|
return d.class;
|
|
7706
7673
|
})
|
|
7707
7674
|
.attr('width', function () {
|
|
7675
|
+
// if (metaData.hasDrillDown) {
|
|
7708
7676
|
if (xScale.bandwidth() + leftAndRightSpaces * 2 > 180) {
|
|
7709
7677
|
return '180px';
|
|
7710
7678
|
}
|
|
7711
7679
|
return xScale.bandwidth() + leftAndRightSpaces * 2;
|
|
7680
|
+
// } else return xScale.bandwidth() + leftAndRightSpaces * 2;
|
|
7712
7681
|
})
|
|
7713
7682
|
.attr('height', 40)
|
|
7714
7683
|
.append('xhtml:div')
|
|
7715
7684
|
.attr('class', 'title')
|
|
7716
7685
|
.style('z-index', 99)
|
|
7717
7686
|
.html(function () {
|
|
7718
|
-
// Tooltip content without any arrow mark
|
|
7719
7687
|
if (!isNaN(d[1] - d[0])) {
|
|
7720
|
-
if (d[1] - d[0]
|
|
7721
|
-
return
|
|
7688
|
+
if (d[1] - d[0] == 0) {
|
|
7689
|
+
return;
|
|
7722
7690
|
}
|
|
7723
7691
|
var dataType = metaData.dataType ? metaData.dataType : '';
|
|
7724
7692
|
var desiredText = '';
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
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
|
+
}
|
|
7742
7750
|
}
|
|
7743
7751
|
else
|
|
7744
7752
|
return;
|
|
@@ -7866,54 +7874,25 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7866
7874
|
});
|
|
7867
7875
|
}
|
|
7868
7876
|
if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
.attr('class', 'custom-x-label')
|
|
7876
|
-
.attr('x', 0)
|
|
7877
|
-
.attr('y', height + 18)
|
|
7878
|
-
.attr('text-anchor', 'middle')
|
|
7879
|
-
.attr('transform', 'translate(' + (xVal + 20) + ',0)') // current value + 20
|
|
7880
|
-
.style('font-size', '10px')
|
|
7881
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7882
|
-
.style('writing-mode', 'sideways-lr') // writing mode for mobile
|
|
7883
|
-
.text(d.name.substring(0, 3));
|
|
7884
|
-
});
|
|
7885
|
-
}
|
|
7886
|
-
else {
|
|
7887
|
-
svg
|
|
7888
|
-
.append('g')
|
|
7889
|
-
.attr('transform', 'translate(0,' + height + ')')
|
|
7890
|
-
.attr('class', 'lib-stacked-x-axis-text')
|
|
7891
|
-
.call(xAxis)
|
|
7892
|
-
.selectAll('text')
|
|
7893
|
-
.style('fill', 'var(--chart-text-color)')
|
|
7894
|
-
.style('font-size', '12px')
|
|
7895
|
-
.attr('text-anchor', 'middle')
|
|
7896
|
-
.attr('dx', '0')
|
|
7897
|
-
.attr('dy', '0.71em')
|
|
7898
|
-
.attr('transform', null)
|
|
7899
|
-
.text(function (d) {
|
|
7900
|
-
return d;
|
|
7901
|
-
});
|
|
7902
|
-
}
|
|
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);
|
|
7903
7883
|
svg
|
|
7904
7884
|
.append('g')
|
|
7905
7885
|
.attr('class', 'lib-stacked-y-axis-text')
|
|
7906
7886
|
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
7907
7887
|
.attr('transform', 'translate(0,0)')
|
|
7908
|
-
.call(yAxis)
|
|
7909
|
-
.selectAll('text')
|
|
7910
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7888
|
+
.call(yAxis);
|
|
7911
7889
|
}
|
|
7912
7890
|
else if (this.chartConfiguration.isDrilldownChart) {
|
|
7913
7891
|
svg
|
|
7914
7892
|
.append('g')
|
|
7915
7893
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7916
7894
|
.attr('class', 'lib-stacked-x-axis-text multichart1')
|
|
7895
|
+
// .attr('transform', 'translate(0,' + height + ')')
|
|
7917
7896
|
.call(xAxis)
|
|
7918
7897
|
.style('display', 'none');
|
|
7919
7898
|
svgYAxisLeft
|
|
@@ -7921,9 +7900,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7921
7900
|
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
7922
7901
|
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
7923
7902
|
.attr('transform', 'translate(0,0)')
|
|
7924
|
-
.call(yAxis)
|
|
7925
|
-
.selectAll('text')
|
|
7926
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7903
|
+
.call(yAxis);
|
|
7927
7904
|
svgYAxisRight
|
|
7928
7905
|
.append('g')
|
|
7929
7906
|
.attr('class', 'lib-yaxis-labels-texts-drilldown yaxis-dashed')
|
|
@@ -7938,17 +7915,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7938
7915
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7939
7916
|
.attr('class', 'lib-stacked-x-axis-text multichart')
|
|
7940
7917
|
.attr('transform', 'translate(0,' + height + ')')
|
|
7941
|
-
.call(xAxis)
|
|
7942
|
-
|
|
7943
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7918
|
+
.call(xAxis);
|
|
7919
|
+
// .call(g => g.select(".domain").remove());
|
|
7944
7920
|
svg
|
|
7945
7921
|
.append('g')
|
|
7946
7922
|
.attr('class', 'lib-stacked-y-axis-text yaxis-dashed')
|
|
7947
7923
|
.attr('style', self.chartConfiguration.yAxisCustomTextStyles)
|
|
7948
7924
|
.attr('transform', 'translate(0,0)')
|
|
7949
|
-
.call(yAxis)
|
|
7950
|
-
.selectAll('text')
|
|
7951
|
-
.style('fill', 'var(--chart-text-color)');
|
|
7925
|
+
.call(yAxis);
|
|
7952
7926
|
}
|
|
7953
7927
|
/**
|
|
7954
7928
|
* for existing charts, place xaxis labels nearer to xaxis
|
|
@@ -8046,31 +8020,11 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8046
8020
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8047
8021
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8048
8022
|
.attr('y', short_tick_length_bg)
|
|
8049
|
-
.text(function (d
|
|
8050
|
-
if (isMobile) {
|
|
8051
|
-
// If label has more than one word, show only first 3 letters of first word
|
|
8052
|
-
var firstWord = d.split(' ')[0];
|
|
8053
|
-
return firstWord.substring(0, 3);
|
|
8054
|
-
}
|
|
8023
|
+
.text(function (d) {
|
|
8055
8024
|
if (d.trim().indexOf(' ') > -1) {
|
|
8056
8025
|
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8057
8026
|
}
|
|
8058
8027
|
return d.toLowerCase();
|
|
8059
|
-
})
|
|
8060
|
-
.attr('transform', function (d, i) {
|
|
8061
|
-
if (isMobile) {
|
|
8062
|
-
var totalBars = 0;
|
|
8063
|
-
if (this.parentNode && this.parentNode.parentNode) {
|
|
8064
|
-
totalBars = d3.select(this.parentNode.parentNode).selectAll('g.tick').size();
|
|
8065
|
-
}
|
|
8066
|
-
if (totalBars === 2) {
|
|
8067
|
-
return 'translate(0,0)';
|
|
8068
|
-
}
|
|
8069
|
-
else {
|
|
8070
|
-
return 'translate(' + (i * 30) + ',0)';
|
|
8071
|
-
}
|
|
8072
|
-
}
|
|
8073
|
-
return null;
|
|
8074
8028
|
});
|
|
8075
8029
|
svg
|
|
8076
8030
|
.selectAll('g.x1.axis1 g.tick')
|
|
@@ -8079,20 +8033,10 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8079
8033
|
.attr('y', long_tick_length_bg)
|
|
8080
8034
|
.attr('fill', 'currentColor')
|
|
8081
8035
|
.text(function (d) {
|
|
8082
|
-
// For mobile, do not print the second word at all
|
|
8083
|
-
if (isMobile) {
|
|
8084
|
-
return '';
|
|
8085
|
-
}
|
|
8086
8036
|
if (d.trim().indexOf(' ') > -1) {
|
|
8087
8037
|
return d.trim().substring(d.indexOf(' '), d.length).toLowerCase();
|
|
8088
8038
|
}
|
|
8089
8039
|
return '';
|
|
8090
|
-
})
|
|
8091
|
-
.attr('transform', function (d, i) {
|
|
8092
|
-
if (isMobile && i === 0) {
|
|
8093
|
-
return 'translate(20,0)';
|
|
8094
|
-
}
|
|
8095
|
-
return null;
|
|
8096
8040
|
});
|
|
8097
8041
|
}
|
|
8098
8042
|
/**
|
|
@@ -8120,14 +8064,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8120
8064
|
this.chartConfiguration.isYaxisDashed) {
|
|
8121
8065
|
d3.selectAll('.yaxis-dashed')
|
|
8122
8066
|
.style('stroke-dasharray', '5 5')
|
|
8123
|
-
.style('color', '
|
|
8067
|
+
.style('color', '#999999');
|
|
8124
8068
|
}
|
|
8125
8069
|
/**
|
|
8126
8070
|
* x axis color
|
|
8127
8071
|
* used by weekly charts
|
|
8128
8072
|
*/
|
|
8129
8073
|
if (this.chartConfiguration.isXaxisColor != undefined) {
|
|
8130
|
-
d3.selectAll('.multichart').style('color', this.chartConfiguration.isXaxisColor
|
|
8074
|
+
d3.selectAll('.multichart').style('color', this.chartConfiguration.isXaxisColor);
|
|
8131
8075
|
}
|
|
8132
8076
|
/**
|
|
8133
8077
|
* used to display y label
|
|
@@ -8135,51 +8079,30 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8135
8079
|
if (this.isZoomedOut) {
|
|
8136
8080
|
svg
|
|
8137
8081
|
.selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
8138
|
-
.attr('
|
|
8139
|
-
.attr('text-anchor', 'end')
|
|
8140
|
-
.attr('x', '-5')
|
|
8141
|
-
.attr('dy', null);
|
|
8142
|
-
}
|
|
8143
|
-
function styleAxisDomain() {
|
|
8144
|
-
svg.selectAll('.domain')
|
|
8145
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
8146
|
-
.style('stroke-width', '1px');
|
|
8147
|
-
svgYAxisLeft.selectAll('.domain')
|
|
8148
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
8149
|
-
.style('stroke-width', '1px');
|
|
8150
|
-
svgYAxisRight.selectAll('.domain')
|
|
8151
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
8152
|
-
.style('stroke-width', '1px');
|
|
8082
|
+
.attr('class', 'lib-display-hidden');
|
|
8153
8083
|
}
|
|
8154
|
-
styleAxisDomain();
|
|
8155
8084
|
if (metaData.yLabel) {
|
|
8156
|
-
svgYAxisLeft.selectAll('.lib-axis-group-label, .lib-ylabel-drilldowncharts, .lib-ylabel-weeklyCharts').remove();
|
|
8157
|
-
function isAcronym(label) {
|
|
8158
|
-
return (label.length <= 4 && /^[A-Z]+$/.test(label)) || (label === label.toUpperCase() && /[A-Z]/.test(label));
|
|
8159
|
-
}
|
|
8160
|
-
const yLabelText = metaData.yLabel;
|
|
8161
|
-
const isAcr = isAcronym(yLabelText.replace(/[^A-Za-z]/g, ''));
|
|
8162
|
-
const yPosition = isria ? 0 - margin.left / 2 - 30 : 0 - margin.left / 2 - 40;
|
|
8163
8085
|
svgYAxisLeft
|
|
8164
8086
|
.append('text')
|
|
8165
|
-
.attr('class',
|
|
8166
|
-
let baseClass = 'lib-axis-group-label font-size-1';
|
|
8167
|
-
if (self.chartConfiguration.isDrilldownChart)
|
|
8168
|
-
return baseClass + ' lib-ylabel-drilldowncharts';
|
|
8169
|
-
if (self.chartConfiguration.isMultiChartGridLine != undefined)
|
|
8170
|
-
return baseClass + ' lib-ylabel-weeklyCharts';
|
|
8171
|
-
return baseClass + ' lib-axis-waterfall-label';
|
|
8172
|
-
})
|
|
8087
|
+
.attr('class', 'lib-axis-group-label font-size-1')
|
|
8173
8088
|
.attr('style', self.chartConfiguration.yAxisCustomlabelStyles)
|
|
8174
8089
|
.attr('transform', 'rotate(-90)')
|
|
8175
|
-
.attr('y',
|
|
8090
|
+
.attr('y', 0 - margin.left / 2 - 20 - 15)
|
|
8176
8091
|
.attr('x', 0 - height / 2)
|
|
8177
8092
|
.attr('dy', '1em')
|
|
8178
8093
|
.style('text-anchor', 'middle')
|
|
8179
|
-
.
|
|
8180
|
-
.style('
|
|
8181
|
-
|
|
8182
|
-
|
|
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
|
+
}
|
|
8183
8106
|
}
|
|
8184
8107
|
if (this.chartData.targetLineData) {
|
|
8185
8108
|
const yZero = yScale(parsedNum);
|
|
@@ -8205,7 +8128,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8205
8128
|
.attr('height', 50)
|
|
8206
8129
|
.append('xhtml:div')
|
|
8207
8130
|
.attr('class', 'target-display')
|
|
8208
|
-
.style('color',
|
|
8131
|
+
.style('color', this.chartData.targetLineData.color)
|
|
8209
8132
|
.html(function (d, i) {
|
|
8210
8133
|
let dataTypeTemp = '';
|
|
8211
8134
|
let targetLineName = 'target';
|
|
@@ -8241,29 +8164,23 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8241
8164
|
.text(metaData.lineyLabel);
|
|
8242
8165
|
}
|
|
8243
8166
|
if (metaData.xLabel) {
|
|
8244
|
-
function isAcronym(label) {
|
|
8245
|
-
return ((label.length <= 4 && /^[A-Z]+$/.test(label)) ||
|
|
8246
|
-
(label === label.toUpperCase() && /[A-Z]/.test(label)));
|
|
8247
|
-
}
|
|
8248
|
-
const xLabelText = metaData.xLabel;
|
|
8249
|
-
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
8250
|
-
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
|
|
8251
8167
|
svg
|
|
8252
8168
|
.append('text')
|
|
8253
|
-
.attr('class',
|
|
8254
|
-
|
|
8255
|
-
if (self.chartConfiguration.isDrilldownChart)
|
|
8256
|
-
return baseClass + ' lib-xlabel-drilldowncharts';
|
|
8257
|
-
if (self.chartConfiguration.isMultiChartGridLine != undefined)
|
|
8258
|
-
return baseClass + ' lib-xlabel-weeklyCharts';
|
|
8259
|
-
return baseClass + ' lib-axis-waterfall-label';
|
|
8260
|
-
})
|
|
8261
|
-
.attr('style', self.chartConfiguration.xAxisCustomlabelStyles)
|
|
8262
|
-
.attr('transform', 'translate(' + width / 2 + ' ,' + xPosition + ')')
|
|
8169
|
+
.attr('class', 'lib-axis-waterfall-label')
|
|
8170
|
+
.attr('transform', 'translate(' + width / 2 + ' ,' + (height + margin.top + 20) + ')')
|
|
8263
8171
|
.style('text-anchor', 'middle')
|
|
8264
|
-
.
|
|
8265
|
-
.text
|
|
8266
|
-
|
|
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
|
+
}
|
|
8267
8184
|
}
|
|
8268
8185
|
if (lineData && colors) {
|
|
8269
8186
|
var dataGroup = d3
|