@vizzly/dashboard 0.15.0-dev-2951fa8f4bfb19f2edfb461044c09144bcc56296 → 0.15.0-dev-65c3e5d7491389a56cc8409b046f92683dd4725f

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.
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from 'react';
1
+ import React, { CSSProperties } from 'react';
2
2
  import { DataItem } from '../../../../../shared-logic/src/WaterfallChart/types';
3
3
  export declare type TooltipProps = {
4
4
  showTooltip: boolean;
@@ -11,4 +11,4 @@ export declare type TooltipProps = {
11
11
  yKey: string;
12
12
  theme: CSSProperties;
13
13
  };
14
- export declare const Tooltip: ({ showTooltip, tooltipData, tooltipLeft, tooltipTop, xKey, yKey, theme, }: TooltipProps) => JSX.Element | null;
14
+ export declare const Tooltip: ({ showTooltip, tooltipData, tooltipLeft, tooltipTop, xKey, yKey, theme }: TooltipProps) => React.ReactPortal | null;
@@ -10562,7 +10562,7 @@ var WaterfallChart = function WaterfallChart(config) {
10562
10562
  return removeField$1(attrs, fieldId, config.queryEngineConfig);
10563
10563
  },
10564
10564
  isRunnable: function isRunnable(hydrated) {
10565
- return hydrated.measure.length > 0;
10565
+ return hydrated.measure.length > 0 && (hydrated.dimension.length > 0 || hydrated.timeDimension !== null);
10566
10566
  },
10567
10567
  autoGenerate: function autoGenerate(dataSet) {
10568
10568
  var _DataSet$buildQueryAt = buildQueryAttributes(dataSet, config.queryEngineConfig, 'waterfallChart'),
@@ -10587,7 +10587,8 @@ var WaterfallChart = function WaterfallChart(config) {
10587
10587
  getValues: function getValues(attrs) {
10588
10588
  return attrs.measure;
10589
10589
  },
10590
- testId: 'metric-input'
10590
+ testId: 'metric-input',
10591
+ maxAllowed: 1
10591
10592
  }), _extends({}, namespace(CONSTANTS$l, 'field_x_axis'), {
10592
10593
  fieldFilterOptions: {
10593
10594
  forComponent: 'waterfallChart',
@@ -10600,7 +10601,7 @@ var WaterfallChart = function WaterfallChart(config) {
10600
10601
  getValues: function getValues(attrs) {
10601
10602
  return getGroupingWithTimeDimension(attrs);
10602
10603
  },
10603
- maxAllowed: 2,
10604
+ maxAllowed: 1,
10604
10605
  testId: 'add-dimension'
10605
10606
  }), namespace(CONSTANTS$l, 'sort'), namespace(CONSTANTS$l, 'filter'), namespace(CONSTANTS$l, 'custom_metrics'), namespace(CONSTANTS$l, 'limit')];
10606
10607
  },
@@ -53083,6 +53084,246 @@ var SunburstChart$2 = function SunburstChart(props) {
53083
53084
  });
53084
53085
  };
53085
53086
 
