@vizzly/dashboard 0.14.4-dev-3455fe16fbb312a7c23a46cc2f4bcf62b52bb944 → 0.14.4-dev-452014891c726bda8e71210563e32bb225b30c86

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.
@@ -10018,7 +10018,9 @@ var attributesSchema$h = function attributesSchema(config) {
10018
10018
  parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
10019
10019
  axisTitles: axisTitleSchema(),
10020
10020
  headline: headlineSchema(),
10021
- tags: tagsSchema()
10021
+ tags: tagsSchema(),
10022
+ increaseColor: Joi.string().required(),
10023
+ decreaseColor: Joi.string().required()
10022
10024
  }));
10023
10025
  };
10024
10026
 
@@ -10182,6 +10184,11 @@ var CONSTANTS$j = {
10182
10184
  type: 'headline',
10183
10185
  title: 'Headline',
10184
10186
  description: ''
10187
+ },
10188
+ waterfall_colors: {
10189
+ type: 'waterfallColors',
10190
+ title: 'Color selector',
10191
+ description: ''
10185
10192
  }
10186
10193
  }
10187
10194
  };
@@ -10221,6 +10228,8 @@ var WaterfallChart = function WaterfallChart(config) {
10221
10228
  axisTitles: dumped.axisTitles,
10222
10229
  displaySubject: dumped.displaySubject,
10223
10230
  displayTitle: dumped.displayTitle,
10231
+ increaseColor: dumped.increaseColor,
10232
+ decreaseColor: dumped.decreaseColor,
10224
10233
  protectedByOrganisation: dumped.protectedByOrganisation,
10225
10234
  type: dumped.type,
10226
10235
  offset: dumped.offset
@@ -10255,6 +10264,8 @@ var WaterfallChart = function WaterfallChart(config) {
10255
10264
  parameters: {},
10256
10265
  axisTitles: undefined,
10257
10266
  headline: undefined,
10267
+ increaseColor: '#00FF00',
10268
+ decreaseColor: '#FF0000',
10258
10269
  tags: [],
10259
10270
  approxXAxisLabelCount: 'auto',
10260
10271
  approxYAxisLabelCount: 'auto'
@@ -10309,7 +10320,7 @@ var WaterfallChart = function WaterfallChart(config) {
10309
10320
  }), namespace(CONSTANTS$j, 'sort'), namespace(CONSTANTS$j, 'filter'), namespace(CONSTANTS$j, 'custom_metrics'), namespace(CONSTANTS$j, 'limit')];
10310
10321
  },
10311
10322
  formatPanelConfig: function formatPanelConfig() {
10312
- return [headingConstant(CONSTANTS$j), chartStylesConstant(CONSTANTS$j, false, false), axisLabelsConstants(CONSTANTS$j)];
10323
+ return [headingConstant(CONSTANTS$j), namespace(CONSTANTS$j, 'waterfall_colors'), chartStylesConstant(CONSTANTS$j, false, false), axisLabelsConstants(CONSTANTS$j)];
10313
10324
  },
10314
10325
  supportedCustomFields: {
10315
10326
  percentages: true,
@@ -49101,30 +49112,6 @@ var BarChartV2 = function BarChartV2(props) {
49101
49112
  });
49102
49113
  };
49103
49114
 
49104
- function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
49105
- var _bars$find;
49106
- // Default fill color from the corresponding bar
49107
- var fill = (_bars$find = bars.find(function (chartBar) {
49108
- return chartBar.yKey === barKey;
49109
- })) == null ? void 0 : _bars$find.color;
49110
-
49111
- // Determine the value based on barValues type
49112
- var value = typeof barValues === 'number' ? barValues : barValues == null ? void 0 : barValues[barKey];
49113
- if (typeof value === 'number') {
49114
- for (var _iterator = _createForOfIteratorHelperLoose(conditionalFormattingRules), _step; !(_step = _iterator()).done;) {
49115
- var rule = _step.value;
49116
- if (compare({
49117
- op: rule.operator,
49118
- value: rule.value
49119
- }, value)) {
49120
- fill = rule.color;
49121
- break;
49122
- }
49123
- }
49124
- }
49125
- return fill;
49126
- }
49127
-
49128
49115
  var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
