@vizzly/dashboard 0.14.4-dev-28ace990f8935dcd353f0b09527a2a1b32940e13 → 0.14.4-dev-dacb7b6ee19300aa636d654c99f13d6ac43da830

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.
@@ -64,7 +64,6 @@ var axis = require('@visx/axis');
64
64
  var text$3 = require('@visx/text');
65
65
  var grid = require('@visx/grid');
66
66
  require('@visx/point');
67
- var WaterfallChart$4 = require('./charts/src/v2/components/WaterfallChart');
68
67
  var VisibilitySensor = _interopDefault(require('react-visibility-sensor'));
69
68
  var ExcelJS = _interopDefault(require('exceljs'));
70
69
  var fileSaver = require('file-saver');
@@ -46808,6 +46807,608 @@ var BarChartV2 = function BarChartV2(props) {
46808
46807
  });
46809
46808
  };
46810
46809
 
46810
+ function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
46811
+ var _bars$find;
46812
+ // Default fill color from the corresponding bar
46813
+ var fill = (_bars$find = bars.find(function (chartBar) {
46814
+ return chartBar.yKey === barKey;
46815
+ })) == null ? void 0 : _bars$find.color;
46816
+
46817
+ // Determine the value based on barValues type
46818
+ var value = typeof barValues === 'number' ? barValues : barValues == null ? void 0 : barValues[barKey];
46819
+ if (typeof value === 'number') {
46820
+ for (var _iterator = _createForOfIteratorHelperLoose(conditionalFormattingRules), _step; !(_step = _iterator()).done;) {
46821
+ var rule = _step.value;
46822
+ if (compare({
46823
+ op: rule.operator,
46824
+ value: rule.value
46825
+ }, value)) {
46826
+ fill = rule.color;
46827
+ break;
46828
+ }
46829
+ }
46830
+ }
46831
+ return fill;
46832
+ }
46833
+
46834
+ var ASSUMED_AVERAGE_CHAR_WIDTH$2 = 8.8;
46835
+ function calculateWordWidth$2(word, avgCharWidth) {
46836
+ if (avgCharWidth === void 0) {
46837
+ avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$2;
46838
+ }
46839
+ return word.length * avgCharWidth;
46840
+ }
46841
+
46842
+ /** Reduce width proportionally to simulate spacing / padding between ticks. */
46843
+ var widthWithSpacing$2 = function widthWithSpacing(width) {
46844
+ var THIRTY_PERCENT = 0.3;
46845
+ return width - width * THIRTY_PERCENT;
46846
+ };
46847
+ function howManyTicksFitInWidth$2(ticks, maxWidth, avgCharWidth) {
46848
+ if (avgCharWidth === void 0) {
46849
+ avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$2;
46850
+ }
46851
+ var fittedTicks = [];
46852
+ var currentWidth = 0;
46853
+ for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
46854
+ var tick = _step.value;
46855
+ var word = (tick == null ? void 0 : tick.formattedValue) || '';
46856
+ var wordWidth = calculateWordWidth$2(word, avgCharWidth);
46857
+ if (currentWidth + wordWidth <= widthWithSpacing$2(maxWidth)) {
46858
+ fittedTicks.push(tick);
46859
+ currentWidth += wordWidth + avgCharWidth; // Add space between words
46860
+ } else {
46861
+ break; // Stop if adding the word exceeds maxWidth
46862
+ }
46863
+ }
46864
+ return fittedTicks.length;
46865
+ }
46866
+ function pickEquallySpaced$2(arr, numPicks) {
46867
+ if (numPicks >= arr.length) {
46868
+ return arr; // If numPicks is greater than or equal to the array length, return the whole array
46869
+ }
46870
+ var result = [];
46871
+ var interval = (arr.length - 1) / (numPicks - 1);
46872
+ for (var i = 0; i < numPicks; i++) {
46873
+ var index = Math.round(i * interval); // Calculate index and round it
46874
+ result.push(arr[index]);
46875
+ }
46876
+ return result;
46877
+ }
46878
+ var adjustTicks$2 = function adjustTicks(waterfallChartRepresentation, width) {
46879
+ waterfallChartRepresentation = _.cloneDeep(waterfallChartRepresentation);
46880
+
46881
+ // TODO; take this from the theme override...
46882
+ var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$2;
46883
+ var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$2(waterfallChartRepresentation.x.ticks || [], width, averageCharacterWidth);
46884
+ var MINIMUM_NUMBER_OF_TICKS = 2;
46885
+ if (numberOfTicksFittingIntoSpace < MINIMUM_NUMBER_OF_TICKS) {
46886
+ numberOfTicksFittingIntoSpace = MINIMUM_NUMBER_OF_TICKS;
46887
+ }
46888
+
46889
+ // @ts-ignore
46890
+ waterfallChartRepresentation.x.ticks = pickEquallySpaced$2(waterfallChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
46891
+ return waterfallChartRepresentation;
46892
+ };
46893
+
46894
+ var Tooltip$2 = function Tooltip(_ref) {
46895
+ var _tooltipData$xKey$for, _tooltipData$yKey$for;
46896
+ var showTooltip = _ref.showTooltip,
46897
+ tooltipData = _ref.tooltipData,
46898
+ tooltipLeft = _ref.tooltipLeft,
46899
+ tooltipTop = _ref.tooltipTop,
46900
+ xKey = _ref.xKey,
46901
+ yKey = _ref.yKey,
46902
+ theme = _ref.theme;
46903
+ var tooltipRowContainerClasses = buildStyleOverrides({
46904
+ display: 'grid',
46905
+ gridTemplateColumns: 'auto 1fr',
46906
+ gap: 12,
46907
+ fontWeight: 500,
46908
+ color: 'inherit',
46909
+ alignItems: 'center'
46910
+ });
46911
+ var rowClasses = buildStyleOverrides({
46912
+ borderBottom: '1px dotted rgba(0,0,0,0.025)'
46913
+ });
46914
+ var rowLabelClasses = buildStyleOverrides({
46915
+ alignItems: 'center',
46916
+ display: 'flex',
46917
+ fontFamily: 'inherit',
46918
+ letterSpacing: 'inherit',
46919
+ gap: 6
46920
+ });
46921
+ var rowValueClasses = buildStyleOverrides({
46922
+ display: 'block',
46923
+ fontFamily: 'inherit',
46924
+ letterSpacing: 'inherit',
46925
+ margin: 0,
46926
+ padding: 0,
46927
+ textAlign: 'right'
46928
+ });
46929
+ var highlightedClasses = buildStyleOverrides({
46930
+ wordBreak: 'break-all'
46931
+ });
46932
+ if (!showTooltip || !tooltipData) return null;
46933
+ var value = tooltipData[yKey].value;
46934
+ var isPositiveValue = Number(value) > 0;
46935
+ return jsxRuntime.jsx(tooltip$3.TooltipWithBounds, {
46936
+ left: tooltipLeft,
46937
+ top: tooltipTop,
46938
+ style: theme,
46939
+ children: jsxRuntime.jsxs("div", {
46940
+ style: {
46941
+ wordBreak: 'break-all'
46942
+ },
46943
+ children: [jsxRuntime.jsx("div", {
46944
+ style: {
46945
+ fontFamily: 'inherit',
46946
+ lineHeight: 'inherit',
46947
+ letterSpacing: 'inherit',
46948
+ fontWeight: 'bold',
46949
+ fontSize: '15px',
46950
+ width: '100%'
46951
+ },
46952
+ children: (_tooltipData$xKey$for = tooltipData[xKey].formattedValue) != null ? _tooltipData$xKey$for : tooltipData[xKey].value
46953
+ }), jsxRuntime.jsxs("div", {
46954
+ style: {
46955
+ fontWeight: 700
46956
+ },
46957
+ className: "" + tooltipRowContainerClasses,
46958
+ children: [jsxRuntime.jsx("span", {
46959
+ className: rowClasses + " " + rowLabelClasses,
46960
+ children: jsxRuntime.jsx("span", {
46961
+ className: "" + highlightedClasses,
46962
+ children: isPositiveValue ? jsxRuntime.jsx(IconNarrowRight$1, {}) : jsxRuntime.jsx(IconTrendingDown$1, {})
46963
+ })
46964
+ }), jsxRuntime.jsx("p", {
46965
+ className: rowClasses + " " + rowValueClasses,
46966
+ children: (_tooltipData$yKey$for = tooltipData[yKey].formattedValue) != null ? _tooltipData$yKey$for : tooltipData[yKey].value
46967
+ })]
46968
+ })]
46969
+ })
46970
+ }, Math.random());
46971
+ };
46972
+ var IconNarrowRight$1 = function IconNarrowRight() {
46973
+ var style = {
46974
+ width: 20,
46975
+ height: 20,
46976
+ display: 'block'
46977
+ };
46978
+ var fill = "#12B76A";
46979
+ return jsxRuntime.jsx("svg", {
46980
+ fill: "none",
46981
+ xmlns: "http://www.w3.org/2000/svg",
46982
+ viewBox: "0 0 256 256",
46983
+ style: style,
46984
+ children: jsxRuntime.jsx("path", {
46985
+ fillRule: "evenodd",
46986
+ clipRule: "evenodd",
46987
+ d: "M244 56v64a12 12 0 0 1-24 0V85l-75.51 75.52a12 12 0 0 1-17 0L96 129l-63.51 63.49a12 12 0 0 1-17-17l72-72a12 12 0 0 1 17 0L136 135l67-67h-35a12 12 0 0 1 0-24h64a12 12 0 0 1 12 12",
46988
+ fill: fill
46989
+ })
46990
+ });
46991
+ };
46992
+ var IconTrendingDown$1 = function IconTrendingDown() {
46993
+ var style = {
46994
+ width: 20,
46995
+ height: 20,
46996
+ display: 'block'
46997
+ };
46998
+ var fill = "#F04438";
46999
+ return jsxRuntime.jsx("svg", {
47000
+ fill: "none",
47001
+ xmlns: "http://www.w3.org/2000/svg",
47002
+ viewBox: "0 0 20 20",
47003
+ style: style,
47004
+ children: jsxRuntime.jsx("path", {
47005
+ fillRule: "evenodd",
47006
+ clipRule: "evenodd",
47007
+ d: "M12 13a1 1 0 1 0 0 2h5a1 1 0 0 0 1-1V9a1 1 0 1 0-2 0v2.586l-4.293-4.293a1 1 0 0 0-1.414 0L8 9.586 3.707 5.293a1 1 0 0 0-1.414 1.414l5 5a1 1 0 0 0 1.414 0L11 9.414 14.586 13H12Z",
47008
+ fill: fill
47009
+ })
47010
+ });
47011
+ };
47012
+
47013
+ var Legend$2 = function Legend(_ref) {
47014
+ var showLegend = _ref.showLegend,
47015
+ margin = _ref.margin;
47016
+ var items = [{
47017
+ color: 'green',
47018
+ yKey: 'increase',
47019
+ style: {
47020
+ type: 'line',
47021
+ strokeDasharray: null,
47022
+ strokeWidth: 2
47023
+ }
47024
+ }, {
47025
+ color: 'red',
47026
+ yKey: 'decrease',
47027
+ style: {
47028
+ type: 'line',
47029
+ strokeDasharray: null,
47030
+ strokeWidth: 2
47031
+ }
47032
+ }];
47033
+ var keys = {
47034
+ increase: {
47035
+ key: 'increase',
47036
+ keyFormatted: 'Increase',
47037
+ dataType: 'string'
47038
+ },
47039
+ decrease: {
47040
+ key: 'decrease',
47041
+ keyFormatted: 'Decrease',
47042
+ dataType: 'string'
47043
+ }
47044
+ };
47045
+ if (!showLegend) return null;
47046
+ return jsxRuntime.jsx(Legend$1, {
47047
+ legendItems: items,
47048
+ visibleYKeys: ['increase', 'decrease'],
47049
+ keys: keys,
47050
+ marginLeft: margin.left - margin.leftTitleOffset,
47051
+ conditionalFormattingRules: [],
47052
+ setVisibleYKeys: function setVisibleYKeys() {}
47053
+ });
47054
+ };
47055
+
47056
+ var _excluded$g = ["formattedValue"],
47057
+ _excluded2$4 = ["formattedValue"];
47058
+ var AXIS_TITLE_STYLES$1 = {
47059
+ opacity: '0.75',
47060
+ fontWeight: 'bold'
47061
+ };
47062
+ var WaterfallChart$2 = function WaterfallChart(_ref) {
47063
+ var _theme$axis$stroke, _theme$axis;
47064
+ var height = _ref.height,
47065
+ width = _ref.width,
47066
+ options = _ref.options,
47067
+ chart = _ref.chart,
47068
+ theme = _ref.theme;
47069
+ //Waterfall TODO: fix chart for other x types
47070
+ if (chart.x.scale.dataType === 'date_time' || chart.x.scale.dataType === 'number') {
47071
+ return null;
47072
+ }
47073
+ var _useTooltip = tooltip$3.useTooltip(),
47074
+ tooltipOpen = _useTooltip.tooltipOpen,
47075
+ _useTooltip$tooltipLe = _useTooltip.tooltipLeft,
47076
+ tooltipLeft = _useTooltip$tooltipLe === void 0 ? 0 : _useTooltip$tooltipLe,
47077
+ _useTooltip$tooltipTo = _useTooltip.tooltipTop,
47078
+ tooltipTop = _useTooltip$tooltipTo === void 0 ? 0 : _useTooltip$tooltipTo,
47079
+ tooltipData = _useTooltip.tooltipData,
47080
+ hideTooltip = _useTooltip.hideTooltip,
47081
+ showTooltip = _useTooltip.showTooltip;
47082
+ var chartCopy = _.cloneDeep(chart);
47083
+ var data = chartCopy.data,
47084
+ x = chartCopy.x,
47085
+ y = chartCopy.y;
47086
+ var showTotalBar = options.showTotalBar;
47087
+ var conditionalFormattingRules = [{
47088
+ yKey: y.key,
47089
+ operator: '>',
47090
+ value: 0,
47091
+ color: 'green'
47092
+ }, {
47093
+ yKey: y.key,
47094
+ operator: '<',
47095
+ value: 0,
47096
+ color: 'red'
47097
+ }];
47098
+ var xKey = x.key;
47099
+ var yKey = y.key;
47100
+ var cumulativeTotal = 0;
47101
+ var steps = data.map(function (item) {
47102
+ var xValue = item[xKey].value;
47103
+ var yValue = Number(item[yKey].value);
47104
+ var prevTotal = cumulativeTotal;
47105
+ cumulativeTotal += yValue;
47106
+ return {
47107
+ x: xValue,
47108
+ y: yValue,
47109
+ start: prevTotal,
47110
+ end: cumulativeTotal
47111
+ };
47112
+ });
47113
+ if (showTotalBar) {
47114
+ var _data$push;
47115
+ steps.push({
47116
+ x: "Total",
47117
+ y: cumulativeTotal,
47118
+ start: 0,
47119
+ end: cumulativeTotal
47120
+ });
47121
+ data.push((_data$push = {}, _data$push[x.key] = {
47122
+ value: "Total",
47123
+ formattedValue: "Total"
47124
+ }, _data$push[y.key] = {
47125
+ value: cumulativeTotal,
47126
+ formattedValue: null
47127
+ }, _data$push));
47128
+ x.ticks.push({
47129
+ value: "Total",
47130
+ formattedValue: "Total",
47131
+ scaleValue: "Total"
47132
+ });
47133
+ }
47134
+ var formattedYAxisForBarChart = _extends({}, y, {
47135
+ keys: [y.key]
47136
+ });
47137
+ var adjustedChartRepresentation = React.useMemo(function () {
47138
+ return adjustTicks$2(_extends({}, chartCopy), width);
47139
+ }, [chartCopy, width]);
47140
+ var formattedChartDataForBarChart = _extends({}, adjustedChartRepresentation, {
47141
+ y: formattedYAxisForBarChart,
47142
+ steps: steps,
47143
+ conditionalFormattingRules: conditionalFormattingRules,
47144
+ bars: []
47145
+ });
47146
+ var margin = React.useMemo(function () {
47147
+ return buildMargin(formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title != null, formattedChartDataForBarChart.x.title != null);
47148
+ }, [formattedChartDataForBarChart.y.ticks, options.axis.showYAxisLabels, formattedChartDataForBarChart.y.title, formattedChartDataForBarChart.x.title]);
47149
+ var innerWidth = width - margin.left - margin.right;
47150
+ var innerHeight = height - margin.top - margin.bottom - (options.showLegend ? 40 : 0);
47151
+ var xScaleKey = formattedChartDataForBarChart.x.scale.key;
47152
+ var yScaleKeys = formattedChartDataForBarChart.y.keys;
47153
+ var xScaleDataType = formattedChartDataForBarChart.x.scale.dataType;
47154
+ var xScale = React.useMemo(function () {
47155
+ return scale.scaleBand({
47156
+ range: [0, innerWidth],
47157
+ domain: xScaleKey ? [].concat(formattedChartDataForBarChart.data.map(function (d) {
47158
+ return d[xScaleKey] && d[xScaleKey].value !== null ? String(d[xScaleKey].value) : '';
47159
+ })) : [],
47160
+ paddingOuter: 0,
47161
+ paddingInner: 0
47162
+ });
47163
+ }, [innerWidth, formattedChartDataForBarChart.x, formattedChartDataForBarChart.data]);
47164
+ var yScale = React.useMemo(function () {
47165
+ return scale.scaleLinear({
47166
+ range: [innerHeight, 0],
47167
+ domain: formattedChartDataForBarChart.y.scale.ordering === 'asc' ? [formattedChartDataForBarChart.y.scale.min, formattedChartDataForBarChart.y.scale.max] : [formattedChartDataForBarChart.y.scale.max, formattedChartDataForBarChart.y.scale.min],
47168
+ nice: true
47169
+ });
47170
+ }, [innerHeight, formattedChartDataForBarChart.y]);
47171
+ var xBandwidth = xScale.bandwidth();
47172
+ var innerXScale = React.useMemo(function () {
47173
+ return scale.scaleBand({
47174
+ range: [0, xBandwidth],
47175
+ domain: yScaleKeys,
47176
+ padding: 0.1
47177
+ });
47178
+ }, [xScale, yScaleKeys, xScaleDataType]);
47179
+ var dataFlattened = React.useMemo(function () {
47180
+ if (xScaleKey) {
47181
+ return flattenData({
47182
+ data: formattedChartDataForBarChart.data,
47183
+ xScaleKey: xScaleKey,
47184
+ xScaleDataType: xScaleDataType,
47185
+ yKeys: formattedChartDataForBarChart.y.keys
47186
+ });
47187
+ }
47188
+ return [];
47189
+ }, [formattedChartDataForBarChart.data, xScaleKey, xScaleDataType, formattedChartDataForBarChart.y.keys]);
47190
+ var themeCSS = React.useMemo(function () {
47191
+ return getChartThemeCSS(theme);
47192
+ }, [theme]);
47193
+ var yTickValues = formattedChartDataForBarChart.y.ticks.map(function (tick) {
47194
+ return Number(tick.value);
47195
+ });
47196
+ var xTickValues = formattedChartDataForBarChart.x.ticks.length > 0 ? formattedChartDataForBarChart.x.ticks.map(function (tick) {
47197
+ var _tick$scaleValue;
47198
+ return (_tick$scaleValue = tick.scaleValue) != null ? _tick$scaleValue : 0;
47199
+ }) : undefined;
47200
+ var handleMouseMove = React.useCallback(function (event) {
47201
+ if (!xKey || !xScaleKey || xScale === null) return;
47202
+ var tooltipData = getTooltipData({
47203
+ data: formattedChartDataForBarChart.data,
47204
+ event: event,
47205
+ margin: margin,
47206
+ xScaleKey: xScaleKey,
47207
+ xScaleDataType: xScaleDataType,
47208
+ xOrdering: formattedChartDataForBarChart.x.scale.ordering,
47209
+ xScale: xScale,
47210
+ chartType: 'bar'
47211
+ });
47212
+ showTooltip({
47213
+ tooltipLeft: tooltipData == null ? void 0 : tooltipData.tooltipLeft,
47214
+ tooltipTop: tooltipData == null ? void 0 : tooltipData.tooltipTop,
47215
+ tooltipData: tooltipData == null ? void 0 : tooltipData.tooltipData
47216
+ });
47217
+ }, [showTooltip, xScale, margin, xKey, xScaleKey, xScaleDataType, formattedChartDataForBarChart.x.scale.ordering, formattedChartDataForBarChart.data]);
47218
+ var handleMouseLeave = React.useCallback(function () {
47219
+ hideTooltip();
47220
+ }, [hideTooltip]);
47221
+ var getXTickFormat = React.useCallback(function (value) {
47222
+ var tick = null;
47223
+ if (xScaleDataType === 'date_time' && value instanceof Date) {
47224
+ var matchingTickValue = formattedChartDataForBarChart.x.ticks.find(function (tickValue) {
47225
+ return tickValue.scaleValue && new Date(tickValue.scaleValue).valueOf() === value.valueOf();
47226
+ });
47227
+ tick = matchingTickValue || null;
47228
+ } else {
47229
+ var _matchingTickValue = formattedChartDataForBarChart.x.ticks.find(function (tickValue) {
47230
+ return tickValue.scaleValue === value;
47231
+ });
47232
+ tick = _matchingTickValue || null;
47233
+ }
47234
+ if (tick) {
47235
+ if (tick.formattedValue) {
47236
+ return tick.formattedValue;
47237
+ }
47238
+ return tick.value.toString();
47239
+ }
47240
+ return '';
47241
+ }, [formattedChartDataForBarChart.x.ticks, xScaleDataType]);
47242
+ var getYTickFormat = React.useCallback(function (value) {
47243
+ var item = formattedChartDataForBarChart.y.ticks.filter(function (tick) {
47244
+ return tick.value === value;
47245
+ })[0];
47246
+ if (item) {
47247
+ if (item.formattedValue) {
47248
+ return item.formattedValue;
47249
+ }
47250
+ return item.value.toString();
47251
+ }
47252
+ return '';
47253
+ }, [formattedChartDataForBarChart.y.ticks]);
47254
+ var getBarGroupPosition = React.useCallback(function (d) {
47255
+ if (xScaleKey == null || d == null) return;
47256
+ var xValue = d[xScaleKey];
47257
+ if (xScaleDataType === 'string') return xValue;
47258
+ return;
47259
+ }, [xScaleKey, xScaleDataType]);
47260
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
47261
+ children: [jsxRuntime.jsxs("svg", {
47262
+ width: width,
47263
+ height: height - (options.showLegend ? 40 : 0),
47264
+ onMouseMove: handleMouseMove,
47265
+ onMouseLeave: handleMouseLeave,
47266
+ style: {
47267
+ display: 'block'
47268
+ },
47269
+ children: [jsxRuntime.jsxs(group.Group, {
47270
+ left: margin.left,
47271
+ top: margin.top,
47272
+ children: [jsxRuntime.jsx(grid.GridRows, {
47273
+ tickValues: yTickValues.length > 0 ? yTickValues : undefined,
47274
+ scale: yScale,
47275
+ width: innerWidth,
47276
+ height: innerHeight,
47277
+ pointerEvents: "none",
47278
+ strokeDasharray: "0.5 5",
47279
+ strokeWidth: options.removeStroke ? 0 : 2,
47280
+ lineStyle: {
47281
+ strokeLinecap: 'round',
47282
+ stroke: themeCSS.grid.stroke
47283
+ }
47284
+ }), options.axis.showXAxisLabels && jsxRuntime.jsx(axis.AxisBottom, {
47285
+ label: formattedChartDataForBarChart.x.title || undefined,
47286
+ labelProps: {
47287
+ style: AXIS_TITLE_STYLES$1
47288
+ },
47289
+ labelOffset: margin.bottomTitleOffset,
47290
+ hideTicks: true,
47291
+ top: innerHeight,
47292
+ scale: xScale,
47293
+ tickFormat: getXTickFormat,
47294
+ tickValues: xTickValues,
47295
+ tickComponent: function tickComponent(_ref2) {
47296
+ var formattedValue = _ref2.formattedValue,
47297
+ tickProps = _objectWithoutPropertiesLoose(_ref2, _excluded$g);
47298
+ return jsxRuntime.jsx(text$3.Text, _extends({
47299
+ style: themeCSS.labels
47300
+ }, tickProps, {
47301
+ children: formattedValue
47302
+ }));
47303
+ },
47304
+ stroke: themeCSS.axis.stroke,
47305
+ strokeWidth: options.removeStroke ? 0 : 1
47306
+ }), options.axis.showYAxisLabels && jsxRuntime.jsx(axis.AxisLeft, {
47307
+ labelOffset: margin.leftTitleOffset,
47308
+ label: formattedChartDataForBarChart.y.title || undefined,
47309
+ labelProps: {
47310
+ style: AXIS_TITLE_STYLES$1
47311
+ },
47312
+ hideTicks: true,
47313
+ left: 0,
47314
+ top: 0,
47315
+ scale: yScale,
47316
+ tickFormat: getYTickFormat,
47317
+ tickValues: yTickValues,
47318
+ tickComponent: function tickComponent(_ref3) {
47319
+ var formattedValue = _ref3.formattedValue,
47320
+ tickProps = _objectWithoutPropertiesLoose(_ref3, _excluded2$4);
47321
+ return jsxRuntime.jsx(text$3.Text, _extends({
47322
+ width: 10,
47323
+ style: themeCSS.labels
47324
+ }, tickProps, {
47325
+ children: formattedValue
47326
+ }));
47327
+ },
47328
+ stroke: (_theme$axis$stroke = theme == null || (_theme$axis = theme.axis) == null ? void 0 : _theme$axis.stroke) != null ? _theme$axis$stroke : 'transparent'
47329
+ }), jsxRuntime.jsx(group.Group, {
47330
+ children: jsxRuntime.jsx(shape.BarGroup, {
47331
+ data: dataFlattened,
47332
+ keys: yScaleKeys,
47333
+ height: innerHeight,
47334
+ x0: getBarGroupPosition
47335
+ // @ts-ignore
47336
+ ,
47337
+ x0Scale: xScale
47338
+ // @ts-ignore
47339
+ ,
47340
+ x1Scale: innerXScale,
47341
+ yScale: yScale,
47342
+ color: function color() {
47343
+ return '';
47344
+ },
47345
+ children: function children(barGroups) {
47346
+ return barGroups.map(function (barGroup) {
47347
+ return jsxRuntime.jsx(group.Group, {
47348
+ left: barGroup.x0,
47349
+ children: barGroup.bars.map(function (bar) {
47350
+ return jsxRuntime.jsx(Bar$1, {
47351
+ bar: bar,
47352
+ barGroup: barGroup,
47353
+ yScale: yScale,
47354
+ formattedChartDataForBarChart: formattedChartDataForBarChart
47355
+ });
47356
+ })
47357
+ }, "bar-group-" + barGroup.index + "-" + barGroup.x0);
47358
+ });
47359
+ }
47360
+ })
47361
+ })]
47362
+ }), tooltipData && jsxRuntime.jsx("g", {
47363
+ children: jsxRuntime.jsx(shape.Line, {
47364
+ from: {
47365
+ x: tooltipLeft,
47366
+ y: margin.top
47367
+ },
47368
+ to: {
47369
+ x: tooltipLeft,
47370
+ y: innerHeight + margin.top
47371
+ },
47372
+ stroke: '#aaa',
47373
+ strokeWidth: 2,
47374
+ pointerEvents: "none",
47375
+ opacity: 0.8
47376
+ })
47377
+ })]
47378
+ }), jsxRuntime.jsx(Legend$2, {
47379
+ showLegend: options.showLegend,
47380
+ margin: margin
47381
+ }), jsxRuntime.jsx(Tooltip$2, {
47382
+ showTooltip: tooltipOpen,
47383
+ tooltipData: tooltipData,
47384
+ tooltipLeft: tooltipLeft,
47385
+ tooltipTop: tooltipTop,
47386
+ xKey: xKey,
47387
+ yKey: yKey,
47388
+ theme: themeCSS.popoverMenus
47389
+ })]
47390
+ });
47391
+ };
47392
+ var Bar$1 = function Bar(_ref4) {
47393
+ var bar = _ref4.bar,
47394
+ barGroup = _ref4.barGroup,
47395
+ yScale = _ref4.yScale,
47396
+ formattedChartDataForBarChart = _ref4.formattedChartDataForBarChart;
47397
+ var step = formattedChartDataForBarChart.steps[barGroup.index];
47398
+ var y = yScale(Math.max(step.start, step.end));
47399
+ var barHeight = Math.abs(yScale(step.start) - yScale(step.end));
47400
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {
47401
+ children: jsxRuntime.jsx("rect", {
47402
+ x: bar.x,
47403
+ y: y,
47404
+ width: bar.width,
47405
+ height: barHeight,
47406
+ fill: getBarFill$1(formattedChartDataForBarChart.bars, formattedChartDataForBarChart.conditionalFormattingRules, bar.key, bar.value),
47407
+ rx: 4
47408
+ }, "bar-group-bar-" + barGroup.index + "-" + bar.index + "-" + bar.value + "-" + bar.key)
47409
+ });
47410
+ };
47411
+
46811
47412
  function getNiceInterval$2(interval) {
46812
47413
  // Round the interval to a "nice" value (1, 2, 5, etc.)
46813
47414
  var exponent = Math.floor(Math.log10(interval));
@@ -47092,7 +47693,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
47092
47693
  overflowX: 'hidden'
47093
47694
  },