53087
+ function getNiceInterval$3(interval) {
53088
+ // Round the interval to a "nice" value (1, 2, 5, etc.)
53089
+ var exponent = Math.floor(Math.log10(interval));
53090
+ var fraction = interval / Math.pow(10, exponent);
53091
+ var niceFraction;
53092
+ if (fraction <= 1.5) niceFraction = 1;else if (fraction <= 3) niceFraction = 2;else if (fraction <= 7) niceFraction = 5;else niceFraction = 10;
53093
+ return niceFraction * Math.pow(10, exponent);
53094
+ }
53095
+
53096
+ var getYTicks = function getYTicks(_ref) {
53097
+ var yMinValue = _ref.yMinValue,
53098
+ yMaxValue = _ref.yMaxValue,
53099
+ approxYAxisLabelCount = _ref.approxYAxisLabelCount,
53100
+ formattingFunctionY = _ref.formattingFunctionY;
53101
+ var yTicks = [];
53102
+ var yTickInterval = getNiceInterval$3((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
53103
+ for (var i = 0; i < approxYAxisLabelCount; i++) {
53104
+ var value = (yMinValue + i) * yTickInterval;
53105
+ var formattedValue = formattingFunctionY(value);
53106
+ yTicks.push({
53107
+ value: value,
53108
+ formattedValue: formattedValue,
53109
+ scaleValue: value
53110
+ });
53111
+ }
53112
+ return yTicks;
53113
+ };
53114
+
53115
+ var getRepresentationData = function getRepresentationData(_ref) {
53116
+ var content = _ref.content,
53117
+ xKey = _ref.xKey,
53118
+ yKey = _ref.yKey,
53119
+ approxYAxisLabelCount = _ref.approxYAxisLabelCount,
53120
+ showTotalBar = _ref.showTotalBar,
53121
+ formattingFunctionY = _ref.formattingFunctionY;
53122
+ var data = [];
53123
+ var steps = [];
53124
+ var xTicks = [];
53125
+ var yValueSum = 0;
53126
+ var yMinValue = 0;
53127
+ var yMaxValue = 0;
53128
+ content.forEach(function (dataItem, index) {
53129
+ var _dataItem$xValueIndex, _dataItem$xValueIndex2, _dataItem$yValueIndex, _dataItem$yValueIndex2, _data$push;
53130
+ var xValueIndex = 0;
53131
+ var yValueIndex = 1;
53132
+ var xValue = (_dataItem$xValueIndex = dataItem[xValueIndex]) == null ? void 0 : _dataItem$xValueIndex.value;
53133
+ var xFormattedValue = (_dataItem$xValueIndex2 = dataItem[xValueIndex]) == null ? void 0 : _dataItem$xValueIndex2.formattedValue;
53134
+ var yValue = Number((_dataItem$yValueIndex = (_dataItem$yValueIndex2 = dataItem[yValueIndex]) == null ? void 0 : _dataItem$yValueIndex2.value) != null ? _dataItem$yValueIndex : 0);
53135
+ var yValueDiff = yValue;
53136
+ if (index > 0) {
53137
+ var _content$yValueIndex;
53138
+ var prevYValue = Number((_content$yValueIndex = content[index - 1][yValueIndex]) == null ? void 0 : _content$yValueIndex.value);
53139
+ yValueDiff = yValue - prevYValue;
53140
+ }
53141
+ var prevYValueSum = yValueSum;
53142
+ yValueSum += yValueDiff;
53143
+ data.push((_data$push = {}, _data$push[xKey] = {
53144
+ value: xValue,
53145
+ formattedValue: xFormattedValue
53146
+ }, _data$push[yKey] = {
53147
+ value: yValueDiff,
53148
+ formattedValue: formattingFunctionY(yValueDiff)
53149
+ }, _data$push));
53150
+ xTicks.push({
53151
+ value: xValue,
53152
+ formattedValue: xFormattedValue,
53153
+ scaleValue: xValue
53154
+ });
53155
+ steps.push({
53156
+ x: xValue,
53157
+ y: yValue,
53158
+ start: prevYValueSum,
53159
+ end: yValueSum
53160
+ });
53161
+ yMinValue = Math.floor(Math.min(yMinValue, yValue));
53162
+ yMaxValue = Math.ceil(Math.max(yMaxValue, yValue));
53163
+ });
53164
+ if (showTotalBar) {
53165
+ var _data$push2;
53166
+ var totalLabel = 'Total';
53167
+ steps.push({
53168
+ x: totalLabel,
53169
+ y: yValueSum,
53170
+ start: 0,
53171
+ end: yValueSum
53172
+ });
53173
+ data.push((_data$push2 = {}, _data$push2[xKey] = {
53174
+ value: totalLabel,
53175
+ formattedValue: totalLabel
53176
+ }, _data$push2[yKey] = {
53177
+ value: yValueSum,
53178
+ formattedValue: formattingFunctionY(yValueSum)
53179
+ }, _data$push2));
53180
+ xTicks.push({
53181
+ value: totalLabel,
53182
+ formattedValue: totalLabel,
53183
+ scaleValue: totalLabel
53184
+ });
53185
+ }
53186
+ var yTicks = getYTicks({
53187
+ yMinValue: yMinValue,
53188
+ yMaxValue: yMaxValue,
53189
+ approxYAxisLabelCount: approxYAxisLabelCount,
53190
+ formattingFunctionY: formattingFunctionY
53191
+ });
53192
+ return {
53193
+ data: data,
53194
+ steps: steps,
53195
+ xTicks: xTicks,
53196
+ yTicks: yTicks,
53197
+ yMinValue: yMinValue,
53198
+ yMaxValue: yMaxValue
53199
+ };
53200
+ };
53201
+
53202
+ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentation(_ref) {
53203
+ var _formattedResult$fiel, _formattedResult$fiel2, _axisTitles$x, _axisTitles$y;
53204
+ var approxYAxisLabelCount = _ref.approxYAxisLabelCount,
53205
+ axisTitles = _ref.axisTitles,
53206
+ dateTimeFormatOptions = _ref.dateTimeFormatOptions,
53207
+ defaultFormats = _ref.defaultFormats,
53208
+ nullValue = _ref.nullValue,
53209
+ numberFormatOptions = _ref.numberFormatOptions,
53210
+ pivotConfig = _ref.pivotConfig,
53211
+ result = _ref.result,
53212
+ showTotalBar = _ref.showTotalBar,
53213
+ _valueAlias = _ref.valueAlias,
53214
+ xAxisFormat = _ref.xAxisFormat,
53215
+ xAxisPrefix = _ref.xAxisPrefix,
53216
+ xAxisPostfix = _ref.xAxisPostfix,
53217
+ yAxisFormat = _ref.yAxisFormat,
53218
+ yAxisPrefix = _ref.yAxisPrefix,
53219
+ yAxisPostfix = _ref.yAxisPostfix;
53220
+ var activeDateTimeFormats = {};
53221
+ var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
53222
+ allPrefixes = _buildFieldFormatMaps.allPrefixes,
53223
+ allPostfixes = _buildFieldFormatMaps.allPostfixes,
53224
+ nullValues = _buildFieldFormatMaps.nullValues,
53225
+ activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
53226
+ var params = {
53227
+ defaultFormats: defaultFormats,
53228
+ dateTimeFormatOptions: dateTimeFormatOptions,
53229
+ numberFormatOptions: numberFormatOptions,
53230
+ valueAlias: function valueAlias(params) {
53231
+ if (typeof _valueAlias === 'function') {
53232
+ return String(_valueAlias({
53233
+ fieldId: id({
53234
+ field: params.fieldId,
53235
+ "function": params["function"]
53236
+ }),
53237
+ value: params.value
53238
+ }));
53239
+ }
53240
+ return undefined;
53241
+ },
53242
+ nullValue: nullValues,
53243
+ prefixes: allPrefixes,
53244
+ postfixes: allPostfixes,
53245
+ activeNumberFormats: activeNumberFormats,
53246
+ activeDateTimeFormats: activeDateTimeFormats
53247
+ };
53248
+ var formattedResult = formatResult(result, params);
53249
+ var formattingFunctionY = function formattingFunctionY(value) {
53250
+ // Use any y axis field as they are all formatted in the same way (for now...);
53251
+ var nonPivotField = formattedResult.fields.find(function (resultField) {
53252
+ return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
53253
+ });
53254
+ if (!nonPivotField) return '';
53255
+ return formattedResult.formatterFunc(value, {
53256
+ fieldId: nonPivotField.fieldId,
53257
+ "function": nonPivotField["function"],
53258
+ outputDataType: nonPivotField.outputDataType
53259
+ }).formattedValue;
53260
+ };
53261
+ var keys = formattedResult.fields.map(function (field) {
53262
+ var _ref2;
53263
+ var key = field.fieldId;
53264
+ var keyFormatted = field.publicName;
53265
+ var dataType = field.dataType;
53266
+ return _ref2 = {}, _ref2[key] = {
53267
+ key: key,
53268
+ keyFormatted: keyFormatted,
53269
+ dataType: dataType
53270
+ }, _ref2;
53271
+ });
53272
+ var xKey = (_formattedResult$fiel = formattedResult.fields[0]) == null ? void 0 : _formattedResult$fiel.fieldId;
53273
+ var yKey = (_formattedResult$fiel2 = formattedResult.fields[1]) == null ? void 0 : _formattedResult$fiel2.fieldId;
53274
+ var content = formattedResult.content;
53275
+ var _getRepresentationDat = getRepresentationData({
53276
+ content: content,
53277
+ xKey: xKey,
53278
+ yKey: yKey,
53279
+ approxYAxisLabelCount: approxYAxisLabelCount,
53280
+ showTotalBar: showTotalBar,
53281
+ formattingFunctionY: formattingFunctionY
53282
+ }),
53283
+ data = _getRepresentationDat.data,
53284
+ steps = _getRepresentationDat.steps,
53285
+ xTicks = _getRepresentationDat.xTicks,
53286
+ yTicks = _getRepresentationDat.yTicks,
53287
+ yMinValue = _getRepresentationDat.yMinValue,
53288
+ yMaxValue = _getRepresentationDat.yMaxValue;
53289
+ var chartRepresentation = {
53290
+ keys: _extends({}, keys[0], keys[1]),
53291
+ x: {
53292
+ title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null,
53293
+ ticks: xTicks,
53294
+ prefix: xAxisPrefix,
53295
+ postfix: xAxisPostfix,
53296
+ key: xKey,
53297
+ scale: {
53298
+ dataType: 'string',
53299
+ key: xKey,
53300
+ ordering: null,
53301
+ min: null,
53302
+ max: null
53303
+ }
53304
+ },
53305
+ y: {
53306
+ title: (_axisTitles$y = axisTitles == null ? void 0 : axisTitles.y) != null ? _axisTitles$y : null,
53307
+ ticks: yTicks,
53308
+ key: yKey,
53309
+ prefix: yAxisPrefix,
53310
+ postfix: yAxisPostfix,
53311
+ scale: {
53312
+ dataType: 'number',
53313
+ key: null,
53314
+ ordering: 'asc',
53315
+ min: yMinValue,
53316
+ max: yMaxValue
53317
+ }
53318
+ },
53319
+ data: data
53320
+ };
53321
+ return {
53322
+ waterfallChartRepresentation: chartRepresentation,
53323
+ waterfallChartSteps: steps
53324
+ };
53325
+ };
53326
+
53086
53327
  var ASSUMED_AVERAGE_CHAR_WIDTH$2 = 8.8;
53087
53328
  function calculateWordWidth$1(word, avgCharWidth) {
53088
53329
  if (avgCharWidth === void 0) {
@@ -53184,7 +53425,7 @@ var Tooltip$2 = function Tooltip(_ref) {
53184
53425
  if (!showTooltip || !tooltipData) return null;
53185
53426
  var value = tooltipData[yKey].value;
53186
53427
  var isPositiveValue = Number(value) > 0;
53187
- return jsxRuntime.jsx(tooltip$3.TooltipWithBounds, {
53428
+ return /*#__PURE__*/ReactDOM.createPortal(jsxRuntime.jsx(tooltip$3.TooltipWithBounds, {
53188
53429
  left: tooltipLeft,
53189
53430
  top: tooltipTop,
53190
53431
  style: theme,
@@ -53219,7 +53460,7 @@ var Tooltip$2 = function Tooltip(_ref) {
53219
53460
  })]
53220
53461
  })]
53221
53462
  })
53222
- }, Math.random());
53463
+ }, Math.random()), document.body);
53223
53464
  };
