@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
package/dist/dashboard.esm.js
CHANGED
|
@@ -14507,6 +14507,13 @@ var shuffle = function shuffle(array, seed) {
|
|
|
14507
14507
|
}
|
|
14508
14508
|
return array;
|
|
14509
14509
|
};
|
|
14510
|
+
var DEFAULT_CHART_FONT_SIZES = {
|
|
14511
|
+
title: 16,
|
|
14512
|
+
axisTitles: 11,
|
|
14513
|
+
subject: 12,
|
|
14514
|
+
labels: 9
|
|
14515
|
+
};
|
|
14516
|
+
|
|
14510
14517
|
// ------------------------------------------------------------------------------------
|
|
14511
14518
|
// ------------------------------------------------------------------------------------
|
|
14512
14519
|
// ------------------------------------------------------------------------------------
|
|
@@ -17599,12 +17606,6 @@ var defaultThemeV1 = {
|
|
|
17599
17606
|
}
|
|
17600
17607
|
};
|
|
17601
17608
|
var COMMON_BORDER_COLOR = /*#__PURE__*/brandColor(82);
|
|
17602
|
-
var DEFAULT_CHART_FONT_SIZES = {
|
|
17603
|
-
title: VIZZLY_STYLE_DICTIONARY.font.header,
|
|
17604
|
-
axisTitles: 11,
|
|
17605
|
-
subject: 12,
|
|
17606
|
-
labels: 9
|
|
17607
|
-
};
|
|
17608
17609
|
var defaultThemeV2 = {
|
|
17609
17610
|
detail: 'minimal',
|
|
17610
17611
|
rowLimit: 6,
|
|
@@ -34413,6 +34414,226 @@ var buildTooltipStyles = function buildTooltipStyles(_ref) {
|
|
|
34413
34414
|
return tooltipStyles;
|
|
34414
34415
|
};
|
|
34415
34416
|
|
|
34417
|
+
var ASSUMED_AVERAGE_CHAR_WIDTH = 7.1;
|
|
34418
|
+
var ASSUMED_AVERAGE_CHAR_HEIGHT = 24;
|
|
34419
|
+
var DEFAULT_TICK_GAP = 12; // Default gap between ticks in pixels
|
|
34420
|
+
|
|
34421
|
+
function getAverageCharSize(averageSize, theme) {
|
|
34422
|
+
var themeFontSize = function (_theme$labels) {
|
|
34423
|
+
if (!theme) return DEFAULT_CHART_FONT_SIZES.labels;
|
|
34424
|
+
var fontSize = (_theme$labels = theme.labels) == null ? void 0 : _theme$labels.fontSize;
|
|
34425
|
+
if (typeof fontSize === 'number') return fontSize;
|
|
34426
|
+
if (typeof fontSize === 'string') return parseFloat(fontSize);
|
|
34427
|
+
return DEFAULT_CHART_FONT_SIZES.labels;
|
|
34428
|
+
}();
|
|
34429
|
+
return averageSize * (themeFontSize / DEFAULT_CHART_FONT_SIZES.labels);
|
|
34430
|
+
}
|
|
34431
|
+
function getAverageCharWidth(theme) {
|
|
34432
|
+
return getAverageCharSize(ASSUMED_AVERAGE_CHAR_WIDTH, theme);
|
|
34433
|
+
}
|
|
34434
|
+
function getAverageCharHeight(theme) {
|
|
34435
|
+
return getAverageCharSize(ASSUMED_AVERAGE_CHAR_HEIGHT, theme);
|
|
34436
|
+
}
|
|
34437
|
+
function calculateWordWidth(word, avgCharWidth) {
|
|
34438
|
+
return word.length * avgCharWidth;
|
|
34439
|
+
}
|
|
34440
|
+
function calculateWordHeight(word, avgCharHeight) {
|
|
34441
|
+
var lines = word.split(/[\n\s]+/).length;
|
|
34442
|
+
return lines * avgCharHeight;
|
|
34443
|
+
}
|
|
34444
|
+
function getTicksIntervals(numElements) {
|
|
34445
|
+
var divisors = [];
|
|
34446
|
+
for (var i = 1; i <= Math.sqrt(numElements - 1); i++) {
|
|
34447
|
+
if ((numElements - 1) % i !== 0) {
|
|
34448
|
+
continue;
|
|
34449
|
+
}
|
|
34450
|
+
divisors.push(i);
|
|
34451
|
+
var divisor = (numElements - 1) / i;
|
|
34452
|
+
if (i === divisor) {
|
|
34453
|
+
continue;
|
|
34454
|
+
}
|
|
34455
|
+
divisors.push(divisor);
|
|
34456
|
+
}
|
|
34457
|
+
divisors.sort(function (a, b) {
|
|
34458
|
+
return b - a;
|
|
34459
|
+
});
|
|
34460
|
+
return divisors;
|
|
34461
|
+
}
|
|
34462
|
+
function isTickIntervalValid(interval, maxWidth, wordWidths) {
|
|
34463
|
+
var totalWidth = 0;
|
|
34464
|
+
for (var i = 0; i < wordWidths.length; i += interval) {
|
|
34465
|
+
var spacing = i > 0 ? DEFAULT_TICK_GAP : 0; // Add spacing only after the first tick
|
|
34466
|
+
totalWidth += wordWidths[i] + spacing;
|
|
34467
|
+
}
|
|
34468
|
+
return totalWidth <= maxWidth;
|
|
34469
|
+
}
|
|
34470
|
+
function howManyTicksFitInWidth(ticks, maxWidth, theme) {
|
|
34471
|
+
var avgCharWidth = getAverageCharWidth(theme);
|
|
34472
|
+
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
34473
|
+
var ticksWidths = ticks.map(function (tick) {
|
|
34474
|
+
var _tick$formattedValue;
|
|
34475
|
+
return calculateWordWidth((_tick$formattedValue = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue : '', avgCharWidth);
|
|
34476
|
+
});
|
|
34477
|
+
var optimalInterval = ticksIntervals[0];
|
|
34478
|
+
var left = 0;
|
|
34479
|
+
var right = ticksIntervals.length - 1;
|
|
34480
|
+
|
|
34481
|
+
// Binary search for the largest step that fits all elements
|
|
34482
|
+
while (left <= right) {
|
|
34483
|
+
var mid = Math.floor((left + right) / 2);
|
|
34484
|
+
var step = ticksIntervals[mid];
|
|
34485
|
+
if (isTickIntervalValid(step, maxWidth, ticksWidths)) {
|
|
34486
|
+
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
34487
|
+
left = mid + 1;
|
|
34488
|
+
} else {
|
|
34489
|
+
right = mid - 1;
|
|
34490
|
+
}
|
|
34491
|
+
}
|
|
34492
|
+
var fittedTicks = ticks.filter(function (_, index) {
|
|
34493
|
+
return index % optimalInterval === 0;
|
|
34494
|
+
});
|
|
34495
|
+
return fittedTicks.length;
|
|
34496
|
+
}
|
|
34497
|
+
function howManyTicksFitInHeight(ticks, maxHeight, theme) {
|
|
34498
|
+
if (ticks.length === 0) return 0;
|
|
34499
|
+
if (ticks.length === 1) return 1;
|
|
34500
|
+
var avgCharHeight = getAverageCharHeight(theme);
|
|
34501
|
+
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
34502
|
+
var ticksHeights = ticks.map(function (tick) {
|
|
34503
|
+
var _tick$formattedValue2;
|
|
34504
|
+
return calculateWordHeight((_tick$formattedValue2 = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue2 : '', avgCharHeight);
|
|
34505
|
+
});
|
|
34506
|
+
var optimalInterval = ticksIntervals[0]; // Default to showing only first and last marks if none fit
|
|
34507
|
+
var left = 0;
|
|
34508
|
+
var right = ticksIntervals.length - 1;
|
|
34509
|
+
|
|
34510
|
+
// Binary search for the largest step that fits all elements
|
|
34511
|
+
while (left <= right) {
|
|
34512
|
+
var mid = Math.floor((left + right) / 2);
|
|
34513
|
+
var step = ticksIntervals[mid];
|
|
34514
|
+
if (isTickIntervalValid(step, maxHeight, ticksHeights)) {
|
|
34515
|
+
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
34516
|
+
left = mid + 1;
|
|
34517
|
+
} else {
|
|
34518
|
+
right = mid - 1;
|
|
34519
|
+
}
|
|
34520
|
+
}
|
|
34521
|
+
var fittedTicks = ticks.filter(function (_, index) {
|
|
34522
|
+
return index % optimalInterval === 0;
|
|
34523
|
+
});
|
|
34524
|
+
return fittedTicks.length;
|
|
34525
|
+
}
|
|
34526
|
+
function determineYTicks(ticks, height, theme) {
|
|
34527
|
+
if (ticks.length === 0) return [];
|
|
34528
|
+
if (height > 224) return ticks; // No restriction if enough space
|
|
34529
|
+
|
|
34530
|
+
var assumedCharHeight = getAverageCharHeight(theme);
|
|
34531
|
+
var maxFittingTicks = Math.floor(height / assumedCharHeight);
|
|
34532
|
+
if (maxFittingTicks < 2) return ticks.slice(0, maxFittingTicks);
|
|
34533
|
+
var evenTicks = ticks.filter(function (t) {
|
|
34534
|
+
return t.value % 2 === 0;
|
|
34535
|
+
});
|
|
34536
|
+
var oddTicks = ticks.filter(function (t) {
|
|
34537
|
+
return t.value % 2 === 1;
|
|
34538
|
+
});
|
|
34539
|
+
var favorEven = evenTicks.length >= oddTicks.length;
|
|
34540
|
+
var selectedList = favorEven ? evenTicks : oddTicks;
|
|
34541
|
+
var selectedTicks = pickEquallySpaced(selectedList, maxFittingTicks);
|
|
34542
|
+
if (selectedTicks.length && selectedTicks[selectedTicks.length - 1] === ticks[ticks.length - 1]) {
|
|
34543
|
+
selectedTicks.pop();
|
|
34544
|
+
}
|
|
34545
|
+
return selectedTicks;
|
|
34546
|
+
}
|
|
34547
|
+
function pickEquallySpaced(arr, numPicks) {
|
|
34548
|
+
if (numPicks >= arr.length) {
|
|
34549
|
+
return arr;
|
|
34550
|
+
}
|
|
34551
|
+
var result = [];
|
|
34552
|
+
var interval = (arr.length - 1) / (numPicks - 1);
|
|
34553
|
+
for (var i = 0; i < numPicks; i++) {
|
|
34554
|
+
var index = Math.round(i * interval); // Calculate index and round it
|
|
34555
|
+
result.push(arr[index]);
|
|
34556
|
+
}
|
|
34557
|
+
return result;
|
|
34558
|
+
}
|
|
34559
|
+
function adjustTicks(representation, width, height, xKeyField, theme) {
|
|
34560
|
+
var _representation$x$tic, _representation$y$tic;
|
|
34561
|
+
representation = cloneDeep(representation);
|
|
34562
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth((_representation$x$tic = representation.x.ticks) != null ? _representation$x$tic : [], width, theme);
|
|
34563
|
+
representation.x.ticks = getEvenlySpacedTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField);
|
|
34564
|
+
representation.y.ticks = determineYTicks((_representation$y$tic = representation.y.ticks) != null ? _representation$y$tic : [], height, theme);
|
|
34565
|
+
return representation;
|
|
34566
|
+
}
|
|
34567
|
+
function adjustTicksForHorizontalChart(representation, width, height, yKeyField, theme) {
|
|
34568
|
+
representation = cloneDeep(representation);
|
|
34569
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks, width, theme);
|
|
34570
|
+
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks, height, theme);
|
|
34571
|
+
representation.y.ticks = getEvenlySpacedTicks(representation.y.ticks, numberOfYTicksFittingIntoSpace, yKeyField);
|
|
34572
|
+
representation.x.ticks = getEvenlySpacedNumericTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
34573
|
+
return representation;
|
|
34574
|
+
}
|
|
34575
|
+
function toNumeric(value) {
|
|
34576
|
+
if (value == null) return null;
|
|
34577
|
+
if (value instanceof Date) return value.getTime();
|
|
34578
|
+
if (typeof value === 'number') return value;
|
|
34579
|
+
var parsed = Date.parse(value);
|
|
34580
|
+
if (!isNaN(parsed)) {
|
|
34581
|
+
return parsed; // treat as timestamp
|
|
34582
|
+
}
|
|
34583
|
+
var numeric = Number(value);
|
|
34584
|
+
return Number.isFinite(numeric) ? numeric : null;
|
|
34585
|
+
}
|
|
34586
|
+
function getEvenlySpacedNumericTicks(sorted, count) {
|
|
34587
|
+
var _toNumeric, _toNumeric2;
|
|
34588
|
+
if (sorted.length <= count) return sorted;
|
|
34589
|
+
var minVal = (_toNumeric = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric : 0;
|
|
34590
|
+
var maxVal = (_toNumeric2 = toNumeric(sorted[sorted.length - 1].scaleValue)) != null ? _toNumeric2 : 0;
|
|
34591
|
+
var range = maxVal - minVal;
|
|
34592
|
+
if (range <= 0) {
|
|
34593
|
+
return [sorted[0]];
|
|
34594
|
+
}
|
|
34595
|
+
var targets = Array.from({
|
|
34596
|
+
length: count
|
|
34597
|
+
}, function (_, i) {
|
|
34598
|
+
var fraction = i / (count - 1);
|
|
34599
|
+
return minVal + fraction * range;
|
|
34600
|
+
});
|
|
34601
|
+
return targets.map(function (target) {
|
|
34602
|
+
var _toNumeric3;
|
|
34603
|
+
var closest = sorted[0];
|
|
34604
|
+
var minDiff = Math.abs(((_toNumeric3 = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric3 : 0) - target);
|
|
34605
|
+
for (var _iterator = _createForOfIteratorHelperLoose(sorted), _step; !(_step = _iterator()).done;) {
|
|
34606
|
+
var _toNumeric4;
|
|
34607
|
+
var tick = _step.value;
|
|
34608
|
+
var numericVal = (_toNumeric4 = toNumeric(tick.scaleValue)) != null ? _toNumeric4 : 0;
|
|
34609
|
+
var diff = Math.abs(numericVal - target);
|
|
34610
|
+
if (diff < minDiff) {
|
|
34611
|
+
closest = tick;
|
|
34612
|
+
minDiff = diff;
|
|
34613
|
+
}
|
|
34614
|
+
}
|
|
34615
|
+
return closest;
|
|
34616
|
+
});
|
|
34617
|
+
}
|
|
34618
|
+
function getEvenlySpacedStringTicks(ticks, count) {
|
|
34619
|
+
if (ticks.length <= count) return ticks;
|
|
34620
|
+
var result = [];
|
|
34621
|
+
var step = (ticks.length - 1) / (count - 1);
|
|
34622
|
+
for (var i = 0; i < count; i++) {
|
|
34623
|
+
var index = Math.round(i * step);
|
|
34624
|
+
result.push(ticks[index]);
|
|
34625
|
+
}
|
|
34626
|
+
return result;
|
|
34627
|
+
}
|
|
34628
|
+
function getEvenlySpacedTicks(ticks, count, xKeyField) {
|
|
34629
|
+
if (ticks.length === 0) return [];
|
|
34630
|
+
if ((xKeyField == null ? void 0 : xKeyField.dataType) === 'number') {
|
|
34631
|
+
return getEvenlySpacedNumericTicks(ticks, count);
|
|
34632
|
+
} else {
|
|
34633
|
+
return getEvenlySpacedStringTicks(ticks, count);
|
|
34634
|
+
}
|
|
34635
|
+
}
|
|
34636
|
+
|
|
34416
34637
|
var calculateTextWidth$1 = function calculateTextWidth(text, fontFamily, fontWeight, fontSize, letterSpacing) {
|
|
34417
34638
|
// Create a temporary SVG text element to measure the width
|
|
34418
34639
|
var tempSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -34609,10 +34830,10 @@ var getDefaultMargins = function getDefaultMargins(hasHorizontal, hasLeft, xAxis
|
|
|
34609
34830
|
var isXAxisPresent = xAxisType !== 'none';
|
|
34610
34831
|
var bottomMargin = hasXAxisTitle ? X_AXIS_TITLE : DEFAULT_MARGINS.bottom;
|
|
34611
34832
|
var leftMarginHorizontal = (isXAxisPresent ? yAxisWidth ? yAxisWidth + 10 : HORIZONTAL_LEFT_PANEL_WIDTH : DEFAULT_MARGINS.left) + (hasYAxisTitle ? Y_AXIS_TITLE_WIDTH : 0);
|
|
34612
|
-
var leftMarginVertical = hasLeft ? LEFT_PANEL_WIDTH + (hasYAxisTitle ? Y_AXIS_TITLE_WIDTH : 0) : DEFAULT_MARGINS.left;
|
|
34833
|
+
var leftMarginVertical = hasLeft ? getAverageCharSize(LEFT_PANEL_WIDTH + (hasYAxisTitle ? Y_AXIS_TITLE_WIDTH : 0)) : DEFAULT_MARGINS.left;
|
|
34613
34834
|
return {
|
|
34614
|
-
top: DEFAULT_MARGINS.top,
|
|
34615
|
-
bottom: bottomMargin,
|
|
34835
|
+
top: getAverageCharSize(DEFAULT_MARGINS.top),
|
|
34836
|
+
bottom: getAverageCharSize(bottomMargin),
|
|
34616
34837
|
left: hasHorizontal ? leftMarginHorizontal : leftMarginVertical,
|
|
34617
34838
|
right: DEFAULT_MARGINS.right
|
|
34618
34839
|
};
|
|
@@ -44599,216 +44820,7 @@ function buildComboTooltipData(barTooltipData, lineTooltipData, xScaleKey) {
|
|
|
44599
44820
|
return barTooltipData && lineTooltipData ? _extends({}, barTooltipData, lineTooltipData) : undefined;
|
|
44600
44821
|
}
|
|
44601
44822
|
|
|
44602
|
-
var
|
|
44603
|
-
var ASSUMED_AVERAGE_CHAR_HEIGHT = 24;
|
|
44604
|
-
|
|
44605
|
-
function calculateWordWidth(word, avgCharWidth) {
|
|
44606
|
-
return word.length * avgCharWidth;
|
|
44607
|
-
}
|
|
44608
|
-
function calculateWordHeight(word, avgCharHeight) {
|
|
44609
|
-
var lines = word.split(/[\n\s]+/).length;
|
|
44610
|
-
return lines * avgCharHeight;
|
|
44611
|
-
}
|
|
44612
|
-
function getTicksIntervals(numElements) {
|
|
44613
|
-
var divisors = [];
|
|
44614
|
-
for (var i = 1; i <= Math.sqrt(numElements - 1); i++) {
|
|
44615
|
-
if ((numElements - 1) % i !== 0) {
|
|
44616
|
-
continue;
|
|
44617
|
-
}
|
|
44618
|
-
divisors.push(i);
|
|
44619
|
-
var divisor = (numElements - 1) / i;
|
|
44620
|
-
if (i === divisor) {
|
|
44621
|
-
continue;
|
|
44622
|
-
}
|
|
44623
|
-
divisors.push(divisor);
|
|
44624
|
-
}
|
|
44625
|
-
divisors.sort(function (a, b) {
|
|
44626
|
-
return b - a;
|
|
44627
|
-
});
|
|
44628
|
-
return divisors;
|
|
44629
|
-
}
|
|
44630
|
-
function isTickIntervalValid(interval, maxWidth, wordWidths) {
|
|
44631
|
-
var totalWidth = 0;
|
|
44632
|
-
for (var i = 0; i < wordWidths.length; i += interval) {
|
|
44633
|
-
var spacing = i > 0 ? 12 : 0; // Add spacing only after the first tick
|
|
44634
|
-
totalWidth += wordWidths[i] + spacing;
|
|
44635
|
-
}
|
|
44636
|
-
return totalWidth <= maxWidth;
|
|
44637
|
-
}
|
|
44638
|
-
function howManyTicksFitInWidth(ticks, maxWidth, avgCharWidth) {
|
|
44639
|
-
if (avgCharWidth === void 0) {
|
|
44640
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44641
|
-
}
|
|
44642
|
-
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
44643
|
-
var ticksWidths = ticks.map(function (tick) {
|
|
44644
|
-
var _tick$formattedValue;
|
|
44645
|
-
return calculateWordWidth((_tick$formattedValue = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue : '', avgCharWidth);
|
|
44646
|
-
});
|
|
44647
|
-
var optimalInterval = ticksIntervals[ticksIntervals.length - 1]; // Default to showing only first and last marks if none fit
|
|
44648
|
-
var left = 0;
|
|
44649
|
-
var right = ticksIntervals.length - 1;
|
|
44650
|
-
|
|
44651
|
-
// Binary search for the largest step that fits all elements
|
|
44652
|
-
while (left <= right) {
|
|
44653
|
-
var mid = Math.floor((left + right) / 2);
|
|
44654
|
-
var step = ticksIntervals[mid];
|
|
44655
|
-
if (isTickIntervalValid(step, maxWidth, ticksWidths)) {
|
|
44656
|
-
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
44657
|
-
left = mid + 1;
|
|
44658
|
-
} else {
|
|
44659
|
-
right = mid - 1;
|
|
44660
|
-
}
|
|
44661
|
-
}
|
|
44662
|
-
var fittedTicks = ticks.filter(function (_, index) {
|
|
44663
|
-
return index % optimalInterval === 0;
|
|
44664
|
-
});
|
|
44665
|
-
return fittedTicks.length;
|
|
44666
|
-
}
|
|
44667
|
-
function howManyTicksFitInHeight(ticks, maxHeight, avgCharHeight) {
|
|
44668
|
-
if (avgCharHeight === void 0) {
|
|
44669
|
-
avgCharHeight = ASSUMED_AVERAGE_CHAR_HEIGHT;
|
|
44670
|
-
}
|
|
44671
|
-
if (ticks.length === 0) return 0;
|
|
44672
|
-
if (ticks.length === 1) return 1;
|
|
44673
|
-
var ticksIntervals = getTicksIntervals(ticks.length);
|
|
44674
|
-
var ticksHeights = ticks.map(function (tick) {
|
|
44675
|
-
var _tick$formattedValue2;
|
|
44676
|
-
return calculateWordHeight((_tick$formattedValue2 = tick == null ? void 0 : tick.formattedValue) != null ? _tick$formattedValue2 : '', avgCharHeight);
|
|
44677
|
-
});
|
|
44678
|
-
var optimalInterval = ticksIntervals[ticksIntervals.length - 1]; // Default to showing only first and last marks if none fit
|
|
44679
|
-
var left = 0;
|
|
44680
|
-
var right = ticksIntervals.length - 1;
|
|
44681
|
-
|
|
44682
|
-
// Binary search for the largest step that fits all elements
|
|
44683
|
-
while (left <= right) {
|
|
44684
|
-
var mid = Math.floor((left + right) / 2);
|
|
44685
|
-
var step = ticksIntervals[mid];
|
|
44686
|
-
if (isTickIntervalValid(step, maxHeight, ticksHeights)) {
|
|
44687
|
-
optimalInterval = step; // Found a valid step, try to find a larger one
|
|
44688
|
-
left = mid + 1;
|
|
44689
|
-
} else {
|
|
44690
|
-
right = mid - 1;
|
|
44691
|
-
}
|
|
44692
|
-
}
|
|
44693
|
-
var fittedTicks = ticks.filter(function (_, index) {
|
|
44694
|
-
return index % optimalInterval === 0;
|
|
44695
|
-
});
|
|
44696
|
-
return fittedTicks.length;
|
|
44697
|
-
}
|
|
44698
|
-
function determineYTicks(ticks, height) {
|
|
44699
|
-
if (ticks.length === 0) return [];
|
|
44700
|
-
if (height > 224) return ticks; // No restriction if enough space
|
|
44701
|
-
|
|
44702
|
-
var maxFittingTicks = Math.floor(height / ASSUMED_AVERAGE_CHAR_HEIGHT);
|
|
44703
|
-
if (maxFittingTicks < 2) return ticks.slice(0, maxFittingTicks);
|
|
44704
|
-
var evenTicks = ticks.filter(function (t) {
|
|
44705
|
-
return t.value % 2 === 0;
|
|
44706
|
-
});
|
|
44707
|
-
var oddTicks = ticks.filter(function (t) {
|
|
44708
|
-
return t.value % 2 === 1;
|
|
44709
|
-
});
|
|
44710
|
-
var favorEven = evenTicks.length >= oddTicks.length;
|
|
44711
|
-
var selectedList = favorEven ? evenTicks : oddTicks;
|
|
44712
|
-
var selectedTicks = pickEquallySpaced(selectedList, maxFittingTicks);
|
|
44713
|
-
if (selectedTicks.length && selectedTicks[selectedTicks.length - 1] === ticks[ticks.length - 1]) {
|
|
44714
|
-
selectedTicks.pop();
|
|
44715
|
-
}
|
|
44716
|
-
return selectedTicks;
|
|
44717
|
-
}
|
|
44718
|
-
function pickEquallySpaced(arr, numPicks) {
|
|
44719
|
-
if (numPicks >= arr.length) {
|
|
44720
|
-
return arr;
|
|
44721
|
-
}
|
|
44722
|
-
var result = [];
|
|
44723
|
-
var interval = (arr.length - 1) / (numPicks - 1);
|
|
44724
|
-
for (var i = 0; i < numPicks; i++) {
|
|
44725
|
-
var index = Math.round(i * interval); // Calculate index and round it
|
|
44726
|
-
result.push(arr[index]);
|
|
44727
|
-
}
|
|
44728
|
-
return result;
|
|
44729
|
-
}
|
|
44730
|
-
function adjustTicks(representation, width, height, xKeyField) {
|
|
44731
|
-
var _representation$x$tic, _representation$y$tic;
|
|
44732
|
-
representation = cloneDeep(representation);
|
|
44733
|
-
|
|
44734
|
-
// TODO; take this from the theme override...
|
|
44735
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
44736
|
-
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth((_representation$x$tic = representation.x.ticks) != null ? _representation$x$tic : [], width, averageCharacterWidth);
|
|
44737
|
-
representation.x.ticks = getEvenlySpacedTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField);
|
|
44738
|
-
representation.y.ticks = determineYTicks((_representation$y$tic = representation.y.ticks) != null ? _representation$y$tic : [], height);
|
|
44739
|
-
return representation;
|
|
44740
|
-
}
|
|
44741
|
-
function adjustTicksForHorizontalChart(representation, width, height, yKeyField) {
|
|
44742
|
-
representation = cloneDeep(representation);
|
|
44743
|
-
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks, width);
|
|
44744
|
-
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks, height);
|
|
44745
|
-
representation.y.ticks = getEvenlySpacedTicks(representation.y.ticks, numberOfYTicksFittingIntoSpace, yKeyField);
|
|
44746
|
-
representation.x.ticks = getEvenlySpacedNumericTicks(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
44747
|
-
return representation;
|
|
44748
|
-
}
|
|
44749
|
-
function toNumeric(value) {
|
|
44750
|
-
if (value == null) return null;
|
|
44751
|
-
if (value instanceof Date) return value.getTime();
|
|
44752
|
-
if (typeof value === 'number') return value;
|
|
44753
|
-
var parsed = Date.parse(value);
|
|
44754
|
-
if (!isNaN(parsed)) {
|
|
44755
|
-
return parsed; // treat as timestamp
|
|
44756
|
-
}
|
|
44757
|
-
var numeric = Number(value);
|
|
44758
|
-
return Number.isFinite(numeric) ? numeric : null;
|
|
44759
|
-
}
|
|
44760
|
-
function getEvenlySpacedNumericTicks(sorted, count) {
|
|
44761
|
-
var _toNumeric, _toNumeric2;
|
|
44762
|
-
if (sorted.length <= count) return sorted;
|
|
44763
|
-
var minVal = (_toNumeric = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric : 0;
|
|
44764
|
-
var maxVal = (_toNumeric2 = toNumeric(sorted[sorted.length - 1].scaleValue)) != null ? _toNumeric2 : 0;
|
|
44765
|
-
var range = maxVal - minVal;
|
|
44766
|
-
if (range <= 0) {
|
|
44767
|
-
return [sorted[0]];
|
|
44768
|
-
}
|
|
44769
|
-
var targets = Array.from({
|
|
44770
|
-
length: count
|
|
44771
|
-
}, function (_, i) {
|
|
44772
|
-
var fraction = i / (count - 1);
|
|
44773
|
-
return minVal + fraction * range;
|
|
44774
|
-
});
|
|
44775
|
-
return targets.map(function (target) {
|
|
44776
|
-
var _toNumeric3;
|
|
44777
|
-
var closest = sorted[0];
|
|
44778
|
-
var minDiff = Math.abs(((_toNumeric3 = toNumeric(sorted[0].scaleValue)) != null ? _toNumeric3 : 0) - target);
|
|
44779
|
-
for (var _iterator = _createForOfIteratorHelperLoose(sorted), _step; !(_step = _iterator()).done;) {
|
|
44780
|
-
var _toNumeric4;
|
|
44781
|
-
var tick = _step.value;
|
|
44782
|
-
var numericVal = (_toNumeric4 = toNumeric(tick.scaleValue)) != null ? _toNumeric4 : 0;
|
|
44783
|
-
var diff = Math.abs(numericVal - target);
|
|
44784
|
-
if (diff < minDiff) {
|
|
44785
|
-
closest = tick;
|
|
44786
|
-
minDiff = diff;
|
|
44787
|
-
}
|
|
44788
|
-
}
|
|
44789
|
-
return closest;
|
|
44790
|
-
});
|
|
44791
|
-
}
|
|
44792
|
-
function getEvenlySpacedStringTicks(ticks, count) {
|
|
44793
|
-
if (ticks.length <= count) return ticks;
|
|
44794
|
-
var result = [];
|
|
44795
|
-
var step = (ticks.length - 1) / (count - 1);
|
|
44796
|
-
for (var i = 0; i < count; i++) {
|
|
44797
|
-
var index = Math.round(i * step);
|
|
44798
|
-
result.push(ticks[index]);
|
|
44799
|
-
}
|
|
44800
|
-
return result;
|
|
44801
|
-
}
|
|
44802
|
-
function getEvenlySpacedTicks(ticks, count, xKeyField) {
|
|
44803
|
-
if (ticks.length === 0) return [];
|
|
44804
|
-
if ((xKeyField == null ? void 0 : xKeyField.dataType) === 'number') {
|
|
44805
|
-
return getEvenlySpacedNumericTicks(ticks, count);
|
|
44806
|
-
} else {
|
|
44807
|
-
return getEvenlySpacedStringTicks(ticks, count);
|
|
44808
|
-
}
|
|
44809
|
-
}
|
|
44810
|
-
|
|
44811
|
-
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle, showDetailedSubGroupingLabels, isDualAxisEnabled, hasDualYAxisTitle, yTicksDual) {
|
|
44823
|
+
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle, showDetailedSubGroupingLabels, isDualAxisEnabled, hasDualYAxisTitle, yTicksDual, theme) {
|
|
44812
44824
|
if (showDetailedSubGroupingLabels === void 0) {
|
|
44813
44825
|
showDetailedSubGroupingLabels = false;
|
|
44814
44826
|
}
|
|
@@ -44818,8 +44830,9 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44818
44830
|
if (hasDualYAxisTitle === void 0) {
|
|
44819
44831
|
hasDualYAxisTitle = false;
|
|
44820
44832
|
}
|
|
44833
|
+
var averageCharacterWidth = getAverageCharWidth(theme);
|
|
44821
44834
|
var maxWidth = max(yTicks.map(function (tick) {
|
|
44822
|
-
return (tick.formattedValue || '').length *
|
|
44835
|
+
return (tick.formattedValue || '').length * averageCharacterWidth;
|
|
44823
44836
|
}));
|
|
44824
44837
|
var showYTicks = showYAxisLabels && yTicks.length > 0;
|
|
44825
44838
|
var MINIMUM_Y_AXIS_WIDTH = 40;
|
|
@@ -44829,11 +44842,11 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44829
44842
|
var left = showYTicks ? max([maxWidth, MINIMUM_Y_AXIS_WIDTH]) : MINIMUM_Y_AXIS_WIDTH;
|
|
44830
44843
|
var yDualAxisTitleOffset = hasDualYAxisTitle ? 40 : 0;
|
|
44831
44844
|
var maxDualWidth = max(yTicksDual == null ? void 0 : yTicksDual.map(function (tick) {
|
|
44832
|
-
return (tick.formattedValue || '').length *
|
|
44845
|
+
return (tick.formattedValue || '').length * averageCharacterWidth;
|
|
44833
44846
|
}));
|
|
44834
44847
|
var right = showYTicks ? max([maxDualWidth, MINIMUM_Y_AXIS_WIDTH]) : MINIMUM_Y_AXIS_WIDTH;
|
|
44835
44848
|
return {
|
|
44836
|
-
top: showDetailedSubGroupingLabels ? 25 : 15,
|
|
44849
|
+
top: getAverageCharSize(showDetailedSubGroupingLabels ? 25 : 15, theme),
|
|
44837
44850
|
right: isDualAxisEnabled ? 2 * MINIMUM_Y_AXIS_WIDTH + yDualAxisTitleOffset : MINIMUM_Y_AXIS_WIDTH,
|
|
44838
44851
|
bottom: 30 + xAxisTitleOffset,
|
|
44839
44852
|
left: left + yAxisTitleOffset,
|
|
@@ -44842,9 +44855,10 @@ var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, h
|
|
|
44842
44855
|
rightTitleOffset: right
|
|
44843
44856
|
};
|
|
44844
44857
|
};
|
|
44845
|
-
var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTicks, yTicks, showXAxisLabels, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
44858
|
+
var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTicks, yTicks, showXAxisLabels, showYAxisLabels, hasYAxisTitle, hasXAxisTitle, theme) {
|
|
44859
|
+
var averageCharacterWidth = getAverageCharWidth(theme);
|
|
44846
44860
|
var maxWidth = max(yTicks.map(function (tick) {
|
|
44847
|
-
return (tick.formattedValue || '').split(/[\n\s]+/)[0].length *
|
|
44861
|
+
return (tick.formattedValue || '').split(/[\n\s]+/)[0].length * averageCharacterWidth;
|
|
44848
44862
|
}));
|
|
44849
44863
|
var showXTicks = showXAxisLabels && xTicks.length > 0;
|
|
44850
44864
|
var showYTicks = showYAxisLabels && yTicks.length > 0;
|
|
@@ -44855,7 +44869,7 @@ var buildMarginForHorizontalChart = function buildMarginForHorizontalChart(xTick
|
|
|
44855
44869
|
var leftTicksMargin = MINIMUM_Y_AXIS_WIDTH + (showYTicks ? max([maxWidth, MINIMUM_Y_AXIS_WIDTH]) : 0);
|
|
44856
44870
|
var bottomTitleOffset = showXTicks ? estimatedHeight : 0;
|
|
44857
44871
|
return {
|
|
44858
|
-
top:
|
|
44872
|
+
top: getAverageCharSize(20, theme),
|
|
44859
44873
|
right: MINIMUM_Y_AXIS_WIDTH + 30,
|
|
44860
44874
|
bottom: bottomTitleOffset + xAxisTitleOffset,
|
|
44861
44875
|
left: leftTicksMargin + yAxisTitleOffset,
|
|
@@ -45837,7 +45851,7 @@ var AreaChart$5 = function AreaChart(_ref) {
|
|
|
45837
45851
|
tooltipData = _useTooltip.tooltipData,
|
|
45838
45852
|
hideTooltip = _useTooltip.hideTooltip,
|
|
45839
45853
|
showTooltip = _useTooltip.showTooltip;
|
|
45840
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null);
|
|
45854
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, false, false, undefined, theme);
|
|
45841
45855
|
var _useVisibleYKeys = useVisibleYKeys(chart.areas),
|
|
45842
45856
|
visibleYKeys = _useVisibleYKeys.visibleYKeys,
|
|
45843
45857
|
setVisibleYKeys = _useVisibleYKeys.setVisibleYKeys;
|
|
@@ -47014,7 +47028,7 @@ var BarChart$5 = function BarChart(_ref) {
|
|
|
47014
47028
|
groupingAxisBaselineShift = _useGroupingAxisBaseL.groupingAxisBaselineShift,
|
|
47015
47029
|
bottomOffset = _useGroupingAxisBaseL.bottomOffset,
|
|
47016
47030
|
leftOffset = _useGroupingAxisBaseL.leftOffset;
|
|
47017
|
-
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);
|
|
47031
|
+
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);
|
|
47018
47032
|
var innerWidth = width - margin.left - margin.right;
|
|
47019
47033
|
var innerHeight = Math.max(0, height - margin.top - margin.bottom - (options.showLegend ? 50 : 0) - (showDetailedSubGroupingLabels ? 50 : 0) + (options.axis.showXAxisLabels ? 0 : 25));
|
|
47020
47034
|
var xKey = chart.x.key;
|
|
@@ -47313,7 +47327,7 @@ var BubbleChart$4 = function BubbleChart(_ref) {
|
|
|
47313
47327
|
});
|
|
47314
47328
|
};
|
|
47315
47329
|
var scaledSizeValues = normaliseArray(zValues, 5, MAX_BUBBLE_RADIUS);
|
|
47316
|
-
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null);
|
|
47330
|
+
var margin = buildMargin(chart.y.ticks, options.axis.showYAxisLabels, chart.y.title != null, chart.x.title != null, false, false, false, [], theme);
|
|
47317
47331
|
var _useState = useState(chart.lines.map(function (legendItem) {
|
|
47318
47332
|
return legendItem.yKey;
|
|
47319
47333
|
}).filter(function (yKey) {
|
|
@@ -48157,7 +48171,7 @@ var HorizontalBarChart$3 = function HorizontalBarChart(_ref) {
|
|
|
48157
48171
|
}),
|
|
48158
48172
|
groupingAxisBaselineShift = _useGroupingAxisBaseL.groupingAxisBaselineShift,
|
|
48159
48173
|
leftOffset = _useGroupingAxisBaseL.leftOffset;
|
|
48160
|
-
var margin = buildMarginForHorizontalChart(chart.x.ticks, chart.y.ticks, options.axis.showXAxisLabels, options.axis.showYAxisLabels, hasLeftTitle, hasBottomTitle);
|
|
48174
|
+
var margin = buildMarginForHorizontalChart(chart.x.ticks, chart.y.ticks, options.axis.showXAxisLabels, options.axis.showYAxisLabels, hasLeftTitle, hasBottomTitle, theme);
|
|
48161
48175
|
var legendOffset = options.showLegend ? 50 : 10;
|
|
48162
48176
|
var innerWidth = width - margin.left - margin.right + groupingAxisBaselineShift;
|
|
48163
48177
|
var innerHeight = Math.max(0, height - margin.top - margin.bottom - legendOffset);
|
|
@@ -48469,7 +48483,7 @@ var LineChart$5 = function LineChart(_ref) {
|
|
|
48469
48483
|
tooltipData = _useTooltip.tooltipData,
|
|
48470
48484
|
hideTooltip = _useTooltip.hideTooltip,
|
|
48471
48485
|
showTooltip = _useTooltip.showTooltip;
|
|
48472
|
-
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);
|
|
48486
|
+
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);
|
|
48473
48487
|
var _useState = useState(chart.lines.map(function (legendItem) {
|
|
48474
48488
|
return legendItem.yKey;
|
|
48475
48489
|
})),
|
|
@@ -49842,8 +49856,17 @@ var buildBubbleChartRepresentation = function buildBubbleChartRepresentation(_re
|
|
|
49842
49856
|
return chart;
|
|
49843
49857
|
};
|
|
49844
49858
|
|
|
49859
|
+
function getXKeyField(pivotConfig, fields) {
|
|
49860
|
+
var _pivotConfig$x$;
|
|
49861
|
+
var xKeyTemp = (_pivotConfig$x$ = pivotConfig.x[0]) != null ? _pivotConfig$x$ : null; // Basically `${dimensions[0].field}_${dimensions[0].function}`
|
|
49862
|
+
var xKeyField = fields.find(function (field) {
|
|
49863
|
+
return field.id === xKeyTemp;
|
|
49864
|
+
});
|
|
49865
|
+
return xKeyField;
|
|
49866
|
+
}
|
|
49867
|
+
|
|
49845
49868
|
var BubbleChartV2View = function BubbleChartV2View(props) {
|
|
49846
|
-
var _props$library, _props$attributes$vie, _props$result, _props$result2, _props$result3;
|
|
49869
|
+
var _props$library, _props$attributes$vie, _props$result, _props$result2, _props$result3, _props$result$fields, _props$result4;
|
|
49847
49870
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
49848
49871
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
49849
49872
|
valueAlias = _useDashboardBehaviou.valueAlias;
|
|
@@ -49915,6 +49938,7 @@ var BubbleChartV2View = function BubbleChartV2View(props) {
|
|
|
49915
49938
|
if (isLoading(props.result)) return jsx(LoadingComponent, {});
|
|
49916
49939
|
if (hasFailed(props.result)) return jsx(FailedToLoadDataNotice, {});
|
|
49917
49940
|
if (isEmpty(props.result)) return jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
49941
|
+
var xKeyField = getXKeyField(pivotConfig, (_props$result$fields = (_props$result4 = props.result) == null ? void 0 : _props$result4.fields) != null ? _props$result$fields : []);
|
|
49918
49942
|
return jsx(Suspense, {
|
|
49919
49943
|
fallback: jsx(LoadingComponent, {}),
|
|
49920
49944
|
children: jsxs(ViewWrapper, {
|
|
@@ -49940,7 +49964,7 @@ var BubbleChartV2View = function BubbleChartV2View(props) {
|
|
|
49940
49964
|
return jsx(BubbleChart$4, {
|
|
49941
49965
|
width: parent.width,
|
|
49942
49966
|
height: parent.height,
|
|
49943
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
49967
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
49944
49968
|
options: {
|
|
49945
49969
|
removeStroke: false,
|
|
49946
49970
|
showRoundedTotal: false,
|
|
@@ -50224,15 +50248,6 @@ var getConditionalFormatting$1 = function getConditionalFormatting(_ref) {
|
|
|
50224
50248
|
return conditionalFormattingRules;
|
|
50225
50249
|
};
|
|
50226
50250
|
|
|
50227
|
-
function getXKeyField(pivotConfig, fields) {
|
|
50228
|
-
var _pivotConfig$x$;
|
|
50229
|
-
var xKeyTemp = (_pivotConfig$x$ = pivotConfig.x[0]) != null ? _pivotConfig$x$ : null; // Basically `${dimensions[0].field}_${dimensions[0].function}`
|
|
50230
|
-
var xKeyField = fields.find(function (field) {
|
|
50231
|
-
return field.id === xKeyTemp;
|
|
50232
|
-
});
|
|
50233
|
-
return xKeyField;
|
|
50234
|
-
}
|
|
50235
|
-
|
|
50236
50251
|
function buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions) {
|
|
50237
50252
|
var allPrefixes = {};
|
|
50238
50253
|
var allPostfixes = {};
|
|
@@ -50895,7 +50910,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
50895
50910
|
return jsx(LineChart$5, {
|
|
50896
50911
|
width: parent.width,
|
|
50897
50912
|
height: parent.height,
|
|
50898
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField),
|
|
50913
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
50899
50914
|
options: {
|
|
50900
50915
|
lineCurve: props.attributes.lineCurve,
|
|
50901
50916
|
removeStroke: false,
|
|
@@ -51267,7 +51282,7 @@ var AreaChartV2View = function AreaChartV2View(props) {
|
|
|
51267
51282
|
return jsx(AreaChart$5, {
|
|
51268
51283
|
width: parent.width,
|
|
51269
51284
|
height: parent.height,
|
|
51270
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField),
|
|
51285
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
51271
51286
|
uniqueId: (_props$attributes$vie2 = props.attributes.viewId) != null ? _props$attributes$vie2 : 'area-chart',
|
|
51272
51287
|
options: {
|
|
51273
51288
|
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
@@ -51731,7 +51746,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
51731
51746
|
return jsx(BarChart$5, {
|
|
51732
51747
|
width: parent.width,
|
|
51733
51748
|
height: parent.height,
|
|
51734
|
-
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField),
|
|
51749
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height, xKeyField, theme == null ? void 0 : theme.charts),
|
|
51735
51750
|
options: {
|
|
51736
51751
|
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
51737
51752
|
removeStroke: false,
|
|
@@ -52002,7 +52017,7 @@ var ComboChart$4 = function ComboChart(_ref) {
|
|
|
52002
52017
|
var themeCSS = useMemo(function () {
|
|
52003
52018
|
return getChartThemeCSS(theme);
|
|
52004
52019
|
}, [theme]);
|
|
52005
|
-
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);
|
|
52020
|
+
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);
|
|
52006
52021
|
var innerWidth = width - margin.left - margin.right;
|
|
52007
52022
|
var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
|
|
52008
52023
|
var xKey = chart.x.key;
|
|
@@ -52529,13 +52544,13 @@ var ComboChartViewV2 = function ComboChartViewV2(props) {
|
|
|
52529
52544
|
},
|
|
52530
52545
|
children: function children(parent) {
|
|
52531
52546
|
var _props$attributes$sta2, _props$attributes$lab, _props$attributes$isD2;
|
|
52532
|
-
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(comboChartRepresentation.x.ticks || [], parent.width);
|
|
52547
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(comboChartRepresentation.x.ticks || [], parent.width, theme == null ? void 0 : theme.charts);
|
|
52533
52548
|
return jsx(ComboChart$4, {
|
|
52534
52549
|
width: parent.width,
|
|
52535
52550
|
height: parent.height,
|
|
52536
52551
|
chart: _extends({}, comboChartRepresentation, {
|
|
52537
52552
|
y: _extends({}, comboChartRepresentation.y, {
|
|
52538
|
-
ticks: determineYTicks(comboChartRepresentation.y.ticks, parent.height)
|
|
52553
|
+
ticks: determineYTicks(comboChartRepresentation.y.ticks, parent.height, theme == null ? void 0 : theme.charts)
|
|
52539
52554
|
}),
|
|
52540
52555
|
x: _extends({}, comboChartRepresentation == null ? void 0 : comboChartRepresentation.x, {
|
|
52541
52556
|
ticks: getEvenlySpacedTicks(comboChartRepresentation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField)
|
|
@@ -55992,7 +56007,7 @@ var HorizontalBarChartV2View = function HorizontalBarChartV2View(props) {
|
|
|
55992
56007
|
return jsx(HorizontalBarChart$3, {
|
|
55993
56008
|
width: parent.width,
|
|
55994
56009
|
height: parent.height,
|
|
55995
|
-
chart: adjustTicksForHorizontalChart(chartRepresentation, parent.width, parent.height, yKeyField),
|
|
56010
|
+
chart: adjustTicksForHorizontalChart(chartRepresentation, parent.width, parent.height, yKeyField, theme == null ? void 0 : theme.charts),
|
|
55996
56011
|
options: {
|
|
55997
56012
|
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
55998
56013
|
removeStroke: false,
|
|
@@ -58130,8 +58145,8 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
58130
58145
|
bars: []
|
|
58131
58146
|
});
|
|
58132
58147
|
var margin = useMemo(function () {
|
|
58133
|
-
return buildMargin(formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title != null, formattedChartDataForBarChart.x.title != null);
|
|
58134
|
-
}, [formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title, formattedChartDataForBarChart.x.title]);
|
|
58148
|
+
return buildMargin(formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title != null, formattedChartDataForBarChart.x.title != null, false, false, false, [], theme);
|
|
58149
|
+
}, [formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title, formattedChartDataForBarChart.x.title, theme]);
|
|
58135
58150
|
var innerWidth = width - margin.left - margin.right;
|
|
58136
58151
|
var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
|
|
58137
58152
|
var xScaleKey = formattedChartDataForBarChart.x.scale.key;
|
|
@@ -58488,6 +58503,11 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58488
58503
|
developerTools: developerTools,
|
|
58489
58504
|
viewId: id
|
|
58490
58505
|
});
|
|
58506
|
+
var pivotConfig = init$c(props);
|
|
58507
|
+
var xKeyField = useMemo(function () {
|
|
58508
|
+
var _props$result$fields, _props$result;
|
|
58509
|
+
return getXKeyField(pivotConfig, (_props$result$fields = (_props$result = props.result) == null ? void 0 : _props$result.fields) != null ? _props$result$fields : []);
|
|
58510
|
+
}, [pivotConfig, props.result]);
|
|
58491
58511
|
var WaterfallChartComponent = getComponentInterface(type);
|
|
58492
58512
|
if (!WaterfallChartComponent.isRunnable(props)) return jsx(QueryUnderConstructionNotice, {
|
|
58493
58513
|
title: "Missing parameters"
|
|
@@ -58497,7 +58517,6 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58497
58517
|
if (hasFailed(result)) return jsx(FailedToLoadDataNotice, {});
|
|
58498
58518
|
if (isEmpty(result)) return jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
58499
58519
|
var showHeadline = headlineAvailable(order, headline, timeDimension);
|
|
58500
|
-
var pivotConfig = init$c(props);
|
|
58501
58520
|
var _buildWaterfallChartR = buildWaterfallChartRepresentation({
|
|
58502
58521
|
approxYAxisLabelCount: approxYAxisLabelCount === 'auto' ? 10 : approxYAxisLabelCount,
|
|
58503
58522
|
axisTitles: axisTitles,
|
|
@@ -58542,6 +58561,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58542
58561
|
},
|
|
58543
58562
|
children: function children(parent) {
|
|
58544
58563
|
if (chartRepresentation.data.length === 0) return jsx(LoadingComponent, {});
|
|
58564
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(chartRepresentation.x.ticks || [], parent.width, theme == null ? void 0 : theme.charts);
|
|
58545
58565
|
return jsx(WaterfallChart$2, {
|
|
58546
58566
|
width: parent.width,
|
|
58547
58567
|
height: parent.height,
|
|
@@ -58556,7 +58576,14 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58556
58576
|
}
|
|
58557
58577
|
},
|
|
58558
58578
|
theme: theme == null ? void 0 : theme.charts,
|
|
58559
|
-
chart: chartRepresentation,
|
|
58579
|
+
chart: _extends({}, chartRepresentation, {
|
|
58580
|
+
y: _extends({}, chartRepresentation.y, {
|
|
58581
|
+
ticks: determineYTicks(chartRepresentation.y.ticks, parent.height, theme == null ? void 0 : theme.charts)
|
|
58582
|
+
}),
|
|
58583
|
+
x: _extends({}, chartRepresentation == null ? void 0 : chartRepresentation.x, {
|
|
58584
|
+
ticks: getEvenlySpacedTicks(chartRepresentation.x.ticks, numberOfXTicksFittingIntoSpace, xKeyField)
|
|
58585
|
+
})
|
|
58586
|
+
}),
|
|
58560
58587
|
steps: steps,
|
|
58561
58588
|
increaseColor: increaseColor,
|
|
58562
58589
|
decreaseColor: decreaseColor,
|
|
@@ -58569,7 +58596,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
58569
58596
|
});
|
|
58570
58597
|
};
|
|
58571
58598
|
function isLoadingResult(result) {
|
|
58572
|
-
|
|
58599
|
+
var _result$content, _result$content2;
|
|
58600
|
+
if (!result || !result.content || !result.content[0]) return true;
|
|
58601
|
+
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;
|
|
58573
58602
|
}
|
|
58574
58603
|
var WaterfallChartView$1 = /*#__PURE__*/memo(WaterfallChartView, shouldUpdate);
|
|
58575
58604
|
|
|
@@ -81471,7 +81500,7 @@ var index = {
|
|
|
81471
81500
|
DataSetField: DataSetField
|
|
81472
81501
|
};
|
|
81473
81502
|
var VIRDIS_COLOR_PALETTE = ['#440154FF', '#414487FF', '#2A788EFF', '#22A884FF', '#7AD151FF', '#FDE725FF'];
|
|
81474
|
-
var GREYSCALE_COLOR_PALETTE = ['#1e1e1e', '#
|
|
81503
|
+
var GREYSCALE_COLOR_PALETTE = ['#1e1e1e', '#b1b1b1', '#444444', '#6f6f6f', '#898989', '#5c5c5c', '#d7d7d7'];
|
|
81475
81504
|
|
|
81476
81505
|
export default index;
|
|
81477
81506
|
export { DEFAULT_CHART_FONT_SIZES, Dashboard$2 as Dashboard, DataSetField, Editor$1 as Editor, GREYSCALE_COLOR_PALETTE, NewVizzlyImplementation, VIRDIS_COLOR_PALETTE, VizzlyState, VizzlyTheming, displayPositions, useGlobalContext, useVizzly, vizzlyState };
|