47094
47695
  children: function children(parent) {
47095
- return jsxRuntime.jsx(WaterfallChart$4.WaterfallChart, {
47696
+ return jsxRuntime.jsx(WaterfallChart$2, {
47096
47697
  width: parent.width,
47097
47698
  height: parent.height,
47098
47699
  options: {
@@ -47117,7 +47718,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
47117
47718
  };
47118
47719
  var WaterfallChartView$1 = /*#__PURE__*/React.memo(WaterfallChartView, shouldUpdate);
47119
47720
 
47120
- var WaterfallChart$2 = function WaterfallChart(_ref) {
47721
+ var WaterfallChart$3 = function WaterfallChart(_ref) {
47121
47722
  var component = _ref.component,
47122
47723
  dataSet = _ref.dataSet,
47123
47724
  dashboardBehaviour = _ref.dashboardBehaviour,
@@ -47614,7 +48215,7 @@ var Component = function Component(props) {
47614
48215
  });
47615
48216
  },
47616
48217
  onError: dashboardBehaviour.onError,
47617
- children: jsxRuntime.jsx(WaterfallChart$2, {
48218
+ children: jsxRuntime.jsx(WaterfallChart$3, {
47618
48219
  id: props.id,
47619
48220
  dataSet: dataSet,
47620
48221
  setLocalFilters: props.setLocalFilters,
@@ -63930,7 +64531,7 @@ var Progress$3 = /*#__PURE__*/function (_View13) {
63930
64531
  };
63931
64532
  return Progress;
63932
64533
  }(View$3);
63933
- var WaterfallChart$3 = /*#__PURE__*/function (_View15) {
64534
+ var WaterfallChart$4 = /*#__PURE__*/function (_View15) {
63934
64535
  function WaterfallChart(attributes) {
63935
64536
  return _View15.call(this, _extends({}, attributes, {
63936
64537
  type: 'waterfallChart'
@@ -65859,7 +66460,7 @@ VizzlyServices.HorizontalBarChart = HorizontalBarChart$2;
65859
66460
  VizzlyServices.MercatorMap = MercatorMap$4;
65860
66461
  VizzlyServices.SingleStat = SingleStat$3;
65861
66462
  VizzlyServices.Progress = Progress$3;
65862
- VizzlyServices.WaterfallChart = WaterfallChart$3;
66463
+ VizzlyServices.WaterfallChart = WaterfallChart$4;
65863
66464
  // @ts-ignore
65864
66465
  if (typeof window !== 'undefined' && !window.Vizzly) {
65865
66466
  // @ts-ignore
@@ -68685,7 +69286,7 @@ var GlobalProviderContents = function GlobalProviderContents(props) {
68685
69286
  });
68686
69287
  };
68687
69288
 
68688
- var _excluded$g = ["view"];
69289
+ var _excluded$h = ["view"];
68689
69290
  var Dashboard$2 = function Dashboard(props) {
68690
69291
  var handleOnError = function handleOnError(error, errorInfo) {
68691
69292
  return (props == null ? void 0 : props.onError) && (props == null ? void 0 : props.onError(error, errorInfo));
@@ -68706,7 +69307,7 @@ var Editor$1 = function Editor(props) {
68706
69307
  var handleOnError = function handleOnError(error, errorInfo) {
68707
69308
  return (props == null ? void 0 : props.onError) && (props == null ? void 0 : props.onError(error, errorInfo));
68708
69309
  };
68709
- var resetProps = _objectWithoutPropertiesLoose(props, _excluded$g);
69310
+ var resetProps = _objectWithoutPropertiesLoose(props, _excluded$h);
68710
69311
  return jsxRuntime.jsxs(ErrorBoundary, {
68711
69312
  renderOnError: function renderOnError() {
68712
69313
  return jsxRuntime.jsx("p", {