49129
49116
  function calculateWordWidth$1(word, avgCharWidth) {
49130
49117
  if (avgCharWidth === void 0) {
@@ -49306,15 +49293,17 @@ var IconTrendingDown$1 = function IconTrendingDown() {
49306
49293
 
49307
49294
  var Legend$2 = function Legend(_ref) {
49308
49295
  var showLegend = _ref.showLegend,
49309
- margin = _ref.margin;
49296
+ margin = _ref.margin,
49297
+ increaseColor = _ref.increaseColor,
49298
+ decreaseColor = _ref.decreaseColor;
49310
49299
  var items = [{
49311
- color: 'green',
49300
+ color: increaseColor,
49312
49301
  yKey: 'increase',
49313
49302
  style: {
49314
49303
  type: 'bar'
49315
49304
  }
49316
49305
  }, {
49317
- color: 'red',
49306
+ color: decreaseColor,
49318
49307
  yKey: 'decrease',
49319
49308
  style: {
49320
49309
  type: 'bar'
@@ -49358,7 +49347,9 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
49358
49347
  options = _ref.options,
49359
49348
  chart = _ref.chart,
49360
49349
  steps = _ref.steps,
49361
- theme = _ref.theme;
49350
+ theme = _ref.theme,
49351
+ increaseColor = _ref.increaseColor,
49352
+ decreaseColor = _ref.decreaseColor;
49362
49353
  //Waterfall TODO: fix chart for other x types
49363
49354
  if (chart.x.scale.dataType === 'date_time' || chart.x.scale.dataType === 'number') {
49364
49355
  return null;
@@ -49607,6 +49598,8 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
49607
49598
  left: barGroup.x0,
49608
49599
  children: barGroup.bars.map(function (bar) {
49609
49600
  return jsxRuntime.jsx(Bar$1, {
49601
+ increaseColor: increaseColor,
49602
+ decreaseColor: decreaseColor,
49610
49603
  bar: bar,
49611
49604
  barGroup: barGroup,
49612
49605
  yScale: yScale,
@@ -49627,7 +49620,9 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
49627
49620
  })]
49628
49621
  }), jsxRuntime.jsx(Legend$2, {
49629
49622
  showLegend: options.showLegend,
49630
- margin: margin
49623
+ margin: margin,
49624
+ increaseColor: increaseColor,
49625
+ decreaseColor: decreaseColor
49631
49626
  }), jsxRuntime.jsx(Tooltip$2, {
49632
49627
  showTooltip: tooltipOpen,
49633
49628
  tooltipData: tooltipData,
@@ -49643,7 +49638,9 @@ var Bar$1 = function Bar(_ref4) {
49643
49638
  var bar = _ref4.bar,
49644
49639
  barGroup = _ref4.barGroup,
49645
49640
  yScale = _ref4.yScale,
49646
- formattedChartDataForBarChart = _ref4.formattedChartDataForBarChart;
49641
+ formattedChartDataForBarChart = _ref4.formattedChartDataForBarChart,
49642
+ increaseColor = _ref4.increaseColor,
49643
+ decreaseColor = _ref4.decreaseColor;
49647
49644
  var step = formattedChartDataForBarChart.steps[barGroup.index];
49648
49645
  var y = yScale(Math.max(step.start, step.end));
49649
49646
  var barHeight = Math.abs(yScale(step.start) - yScale(step.end));
@@ -49653,7 +49650,7 @@ var Bar$1 = function Bar(_ref4) {
49653
49650
  y: y,
49654
49651
  width: bar.width,
49655
49652
  height: barHeight,
49656
- fill: getBarFill$1(formattedChartDataForBarChart.bars, formattedChartDataForBarChart.conditionalFormattingRules, bar.key, bar.value),
49653
+ fill: bar.value > 0 ? increaseColor : decreaseColor,
49657
49654
  rx: 4
49658
49655
  }, "bar-group-bar-" + barGroup.index + "-" + bar.index + "-" + bar.value + "-" + bar.key)
49659
49656
  });
@@ -49929,7 +49926,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
49929
49926
  xAxisPrefix = props.xAxisPrefix,
49930
49927
  yAxisFormat = props.yAxisFormat,
49931
49928
  yAxisPostfix = props.yAxisPostfix,
49932
- yAxisPrefix = props.yAxisPrefix;
49929
+ yAxisPrefix = props.yAxisPrefix,
49930
+ increaseColor = props.increaseColor,
49931
+ decreaseColor = props.decreaseColor;
49933
49932
  var _useDashboardBehaviou = useDashboardBehaviourContext(),
49934
49933
  textOverride = _useDashboardBehaviou.textOverride,
49935
49934
  valueAlias = _useDashboardBehaviou.valueAlias,
@@ -50023,7 +50022,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
50023
50022
  },
50024
50023
  theme: theme == null ? void 0 : theme.charts,
50025
50024
  chart: chartRepresentation,
50026
- steps: steps
50025
+ steps: steps,
50026
+ increaseColor: increaseColor,
50027
+ decreaseColor: decreaseColor
50027
50028
  });
50028
50029
  }
50029
50030
  })
@@ -60519,6 +60520,47 @@ var RichTextFormatSection = function RichTextFormatSection(props) {
60519
60520
  });