53224
53465
  var IconNarrowRight$1 = function IconNarrowRight() {
53225
53466
  var style = {
@@ -53227,7 +53468,7 @@ var IconNarrowRight$1 = function IconNarrowRight() {
53227
53468
  height: 20,
53228
53469
  display: 'block'
53229
53470
  };
53230
- var fill = "#12B76A";
53471
+ var fill = '#12B76A';
53231
53472
  return jsxRuntime.jsx("svg", {
53232
53473
  fill: "none",
53233
53474
  xmlns: "http://www.w3.org/2000/svg",
@@ -53247,7 +53488,7 @@ var IconTrendingDown$1 = function IconTrendingDown() {
53247
53488
  height: 20,
53248
53489
  display: 'block'
53249
53490
  };
53250
- var fill = "#F04438";
53491
+ var fill = '#F04438';
53251
53492
  return jsxRuntime.jsx("svg", {
53252
53493
  fill: "none",
53253
53494
  xmlns: "http://www.w3.org/2000/svg",
@@ -53415,8 +53656,8 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
53415
53656
  return Number(tick.value);
53416
53657
  });
53417
53658
  var xTickValues = formattedChartDataForBarChart.x.ticks.length > 0 ? formattedChartDataForBarChart.x.ticks.map(function (tick) {
53418
- var _tick$scaleValue;
53419
- return (_tick$scaleValue = tick.scaleValue) != null ? _tick$scaleValue : 0;
53659
+ var _String;
53660
+ return (_String = String(tick.scaleValue)) != null ? _String : '';
53420
53661
  }) : undefined;
53421
53662
  var handleMouseMove = React.useCallback(function (event) {
53422
53663
  if (!xKey || !xScaleKey || xScale === null) return;
@@ -53449,7 +53690,7 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
53449
53690
  tick = matchingTickValue || null;
53450
53691
  } else {
53451
53692
  var _matchingTickValue = formattedChartDataForBarChart.x.ticks.find(function (tickValue) {
53452
- return tickValue.scaleValue === value;
53693
+ return String(tickValue.scaleValue) === value;
53453
53694
  });
53454
53695
  tick = _matchingTickValue || null;
53455
53696
  }
@@ -53474,10 +53715,10 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
53474
53715
  return '';
53475
53716
  }, [formattedChartDataForBarChart.y.ticks]);
53476
53717
  var getBarGroupPosition = React.useCallback(function (d) {
53477
- if (xScaleKey == null || d == null) return;
53718
+ if (xScaleKey == null || d == null) return '';
53478
53719
  var xValue = d[xScaleKey];
53479
- if (xScaleDataType === 'string') return xValue;
53480
- return;
53720
+ if (xScaleDataType === 'string') return String(xValue);
53721
+ return '';
53481
53722
  }, [xScaleKey, xScaleDataType]);
53482
53723
  if (width === 0 || height === 0 || xScale == null) return null;
53483
53724
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -53627,245 +53868,6 @@ var Bar$2 = function Bar(_ref4) {
53627
53868
  });
53628
53869
  };
53629
53870
 
53630
- function getNiceInterval$3(interval) {
53631
- // Round the interval to a "nice" value (1, 2, 5, etc.)
53632
- var exponent = Math.floor(Math.log10(interval));
53633
- var fraction = interval / Math.pow(10, exponent);
53634
- var niceFraction;
53635
- if (fraction <= 1.5) niceFraction = 1;else if (fraction <= 3) niceFraction = 2;else if (fraction <= 7) niceFraction = 5;else niceFraction = 10;
53636
- return niceFraction * Math.pow(10, exponent);
53637
- }
53638
-
53639
- var getYTicks = function getYTicks(_ref) {
53640
- var yMinValue = _ref.yMinValue,
53641
- yMaxValue = _ref.yMaxValue,
53642
- approxYAxisLabelCount = _ref.approxYAxisLabelCount,
53643
- formattingFunctionY = _ref.formattingFunctionY;
53644
- var yTicks = [];
53645
- var yTickInterval = getNiceInterval$3((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
53646
- for (var i = 0; i < approxYAxisLabelCount; i++) {
53647
- var value = (yMinValue + i) * yTickInterval;
53648
- var formattedValue = formattingFunctionY(value);
53649
- yTicks.push({
53650
- value: value,
53651
- formattedValue: formattedValue,
53652
- scaleValue: value
53653
- });
53654
- }
53655
- return yTicks;
53656
- };
53657
-
53658
- var getRepresentationData = function getRepresentationData(_ref) {
53659
- var content = _ref.content,
53660
- xKey = _ref.xKey,
53661
- yKey = _ref.yKey,
53662
- approxYAxisLabelCount = _ref.approxYAxisLabelCount,
53663
- showTotalBar = _ref.showTotalBar,
53664
- formattingFunctionY = _ref.formattingFunctionY;
53665
- var data = [];
53666
- var steps = [];
53667
- var xTicks = [];
53668
- var yValueSum = 0;
53669
- var yMinValue = 0;
53670
- var yMaxValue = 0;
53671
- content.forEach(function (dataItem, index) {
53672
- var _data$push;
53673
- var xValueIndex = 0;
53674
- var yValueIndex = 1;
53675
- var xValue = dataItem[xValueIndex].value;
53676
- var xFormattedValue = dataItem[xValueIndex].formattedValue;
53677
- var yValue = Number(dataItem[yValueIndex].value);
53678
- var yValueDiff = yValue;
53679
- if (index > 0) {
53680
- var prevYValue = Number(content[index - 1][yValueIndex].value);
53681
- yValueDiff = yValue - prevYValue;
53682
- }
53683
- var prevYValueSum = yValueSum;
53684
- yValueSum += yValueDiff;
53685
- data.push((_data$push = {}, _data$push[xKey] = {
53686
- value: xValue,
53687
- formattedValue: xFormattedValue
53688
- }, _data$push[yKey] = {
53689
- value: yValueDiff,
53690
- formattedValue: formattingFunctionY(yValueDiff)
53691
- }, _data$push));
53692
- xTicks.push({
53693
- value: xValue,
53694
- formattedValue: xFormattedValue,
53695
- scaleValue: xValue
53696
- });
53697
- steps.push({
53698
- x: xValue,
53699
- y: yValue,
53700
- start: prevYValueSum,
53701
- end: yValueSum
53702
- });
53703
- yMinValue = Math.floor(Math.min(yMinValue, yValue));
53704
- yMaxValue = Math.ceil(Math.max(yMaxValue, yValue));
53705
- });
53706
- if (showTotalBar) {
53707
- var _data$push2;
53708
- var totalLabel = 'Total';
53709
- steps.push({
53710
- x: totalLabel,
53711
- y: yValueSum,
53712
- start: 0,
53713
- end: yValueSum
53714
- });
53715
- data.push((_data$push2 = {}, _data$push2[xKey] = {
53716
- value: totalLabel,
53717
- formattedValue: totalLabel
53718
- }, _data$push2[yKey] = {
53719
- value: yValueSum,
53720
- formattedValue: formattingFunctionY(yValueSum)
53721
- }, _data$push2));
53722
- xTicks.push({
53723
- value: totalLabel,
53724
- formattedValue: totalLabel,
53725
- scaleValue: totalLabel
53726
- });
53727
- }
53728
- var yTicks = getYTicks({
53729
- yMinValue: yMinValue,
53730
- yMaxValue: yMaxValue,
53731
- approxYAxisLabelCount: approxYAxisLabelCount,
53732
- formattingFunctionY: formattingFunctionY
53733
- });
53734
- return {
53735
- data: data,
53736
- steps: steps,
53737
- xTicks: xTicks,
53738
- yTicks: yTicks,
53739
- yMinValue: yMinValue,
53740
- yMaxValue: yMaxValue
53741
- };
53742
- };
53743
-
53744
- var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentation(_ref) {
53745
- var _formattedResult$fiel, _formattedResult$fiel2, _axisTitles$x, _axisTitles$y;
53746
- var approxYAxisLabelCount = _ref.approxYAxisLabelCount,
53747
- axisTitles = _ref.axisTitles,
53748
- dateTimeFormatOptions = _ref.dateTimeFormatOptions,
53749
- defaultFormats = _ref.defaultFormats,
53750
- nullValue = _ref.nullValue,
53751
- numberFormatOptions = _ref.numberFormatOptions,
53752
- pivotConfig = _ref.pivotConfig,
53753
- result = _ref.result,
53754
- showTotalBar = _ref.showTotalBar,
53755
- _valueAlias = _ref.valueAlias,
53756
- xAxisFormat = _ref.xAxisFormat,
53757
- xAxisPrefix = _ref.xAxisPrefix,
53758
- xAxisPostfix = _ref.xAxisPostfix,
53759
- yAxisFormat = _ref.yAxisFormat,
53760
- yAxisPrefix = _ref.yAxisPrefix,
53761
- yAxisPostfix = _ref.yAxisPostfix;
53762
- var activeDateTimeFormats = {};
53763
- var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
53764
- allPrefixes = _buildFieldFormatMaps.allPrefixes,
53765
- allPostfixes = _buildFieldFormatMaps.allPostfixes,
53766
- nullValues = _buildFieldFormatMaps.nullValues,
53767
- activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
53768
- var params = {
53769
- defaultFormats: defaultFormats,
53770
- dateTimeFormatOptions: dateTimeFormatOptions,
53771
- numberFormatOptions: numberFormatOptions,
53772
- valueAlias: function valueAlias(params) {
53773
- if (typeof _valueAlias === 'function') {
53774
- return String(_valueAlias({
53775
- fieldId: id({
53776
- field: params.fieldId,
53777
- "function": params["function"]
53778
- }),
53779
- value: params.value
53780
- }));
53781
- }
53782
- return undefined;
53783
- },
53784
- nullValue: nullValues,
53785
- prefixes: allPrefixes,
53786
- postfixes: allPostfixes,
53787
- activeNumberFormats: activeNumberFormats,
53788
- activeDateTimeFormats: activeDateTimeFormats
53789
- };
53790
- var formattedResult = formatResult(result, params);
53791
- var formattingFunctionY = function formattingFunctionY(value) {
53792
- // Use any y axis field as they are all formatted in the same way (for now...);
53793
- var nonPivotField = formattedResult.fields.find(function (resultField) {
53794
- return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
53795
- });
53796
- if (!nonPivotField) return '';
53797
- return formattedResult.formatterFunc(value, {
53798
- fieldId: nonPivotField.fieldId,
53799
- "function": nonPivotField["function"],
53800
- outputDataType: nonPivotField.outputDataType
53801
- }).formattedValue;
53802
- };
53803
- var keys = formattedResult.fields.map(function (field) {
53804
- var _ref2;
53805
- var key = field.fieldId;
53806
- var keyFormatted = field.publicName;
53807
- var dataType = field.dataType;
53808
- return _ref2 = {}, _ref2[key] = {
53809
- key: key,
53810
- keyFormatted: keyFormatted,
53811
- dataType: dataType
53812
- }, _ref2;
53813
- });
53814
- var xKey = (_formattedResult$fiel = formattedResult.fields[0]) == null ? void 0 : _formattedResult$fiel.fieldId;
53815
- var yKey = (_formattedResult$fiel2 = formattedResult.fields[1]) == null ? void 0 : _formattedResult$fiel2.fieldId;
53816
- var content = formattedResult.content;
53817
- var _getRepresentationDat = getRepresentationData({
53818
- content: content,
53819
- xKey: xKey,
53820
- yKey: yKey,
53821
- approxYAxisLabelCount: approxYAxisLabelCount,
53822
- showTotalBar: showTotalBar,
53823
- formattingFunctionY: formattingFunctionY
53824
- }),
53825
- data = _getRepresentationDat.data,
53826
- steps = _getRepresentationDat.steps,
53827
- xTicks = _getRepresentationDat.xTicks,
53828
- yTicks = _getRepresentationDat.yTicks,
53829
- yMinValue = _getRepresentationDat.yMinValue,
53830
- yMaxValue = _getRepresentationDat.yMaxValue;
53831
- var chartRepresentation = {
53832
- keys: _extends({}, keys[0], keys[1]),
53833
- x: {
53834
- title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null,
53835
- ticks: xTicks,
53836
- prefix: xAxisPrefix,
53837
- postfix: xAxisPostfix,
53838
- key: xKey,
53839
- scale: {
53840
- dataType: 'string',
53841
- key: xKey,
53842
- ordering: null,
53843
- min: null,
53844
- max: null
53845
- }
53846
- },
53847
- y: {
53848
- title: (_axisTitles$y = axisTitles == null ? void 0 : axisTitles.y) != null ? _axisTitles$y : null,
53849
- ticks: yTicks,
53850
- key: yKey,
53851
- prefix: yAxisPrefix,
53852
- postfix: yAxisPostfix,
53853
- scale: {
53854
- dataType: 'number',
53855
- key: null,
53856
- ordering: 'asc',
53857
- min: yMinValue,
53858
- max: yMaxValue
53859
- }
53860
- },
53861
- data: data
53862
- };
53863
- return {
53864
- waterfallChartRepresentation: chartRepresentation,
53865
- waterfallChartSteps: steps
53866
- };
53867
- };
53868
-
53869
53871
  var WaterfallChartView = function WaterfallChartView(props) {
53870
53872
  var approxXAxisLabelCount = props.approxXAxisLabelCount,
53871
53873
  approxYAxisLabelCount = props.approxYAxisLabelCount,
@@ -53933,6 +53935,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
53933
53935
  title: "Missing parameters"
53934
53936
  });
53935
53937
  if (isLoading(result)) return jsxRuntime.jsx(LoadingComponent, {});
53938
+ if (isLoadingResult(result)) return jsxRuntime.jsx(LoadingComponent, {});
53936
53939
  if (hasFailed(result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
53937
53940
  if (isEmpty(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
53938
53941
  var showHeadline = headlineAvailable(order, headline, timeDimension);
@@ -54003,6 +54006,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
54003
54006
  })
54004
54007
  });
54005
54008
  };
54009
+ function isLoadingResult(result) {
54010
+ return result != null && result.content[0].length ? (result == null ? void 0 : result.content[0].length) < 2 : false;
54011
+ }
54006
54012
  var WaterfallChartView$1 = /*#__PURE__*/React.memo(WaterfallChartView, shouldUpdate);
54007
54013
 
54008
54014
  var WaterfallChart$3 = function WaterfallChart(_ref) {