@vizzly/dashboard 0.15.0-dev-faa8583d678bfc9b3d4da564fbf074620ea48b15 → 0.15.0-dev-532824b8277b56794208595a2825194b1d110465
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/dist/charts/src/v2/utils/buildMargin.d.ts +3 -2
- package/dist/dashboard/src/index.d.ts +1 -1
- package/dist/dashboard.cjs.development.js +283 -254
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +283 -254
- package/dist/shared-logic/src/ChartsV2/adjustTicks.d.ts +15 -7
- package/dist/shared-logic/src/Theme/Theme.d.ts +6 -0
- package/dist/shared-ui/src/contexts/ThemeProvider/default.theme.d.ts +0 -6
- package/package.json +1 -1
|
@@ -14512,6 +14512,13 @@ var shuffle = function shuffle(array, seed) {
|
|
|
14512
14512
|
}
|
|
14513
14513
|
return array;
|
|
14514
14514
|
};
|
|
14515
|
+
var DEFAULT_CHART_FONT_SIZES = {
|
|
14516
|
+
title: 16,
|
|
14517
|
+
axisTitles: 11,
|
|
14518
|
+
subject: 12,
|
|
14519
|
+
labels: 9
|
|
14520
|
+
};
|
|
14521
|
+
|
|
14515
14522
|
// ------------------------------------------------------------------------------------
|
|
14516
14523
|
// ------------------------------------------------------------------------------------
|
|
14517
14524
|
// ------------------------------------------------------------------------------------
|
|
@@ -17598,12 +17605,6 @@ var defaultThemeV1 = {
|
|
|
17598
17605
|
}
|
|
17599
17606
|
};
|
|
17600
17607
|
var COMMON_BORDER_COLOR = /*#__PURE__*/brandColor(82);
|
|
17601
|
-
var DEFAULT_CHART_FONT_SIZES = {
|
|
17602
|
-
title: VIZZLY_STYLE_DICTIONARY.font.header,
|
|
17603
|
-
axisTitles: 11,
|
|
17604
|
-
subject: 12,
|
|
17605
|
-
labels: 9
|
|
17606
|
-
};
|
|
17607
17608
|
var defaultThemeV2 = {
|
|
17608
17609
|
detail: 'minimal',
|
|
17609
17610
|
rowLimit: 6,
|
|
@@ -34376,6 +34377,226 @@ var buildTooltipStyles = function buildTooltipStyles(_ref) {
|
|
|
34376
34377
|
return tooltipStyles;
|
|
34377
34378
|
};
|
|
34378
34379
|
|
|
34380
|
+
var ASSUMED_AVERAGE_CHAR_WIDTH = 7.1;
|
|
34381
|
+
var ASSUMED_AVERAGE_CHAR_HEIGHT = 24;
|
|
34382
|
+
var DEFAULT_TICK_GAP = 12; // Default gap between ticks in pixels
|
|
34383
|
+
|
|
34384
|
+
function getAverageCharSize(averageSize, theme) {
|
|
34385
|
+
var themeFontSize = function (_theme$labels) {
|
|
34386
|
+
if (!theme) return DEFAULT_CHART_FONT_SIZES.labels;
|
|
34387
|
+
var fontSize = (_theme$labels = theme.labels) == null ? void 0 : _theme$labels.fontSize;
|
|
34388
|
+
if (typeof fontSize === 'number') return fontSize;
|
|
34389
|
+
if (typeof fontSize === 'string') return parseFloat(fontSize);
|
|
34390
|
+
return DEFAULT_CHART_FONT_SIZES.labels;
|
|
34391
|
+
}();
|
|
34392
|
+
return averageSize * (themeFontSize / DEFAULT_CHART_FONT_SIZES.labels);
|
|
34393
|
+
}
|
|
34394
|
+
function getAverageCharWidth(theme) {
|
|
34395
|
+
return getAverageCharSize(ASSUMED_AVERAGE_CHAR_WIDTH, theme);
|
|
34396
|
+
}
|
|
34397
|
+
function getAverageCharHeight(theme) {
|
|
34398
|
+
return getAverageCharSize(ASSUMED_AVERAGE_CHAR_HEIGHT, theme);
|
|
34399
|
+
}
|
|
34400
|
+
function calculateWordWidth(word, avgCharWidth) {
|
|
34401
|
+
return word.length * avgCharWidth;
|
|
34402
|
+
}
|
|
34403
|
+
function calculateWordHeight(word, avgCharHeight) {
|
|
34404
|
+
var lines = word.split(/[\n\s]+/).length;
|
|
34405
|
+
return lines * avgCharHeight;
|
|
34406
|
+
}
|
|
34407
|
+
function getTicksIntervals(numElements) {
|
|
34408
|
+
var divisors = [];
|
|
34409
|
+
for (var i = 1; i <= Math.sqrt(numElements - 1); i++) {
|
|
34410
|
+
if ((numElements - 1) % i !== 0) {
|
|
34411
|
+
continue;
|
|
34412
|
+
}
|
|
34413
|
+
divisors.push(i);
|
|
34414
|
+
var divisor = (numElements - 1) / i;
|
|
34415
|
+
if (i === divisor) {
|
|
34416
|
+
continue;
|
|
34417
|
+
}
|
|
34418
|
+
divisors.push(divisor);
|
|
34419
|
+
}
|
|
34420
|
+
divisors.sort(function (a, b) {
|
|
34421
|
+
return b - a;
|
|
34422
|
+
});
|
|
34423
|
+
return divisors;
|
|
34424
|
+
}
|
|
34425
|
+
function isTickIntervalValid(interval, maxWidth, wordWidths) {
|
|
34426
|
+
var totalWidth = 0;
|
|
34427
|
+
for (var i = 0; i < wordWidths.length; i += interval) {
|
|
34428
|
+
var spacing = i > 0 ? DEFAULT_TICK_GAP : 0; // Add spacing only after the first tick
|
|
34429
|
+
totalWidth += wordWidths[i] + spacing;
|
|
34430
|
+
}
|
|
34431
|
+
return totalWidth <= maxWidth;
|
|
34432
|
+
}
|
|
34433
|
+
function howManyTicksFitInWidth(ticks, maxWidth, theme) {
|
|
34434
|
+
var avgCharWidth = getAverageCharWidth(theme);
|
|
34435
|
+
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
34436
|
+
var ticksWidths = ticks.map(function (tick) {
|
|
34437
|
+
var _tick$formattedValue;
|
|
34438
|
+
return calculateWordWidth((_tick$formattedValue = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue : '', avgCharWidth);
|
|
34439
|
+
});
|
|
34440
|
+
var optimalInterval = ticksIntervals[0];
|
|
34441
|
+
var left = 0;
|
|
34442
|
+
var right = ticksIntervals.length - 1;
|
|
34443
|
+
|
|
34444
|
+
// Binary search for the largest step that fits all elements
|
|
34445
|
+
while (left <= right) {
|
|
34446
|
+
var mid = Math.floor((left + right) / 2);
|
|
34447
|
+
var step = ticksIntervals[mid];
|
|
34448
|
+
if (isTickIntervalValid(step, maxWidth, ticksWidths)) {
|
|
34449
|
+
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
34450
|
+
left = mid + 1;
|
|
34451
|
+
} else {
|
|
34452
|
+
right = mid - 1;
|
|
34453
|
+
}
|
|
34454
|
+
}
|
|
34455
|
+
var fittedTicks = ticks.filter(function (_, index) {
|
|
34456
|
+
return index % optimalInterval === 0;
|
|
34457
|
+
});
|
|
34458
|
+
return fittedTicks.length;
|
|
34459
|
+
}
|
|
34460
|
+
function howManyTicksFitInHeight(ticks, maxHeight, theme) {
|
|
34461
|
+
if (ticks.length === 0) return 0;
|
|
34462
|
+
if (ticks.length === 1) return 1;
|
|
34463
|
+
var avgCharHeight = getAverageCharHeight(theme);
|
|
34464
|
+
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
34465
|
+
var ticksHeights = ticks.map(function (tick) {
|
|
34466
|
+
var _tick$formattedValue2;
|
|
34467
|
+
return calculateWordHeight((_tick$formattedValue2 = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue2 : '', avgCharHeight);
|
|
34468
|
+
});
|
|
34469
|
+
var optimalInterval = ticksIntervals[0]; // Default to showing only first and last marks if none fit
|
|
34470
|
+
var left = 0;
|
|
34471
|
+
var right = ticksIntervals.length - 1;
|
|
34472
|
+
|
|
34473
|
+
// Binary search for the largest step that fits all elements
|
|
34474
|
+
while (left <= right) {
|
|
34475
|
+
var mid = Math.floor((left + right) / 2);
|
|
34476
|
+
var step = ticksIntervals[mid];
|
|
34477
|
+
if (isTickIntervalValid(step, maxHeight, ticksHeights)) {
|
|
34478
|
+
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
34479
|
+
left = mid + 1;
|
|
34480
|
+
} else {
|
|
34481
|
+
right = mid - 1;
|
|
34482
|
+
}
|
|
34483
|
+
}
|
|
34484
|
+
var fittedTicks = ticks.filter(function (_, index) {
|
|
34485
|
+
return index % optimalInterval === 0;
|
|
34486
|
+
});
|
|
34487
|
+
return fittedTicks.length;
|
|
34488
|
+
}
|
|
34489
|
+
function determineYTicks(ticks, height, theme) {
|
|
34490
|
+
if (ticks.length === 0) return [];
|
|
34491
|
+
if (height > 224) return ticks; // No restriction if enough space
|
|
34492
|
+
|
|
34493
|
+
var assumedCharHeight = getAverageCharHeight(theme);
|
|
34494
|
+
var maxFittingTicks = Math.floor(height / assumedCharHeight);
|
|
34495
|
+
if (maxFittingTicks < 2) return ticks.slice(0, maxFittingTicks);
|
|
34496
|
+
var evenTicks = ticks.filter(function (t) {
|
|
34497
|
+
return t.value % 2 === 0;
|
|
34498
|
+
});
|
|
34499
|
+
var oddTicks = ticks.filter(function (t) {
|
|
34500
|
+
return t.value % 2 === 1;
|
|
34501
|
+
});
|
|
34502
|
+
var favorEven = evenTicks.length >= oddTicks.length;
|
|
34503
|
+
var selectedList = favorEven ? evenTicks : oddTicks;
|
|
34504
|
+
var selectedTicks = pickEquallySpaced(selectedList, maxFittingTicks);
|
|
34505
|
+
if (selectedTicks.length && selectedTicks[selectedTicks.length - 1] === ticks[ticks.length - 1]) {
|
|
34506
|
+
selectedTicks.pop();
|
|
34507
|
+
}
|
|
34508
|
+
return selectedTicks;
|
|
34509
|
+
}
|
|
34510
|
+
function pickEquallySpaced(arr, numPicks) {
|
|
34511
|
+
if (numPicks >= arr.length) {
|
|
34512
|
+
return arr;
|
|
34513
|
+
}
|
|
34514
|
+
var result = [];
|
|
34515
|
+
var interval = (arr.length - 1) / (numPicks - 1);
|
|
34516
|
+
for (var i = 0; i < numPicks; i++) {
|
|
34517
|
+
var index = Math.round(i * interval); // Calculate index and round it
|
|
34518
|
+
result.push(arr[index]);
|
|
34519
|
+
}
|
|
34520
|
+
return result;
|
|
34521
|
+
}
|
|
34522
|
+
function adjustTicks(representation, width, height, xKeyField, theme) {
|
|
34523
|
+
var _representation$x$tic, _representation$y$tic;
|
|
34524
|
+
representation = _.cloneDeep(representation);
|
|
34525
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth((_representation$x$tic = representation.x.ticks) != null ? _representation$x$tic : [], width, theme);
|
|
34526
|
+
representation.x.ticks = getEvenlySpacedTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField);
|
|
34527
|
+
representation.y.ticks = determineYTicks((_representation$y$tic = representation.y.ticks) != null ? _representation$y$tic : [], height, theme);
|
|
34528
|
+
return representation;
|
|
34529
|
+
}
|
|
34530
|
+
function adjustTicksForHorizontalChart(representation, width, height, yKeyField, theme) {
|
|
34531
|
+
representation = _.cloneDeep(representation);
|
|
34532
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks, width, theme);
|
|
34533
|
+
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks, height, theme);
|
|
34534
|
+
representation.y.ticks = getEvenlySpacedTicks(representation.y.ticks, numberOfYTicksFittingIntoSpace, yKeyField);
|
|
34535
|
+
representation.x.ticks = getEvenlySpacedNumericTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
34536
|
+
return representation;
|
|
34537
|
+
}
|
|
34538
|
+
function toNumeric(value) {
|
|
34539
|
+
if (value == null) return null;
|
|
34540
|
+
if (value instanceof Date) return value.getTime();
|
|
34541
|
+
if (typeof value === 'number') return value;
|
|
34542
|
+
var parsed = Date.parse(value);
|
|
34543
|
+
if (!isNaN(parsed)) {
|
|
34544
|
+
return parsed; // treat as timestamp
|
|
34545
|
+
}
|
|
34546
|
+
var numeric = Number(value);
|
|
34547
|
+
return Number.isFinite(numeric) ? numeric : null;
|
|
34548
|
+
}
|
|
34549
|
+
function getEvenlySpacedNumericTicks(sorted, count) {
|
|
34550
|
+
var _toNumeric, _toNumeric2;
|
|
34551
|
+
if (sorted.length <= count) return sorted;
|
|
34552
|
+
var minVal = (_toNumeric = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric : 0;
|
|
34553
|
+
var maxVal = (_toNumeric2 = toNumeric(sorted[sorted.length - 1].scaleValue)) != null ? _toNumeric2 : 0;
|
|
34554
|
+
var range = maxVal - minVal;
|
|
34555
|
+
if (range <= 0) {
|
|
34556
|
+
return [sorted[0]];
|
|
34557
|
+
}
|
|
34558
|
+
var targets = Array.from({
|
|
34559
|
+
length: count
|
|
34560
|
+
}, function (_, i) {
|
|
34561
|
+
var fraction = i / (count - 1);
|
|
34562
|
+
return minVal + fraction * range;
|
|
34563
|
+
});
|
|
34564
|
+
return targets.map(function (target) {
|
|
34565
|
+
var _toNumeric3;
|
|
34566
|
+
var closest = sorted[0];
|
|
34567
|
+
var minDiff = Math.abs(((_toNumeric3 = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric3 : 0) - target);
|
|
34568
|
+
for (var _iterator = _createForOfIteratorHelperLoose(sorted), _step; !(_step = _iterator()).done;) {
|
|
34569
|
+
var _toNumeric4;
|
|
34570
|
+
var tick = _step.value;
|
|
34571
|
+
var numericVal = (_toNumeric4 = toNumeric(tick.scaleValue)) != null ? _toNumeric4 : 0;
|
|
34572
|
+
var diff = Math.abs(numericVal - target);
|
|
34573
|
+
if (diff < minDiff) {
|
|
34574
|
+
closest = tick;
|
|
34575
|
+
minDiff = diff;
|
|
34576
|
+
}
|
|
34577
|
+
}
|
|
34578
|
+
return closest;
|
|
34579
|
+
});
|
|
34580
|
+
}
|
|
34581
|
+
function getEvenlySpacedStringTicks(ticks, count) {
|
|
34582
|
+
if (ticks.length <= count) return ticks;
|
|
34583
|
+
var result = [];
|
|
34584
|
+
var step = (ticks.length - 1) / (count - 1);
|
|
34585
|
+
for (var i = 0; i < count; i++) {
|
|
34586
|
+
var index = Math.round(i * step);
|
|
34587
|
+
result.push(ticks[index]);
|
|
34588
|
+
}
|
|
34589
|
+
return result;
|
|
34590
|
+
}
|
|
34591
|
+
function getEvenlySpacedTicks(ticks, count, xKeyField) {
|
|
34592
|
+
if (ticks.length === 0) return [];
|
|
34593
|
+
if ((xKeyField == null ? void 0 : xKeyField.dataType) === 'number') {
|
|
34594
|
+
return getEvenlySpacedNumericTicks(ticks, count);
|
|
34595
|
+
} else {
|
|
34596
|
+
return getEvenlySpacedStringTicks(ticks, count);
|
|
34597
|
+
}
|
|
34598
|
+
}
|
|
34599
|
+
|
|
34379
34600
|
var calculateTextWidth$1 = function calculateTextWidth(text, fontFamily, fontWeight, fontSize, letterSpacing) {
|
|
34380
34601
|
// Create a temporary SVG text element to measure the width
|
|
34381
34602
|
var tempSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -34572,10 +34793,10 @@ var getDefaultMargins = function getDefaultMargins(hasHorizontal, hasLeft, xAxis
|
|
|
34572
34793
|
var isXAxisPresent = xAxisType !== 'none';
|
|
34573
34794
|
var bottomMargin = hasXAxisTitle ? X_AXIS_TITLE : DEFAULT_MARGINS.bottom;
|
|
34574
34795
|
var leftMarginHorizontal = (isXAxisPresent ? yAxisWidth ? yAxisWidth + 10 : HORIZONTAL_LEFT_PANEL_WIDTH : DEFAULT_MARGINS.left) + (hasYAxisTitle ? Y_AXIS_TITLE_WIDTH : 0);
|
|
34575
|
-
var leftMarginVertical = hasLeft ? LEFT_PANEL_WIDTH + (hasYAxisTitle ? Y_AXIS_TITLE_WIDTH : 0) : DEFAULT_MARGINS.left;
|
|
34796
|
+
var leftMarginVertical = hasLeft ? getAverageCharSize(LEFT_PANEL_WIDTH + (hasYAxisTitle ? Y_AXIS_TITLE_WIDTH : 0)) : DEFAULT_MARGINS.left;
|
|
34576
34797
|
return {
|
|
34577
|
-
top: DEFAULT_MARGINS.top,
|
|
34578
|
-
bottom: bottomMargin,
|
|
34798
|
+
top: getAverageCharSize(DEFAULT_MARGINS.top),
|
|
34799
|
+
bottom: getAverageCharSize(bottomMargin),
|
|
34579
34800
|
left: hasHorizontal ? leftMarginHorizontal : leftMarginVertical,
|
|
34580
34801
|
right: DEFAULT_MARGINS.right
|
|
34581
34802
|
};
|
|
@@ -44562,216 +44783,7 @@ function buildComboTooltipData(barTooltipData, lineTooltipData, xScaleKey) {
|
|
|
44562
44783
|
return barTooltipData && lineTooltipData ? _extends({}, barTooltipData, lineTooltipData) : undefined;
|
|
44563
44784
|
}
|
|
44564
44785
|
|
|
44565
|
-
var
|
|
44566
|
-
var ASSUMED_AVERAGE_CHAR_HEIGHT = 24;
|
|
44567
|
-
|
|
44568
|
-
function calculateWordWidth(word, avgCharWidth) {
|
|
44569
|
-
return word.length * avgCharWidth;
|
|
44570
|
-
}
|
|
44571
|
-
function calculateWordHeight(word, avgCharHeight) {
|
|
44572
|
-
var lines = word.split(/[\n\s]+/).length;
|
|
44573
|
-
return lines * avgCharHeight;
|
|
44574
|
-
}
|
|
44575
|
-
function getTicksIntervals(numElements) {
|
|
44576
|
-
var divisors = [];
|
|
44577
|
-
for (var i = 1; i <= Math.sqrt(numElements - 1); i++) {
|
|
44578
|
-
if ((numElements - 1) % i !== 0) {
|
|
44579
|
-
continue;
|
|
44580
|
-
}
|
|
44581
|
-
divisors.push(i);
|
|
44582
|
-
var divisor = (numElements - 1) / i;
|
|
44583
|
-
if (i === divisor) {
|
|
44584
|
-
continue;
|
|
44585
|
-
}
|
|
44586
|
-
divisors.push(divisor);
|
|
44587
|
-
}
|
|
44588
|
-
divisors.sort(function (a, b) {
|
|
44589
|
-
return b - a;
|
|
44590
|
-
});
|
|
44591
|
-
return divisors;
|
|
44592
|
-
}
|
|
44593
|
-
function isTickIntervalValid(interval, maxWidth, wordWidths) {
|
|
44594
|
-
var totalWidth = 0;
|
|
44595
|
-
for (var i = 0; i < wordWidths.length; i += interval) {
|
|
44596
|
-
var spacing = i > 0 ? 12 : 0; // Add spacing only after the first tick
|
|
44597
|
-
totalWidth += wordWidths[i] + spacing;
|
|
44598
|
-
}
|
|
44599
|
-
return totalWidth <= maxWidth;
|
|
44600
|
-
}
|
|
44601
|
-
function howManyTicksFitInWidth(ticks, maxWidth, avgCharWidth) {
|
|
44602
|
-
if (avgCharWidth === void 0) {
|
|
44603
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44604
|
-
}
|
|
44605
|
-
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
44606
|
-
var ticksWidths = ticks.map(function (tick) {
|
|
44607
|
-
var _tick$formattedValue;
|
|
44608
|
-
return calculateWordWidth((_tick$formattedValue = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue : '', avgCharWidth);
|
|
44609
|
-
});
|
|
44610
|
-
var optimalInterval = ticksIntervals[ticksIntervals.length - 1]; // Default to showing only first and last marks if none fit
|
|
44611
|
-
var left = 0;
|
|
44612
|
-
var right = ticksIntervals.length - 1;
|
|
44613
|
-
|
|
44614
|
-
// Binary search for the largest step that fits all elements
|
|
44615
|
-
while (left <= right) {
|
|
44616
|
-
var mid = Math.floor((left + right) / 2);
|
|
44617
|
-
var step = ticksIntervals[mid];
|
|
44618
|
-
if (isTickIntervalValid(step, maxWidth, ticksWidths)) {
|
|
44619
|
-
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
44620
|
-
left = mid + 1;
|
|
44621
|
-
} else {
|
|
44622
|
-
right = mid - 1;
|
|
44623
|
-
}
|
|
44624
|
-
}
|
|
44625
|
-
var fittedTicks = ticks.filter(function (_, index) {
|
|
44626
|
-
return index % optimalInterval === 0;
|
|
44627
|
-
});
|
|
44628
|
-
return fittedTicks.length;
|
|
44629
|
-
}
|
|
44630
|
-
function howManyTicksFitInHeight(ticks, maxHeight, avgCharHeight) {
|
|
44631
|
-
if (avgCharHeight === void 0) {
|
|
44632
|
-
avgCharHeight = ASSUMED_AVERAGE_CHAR_HEIGHT;
|
|
44633
|
-
}
|
|
44634
|
-
if (ticks.length === 0) return 0;
|
|
44635
|
-
if (ticks.length === 1) return 1;
|
|
44636
|
-
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
44637
|
-
var ticksHeights = ticks.map(function (tick) {
|
|
44638
|
-
var _tick$formattedValue2;
|
|
44639
|
-
return calculateWordHeight((_tick$formattedValue2 = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue2 : '', avgCharHeight);
|
|
44640
|
-
});
|
|
44641
|
-
var optimalInterval = ticksIntervals[ticksIntervals.length - 1]; // Default to showing only first and last marks if none fit
|
|
44642
|
-
var left = 0;
|
|
44643
|
-
var right = ticksIntervals.length - 1;
|
|
44644
|
-
|
|
44645
|
-
// Binary search for the largest step that fits all elements
|
|
44646
|
-
while (left <= right) {
|
|
44647
|
-
var mid = Math.floor((left + right) / 2);
|
|
44648
|
-
var step = ticksIntervals[mid];
|
|
44649
|
-
if (isTickIntervalValid(step, maxHeight, ticksHeights)) {
|
|
44650
|
-
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
44651
|
-
left = mid + 1;
|
|
44652
|
-
} else {
|
|
44653
|
-
right = mid - 1;
|
|
44654
|
-
}
|
|
44655
|
-
}
|
|
44656
|
-
var fittedTicks = ticks.filter(function (_, index) {
|
|
44657
|
-
return index % optimalInterval === 0;
|
|
44658
|
-
});
|
|
44659
|
-
return fittedTicks.length;
|
|
44660
|
-
}
|
|
44661
|
-
function determineYTicks(ticks, height) {
|
|
44662
|
-
if (ticks.length === 0) return [];
|
|
44663
|
-
if (height > 224) return ticks; // No restriction if enough space
|
|
44664
|
-
|
|
44665
|
-
var maxFittingTicks = Math.floor(height / ASSUMED_AVERAGE_CHAR_HEIGHT);
|
|
44666
|
-
if (maxFittingTicks < 2) return ticks.slice(0, maxFittingTicks);
|
|
44667
|
-
var evenTicks = ticks.filter(function (t) {
|
|
44668
|
-
return t.value % 2 === 0;
|
|
44669
|
-
});
|
|
44670
|
-
var oddTicks = ticks.filter(function (t) {
|
|
44671
|
-
return t.value % 2 === 1;
|
|
44672
|
-
});
|
|
44673
|
-
var favorEven = evenTicks.length >= oddTicks.length;
|
|
44674
|
-
var selectedList = favorEven ? evenTicks : oddTicks;
|
|
44675
|
-
var selectedTicks = pickEquallySpaced(selectedList, maxFittingTicks);
|
|
44676
|
-
if (selectedTicks.length && selectedTicks[selectedTicks.length - 1] === ticks[ticks.length - 1]) {
|
|
44677
|
-
selectedTicks.pop();
|
|
44678
|
-
}
|
|
44679
|
-
return selectedTicks;
|
|
44680
|
-
}
|
|
44681
|
-
function pickEquallySpaced(arr, numPicks) {
|
|
44682
|
-
if (numPicks >= arr.length) {
|
|
44683
|
-
return arr;
|
|
44684
|
-
}
|
|
44685
|
-
var result = [];
|
|
44686
|
-
var interval = (arr.length - 1) / (numPicks - 1);
|
|
44687
|
-
for (var i = 0; i < numPicks; i++) {
|
|
44688
|
-
var index = Math.round(i * interval); // Calculate index and round it
|
|
44689
|
-
result.push(arr[index]);
|
|
44690
|
-
}
|
|
44691
|
-
return result;
|
|
44692
|
-
}
|
|
44693
|
-
function adjustTicks(representation, width, height, xKeyField) {
|
|
44694
|
-
var _representation$x$tic, _representation$y$tic;
|
|
44695
|
-
representation = _.cloneDeep(representation);
|
|
44696
|
-
|
|
44697
|
-
// TODO; take this from the theme override...
|
|
44698
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44699
|
-
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth((_representation$x$tic = representation.x.ticks) != null ? _representation$x$tic : [], width, averageCharacterWidth);
|
|
44700
|
-
representation.x.ticks = getEvenlySpacedTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField);
|
|
44701
|
-
representation.y.ticks = determineYTicks((_representation$y$tic = representation.y.ticks) != null ? _representation$y$tic : [], height);
|
|
44702
|
-
return representation;
|
|
44703
|
-
}
|
|
44704
|
-
function adjustTicksForHorizontalChart(representation, width, height, yKeyField) {
|
|
44705
|
-
representation = _.cloneDeep(representation);
|
|
44706
|
-
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks, width);
|
|
44707
|
-
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks, height);
|
|
44708
|
-
representation.y.ticks = getEvenlySpacedTicks(representation.y.ticks, numberOfYTicksFittingIntoSpace, yKeyField);
|
|
44709
|
-
representation.x.ticks = getEvenlySpacedNumericTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
44710
|
-
return representation;
|
|
44711
|
-
}
|
|
44712
|
-
function toNumeric(value) {
|
|
44713
|
-
if (value == null) return null;
|
|
44714
|
-
if (value instanceof Date) return value.getTime();
|
|
44715
|
-
if (typeof value === 'number') return value;
|
|
44716
|
-
var parsed = Date.parse(value);
|
|
44717
|
-
if (!isNaN(parsed)) {
|
|
44718
|
-
return parsed; // treat as timestamp
|
|
44719
|
-
}
|
|
44720
|
-
var numeric = Number(value);
|
|
44721
|
-
return Number.isFinite(numeric) ? numeric : null;
|
|
44722
|
-
}
|
|
44723
|
-
function getEvenlySpacedNumericTicks(sorted, count) {
|
|
44724
|
-
var _toNumeric, _toNumeric2;
|
|
44725
|
-
if (sorted.length <= count) return sorted;
|
|
44726
|
-
var minVal = (_toNumeric = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric : 0;
|
|
44727
|
-
var maxVal = (_toNumeric2 = toNumeric(sorted[sorted.length - 1].scaleValue)) != null ? _toNumeric2 : 0;
|
|
44728
|
-
var range = maxVal - minVal;
|
|
44729
|
-
if (range <= 0) {
|
|
44730
|
-
return [sorted[0]];
|
|
44731
|
-
}
|
|
44732
|
-
var targets = Array.from({
|
|
44733
|
-
length: count
|
|
44734
|
-
}, function (_, i) {
|
|
44735
|
-
var fraction = i / (count - 1);
|
|
44736
|
-
return minVal + fraction * range;
|
|
44737
|
-
});
|
|
44738
|
-
return targets.map(function (target) {
|
|
44739
|
-
var _toNumeric3;
|
|
44740
|
-
var closest = sorted[0];
|
|
44741
|
-
var minDiff = Math.abs(((_toNumeric3 = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric3 : 0) - target);
|
|
44742
|
-
for (var _iterator = _createForOfIteratorHelperLoose(sorted), _step; !(_step = _iterator()).done;) {
|
|
44743
|
-
var _toNumeric4;
|
|
44744
|
-
var tick = _step.value;
|
|
44745
|
-
var numericVal = (_toNumeric4 = toNumeric(tick.scaleValue)) != null ? _toNumeric4 : 0;
|
|
44746
|
-
var diff = Math.abs(numericVal - target);
|
|
44747
|
-
if (diff < minDiff) {
|
|
44748
|
-
closest = tick;
|
|
44749
|
-
minDiff = diff;
|
|
44750
|
-
}
|
|
44751
|
-
}
|
|
44752
|
-
return closest;
|
|
44753
|
-
});
|
|
44754
|
-
}
|
|
44755
|
-
function getEvenlySpacedStringTicks(ticks, count) {
|
|
44756
|
-
if (ticks.length <= count) return ticks;
|
|
44757
|
-
var result = [];
|
|
44758
|
-
var step = (ticks.length - 1) / (count - 1);
|
|
44759
|
-
for (var i = 0; i < count; i++) {
|
|
44760
|
-
var index = Math.round(i * step);
|
|
44761
|
-
result.push(ticks[index]);
|
|
44762
|
-
}
|
|
44763
|
-
return result;
|
|
44764
|
-
}
|
|
44765
|
-
function getEvenlySpacedTicks(ticks, count, xKeyField) {
|
|
44766
|
-
if (ticks.length === 0) return [];
|
|
44767
|
-
if ((xKeyField == null ? void 0 : xKeyField.dataType) === 'number') {
|
|
44768
|
-
return getEvenlySpacedNumericTicks(ticks, count);
|
|
44769
|
-
} else {
|
|
44770
|
-
return getEvenlySpacedStringTicks(ticks, count);
|
|
44771
|
-
}
|
|
44772
|
-
}
|
|
44773
|
-
|
|
44774
|
-
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle, showDetailedSubGroupingLabels, isDualAxisEnabled, hasDualYAxisTitle, yTicksDual) {
|
|
44786
|
+
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle, showDetailedSubGroupingLabels, isDualAxisEnabled, hasDualYAxisTitle, yTicksDual, theme) {
|
|
44775
44787
|
if (showDetailedSubGroupingLabels === void 0) {
|
|
44776
44788
|
showDetailedSubGroupingLabels = false;
|
|
44777
44789
|
}
|
|
@@ -44781,8 +44793,9 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44781
44793
|
if (hasDualYAxisTitle === void 0) {
|
|
44782
44794
|
hasDualYAxisTitle = false;
|
|
44783
44795
|
}
|
|
44796
|
+
var averageCharacterWidth = getAverageCharWidth(theme);
|
|
44784
44797
|
var maxWidth = _.max(yTicks.map(function (tick) {
|
|
44785
|
-
return (tick.formattedValue || '').length *
|
|
44798
|
+
return (tick.formattedValue || '').length * averageCharacterWidth;
|
|
44786
44799
|
}));
|
|
44787
44800
|
var showYTicks = showYAxisLabels && yTicks.length > 0;
|
|
44788
44801
|
var MINIMUM_Y_AXIS_WIDTH = 40;
|
|
@@ -44792,11 +44805,11 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44792
44805
|
var left = showYTicks ? _.max([maxWidth, MINIMUM_Y_AXIS_WIDTH]) : MINIMUM_Y_AXIS_WIDTH;
|
|
44793
44806
|
var yDualAxisTitleOffset = hasDualYAxisTitle ? 40 : 0;
|
|
44794
44807
|
var maxDualWidth = _.max(yTicksDual == null ? void 0 : yTicksDual.map(function (tick) {
|
|
44795
|
-
return (tick.formattedValue || '').length *
|
|
44808
|
+
return (tick.formattedValue || '').length * averageCharacterWidth;
|
|
44796
44809
|
}));
|
|
44797
44810
|
var right = showYTicks ? _.max([maxDualWidth, MINIMUM_Y_AXIS_WIDTH]) : MINIMUM_Y_AXIS_WIDTH;
|
|
44798
44811
|
return {
|
|
44799
|
-
top: showDetailedSubGroupingLabels ? 25 : 15,
|
|
44812
|
+
top: getAverageCharSize(showDetailedSubGroupingLabels ? 25 : 15, theme),
|
|
44800
44813
|
right: isDualAxisEnabled ? 2 * MINIMUM_Y_AXIS_WIDTH + yDualAxisTitleOffset : MINIMUM_Y_AXIS_WIDTH,
|
|
44801
44814
|
bottom: 30 + xAxisTitleOffset,
|
|
44802
44815
|
left: left + yAxisTitleOffset,
|
|
@@ -44805,9 +44818,10 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44805
44818
|
rightTitleOffset: right
|
|
44806
44819
|
};
|
|
44807
44820
|
};
|
|
44808
|
-
var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTicks, yTicks, showXAxisLabels, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
44821
|
+
var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTicks, yTicks, showXAxisLabels, showYAxisLabels, hasYAxisTitle, hasXAxisTitle, theme) {
|
|
44822
|
+
var averageCharacterWidth = getAverageCharWidth(theme);
|
|
44809
44823
|
var maxWidth = _.max(yTicks.map(function (tick) {
|
|
44810
|
-
return (tick.formattedValue || '').split(/[\n\s]+/)[0].length *
|
|
44824
|
+
return (tick.formattedValue || '').split(/[\n\s]+/)[0].length * averageCharacterWidth;
|
|
44811
44825
|
}));
|
|
44812
44826
|
var showXTicks = showXAxisLabels && xTicks.length > 0;
|
|
44813
44827
|
var showYTicks = showYAxisLabels && yTicks.length > 0;
|
|
@@ -44818,7 +44832,7 @@ var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTick
|
|
|
44818
44832
|
var leftTicksMargin = MINIMUM_Y_AXIS_WIDTH + (showYTicks ? _.max([maxWidth, MINIMUM_Y_AXIS_WIDTH]) : 0);
|
|
44819
44833
|
var bottomTitleOffset = showXTicks ? estimatedHeight : 0;
|
|
44820
44834
|
return {
|
|
44821
|
-
top:
|
|
44835
|
+
top: getAverageCharSize(20, theme),
|
|
44822
44836
|
right: MINIMUM_Y_AXIS_WIDTH + 30,
|
|
44823
44837
|
bottom: bottomTitleOffset + xAxisTitleOffset,
|
|
44824
44838
|
left: leftTicksMargin + yAxisTitleOffset,
|
|
@@ -45779,7 +45793,7 @@ var AreaChart$5 = function AreaChart(_ref) {
|
|
|
45779
45793
|
tooltipData = _useTooltip.tooltipData,
|
|
45780
45794
|
hideTooltip = _useTooltip.hideTooltip,
|
|
45781
45795
|
showTooltip = _useTooltip.showTooltip;
|
|
45782
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null);
|
|
45796
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, false, false, undefined, theme);
|
|
45783
45797
|
var _useVisibleYKeys = useVisibleYKeys(chart.areas),
|
|
45784
45798
|
visibleYKeys = _useVisibleYKeys.visibleYKeys,
|
|
45785
45799
|
setVisibleYKeys = _useVisibleYKeys.setVisibleYKeys;
|
|
@@ -46953,7 +46967,7 @@ var BarChart$5 = function BarChart(_ref) {
|
|
|
46953
46967
|
groupingAxisBaselineShift = _useGroupingAxisBaseL.groupingAxisBaselineShift,
|
|
46954
46968
|
bottomOffset = _useGroupingAxisBaseL.bottomOffset,
|
|
46955
46969
|
leftOffset = _useGroupingAxisBaseL.leftOffset;
|
|
46956
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, isDualAxisEnabled, options.axis.showYAxisLabels, (_chart$yDual = chart.yDual) == null ? void 0 : _chart$yDual.ticks);
|
|
46970
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, isDualAxisEnabled, options.axis.showYAxisLabels, (_chart$yDual = chart.yDual) == null ? void 0 : _chart$yDual.ticks, theme);
|
|
46957
46971
|
var innerWidth = width - margin.left - margin.right;
|
|
46958
46972
|
var innerHeight = Math.max(0, height - margin.top - margin.bottom - (options.showLegend ? 50 : 0) - (showDetailedSubGroupingLabels ? 50 : 0) + (options.axis.showXAxisLabels ? 0 : 25));
|
|
46959
46973
|
var xKey = chart.x.key;
|
|
@@ -47252,7 +47266,7 @@ var BubbleChart$4 = function BubbleChart(_ref) {
|
|
|
47252
47266
|
});
|
|
47253
47267
|
};
|
|
47254
47268
|
var scaledSizeValues = normaliseArray(zValues, 5, MAX_BUBBLE_RADIUS);
|
|
47255
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null);
|
|
47269
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, false, false, [], theme);
|
|
47256
47270
|
var _useState = React.useState(chart.lines.map(function (legendItem) {
|
|
47257
47271
|
return legendItem.yKey;
|
|
47258
47272
|
}).filter(function (yKey) {
|
|
@@ -48093,7 +48107,7 @@ var HorizontalBarChart$3 = function HorizontalBarChart(_ref) {
|
|
|
48093
48107
|
}),
|
|
48094
48108
|
groupingAxisBaselineShift = _useGroupingAxisBaseL.groupingAxisBaselineShift,
|
|
48095
48109
|
leftOffset = _useGroupingAxisBaseL.leftOffset;
|
|
48096
|
-
var margin = buildMarginForHorizontalChart(chart.x.ticks, chart.y.ticks, options.axis.showXAxisLabels, options.axis.showYAxisLabels, hasLeftTitle, hasBottomTitle);
|
|
48110
|
+
var margin = buildMarginForHorizontalChart(chart.x.ticks, chart.y.ticks, options.axis.showXAxisLabels, options.axis.showYAxisLabels, hasLeftTitle, hasBottomTitle, theme);
|
|
48097
48111
|
var legendOffset = options.showLegend ? 50 : 10;
|
|
48098
48112
|
var innerWidth = width - margin.left - margin.right + groupingAxisBaselineShift;
|
|
48099
48113
|
var innerHeight = Math.max(0, height - margin.top - margin.bottom - legendOffset);
|
|
@@ -48405,7 +48419,7 @@ var LineChart$5 = function LineChart(_ref) {
|
|
|
48405
48419
|
tooltipData = _useTooltip.tooltipData,
|
|
48406
48420
|
hideTooltip = _useTooltip.hideTooltip,
|
|
48407
48421
|
showTooltip = _useTooltip.showTooltip;
|
|
48408
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, isDualAxisEnabled, options.axis.showYAxisLabels, (_chart$yDual = chart.yDual) == null ? void 0 : _chart$yDual.ticks);
|
|
48422
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, isDualAxisEnabled, options.axis.showYAxisLabels, (_chart$yDual = chart.yDual) == null ? void 0 : _chart$yDual.ticks, theme);
|
|
48409
48423
|
var _useState = React.useState(chart.lines.map(function (legendItem) {
|
|
48410
48424
|
return legendItem.yKey;
|
|
48411
48425
|
})),
|
|
@@ -49778,8 +49792,17 @@ var buildBubbleChartRepresentation = function buildBubbleChartRepresentation(_re
|
|
|
49778
49792
|
return chart;
|
|
49779
49793
|
};
|
|
49780
49794
|
|
|
49795
|
+
function getXKeyField(pivotConfig, fields) {
|
|
49796
|
+
var _pivotConfig$x$;
|
|
49797
|
+
var xKeyTemp = (_pivotConfig$x$ = pivotConfig.x[0]) != null ? _pivotConfig$x$ : null; // Basically `${dimensions[0].field}_${dimensions[0].function}`
|
|
49798
|
+
var xKeyField = fields.find(function (field) {
|
|
49799
|
+
return field.id === xKeyTemp;
|
|
49800
|
+
});
|
|
49801
|
+
return xKeyField;
|
|
49802
|
+
}
|
|
49803
|
+
|
|
49781
49804
|
var BubbleChartV2View = function BubbleChartV2View(props) {
|
|
49782
|
-
var _props$library, _props$attributes$vie, _props$result, _props$result2, _props$result3;
|
|
49805
|
+
var _props$library, _props$attributes$vie, _props$result, _props$result2, _props$result3, _props$result$fields, _props$result4;
|
|
49783
49806
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
49784
49807
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
49785
49808
|
valueAlias = _useDashboardBehaviou.valueAlias;
|
|
@@ -49851,6 +49874,7 @@ var BubbleChartV2View = function BubbleChartV2View(props) {
|
|
|
49851
49874
|
if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
|
|
49852
49875
|
if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
|
|
49853
49876
|
if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
49877
|
+
var xKeyField = getXKeyField(pivotConfig, (_props$result$fields = (_props$result4 = props.result) == null ? void 0 : _props$result4.fields) != null ? _props$result$fields : []);
|
|
49854
49878
|
return jsxRuntime.jsx(React.Suspense, {
|
|
49855
49879
|
fallback: jsxRuntime.jsx(LoadingComponent, {}),
|
|
49856
49880
|
children: jsxRuntime.jsxs(ViewWrapper, {
|
|
@@ -49876,7 +49900,7 @@ var BubbleChartV2View = function BubbleChartV2View(props) {
|
|
|
49876
49900
|
return jsxRuntime.jsx(BubbleChart$4, {
|
|
49877
49901
|
width: parent.width,
|
|
49878
49902
|
height: parent.height,
|
|
49879
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
49903
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
49880
49904
|
options: {
|
|
49881
49905
|
removeStroke: false,
|
|
49882
49906
|
showRoundedTotal: false,
|
|
@@ -50160,15 +50184,6 @@ var getConditionalFormatting$1 = function getConditionalFormatting(_ref) {
|
|
|
50160
50184
|
return conditionalFormattingRules;
|
|
50161
50185
|
};
|
|
50162
50186
|
|
|
50163
|
-
function getXKeyField(pivotConfig, fields) {
|
|
50164
|
-
var _pivotConfig$x$;
|
|
50165
|
-
var xKeyTemp = (_pivotConfig$x$ = pivotConfig.x[0]) != null ? _pivotConfig$x$ : null; // Basically `${dimensions[0].field}_${dimensions[0].function}`
|
|
50166
|
-
var xKeyField = fields.find(function (field) {
|
|
50167
|
-
return field.id === xKeyTemp;
|
|
50168
|
-
});
|
|
50169
|
-
return xKeyField;
|
|
50170
|
-
}
|
|
50171
|
-
|
|
50172
50187
|
function buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions) {
|
|
50173
50188
|
var allPrefixes = {};
|
|
50174
50189
|
var allPostfixes = {};
|
|
@@ -50831,7 +50846,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
50831
50846
|
return jsxRuntime.jsx(LineChart$5, {
|
|
50832
50847
|
width: parent.width,
|
|
50833
50848
|
height: parent.height,
|
|
50834
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField),
|
|
50849
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
50835
50850
|
options: {
|
|
50836
50851
|
lineCurve: props.attributes.lineCurve,
|
|
50837
50852
|
removeStroke: false,
|
|
@@ -51203,7 +51218,7 @@ var AreaChartV2View = function AreaChartV2View(props) {
|
|
|
51203
51218
|
return jsxRuntime.jsx(AreaChart$5, {
|
|
51204
51219
|
width: parent.width,
|
|
51205
51220
|
height: parent.height,
|
|
51206
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField),
|
|
51221
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
51207
51222
|
uniqueId: (_props$attributes$vie2 = props.attributes.viewId) != null ? _props$attributes$vie2 : 'area-chart',
|
|
51208
51223
|
options: {
|
|
51209
51224
|
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
@@ -51667,7 +51682,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
51667
51682
|
return jsxRuntime.jsx(BarChart$5, {
|
|
51668
51683
|
width: parent.width,
|
|
51669
51684
|
height: parent.height,
|
|
51670
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField),
|
|
51685
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
51671
51686
|
options: {
|
|
51672
51687
|
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
51673
51688
|
removeStroke: false,
|
|
@@ -51938,7 +51953,7 @@ var ComboChart$4 = function ComboChart(_ref) {
|
|
|
51938
51953
|
var themeCSS = React.useMemo(function () {
|
|
51939
51954
|
return getChartThemeCSS(theme);
|
|
51940
51955
|
}, [theme]);
|
|
51941
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, isDualAxisEnabled, ((_chart$yDual = chart.yDual) == null ? void 0 : _chart$yDual.title) != null, (_chart$yDual2 = chart.yDual) == null ? void 0 : _chart$yDual2.ticks);
|
|
51956
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, isDualAxisEnabled, ((_chart$yDual = chart.yDual) == null ? void 0 : _chart$yDual.title) != null, (_chart$yDual2 = chart.yDual) == null ? void 0 : _chart$yDual2.ticks, theme);
|
|
51942
51957
|
var innerWidth = width - margin.left - margin.right;
|
|
51943
51958
|
var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
|
|
51944
51959
|
var xKey = chart.x.key;
|
|
@@ -52465,13 +52480,13 @@ var ComboChartViewV2 = function ComboChartViewV2(props) {
|
|
|
52465
52480
|
},
|
|
52466
52481
|
children: function children(parent) {
|
|
52467
52482
|
var _props$attributes$sta2, _props$attributes$lab, _props$attributes$isD2;
|
|
52468
|
-
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(comboChartRepresentation.x.ticks || [], parent.width);
|
|
52483
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(comboChartRepresentation.x.ticks || [], parent.width, theme == null ? void 0 : theme.charts);
|
|
52469
52484
|
return jsxRuntime.jsx(ComboChart$4, {
|
|
52470
52485
|
width: parent.width,
|
|
52471
52486
|
height: parent.height,
|
|
52472
52487
|
chart: _extends({}, comboChartRepresentation, {
|
|
52473
52488
|
y: _extends({}, comboChartRepresentation.y, {
|
|
52474
|
-
ticks: determineYTicks(comboChartRepresentation.y.ticks, parent.height)
|
|
52489
|
+
ticks: determineYTicks(comboChartRepresentation.y.ticks, parent.height, theme == null ? void 0 : theme.charts)
|
|
52475
52490
|
}),
|
|
52476
52491
|
x: _extends({}, comboChartRepresentation == null ? void 0 : comboChartRepresentation.x, {
|
|
52477
52492
|
ticks: getEvenlySpacedTicks(comboChartRepresentation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField)
|
|
@@ -55925,7 +55940,7 @@ var HorizontalBarChartV2View = function HorizontalBarChartV2View(props) {
|
|
|
55925
55940
|
return jsxRuntime.jsx(HorizontalBarChart$3, {
|
|
55926
55941
|
width: parent.width,
|
|
55927
55942
|
height: parent.height,
|
|
55928
|
-
chart: adjustTicksForHorizontalChart(chartRepresentation, parent.width, parent.height, yKeyField),
|
|
55943
|
+
chart: adjustTicksForHorizontalChart(chartRepresentation, parent.width, parent.height, yKeyField, theme == null ? void 0 : theme.charts),
|
|
55929
55944
|
options: {
|
|
55930
55945
|
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
55931
55946
|
removeStroke: false,
|
|
@@ -58063,8 +58078,8 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
58063
58078
|
bars: []
|
|
58064
58079
|
});
|
|
58065
58080
|
var margin = React.useMemo(function () {
|
|
58066
|
-
return buildMargin(formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title != null, formattedChartDataForBarChart.x.title != null);
|
|
58067
|
-
}, [formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title, formattedChartDataForBarChart.x.title]);
|
|
58081
|
+
return buildMargin(formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title != null, formattedChartDataForBarChart.x.title != null, false, false, false, [], theme);
|
|
58082
|
+
}, [formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title, formattedChartDataForBarChart.x.title, theme]);
|
|
58068
58083
|
var innerWidth = width - margin.left - margin.right;
|
|
58069
58084
|
var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
|
|
58070
58085
|
var xScaleKey = formattedChartDataForBarChart.x.scale.key;
|
|
@@ -58421,6 +58436,11 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58421
58436
|
developerTools: developerTools,
|
|
58422
58437
|
viewId: id
|
|
58423
58438
|
});
|
|
58439
|
+
var pivotConfig = init$c(props);
|
|
58440
|
+
var xKeyField = React.useMemo(function () {
|
|
58441
|
+
var _props$result$fields, _props$result;
|
|
58442
|
+
return getXKeyField(pivotConfig, (_props$result$fields = (_props$result = props.result) == null ? void 0 : _props$result.fields) != null ? _props$result$fields : []);
|
|
58443
|
+
}, [pivotConfig, props.result]);
|
|
58424
58444
|
var WaterfallChartComponent = getComponentInterface(type);
|
|
58425
58445
|
if (!WaterfallChartComponent.isRunnable(props)) return jsxRuntime.jsx(QueryUnderConstructionNotice, {
|
|
58426
58446
|
title: "Missing parameters"
|
|
@@ -58430,7 +58450,6 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58430
58450
|
if (hasFailed(result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
|
|
58431
58451
|
if (isEmpty(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
58432
58452
|
var showHeadline = headlineAvailable(order, headline, timeDimension);
|
|
58433
|
-
var pivotConfig = init$c(props);
|
|
58434
58453
|
var _buildWaterfallChartR = buildWaterfallChartRepresentation({
|
|
58435
58454
|
approxYAxisLabelCount: approxYAxisLabelCount === 'auto' ? 10 : approxYAxisLabelCount,
|
|
58436
58455
|
axisTitles: axisTitles,
|
|
@@ -58475,6 +58494,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58475
58494
|
},
|
|
58476
58495
|
children: function children(parent) {
|
|
58477
58496
|
if (chartRepresentation.data.length === 0) return jsxRuntime.jsx(LoadingComponent, {});
|
|
58497
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(chartRepresentation.x.ticks || [], parent.width, theme == null ? void 0 : theme.charts);
|
|
58478
58498
|
return jsxRuntime.jsx(WaterfallChart$2, {
|
|
58479
58499
|
width: parent.width,
|
|
58480
58500
|
height: parent.height,
|
|
@@ -58489,7 +58509,14 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58489
58509
|
}
|
|
58490
58510
|
},
|
|
58491
58511
|
theme: theme == null ? void 0 : theme.charts,
|
|
58492
|
-
chart: chartRepresentation,
|
|
58512
|
+
chart: _extends({}, chartRepresentation, {
|
|
58513
|
+
y: _extends({}, chartRepresentation.y, {
|
|
58514
|
+
ticks: determineYTicks(chartRepresentation.y.ticks, parent.height, theme == null ? void 0 : theme.charts)
|
|
58515
|
+
}),
|
|
58516
|
+
x: _extends({}, chartRepresentation == null ? void 0 : chartRepresentation.x, {
|
|
58517
|
+
ticks: getEvenlySpacedTicks(chartRepresentation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField)
|
|
58518
|
+
})
|
|
58519
|
+
}),
|
|
58493
58520
|
steps: steps,
|
|
58494
58521
|
increaseColor: increaseColor,
|
|
58495
58522
|
decreaseColor: decreaseColor,
|
|
@@ -58502,7 +58529,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58502
58529
|
});
|
|
58503
58530
|
};
|
|
58504
58531
|
function isLoadingResult(result) {
|
|
58505
|
-
|
|
58532
|
+
var _result$content, _result$content2;
|
|
58533
|
+
if (!result || !result.content || !result.content[0]) return true;
|
|
58534
|
+
return result != null && (_result$content = result.content) != null && (_result$content = _result$content[0]) != null && _result$content.length ? (result == null || (_result$content2 = result.content) == null || (_result$content2 = _result$content2[0]) == null ? void 0 : _result$content2.length) < 2 : false;
|
|
58506
58535
|
}
|
|
58507
58536
|
var WaterfallChartView$1 = /*#__PURE__*/React.memo(WaterfallChartView, shouldUpdate);
|
|
58508
58537
|
|
|
@@ -81404,7 +81433,7 @@ var index = {
|
|
|
81404
81433
|
DataSetField: DataSetField
|
|
81405
81434
|
};
|
|
81406
81435
|
var VIRDIS_COLOR_PALETTE = ['#440154FF', '#414487FF', '#2A788EFF', '#22A884FF', '#7AD151FF', '#FDE725FF'];
|
|
81407
|
-
var GREYSCALE_COLOR_PALETTE = ['#1e1e1e', '#
|
|
81436
|
+
var GREYSCALE_COLOR_PALETTE = ['#1e1e1e', '#b1b1b1', '#444444', '#6f6f6f', '#898989', '#5c5c5c', '#d7d7d7'];
|
|
81408
81437
|
|
|
81409
81438
|
exports.DEFAULT_CHART_FONT_SIZES = DEFAULT_CHART_FONT_SIZES;
|
|
81410
81439
|
exports.Dashboard = Dashboard$2;
|