60520
60521
  };
60521
60522
 
60523
+ var WaterfallColorsSection = function WaterfallColorsSection(props) {
60524
+ var _props$section;
60525
+ var _useDashboardBehaviou = useDashboardBehaviourContext(),
60526
+ textOverride = _useDashboardBehaviou.textOverride;
60527
+ if (props.attributes.type != 'waterfallChart') return null;
60528
+ var _props$attributes = props.attributes,
60529
+ increaseColor = _props$attributes.increaseColor,
60530
+ decreaseColor = _props$attributes.decreaseColor;
60531
+ var debouncedSetAttributes = _.debounce(props.setAttributes, 200);
60532
+ return jsxRuntime.jsx(Section, {
60533
+ title: props == null ? void 0 : props.section.title,
60534
+ tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
60535
+ children: jsxRuntime.jsxs(Section.Grid, {
60536
+ columns: 2,
60537
+ children: [jsxRuntime.jsx("div", {
60538
+ children: jsxRuntime.jsx(ColorInput, {
60539
+ id: 'waterfall-increase-color',
60540
+ label: textOverride('increase_color', 'Positive value'),
60541
+ currentValue: increaseColor,
60542
+ setColor: function setColor(increaseColor) {
60543
+ return debouncedSetAttributes({
60544
+ increaseColor: increaseColor
60545
+ });
60546
+ }
60547
+ })
60548
+ }), jsxRuntime.jsx("div", {
60549
+ children: jsxRuntime.jsx(ColorInput, {
60550
+ id: 'waterfall-decrease-color',
60551
+ label: textOverride('decrease_color', 'Negative value'),
60552
+ currentValue: decreaseColor,
60553
+ setColor: function setColor(decreaseColor) {
60554
+ return debouncedSetAttributes({
60555
+ decreaseColor: decreaseColor
60556
+ });
60557
+ }
60558
+ })
60559
+ })]
60560
+ })
60561
+ });
60562
+ };
60563
+
60522
60564
  var FormatPanelFromConfig = function FormatPanelFromConfig(props) {
60523
60565
  return jsxRuntime.jsx(EditorGrid, {
60524
60566
  children: props == null ? void 0 : props.formatPanelConfig.map(function (section, i) {
@@ -60549,6 +60591,8 @@ var FormatPanelFromConfig = function FormatPanelFromConfig(props) {
60549
60591
  section: section
60550
60592
  })), section.type === 'mapColors' && jsxRuntime.jsx(MapColorsSection, _extends({}, props, {
60551
60593
  section: section
60594
+ })), section.type === 'waterfallColors' && jsxRuntime.jsx(WaterfallColorsSection, _extends({}, props, {
60595
+ section: section
60552
60596
  })), section.type === 'conditionalFormatting' && jsxRuntime.jsx(ConditionalFormattingSection, _extends({}, props, {
60553
60597
  section: section
60554
60598
  })), section.type === 'goalLine' && jsxRuntime.jsx(GoalLineSection, _extends({}, props, {