@vizzly/dashboard 0.14.4-dev-8beb4cd0b38350abdd05b93b66f2523ced40aa15 → 0.14.4-dev-f96aec9acd048ca40becf3a412567d3799b85700

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.
Files changed (56) hide show
  1. package/dist/charts/src/v2/components/WaterfallChart/WaterfallChart.d.ts +3 -2
  2. package/dist/charts/src/v2/index.d.ts +1 -0
  3. package/dist/dashboard/src/contexts/GlobalProvider/useGlobalProvider.d.ts +6 -6
  4. package/dist/dashboard.cjs.development.js +1194 -580
  5. package/dist/dashboard.cjs.production.min.js +1 -1
  6. package/dist/dashboard.esm.js +1194 -580
  7. package/dist/results-driver/src/driver/VizzlyQuery/AreaChart/toQueries.d.ts +1 -1
  8. package/dist/results-driver/src/driver/VizzlyQuery/BarChart/toQueries.d.ts +1 -1
  9. package/dist/results-driver/src/driver/VizzlyQuery/BarChartV2/toQueries.d.ts +1 -1
  10. package/dist/results-driver/src/driver/VizzlyQuery/BarChartV2 copy/toQueries.d.ts +4 -0
  11. package/dist/results-driver/src/driver/VizzlyQuery/BasicTable/toQueries.d.ts +1 -1
  12. package/dist/results-driver/src/driver/VizzlyQuery/FunnelChart/toQueries.d.ts +1 -1
  13. package/dist/results-driver/src/driver/VizzlyQuery/HorizontalBarChart/toQueries.d.ts +1 -1
  14. package/dist/results-driver/src/driver/VizzlyQuery/LineChart/toQueries.d.ts +1 -1
  15. package/dist/results-driver/src/driver/VizzlyQuery/LineChartV2/toQueries.d.ts +1 -1
  16. package/dist/results-driver/src/driver/VizzlyQuery/PieChart/toQueries.d.ts +1 -1
  17. package/dist/results-driver/src/driver/VizzlyQuery/PivotTable/toQueries.d.ts +1 -1
  18. package/dist/results-driver/src/driver/VizzlyQuery/RichText/toQueries.d.ts +1 -1
  19. package/dist/results-driver/src/driver/VizzlyQuery/WaterfallChart/toQueries.d.ts +1 -1
  20. package/dist/results-driver/src/driver/VizzlyQuery/commonToQueries.d.ts +1 -1
  21. package/dist/shared-logic/src/AreaChartV2/attributesSchema.d.ts +3 -0
  22. package/dist/shared-logic/src/AreaChartV2/buildAreaChartRepresentation.d.ts +40 -0
  23. package/dist/shared-logic/src/AreaChartV2/constants.d.ts +3 -0
  24. package/dist/shared-logic/src/AreaChartV2/index.d.ts +4 -0
  25. package/dist/shared-logic/src/AreaChartV2/setAttributes.d.ts +4 -0
  26. package/dist/shared-logic/src/AreaChartV2/types.d.ts +1 -1
  27. package/dist/shared-logic/src/ChartsV2/adjustTicks.d.ts +3 -0
  28. package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/buildTrendAndForecast.d.ts +1 -1
  29. package/dist/shared-logic/src/ChartsV2/formattingFunctionAxis.d.ts +2 -0
  30. package/dist/shared-logic/src/{BarChartV2/getMinAndMax.d.ts → ChartsV2/getStackedMinAndMax.d.ts} +1 -1
  31. package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/getTrendsAndForecastsData.d.ts +1 -1
  32. package/dist/shared-logic/src/ChartsV2/types.d.ts +4 -3
  33. package/dist/shared-logic/src/Component/setAttributes.d.ts +1 -1
  34. package/dist/shared-logic/src/Component/sharedSchemas.d.ts +1 -0
  35. package/dist/shared-logic/src/Component/types.d.ts +26 -4
  36. package/dist/shared-logic/src/DataSet/DataSet.d.ts +1 -1
  37. package/dist/shared-logic/src/WaterfallChart/buildWaterfallChartRepresentation.d.ts +7 -2
  38. package/dist/shared-logic/src/WaterfallChart/getRepresentationData.d.ts +19 -0
  39. package/dist/shared-logic/src/WaterfallChart/getYTicks.d.ts +8 -0
  40. package/dist/shared-logic/src/WaterfallChart/types.d.ts +5 -15
  41. package/dist/shared-logic/src/getComponentInterface.d.ts +1 -0
  42. package/dist/shared-ui/src/api/useQueryEffect.d.ts +1 -1
  43. package/dist/shared-ui/src/components/AreaChartV2/AreaChartV2.d.ts +3 -0
  44. package/dist/shared-ui/src/components/AreaChartV2/AreaChartV2View.d.ts +17 -0
  45. package/dist/shared-ui/src/components/AreaChartV2/index.d.ts +2 -0
  46. package/dist/shared-ui/src/components/Component/types.d.ts +1 -0
  47. package/dist/shared-ui/src/components/HeadlineStats/HeadlineStats.d.ts +2 -2
  48. package/dist/shared-ui/src/components/LineChart/LineChartView.d.ts +1 -1
  49. package/dist/shared-ui/src/components/MercatorMap/View.d.ts +1 -1
  50. package/package.json +1 -1
  51. package/dist/shared-logic/src/BarChartV2/adjustTicks.d.ts +0 -3
  52. package/dist/shared-logic/src/LineChartV2/adjustTicks.d.ts +0 -3
  53. /package/dist/shared-logic/src/{BarChartV2 → ChartsV2}/fillMissingKeysForChartData.d.ts +0 -0
  54. /package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/getMinAndMax.d.ts +0 -0
  55. /package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/getScaleAndTicks.d.ts +0 -0
  56. /package/dist/shared-logic/src/{BarChartV2/getScaleAndTicks.d.ts → ChartsV2/getStackedScaleAndTicks.d.ts} +0 -0
@@ -64,6 +64,7 @@ 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 v2 = require('./charts/src/v2');
67
68
  var VisibilitySensor = _interopDefault(require('react-visibility-sensor'));
68
69
  var ExcelJS = _interopDefault(require('exceljs'));
69
70
  var fileSaver = require('file-saver');
@@ -2731,6 +2732,7 @@ var timeDimensionQuerySchema = function timeDimensionQuerySchema(queryEngineConf
2731
2732
  });
2732
2733
  };
2733
2734
  var lineCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step', 'stepBefore', 'stepAfter', 'dotted');
2735
+ var areaCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step');
2734
2736
  var protectedFieldsMeasure = function protectedFieldsMeasure(queryEngineConfig) {
2735
2737
  var _Joi$string6;
2736
2738
  return Joi.array().items(Joi.object({
@@ -8171,7 +8173,7 @@ var RichText = function RichText(config) {
8171
8173
  };
8172
8174
  };
8173
8175
 
8174
- var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
8176
+ var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'areaChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
8175
8177
  /** @deprecated */
8176
8178
 
8177
8179
  var ProgressType = /*#__PURE__*/function (ProgressType) {
@@ -8968,7 +8970,6 @@ var attributesSchema$e = function attributesSchema(config) {
8968
8970
  var setAttributes$d = (function (config) {
8969
8971
  return function (bubbleChart, partial) {
8970
8972
  var newAttributes = setAttributes(bubbleChart, partial, attributesSchema$e(config));
8971
- console.log(newAttributes, 'HERE');
8972
8973
  var allowedOrderSpec = [];
8973
8974
  if (newAttributes.xMeasure) {
8974
8975
  allowedOrderSpec.push(newAttributes.xMeasure);
@@ -10019,6 +10020,379 @@ var WaterfallChart = function WaterfallChart(config) {
10019
10020
  };
10020
10021
  };
10021
10022
 
10023
+ var attributesSchema$h = function attributesSchema(config) {
10024
+ return Joi.object(_extends({}, baseAttributesSchema(config.attributesSchemaOptions), timeDimensionQuerySchema(config.queryEngineConfig, config.attributesSchemaOptions), {
10025
+ stacked: Joi.valid(true, false),
10026
+ legend: Joi.valid(true, false),
10027
+ type: Joi.valid('areaChartV2').required(),
10028
+ parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
10029
+ lineCurve: areaCurveSchema,
10030
+ conditionalFormattingRules: conditionalFormattingRulesSchema(config.queryEngineConfig),
10031
+ goalLines: goalLinesSchema(),
10032
+ axisTitles: axisTitleSchema(),
10033
+ headline: headlineSchema(),
10034
+ tags: tagsSchema(),
10035
+ trends: trendsSchema()
10036
+ }));
10037
+ };
10038
+
10039
+ var setAttributes$g = (function (config) {
10040
+ return function (lineChart, partial) {
10041
+ var newAttributes = setAttributes(lineChart, partial, attributesSchema$h(config));
10042
+ newAttributes = removeUnusedOrderFieldsFromTimeSeriesComponent(newAttributes);
10043
+ return newAttributes;
10044
+ };
10045
+ });
10046
+
10047
+ var CONSTANTS$j = {
10048
+ title: 'Area chart',
10049
+ description: 'Ideal for illustrating changes and trends over time with area graphs.',
10050
+ namespace: 'area_chart',
10051
+ data_panel: {
10052
+ data_set: {
10053
+ type: 'dataSet',
10054
+ title: 'Data set',
10055
+ description: 'What data do you want to use in this area chart?'
10056
+ },
10057
+ views: {
10058
+ type: 'views',
10059
+ title: 'View',
10060
+ description: ''
10061
+ },
10062
+ field_y_axis: {
10063
+ type: 'fieldCollector',
10064
+ title: 'Metric - Y Axis',
10065
+ description: 'What do you want each area to measure?',
10066
+ callToAction: 'Add metric'
10067
+ },
10068
+ drilldown: {
10069
+ type: 'drilldown',
10070
+ title: 'Drilldown',
10071
+ description: 'After clicking on a segment of this area chart, what information do you want to see next?'
10072
+ },
10073
+ field_x_axis: {
10074
+ type: 'fieldCollector',
10075
+ title: 'Grouping - X Axis',
10076
+ description: 'What do you want each area to represent? An example might be a `product category` field to represent each category as a area.',
10077
+ callToAction: 'Add grouping'
10078
+ },
10079
+ sort: {
10080
+ type: 'sort',
10081
+ title: 'Sort',
10082
+ description: 'Select the order of categories or time on the x Axis.'
10083
+ },
10084
+ filter: {
10085
+ type: 'filter',
10086
+ title: 'Filters',
10087
+ description: 'Only include the information you want to use in this area chart.'
10088
+ },
10089
+ custom_metrics: {
10090
+ type: 'customMetrics',
10091
+ title: 'Custom metrics',
10092
+ description: 'Build your own metrics, such as a percentage.'
10093
+ },
10094
+ limit: {
10095
+ type: 'limit',
10096
+ title: 'Limit',
10097
+ description: 'Set the maximum number of records to show on this area chart.'
10098
+ }
10099
+ },
10100
+ format_panel: {
10101
+ heading: {
10102
+ type: 'heading',
10103
+ title: 'Heading',
10104
+ description: '',
10105
+ subSectionDefinition: {
10106
+ title: {
10107
+ type: 'title',
10108
+ title: 'Title',
10109
+ description: '',
10110
+ namespace: 'title'
10111
+ },
10112
+ subject: {
10113
+ title: 'Subject',
10114
+ type: 'subject',
10115
+ description: '',
10116
+ namespace: 'subject'
10117
+ }
10118
+ }
10119
+ },
10120
+ chart_styles: {
10121
+ type: 'chartStyles',
10122
+ title: 'Chart Settings',
10123
+ description: '',
10124
+ subSectionDefinition: {
10125
+ stacked: {
10126
+ type: 'stacked',
10127
+ title: 'Layout',
10128
+ description: '',
10129
+ namespace: 'stacked'
10130
+ },
10131
+ curve: {
10132
+ type: 'curve',
10133
+ title: 'Area Style',
10134
+ description: '',
10135
+ namespace: 'curve'
10136
+ },
10137
+ legend: {
10138
+ type: 'legend',
10139
+ title: 'Show Legend',
10140
+ description: '',
10141
+ namespace: 'legend'
10142
+ }
10143
+ }
10144
+ },
10145
+ axis_labels: {
10146
+ type: 'axisLabels',
10147
+ title: 'Axis Preferences',
10148
+ description: '',
10149
+ subSectionDefinition: {
10150
+ x: {
10151
+ title: 'X Axis',
10152
+ description: '',
10153
+ namespace: 'x'
10154
+ },
10155
+ 'x.prefix': {
10156
+ title: 'Prefix',
10157
+ description: '',
10158
+ namespace: 'x.prefix'
10159
+ },
10160
+ 'x.postfix': {
10161
+ title: 'Postfix',
10162
+ description: '',
10163
+ namespace: 'x.postfix'
10164
+ },
10165
+ 'x.format': {
10166
+ title: 'Format',
10167
+ description: '',
10168
+ namespace: 'x.format'
10169
+ },
10170
+ 'x.count': {
10171
+ title: 'Label count',
10172
+ description: '',
10173
+ namespace: 'x.count'
10174
+ },
10175
+ 'x.axis_title': {
10176
+ title: 'Title',
10177
+ description: '',
10178
+ namespace: 'x.axis_title'
10179
+ },
10180
+ y: {
10181
+ title: 'Y Axis',
10182
+ description: '',
10183
+ namespace: 'y'
10184
+ },
10185
+ 'y.prefix': {
10186
+ title: 'Prefix',
10187
+ description: '',
10188
+ namespace: 'y.prefix'
10189
+ },
10190
+ 'y.postfix': {
10191
+ title: 'Postfix',
10192
+ description: '',
10193
+ namespace: 'y.postfix'
10194
+ },
10195
+ 'y.format': {
10196
+ title: 'Format',
10197
+ description: '',
10198
+ namespace: 'y.format'
10199
+ },
10200
+ 'y.count': {
10201
+ title: 'Label count',
10202
+ description: '',
10203
+ namespace: 'y.count'
10204
+ },
10205
+ 'y.axis_title': {
10206
+ title: 'Title',
10207
+ description: '',
10208
+ namespace: 'y.axis_title'
10209
+ }
10210
+ }
10211
+ },
10212
+ conditional_formatting: {
10213
+ type: 'conditionalFormatting',
10214
+ title: 'Conditional Formatting',
10215
+ description: ''
10216
+ },
10217
+ headline: {
10218
+ type: 'headline',
10219
+ title: 'Headarea',
10220
+ description: ''
10221
+ },
10222
+ trends: {
10223
+ type: 'trends',
10224
+ title: 'Trend lines',
10225
+ description: 'Specify a trend type for the area chart.'
10226
+ },
10227
+ goal_line: {
10228
+ type: 'goalLine',
10229
+ title: 'Goal lines',
10230
+ description: ''
10231
+ }
10232
+ }
10233
+ };
10234
+
10235
+ var AreaChart$1 = function AreaChart(config) {
10236
+ return {
10237
+ title: 'Area chart V2',
10238
+ description: 'Ideal for illustrating changes and trends over time with area graphs.',
10239
+ servicesClass: 'AreaChart',
10240
+ namespace: 'area_chart',
10241
+ dump: function dump(hydrated) {
10242
+ return hydrated;
10243
+ },
10244
+ load: function load(dumped) {
10245
+ var _dumped$tags, _dumped$trends;
10246
+ return {
10247
+ type: dumped.type,
10248
+ measure: upcastMeasure(dumped.measure),
10249
+ order: upcastOrder(dumped.order, dumped.timeDimension),
10250
+ dimension: upcastStringDimensionsToObject(dumped.dimension),
10251
+ // TODO: upcast dumped.timeDimension -> dimension
10252
+ displayTitle: dumped.displayTitle,
10253
+ displaySubject: dumped.displaySubject,
10254
+ protectedByOrganisation: dumped.protectedByOrganisation,
10255
+ viewId: upcastViewId(dumped.viewId),
10256
+ filter: upcastFilter(dumped.filter),
10257
+ dataSetId: dumped.dataSetId,
10258
+ limit: dumped.limit,
10259
+ timeDimension: null,
10260
+ xAxisPostfix: dumped.xAxisPostfix,
10261
+ xAxisPrefix: dumped.xAxisPrefix,
10262
+ yAxisPostfix: dumped.yAxisPostfix,
10263
+ yAxisPrefix: dumped.yAxisPrefix,
10264
+ yAxisFormat: dumped.yAxisFormat,
10265
+ xAxisFormat: dumped.xAxisFormat,
10266
+ lineCurve: dumped.lineCurve,
10267
+ conditionalFormattingRules: upcast$1(config.queryEngineConfig, dumped.conditionalFormattingRules),
10268
+ drilldown: dumped.drilldown,
10269
+ legend: dumped.legend,
10270
+ goalLines: dumped.goalLines,
10271
+ headline: upcastHeadline(dumped.headline, dumped.timeDimension),
10272
+ parameters: upcastParameters(dumped.parameters),
10273
+ approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
10274
+ approxYAxisLabelCount: upcastAxisLabel(dumped.approxYAxisLabelCount),
10275
+ axisTitles: dumped.axisTitles,
10276
+ tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
10277
+ trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
10278
+ stacked: dumped.stacked
10279
+ };
10280
+ },
10281
+ setAttributes: setAttributes$g(config),
10282
+ validate: function validate(attrs, dataSets) {
10283
+ return validateView(attrs, dataSets, config.queryEngineConfig);
10284
+ },
10285
+ init: function init(dataSetId, overrides) {
10286
+ return _extends({
10287
+ type: 'areaChartV2',
10288
+ measure: [],
10289
+ dimension: [],
10290
+ timeDimension: null,
10291
+ displayTitle: '',
10292
+ displaySubject: '',
10293
+ protectedByOrganisation: undefined,
10294
+ viewId: upcastViewId(overrides == null ? void 0 : overrides.viewId),
10295
+ filter: [],
10296
+ order: [],
10297
+ dataSetId: dataSetId,
10298
+ limit: 5000,
10299
+ xAxisPostfix: '',
10300
+ xAxisPrefix: '',
10301
+ yAxisPostfix: '',
10302
+ yAxisPrefix: '',
10303
+ yAxisFormat: null,
10304
+ xAxisFormat: null,
10305
+ lineCurve: 'natural',
10306
+ conditionalFormattingRules: [],
10307
+ drilldown: [],
10308
+ legend: true,
10309
+ goalLines: undefined,
10310
+ approxXAxisLabelCount: 'auto',
10311
+ approxYAxisLabelCount: 'auto',
10312
+ parameters: {},
10313
+ axisTitles: undefined,
10314
+ headline: undefined,
10315
+ tags: [],
10316
+ trends: [],
10317
+ stacked: false
10318
+ }, overrides);
10319
+ },
10320
+ createFeedback: createFeedback,
10321
+ schema: attributesSchema$h(config),
10322
+ removeField: function removeField(attrs, fieldId) {
10323
+ return removeField$1(attrs, fieldId, config.queryEngineConfig);
10324
+ },
10325
+ isRunnable: function isRunnable(hydrated) {
10326
+ return hydrated.measure.length > 0 && hydrated.dimension.length > 0;
10327
+ },
10328
+ autoGenerate: function autoGenerate(dataSet) {
10329
+ var _DataSet$buildQueryAt = buildQueryAttributes(dataSet, config.queryEngineConfig, 'lineChart'),
10330
+ measure = _DataSet$buildQueryAt.measure,
10331
+ dimension = _DataSet$buildQueryAt.dimension;
10332
+ return this.init(dataSet.id, {
10333
+ measure: [measure[0]],
10334
+ dimension: dimension
10335
+ });
10336
+ },
10337
+ dataPanelConfig: function dataPanelConfig() {
10338
+ return [namespace(CONSTANTS$j, 'data_set'), namespace(CONSTANTS$j, 'views'), _extends({}, namespace(CONSTANTS$j, 'field_y_axis'), {
10339
+ fieldFilterOptions: {
10340
+ forComponent: 'lineChart'
10341
+ },
10342
+ preSetPartialAttributes: function preSetPartialAttributes(values) {
10343
+ return {
10344
+ measure: values
10345
+ };
10346
+ },
10347
+ getValues: function getValues(attrs) {
10348
+ return attrs.measure;
10349
+ },
10350
+ testId: 'metric-input'
10351
+ }), _extends({}, namespace(CONSTANTS$j, 'field_x_axis'), {
10352
+ fieldFilterOptions: {
10353
+ forComponent: 'lineChart',
10354
+ onlyDimensions: true
10355
+ },
10356
+ preventDuplicates: false,
10357
+ // return all values in the dimension array instead of seperating out timeDimension
10358
+ preSetPartialAttributes: function preSetPartialAttributes(values) {
10359
+ return {
10360
+ dimension: [].concat(values)
10361
+ };
10362
+ },
10363
+ // does this need to be updated too?
10364
+ getValues: function getValues(attrs) {
10365
+ return [].concat(attrs.dimension);
10366
+ },
10367
+ maxAllowed: 2,
10368
+ testId: 'add-dimension'
10369
+ }), namespace(CONSTANTS$j, 'sort'), namespace(CONSTANTS$j, 'filter'), namespace(CONSTANTS$j, 'custom_metrics'), namespace(CONSTANTS$j, 'limit')];
10370
+ },
10371
+ formatPanelConfig: function formatPanelConfig() {
10372
+ return [headingConstant(CONSTANTS$j), chartStylesConstant(CONSTANTS$j, true, false), axisLabelsConstants(CONSTANTS$j), _extends({}, namespace(CONSTANTS$j, 'conditional_formatting'), {
10373
+ ruleType: 'lineColor'
10374
+ }), namespace(CONSTANTS$j, 'goal_line')];
10375
+ },
10376
+ supportedCustomFields: {
10377
+ calculatedField: false,
10378
+ percentages: true,
10379
+ dateCalculations: true,
10380
+ simpleMaths: true,
10381
+ rules: true,
10382
+ aggregateMaths: true,
10383
+ roundedNumbers: true,
10384
+ conditional: true
10385
+ },
10386
+ supportedFeatures: {
10387
+ parameters: true,
10388
+ colorGradient: false
10389
+ },
10390
+ setDataAttributesFromPreAggregatedDataSet: function setDataAttributesFromPreAggregatedDataSet$1(attributes, dataSet) {
10391
+ return setDataAttributesFromPreAggregatedDataSet(attributes, dataSet, this.setAttributes);
10392
+ }
10393
+ };
10394
+ };
10395
+
10022
10396
  var EMPTY_CONFIG = {
10023
10397
  queryEngineConfig: {
10024
10398
  supportedFeatures: [],
@@ -10045,6 +10419,7 @@ function getComponentInterface(type, config) {
10045
10419
  if (type == 'lineChart') return textOverrideComponent(LineChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
10046
10420
  if (type == 'lineChartV2') return textOverrideComponent(LineChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
10047
10421
  if (type == 'barChartV2') return textOverrideComponent(BarChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
10422
+ if (type == 'areaChartV2') return textOverrideComponent(AreaChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
10048
10423
  if (type == 'mercatorMap') return textOverrideComponent(MercatorMap(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
10049
10424
  if (type == 'pieChart') return textOverrideComponent(PieChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
10050
10425
  if (type == 'progress') return textOverrideComponent(Progress(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
@@ -13197,7 +13572,7 @@ var buildDefaults = function buildDefaults(partialFeatureToggles) {
13197
13572
  };
13198
13573
  };
13199
13574
 
13200
- var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
13575
+ var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'areaChartV2', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
13201
13576
  var ALL_VIZZLY_COMPONENT_TYPES = /*#__PURE__*/[].concat(ALL_COMPONENT_TYPES).filter(function (type) {
13202
13577
  return type != 'custom';
13203
13578
  });
@@ -13537,7 +13912,7 @@ var saveable = function saveable(component, protectedComponent) {
13537
13912
  };
13538
13913
  };
13539
13914
 
13540
- var attributesSchema$h = function attributesSchema(config) {
13915
+ var attributesSchema$i = function attributesSchema(config) {
13541
13916
  return Joi.alternatives().conditional('.type', {
13542
13917
  is: 'barChart',
13543
13918
  then: BarChart(config).schema
@@ -13559,6 +13934,9 @@ var attributesSchema$h = function attributesSchema(config) {
13559
13934
  }).conditional('.type', {
13560
13935
  is: 'barChartV2',
13561
13936
  then: BarChart$1(config).schema
13937
+ }).conditional('.type', {
13938
+ is: 'areaChartV2',
13939
+ then: AreaChart$1(config).schema
13562
13940
  }).conditional('.type', {
13563
13941
  is: 'comboChart',
13564
13942
  then: ComboChart(config).schema
@@ -20904,7 +21282,7 @@ var Combobox = function Combobox(props) {
20904
21282
  });
20905
21283
  };
20906
21284
 
20907
- var attributesSchema$i = /*#__PURE__*/Joi.object({
21285
+ var attributesSchema$j = /*#__PURE__*/Joi.object({
20908
21286
  displayTitle: /*#__PURE__*/Joi.string().min(1).required(),
20909
21287
  colSpan: /*#__PURE__*/Joi.number().valid(12).required()
20910
21288
  });
@@ -20921,7 +21299,7 @@ var isEmptyCell = /*#__PURE__*/Joi.object({
20921
21299
  });
20922
21300
  var isPopulatedCell = function isPopulatedCell(queryEngineConfig) {
20923
21301
  return Joi.object({
20924
- attributes: attributesSchema$h({
21302
+ attributes: attributesSchema$i({
20925
21303
  queryEngineConfig: queryEngineConfig
20926
21304
  }),
20927
21305
  colSpan: colSpanSchema
@@ -20932,7 +21310,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
20932
21310
  id: Joi.string(),
20933
21311
  display: displaySchema(queryEngineConfig),
20934
21312
  componentLibrary: Joi.array().required().items(Joi.object({
20935
- attributes: attributesSchema$h({
21313
+ attributes: attributesSchema$i({
20936
21314
  queryEngineConfig: queryEngineConfig
20937
21315
  })
20938
21316
  })),
@@ -20943,7 +21321,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
20943
21321
  function displaySchema(queryEngineConfig) {
20944
21322
  return Joi.array().required().items(Joi.object({
20945
21323
  height: Joi.number().required(),
20946
- components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$i))
21324
+ components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$j))
20947
21325
  }));
20948
21326
  }
20949
21327
 
@@ -21665,7 +22043,7 @@ var setHeaderComponent = function setHeaderComponent(state, action) {
21665
22043
  newDisplayState.dashboard.display[rowIndex].components[cellIndex] = component;
21666
22044
  return newDisplayState;
21667
22045
  };
21668
- var setAttributes$g = function setAttributes(state, action) {
22046
+ var setAttributes$h = function setAttributes(state, action) {
21669
22047
  var attributes = action.attributes,
21670
22048
  rowIndex = action.rowIndex,
21671
22049
  cellIndex = action.cellIndex;
@@ -21950,7 +22328,7 @@ var reducer = function reducer(pipelineTransformationOptions) {
21950
22328
  case 'swapComponents':
21951
22329
  return swapComponents$1(state, action);
21952
22330
  case 'setAttributes':
21953
- return setAttributes$g(state, action);
22331
+ return setAttributes$h(state, action);
21954
22332
  case 'addComponentToLibrary':
21955
22333
  return addComponentToLibrary(state, action);
21956
22334
  case 'setLocalFilters':
@@ -25295,7 +25673,7 @@ var RichText$1 = function RichText(props) {
25295
25673
  })
25296
25674
  }));
25297
25675
  };
25298
- var AreaChart$1 = function AreaChart(props) {
25676
+ var AreaChart$2 = function AreaChart(props) {
25299
25677
  return jsxRuntime.jsx("svg", _extends({
25300
25678
  xmlns: "http://www.w3.org/2000/svg",
25301
25679
  viewBox: "0 0 512 512"
@@ -25564,7 +25942,10 @@ var WaterfallChart$1 = function WaterfallChart(props) {
25564
25942
 
25565
25943
  var componentTypeToIconMapping = {
25566
25944
  areaChart: function areaChart(props) {
25567
- return AreaChart$1(props);
25945
+ return AreaChart$2(props);
25946
+ },
25947
+ areaChartV2: function areaChartV2(props) {
25948
+ return AreaChart$2(props);
25568
25949
  },
25569
25950
  barChart: function barChart(props) {
25570
25951
  return BarChart$2(props);
@@ -32663,7 +33044,7 @@ var VizzlyXYChart = function VizzlyXYChart(props) {
32663
33044
  });
32664
33045
  };
32665
33046
 
32666
- var AreaChart$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
33047
+ var AreaChart$3 = /*#__PURE__*/React.forwardRef(function (props, ref) {
32667
33048
  var forceRerender = useChartForceRerender(ref);
32668
33049
  if (forceRerender) return null;
32669
33050
  return jsxRuntime.jsx(responsive.ParentSize, {
@@ -33614,7 +33995,7 @@ var AreaChartView = function AreaChartView(props) {
33614
33995
  paddingBottom: showHeadline ? '0.5rem' : undefined
33615
33996
  })), showHeadline && jsxRuntime.jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsxRuntime.jsx(ChartWrapper, {
33616
33997
  disabledFeatures: (_props$library2 = props == null ? void 0 : props.library) != null ? _props$library2 : false,
33617
- children: jsxRuntime.jsx(AreaChart$2, {
33998
+ children: jsxRuntime.jsx(AreaChart$3, {
33618
33999
  approxXAxisLabelCount: props.approxXAxisLabelCount,
33619
34000
  approxYAxisLabelCount: props.approxYAxisLabelCount,
33620
34001
  ref: ref,
@@ -33748,7 +34129,7 @@ var isDrilldownAvailable = function isDrilldownAvailable(props) {
33748
34129
  return (props == null || (_props$component = props.component) == null || (_props$component = _props$component.attributes) == null || (_props$component = _props$component.drilldown) == null ? void 0 : _props$component.length) > 0;
33749
34130
  };
33750
34131
 
33751
- var AreaChart$3 = function AreaChart(props) {
34132
+ var AreaChart$4 = function AreaChart(props) {
33752
34133
  var _props$dashboardBehav;
33753
34134
  var _useState = React.useState(null),
33754
34135
  onDrilldown = _useState[0],
@@ -41871,6 +42252,22 @@ function howManyTicksFitInWidth(ticks, maxWidth, avgCharWidth) {
41871
42252
  }
41872
42253
  return fittedTicks.length;
41873
42254
  }
42255
+ function howManyTicksFitInHeight(ticks, height) {
42256
+ if (height > 180) return undefined;
42257
+ var currentHeight = 0;
42258
+ var fittedTicks = 0;
42259
+ var ASSUMED_AVERAGE_CHAR_HEIGHT = 28;
42260
+ for (var i = 0; i < ticks.length; i++) {
42261
+ var wordHeight = ASSUMED_AVERAGE_CHAR_HEIGHT;
42262
+ if (currentHeight + wordHeight <= height) {
42263
+ fittedTicks++;
42264
+ currentHeight += wordHeight;
42265
+ } else {
42266
+ break;
42267
+ }
42268
+ }
42269
+ return fittedTicks;
42270
+ }
41874
42271
  function pickEquallySpaced(arr, numPicks) {
41875
42272
  if (numPicks >= arr.length) {
41876
42273
  return arr; // If numPicks is greater than or equal to the array length, return the whole array
@@ -41883,17 +42280,22 @@ function pickEquallySpaced(arr, numPicks) {
41883
42280
  }
41884
42281
  return result;
41885
42282
  }
41886
- var adjustTicks = function adjustTicks(chartRepresentation, width) {
41887
- chartRepresentation = _.cloneDeep(chartRepresentation);
42283
+ function adjustTicks(representation, width, height) {
42284
+ representation = _.cloneDeep(representation);
41888
42285
 
41889
42286
  // TODO; take this from the theme override...
41890
42287
  var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
41891
- var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth(chartRepresentation.x.ticks || [], width, averageCharacterWidth);
42288
+ var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks || [], width, averageCharacterWidth);
42289
+ var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks || [], height);
41892
42290
 
41893
42291
  // @ts-ignore
41894
- chartRepresentation.x.ticks = pickEquallySpaced(chartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
41895
- return chartRepresentation;
41896
- };
42292
+ representation.x.ticks = pickEquallySpaced(representation.x.ticks, numberOfXTicksFittingIntoSpace);
42293
+ if (numberOfYTicksFittingIntoSpace) {
42294
+ // @ts-ignore
42295
+ representation.y.ticks = pickEquallySpaced(representation.y.ticks, numberOfYTicksFittingIntoSpace);
42296
+ }
42297
+ return representation;
42298
+ }
41897
42299
 
41898
42300
  var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
41899
42301
  var maxWidth = _.max(yTicks.map(function (tick) {
@@ -42857,135 +43259,6 @@ function getStyleDefinition(_ref) {
42857
43259
  });
42858
43260
  }
42859
43261
 
42860
- var getMinAndMax = function getMinAndMax(_ref) {
42861
- var data = _ref.data,
42862
- keys = _ref.keys,
42863
- dataType = _ref.dataType,
42864
- goalLines = _ref.goalLines;
42865
- if (keys.length === 0) return {
42866
- max: null,
42867
- min: null
42868
- };
42869
- if (dataType === 'date_time') {
42870
- var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
42871
- return keys.map(function (key) {
42872
- return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
42873
- });
42874
- }));
42875
- return {
42876
- max: Math.max.apply(Math, dataToAnalyse),
42877
- min: Math.min.apply(Math, dataToAnalyse)
42878
- };
42879
- } else if (dataType === 'number') {
42880
- var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
42881
- return keys.map(function (key) {
42882
- return dataItem[key] ? dataItem[key].value : 0;
42883
- });
42884
- }), goalLines ? goalLines.map(function (gL) {
42885
- return gL.value;
42886
- }) : []);
42887
- return {
42888
- max: Math.max.apply(Math, _dataToAnalyse),
42889
- min: Math.min.apply(Math, _dataToAnalyse)
42890
- };
42891
- } else {
42892
- return {
42893
- max: null,
42894
- min: null
42895
- };
42896
- }
42897
- };
42898
-
42899
- function getNiceInterval(interval) {
42900
- // Round the interval to a "nice" value (1, 2, 5, etc.)
42901
- var exponent = Math.floor(Math.log10(interval));
42902
- var fraction = interval / Math.pow(10, exponent);
42903
- var niceFraction;
42904
- if (fraction <= 1.5) niceFraction = 1;else if (fraction <= 3) niceFraction = 2;else if (fraction <= 7) niceFraction = 5;else niceFraction = 10;
42905
- return niceFraction * Math.pow(10, exponent);
42906
- }
42907
- var getScaleAndTicks = function getScaleAndTicks(_ref) {
42908
- var _order$;
42909
- var data = _ref.data,
42910
- xKey = _ref.xKey,
42911
- yKeys = _ref.yKeys,
42912
- xScaleDataType = _ref.xScaleDataType,
42913
- nullValue = _ref.nullValue,
42914
- tickCountYAxis = _ref.tickCountYAxis,
42915
- formattingFunctionX = _ref.formattingFunctionX,
42916
- formattingFunctionY = _ref.formattingFunctionY,
42917
- order = _ref.order,
42918
- goalLines = _ref.goalLines;
42919
- var xTicks = [];
42920
- var yTicks = [];
42921
- var xScale = {
42922
- dataType: xScaleDataType,
42923
- key: xKey,
42924
- ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
42925
- };
42926
- var x = getMinAndMax({
42927
- data: data,
42928
- keys: xScale.key === null ? [] : [xScale.key],
42929
- dataType: xScale.dataType
42930
- });
42931
- if (xKey) {
42932
- xTicks = data.map(function (dataItem) {
42933
- var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
42934
- var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
42935
- var xformattedValue = formattingFunctionX(xValue, nullValue);
42936
- var xScaleValue = xScale.key !== null && (_dataItem$xScale$key = dataItem[xScale.key]) != null && _dataItem$xScale$key.value ? (_dataItem$xScale$key2 = dataItem[xScale.key]) == null ? void 0 : _dataItem$xScale$key2.value : '';
42937
- var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
42938
- return {
42939
- value: xValue !== null ? xValue : '',
42940
- formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
42941
- scaleValue: xScaleValueAdjusted
42942
- };
42943
- });
42944
- }
42945
- // ----- Y Axis ("number") -----
42946
-
42947
- var y = getMinAndMax({
42948
- data: data,
42949
- keys: yKeys,
42950
- dataType: 'number',
42951
- goalLines: goalLines
42952
- });
42953
- var maxY = y.max || 0;
42954
- var minY = Math.min(y.min || 0, 0);
42955
- var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
42956
- for (var i = 0; i < tickCountYAxis; i++) {
42957
- var _value = yTickInterval * i;
42958
- var formattedValue = formattingFunctionY(_value, nullValue);
42959
- yTicks.push({
42960
- value: _value,
42961
- formattedValue: formattedValue,
42962
- scaleValue: _value
42963
- });
42964
- }
42965
- return {
42966
- x: {
42967
- ticks: xTicks,
42968
- scale: {
42969
- dataType: xScale.dataType,
42970
- max: x.max,
42971
- min: x.min,
42972
- key: xScale.key,
42973
- ordering: xScale.ordering
42974
- }
42975
- },
42976
- y: {
42977
- ticks: yTicks,
42978
- scale: {
42979
- dataType: 'number',
42980
- key: null,
42981
- ordering: 'asc',
42982
- max: maxY,
42983
- min: minY
42984
- }
42985
- }
42986
- };
42987
- };
42988
-
42989
43262
  /**
42990
43263
  * When provided with a result, and formatting parameters, it returns a
42991
43264
  * populated result including the formatted value to show.
@@ -43434,6 +43707,180 @@ function buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xA
43434
43707
  };
43435
43708
  }
43436
43709
 
43710
+ var getStackedMinAndMax = function getStackedMinAndMax(_ref) {
43711
+ var data = _ref.data,
43712
+ keys = _ref.keys,
43713
+ dataType = _ref.dataType,
43714
+ goalLines = _ref.goalLines,
43715
+ stacked = _ref.stacked;
43716
+ if (keys.length === 0) return {
43717
+ max: null,
43718
+ min: null
43719
+ };
43720
+ if (stacked) {
43721
+ var totals = data.map(function (dataItem) {
43722
+ return keys.reduce(function (sum, key) {
43723
+ var value = dataItem[key] ? dataItem[key].value : 0;
43724
+ return sum + (typeof value === 'number' ? value : 0);
43725
+ }, 0);
43726
+ });
43727
+ var maxTotal = Math.max.apply(Math, totals);
43728
+ var minTotal = Math.min.apply(Math, totals);
43729
+ return {
43730
+ max: maxTotal,
43731
+ min: minTotal
43732
+ };
43733
+ }
43734
+ if (dataType === 'date_time') {
43735
+ var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
43736
+ return keys.map(function (key) {
43737
+ return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
43738
+ });
43739
+ }));
43740
+ return {
43741
+ max: Math.max.apply(Math, dataToAnalyse),
43742
+ min: Math.min.apply(Math, dataToAnalyse)
43743
+ };
43744
+ } else if (dataType === 'number') {
43745
+ var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
43746
+ return keys.map(function (key) {
43747
+ return dataItem[key] ? dataItem[key].value : 0;
43748
+ });
43749
+ }), goalLines ? goalLines.map(function (gL) {
43750
+ return gL.value;
43751
+ }) : []);
43752
+ return {
43753
+ max: Math.max.apply(Math, _dataToAnalyse),
43754
+ min: Math.min.apply(Math, _dataToAnalyse)
43755
+ };
43756
+ } else {
43757
+ return {
43758
+ max: null,
43759
+ min: null
43760
+ };
43761
+ }
43762
+ };
43763
+
43764
+ function getNiceInterval(interval) {
43765
+ var exponent = Math.floor(Math.log10(interval));
43766
+ var fraction = interval / Math.pow(10, exponent);
43767
+ var niceFraction;
43768
+ if (fraction <= 1) {
43769
+ niceFraction = 1;
43770
+ } else if (fraction <= 1.25) {
43771
+ niceFraction = 1.25;
43772
+ } else if (fraction <= 1.5) {
43773
+ niceFraction = 1.5;
43774
+ } else if (fraction <= 2) {
43775
+ niceFraction = 2;
43776
+ } else if (fraction <= 2.5) {
43777
+ niceFraction = 2.5;
43778
+ } else if (fraction <= 3) {
43779
+ niceFraction = 3;
43780
+ } else if (fraction <= 5) {
43781
+ niceFraction = 5;
43782
+ } else if (fraction <= 7) {
43783
+ niceFraction = 7;
43784
+ } else if (fraction <= 10) {
43785
+ niceFraction = 10;
43786
+ } else {
43787
+ niceFraction = 10;
43788
+ }
43789
+ return niceFraction * Math.pow(10, exponent);
43790
+ }
43791
+ var getScaleAndTicks = function getScaleAndTicks(_ref) {
43792
+ var _order$;
43793
+ var data = _ref.data,
43794
+ xKey = _ref.xKey,
43795
+ yKeys = _ref.yKeys,
43796
+ xScaleDataType = _ref.xScaleDataType,
43797
+ nullValue = _ref.nullValue,
43798
+ tickCountYAxis = _ref.tickCountYAxis,
43799
+ formattingFunctionX = _ref.formattingFunctionX,
43800
+ formattingFunctionY = _ref.formattingFunctionY,
43801
+ order = _ref.order,
43802
+ goalLines = _ref.goalLines,
43803
+ stacked = _ref.stacked;
43804
+ var xTicks = [];
43805
+ var xScale = {
43806
+ dataType: xScaleDataType,
43807
+ key: xKey,
43808
+ ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
43809
+ };
43810
+ var x = getStackedMinAndMax({
43811
+ data: data,
43812
+ keys: xScale.key === null ? [] : [xScale.key],
43813
+ dataType: xScale.dataType
43814
+ });
43815
+ if (xKey) {
43816
+ xTicks = data.map(function (dataItem) {
43817
+ var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
43818
+ var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
43819
+ var xformattedValue = formattingFunctionX(xValue, nullValue);
43820
+ var xScaleValue = xScale.key !== null && (_dataItem$xScale$key = dataItem[xScale.key]) != null && _dataItem$xScale$key.value ? (_dataItem$xScale$key2 = dataItem[xScale.key]) == null ? void 0 : _dataItem$xScale$key2.value : '';
43821
+ var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
43822
+ return {
43823
+ value: xValue !== null ? xValue : '',
43824
+ formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
43825
+ scaleValue: xScaleValueAdjusted
43826
+ };
43827
+ });
43828
+ }
43829
+ // ----- Y Axis ("number") -----
43830
+
43831
+ var y = getStackedMinAndMax({
43832
+ data: data,
43833
+ keys: yKeys,
43834
+ dataType: 'number',
43835
+ goalLines: goalLines,
43836
+ stacked: stacked
43837
+ });
43838
+ var maxY = y.max || 0;
43839
+ var minY = Math.min(y.min || 0, 0);
43840
+ var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
43841
+ var yTicks = [];
43842
+ for (var i = 0; i < tickCountYAxis; i++) {
43843
+ var _value = minY + yTickInterval * i;
43844
+ var formattedValue = formattingFunctionY(_value, nullValue);
43845
+ yTicks.push({
43846
+ value: _value,
43847
+ formattedValue: formattedValue,
43848
+ scaleValue: _value
43849
+ });
43850
+ }
43851
+ return {
43852
+ x: {
43853
+ ticks: xTicks,
43854
+ scale: {
43855
+ dataType: xScale.dataType,
43856
+ max: x.max,
43857
+ min: x.min,
43858
+ key: xScale.key,
43859
+ ordering: xScale.ordering
43860
+ }
43861
+ },
43862
+ y: {
43863
+ ticks: yTicks,
43864
+ scale: {
43865
+ dataType: 'number',
43866
+ key: null,
43867
+ ordering: 'asc',
43868
+ max: maxY,
43869
+ min: minY
43870
+ }
43871
+ }
43872
+ };
43873
+ };
43874
+
43875
+ var formattingFunctionX = function formattingFunctionX(value, formattedResult, xKeyField) {
43876
+ if (!xKeyField) return '';
43877
+ return formattedResult.formatterFunc(value, {
43878
+ fieldId: xKeyField.fieldId,
43879
+ "function": xKeyField["function"],
43880
+ outputDataType: xKeyField.outputDataType
43881
+ }).formattedValue;
43882
+ };
43883
+
43437
43884
  var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
43438
43885
  var _xKeys$, _axisTitles$x, _axisTitles$y;
43439
43886
  var axisTitles = _ref.axisTitles,
@@ -43506,15 +43953,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
43506
43953
 
43507
43954
  // ----- Formatting -----
43508
43955
 
43509
- var formattingFunctionX = function formattingFunctionX(value) {
43510
- if (!xKeyField) return '';
43511
- return formattedResult.formatterFunc(value, {
43512
- fieldId: xKeyField.fieldId,
43513
- "function": xKeyField["function"],
43514
- outputDataType: xKeyField.outputDataType
43515
- }).formattedValue;
43516
- };
43517
-
43518
43956
  // (value: any, noValueReplacement?: string) => string;
43519
43957
  var formattingFunctionY = function formattingFunctionY(value) {
43520
43958
  // Use any y axis field as they are all formatted in the same way (for now...);
@@ -43543,7 +43981,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
43543
43981
  var orderFunction = order.length > 0 ? order[0]["function"] : undefined;
43544
43982
  var trendsAndForecastData = getTrendsAndForecastsData({
43545
43983
  chartData: chartData,
43546
- formattingFunctionX: formattingFunctionX,
43984
+ formattingFunctionX: function formattingFunctionX$1(value) {
43985
+ return formattingFunctionX(value, formattedResult, xKeyField);
43986
+ },
43547
43987
  formattingFunctionY: formattingFunctionY,
43548
43988
  keys: keys,
43549
43989
  nullValue: nullValue,
@@ -43573,7 +44013,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
43573
44013
  xScaleDataType: xScaleDataType,
43574
44014
  yKeys: yKeys,
43575
44015
  tickCountYAxis: approxYAxisLabelCount,
43576
- formattingFunctionX: formattingFunctionX,
44016
+ formattingFunctionX: function formattingFunctionX$1(value) {
44017
+ return formattingFunctionX(value, formattedResult, xKeyField);
44018
+ },
43577
44019
  formattingFunctionY: formattingFunctionY,
43578
44020
  nullValue: nullValue,
43579
44021
  order: order,
@@ -43635,62 +44077,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
43635
44077
  return chart;
43636
44078
  };
43637
44079
 
43638
- var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
43639
- function calculateWordWidth$1(word, avgCharWidth) {
43640
- if (avgCharWidth === void 0) {
43641
- avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
43642
- }
43643
- return word.length * avgCharWidth;
43644
- }
43645
-
43646
- /** Reduce width proportionally to simulate spacing / padding between ticks. */
43647
- var widthWithSpacing$1 = function widthWithSpacing(width) {
43648
- var THIRTY_PERCENT = 0.3;
43649
- return width - width * THIRTY_PERCENT;
43650
- };
43651
- function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
43652
- if (avgCharWidth === void 0) {
43653
- avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
43654
- }
43655
- var fittedTicks = [];
43656
- var currentWidth = 0;
43657
- for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
43658
- var tick = _step.value;
43659
- var word = (tick == null ? void 0 : tick.formattedValue) || '';
43660
- var wordWidth = calculateWordWidth$1(word, avgCharWidth);
43661
- if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
43662
- fittedTicks.push(tick);
43663
- currentWidth += wordWidth + avgCharWidth; // Add space between words
43664
- } else {
43665
- break; // Stop if adding the word exceeds maxWidth
43666
- }
43667
- }
43668
- return fittedTicks.length;
43669
- }
43670
- function pickEquallySpaced$1(arr, numPicks) {
43671
- if (numPicks >= arr.length) {
43672
- return arr; // If numPicks is greater than or equal to the array length, return the whole array
43673
- }
43674
- var result = [];
43675
- var interval = (arr.length - 1) / (numPicks - 1);
43676
- for (var i = 0; i < numPicks; i++) {
43677
- var index = Math.round(i * interval); // Calculate index and round it
43678
- result.push(arr[index]);
43679
- }
43680
- return result;
43681
- }
43682
- var adjustTicks$1 = function adjustTicks(lineChartRepresentation, width) {
43683
- lineChartRepresentation = _.cloneDeep(lineChartRepresentation);
43684
-
43685
- // TODO; take this from the theme override...
43686
- var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
43687
- var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(lineChartRepresentation.x.ticks || [], width, averageCharacterWidth);
43688
-
43689
- // @ts-ignore
43690
- lineChartRepresentation.x.ticks = pickEquallySpaced$1(lineChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
43691
- return lineChartRepresentation;
43692
- };
43693
-
43694
44080
  var LineChartV2View = function LineChartV2View(props) {
43695
44081
  var _props$library, _props$attributes$vie;
43696
44082
  var _useDashboardBehaviou = useDashboardBehaviourContext(),
@@ -43799,7 +44185,7 @@ var LineChartV2View = function LineChartV2View(props) {
43799
44185
  return jsxRuntime.jsx(LineChart$5, {
43800
44186
  width: parent.width,
43801
44187
  height: parent.height,
43802
- chart: adjustTicks$1(chartRepresentation, parent.width),
44188
+ chart: adjustTicks(chartRepresentation, parent.width, parent.height),
43803
44189
  options: {
43804
44190
  lineCurve: props.attributes.lineCurve,
43805
44191
  removeStroke: false,
@@ -43807,8 +44193,7 @@ var LineChartV2View = function LineChartV2View(props) {
43807
44193
  showLegend: props.attributes.legend,
43808
44194
  axis: {
43809
44195
  showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
43810
- // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
43811
- showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
44196
+ showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
43812
44197
  }
43813
44198
  },
43814
44199
  theme: theme == null ? void 0 : theme.charts
@@ -47130,171 +47515,6 @@ var Progress$2 = function Progress(props) {
47130
47515
  }));
47131
47516
  };
47132
47517
 
47133
- var getMinAndMax$1 = function getMinAndMax(_ref) {
47134
- var data = _ref.data,
47135
- keys = _ref.keys,
47136
- dataType = _ref.dataType,
47137
- goalLines = _ref.goalLines,
47138
- stacked = _ref.stacked;
47139
- if (keys.length === 0) return {
47140
- max: null,
47141
- min: null
47142
- };
47143
- if (stacked) {
47144
- var totals = data.map(function (dataItem) {
47145
- return keys.reduce(function (sum, key) {
47146
- var value = dataItem[key] ? dataItem[key].value : 0;
47147
- return sum + (typeof value === 'number' ? value : 0);
47148
- }, 0);
47149
- });
47150
- var maxTotal = Math.max.apply(Math, totals);
47151
- var minTotal = Math.min.apply(Math, totals);
47152
- return {
47153
- max: maxTotal,
47154
- min: minTotal
47155
- };
47156
- }
47157
- if (dataType === 'date_time') {
47158
- var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
47159
- return keys.map(function (key) {
47160
- return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
47161
- });
47162
- }));
47163
- return {
47164
- max: Math.max.apply(Math, dataToAnalyse),
47165
- min: Math.min.apply(Math, dataToAnalyse)
47166
- };
47167
- } else if (dataType === 'number') {
47168
- var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
47169
- return keys.map(function (key) {
47170
- return dataItem[key] ? dataItem[key].value : 0;
47171
- });
47172
- }), goalLines ? goalLines.map(function (gL) {
47173
- return gL.value;
47174
- }) : []);
47175
- return {
47176
- max: Math.max.apply(Math, _dataToAnalyse),
47177
- min: Math.min.apply(Math, _dataToAnalyse)
47178
- };
47179
- } else {
47180
- return {
47181
- max: null,
47182
- min: null
47183
- };
47184
- }
47185
- };
47186
-
47187
- function getNiceInterval$1(interval) {
47188
- var exponent = Math.floor(Math.log10(interval));
47189
- var fraction = interval / Math.pow(10, exponent);
47190
- var niceFraction;
47191
- if (fraction <= 1) {
47192
- niceFraction = 1;
47193
- } else if (fraction <= 1.25) {
47194
- niceFraction = 1.25;
47195
- } else if (fraction <= 1.5) {
47196
- niceFraction = 1.5;
47197
- } else if (fraction <= 2) {
47198
- niceFraction = 2;
47199
- } else if (fraction <= 2.5) {
47200
- niceFraction = 2.5;
47201
- } else if (fraction <= 3) {
47202
- niceFraction = 3;
47203
- } else if (fraction <= 5) {
47204
- niceFraction = 5;
47205
- } else if (fraction <= 7) {
47206
- niceFraction = 7;
47207
- } else if (fraction <= 10) {
47208
- niceFraction = 10;
47209
- } else {
47210
- niceFraction = 10;
47211
- }
47212
- return niceFraction * Math.pow(10, exponent);
47213
- }
47214
- var getScaleAndTicks$1 = function getScaleAndTicks(_ref) {
47215
- var _order$;
47216
- var data = _ref.data,
47217
- xKey = _ref.xKey,
47218
- yKeys = _ref.yKeys,
47219
- xScaleDataType = _ref.xScaleDataType,
47220
- nullValue = _ref.nullValue,
47221
- tickCountYAxis = _ref.tickCountYAxis,
47222
- formattingFunctionX = _ref.formattingFunctionX,
47223
- formattingFunctionY = _ref.formattingFunctionY,
47224
- order = _ref.order,
47225
- goalLines = _ref.goalLines,
47226
- stacked = _ref.stacked;
47227
- var xTicks = [];
47228
- var xScale = {
47229
- dataType: xScaleDataType,
47230
- key: xKey,
47231
- ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
47232
- };
47233
- var x = getMinAndMax$1({
47234
- data: data,
47235
- keys: xScale.key === null ? [] : [xScale.key],
47236
- dataType: xScale.dataType
47237
- });
47238
- if (xKey) {
47239
- xTicks = data.map(function (dataItem) {
47240
- var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
47241
- var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
47242
- var xformattedValue = formattingFunctionX(xValue, nullValue);
47243
- var xScaleValue = xScale.key !== null && (_dataItem$xScale$key = dataItem[xScale.key]) != null && _dataItem$xScale$key.value ? (_dataItem$xScale$key2 = dataItem[xScale.key]) == null ? void 0 : _dataItem$xScale$key2.value : '';
47244
- var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
47245
- return {
47246
- value: xValue !== null ? xValue : '',
47247
- formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
47248
- scaleValue: xScaleValueAdjusted
47249
- };
47250
- });
47251
- }
47252
- // ----- Y Axis ("number") -----
47253
-
47254
- var y = getMinAndMax$1({
47255
- data: data,
47256
- keys: yKeys,
47257
- dataType: 'number',
47258
- goalLines: goalLines,
47259
- stacked: stacked
47260
- });
47261
- var maxY = y.max || 0;
47262
- var minY = Math.min(y.min || 0, 0);
47263
- var yTickInterval = getNiceInterval$1((maxY - minY) / (tickCountYAxis - 1));
47264
- var yTicks = [];
47265
- for (var i = 0; i < tickCountYAxis; i++) {
47266
- var _value = minY + yTickInterval * i;
47267
- var formattedValue = formattingFunctionY(_value, nullValue);
47268
- yTicks.push({
47269
- value: _value,
47270
- formattedValue: formattedValue,
47271
- scaleValue: _value
47272
- });
47273
- }
47274
- return {
47275
- x: {
47276
- ticks: xTicks,
47277
- scale: {
47278
- dataType: xScale.dataType,
47279
- max: x.max,
47280
- min: x.min,
47281
- key: xScale.key,
47282
- ordering: xScale.ordering
47283
- }
47284
- },
47285
- y: {
47286
- ticks: yTicks,
47287
- scale: {
47288
- dataType: 'number',
47289
- key: null,
47290
- ordering: 'asc',
47291
- max: maxY,
47292
- min: minY
47293
- }
47294
- }
47295
- };
47296
- };
47297
-
47298
47518
  function fillMissingKeysForChartData(data) {
47299
47519
  var allKeys = new Set();
47300
47520
  data.forEach(function (item) {
@@ -47388,15 +47608,6 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
47388
47608
 
47389
47609
  // ----- Formatting -----
47390
47610
 
47391
- var formattingFunctionX = function formattingFunctionX(value) {
47392
- if (!xKeyField) return '';
47393
- return formattedResult.formatterFunc(value, {
47394
- fieldId: xKeyField.fieldId,
47395
- "function": xKeyField["function"],
47396
- outputDataType: xKeyField.outputDataType
47397
- }).formattedValue;
47398
- };
47399
-
47400
47611
  // (value: any, noValueReplacement?: string) => string;
47401
47612
  var formattingFunctionY = function formattingFunctionY(value) {
47402
47613
  // Use any y axis field as they are all formatted in the same way (for now...);
@@ -47440,13 +47651,15 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
47440
47651
 
47441
47652
  // ----- Ticks -----
47442
47653
 
47443
- var ticks = getScaleAndTicks$1({
47654
+ var ticks = getScaleAndTicks({
47444
47655
  data: updatedData,
47445
47656
  xKey: xKey,
47446
47657
  xScaleDataType: xScaleDataType,
47447
47658
  yKeys: yKeys,
47448
47659
  tickCountYAxis: approxYAxisLabelCount,
47449
- formattingFunctionX: formattingFunctionX,
47660
+ formattingFunctionX: function formattingFunctionX$1(value) {
47661
+ return formattingFunctionX(value, formattedResult, xKeyField);
47662
+ },
47450
47663
  formattingFunctionY: formattingFunctionY,
47451
47664
  nullValue: nullValue,
47452
47665
  order: order,
@@ -47658,7 +47871,7 @@ var BarChartV2View = function BarChartV2View(props) {
47658
47871
  return jsxRuntime.jsx(BarChart$5, {
47659
47872
  width: parent.width,
47660
47873
  height: parent.height,
47661
- chart: adjustTicks(chartRepresentation, parent.width),
47874
+ chart: adjustTicks(chartRepresentation, parent.width, parent.height),
47662
47875
  options: {
47663
47876
  stacked: !!props.attributes.stacked,
47664
47877
  removeStroke: false,
@@ -47666,8 +47879,7 @@ var BarChartV2View = function BarChartV2View(props) {
47666
47879
  showLegend: props.attributes.legend,
47667
47880
  axis: {
47668
47881
  showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
47669
- // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
47670
- showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
47882
+ showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
47671
47883
  }
47672
47884
  },
47673
47885
  theme: theme == null ? void 0 : theme.charts,
@@ -47756,30 +47968,30 @@ function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
47756
47968
  return fill;
47757
47969
  }
47758
47970
 
47759
- var ASSUMED_AVERAGE_CHAR_WIDTH$2 = 8.8;
47760
- function calculateWordWidth$2(word, avgCharWidth) {
47971
+ var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
47972
+ function calculateWordWidth$1(word, avgCharWidth) {
47761
47973
  if (avgCharWidth === void 0) {
47762
- avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$2;
47974
+ avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
47763
47975
  }
47764
47976
  return word.length * avgCharWidth;
47765
47977
  }
47766
47978
 
47767
47979
  /** Reduce width proportionally to simulate spacing / padding between ticks. */
47768
- var widthWithSpacing$2 = function widthWithSpacing(width) {
47980
+ var widthWithSpacing$1 = function widthWithSpacing(width) {
47769
47981
  var THIRTY_PERCENT = 0.3;
47770
47982
  return width - width * THIRTY_PERCENT;
47771
47983
  };
47772
- function howManyTicksFitInWidth$2(ticks, maxWidth, avgCharWidth) {
47984
+ function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
47773
47985
  if (avgCharWidth === void 0) {
47774
- avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$2;
47986
+ avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
47775
47987
  }
47776
47988
  var fittedTicks = [];
47777
47989
  var currentWidth = 0;
47778
47990
  for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
47779
47991
  var tick = _step.value;
47780
47992
  var word = (tick == null ? void 0 : tick.formattedValue) || '';
47781
- var wordWidth = calculateWordWidth$2(word, avgCharWidth);
47782
- if (currentWidth + wordWidth <= widthWithSpacing$2(maxWidth)) {
47993
+ var wordWidth = calculateWordWidth$1(word, avgCharWidth);
47994
+ if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
47783
47995
  fittedTicks.push(tick);
47784
47996
  currentWidth += wordWidth + avgCharWidth; // Add space between words
47785
47997
  } else {
@@ -47788,7 +48000,7 @@ function howManyTicksFitInWidth$2(ticks, maxWidth, avgCharWidth) {
47788
48000
  }
47789
48001
  return fittedTicks.length;
47790
48002
  }
47791
- function pickEquallySpaced$2(arr, numPicks) {
48003
+ function pickEquallySpaced$1(arr, numPicks) {
47792
48004
  if (numPicks >= arr.length) {
47793
48005
  return arr; // If numPicks is greater than or equal to the array length, return the whole array
47794
48006
  }
@@ -47800,19 +48012,19 @@ function pickEquallySpaced$2(arr, numPicks) {
47800
48012
  }
47801
48013
  return result;
47802
48014
  }
47803
- var adjustTicks$2 = function adjustTicks(waterfallChartRepresentation, width) {
48015
+ var adjustTicks$1 = function adjustTicks(waterfallChartRepresentation, width) {
47804
48016
  waterfallChartRepresentation = _.cloneDeep(waterfallChartRepresentation);
47805
48017
 
47806
48018
  // TODO; take this from the theme override...
47807
- var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$2;
47808
- var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$2(waterfallChartRepresentation.x.ticks || [], width, averageCharacterWidth);
48019
+ var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
48020
+ var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(waterfallChartRepresentation.x.ticks || [], width, averageCharacterWidth);
47809
48021
  var MINIMUM_NUMBER_OF_TICKS = 2;
47810
48022
  if (numberOfTicksFittingIntoSpace < MINIMUM_NUMBER_OF_TICKS) {
47811
48023
  numberOfTicksFittingIntoSpace = MINIMUM_NUMBER_OF_TICKS;
47812
48024
  }
47813
48025
 
47814
48026
  // @ts-ignore
47815
- waterfallChartRepresentation.x.ticks = pickEquallySpaced$2(waterfallChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
48027
+ waterfallChartRepresentation.x.ticks = pickEquallySpaced$1(waterfallChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
47816
48028
  return waterfallChartRepresentation;
47817
48029
  };
47818
48030
 
@@ -47942,17 +48154,13 @@ var Legend$2 = function Legend(_ref) {
47942
48154
  color: 'green',
47943
48155
  yKey: 'increase',
47944
48156
  style: {
47945
- type: 'line',
47946
- strokeDasharray: null,
47947
- strokeWidth: 2
48157
+ type: 'bar'
47948
48158
  }
47949
48159
  }, {
47950
48160
  color: 'red',
47951
48161
  yKey: 'decrease',
47952
48162
  style: {
47953
- type: 'line',
47954
- strokeDasharray: null,
47955
- strokeWidth: 2
48163
+ type: 'bar'
47956
48164
  }
47957
48165
  }];
47958
48166
  var keys = {
@@ -47990,6 +48198,7 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
47990
48198
  width = _ref.width,
47991
48199
  options = _ref.options,
47992
48200
  chart = _ref.chart,
48201
+ steps = _ref.steps,
47993
48202
  theme = _ref.theme;
47994
48203
  //Waterfall TODO: fix chart for other x types
47995
48204
  if (chart.x.scale.dataType === 'date_time' || chart.x.scale.dataType === 'number') {
@@ -48005,10 +48214,10 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
48005
48214
  hideTooltip = _useTooltip.hideTooltip,
48006
48215
  showTooltip = _useTooltip.showTooltip;
48007
48216
  var chartCopy = _.cloneDeep(chart);
48008
- var data = chartCopy.data,
48009
- x = chartCopy.x,
48217
+ var x = chartCopy.x,
48010
48218
  y = chartCopy.y;
48011
- var showTotalBar = options.showTotalBar;
48219
+ var xKey = x.key;
48220
+ var yKey = y.key;
48012
48221
  var conditionalFormattingRules = [{
48013
48222
  yKey: y.key,
48014
48223
  operator: '>',
@@ -48020,47 +48229,11 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
48020
48229
  value: 0,
48021
48230
  color: 'red'
48022
48231
  }];
48023
- var xKey = x.key;
48024
- var yKey = y.key;
48025
- var cumulativeTotal = 0;
48026
- var steps = data.map(function (item) {
48027
- var xValue = item[xKey].value;
48028
- var yValue = Number(item[yKey].value);
48029
- var prevTotal = cumulativeTotal;
48030
- cumulativeTotal += yValue;
48031
- return {
48032
- x: xValue,
48033
- y: yValue,
48034
- start: prevTotal,
48035
- end: cumulativeTotal
48036
- };
48037
- });
48038
- if (showTotalBar) {
48039
- var _data$push;
48040
- steps.push({
48041
- x: "Total",
48042
- y: cumulativeTotal,
48043
- start: 0,
48044
- end: cumulativeTotal
48045
- });
48046
- data.push((_data$push = {}, _data$push[x.key] = {
48047
- value: "Total",
48048
- formattedValue: "Total"
48049
- }, _data$push[y.key] = {
48050
- value: cumulativeTotal,
48051
- formattedValue: null
48052
- }, _data$push));
48053
- x.ticks.push({
48054
- value: "Total",
48055
- formattedValue: "Total",
48056
- scaleValue: "Total"
48057
- });
48058
- }
48059
48232
  var formattedYAxisForBarChart = _extends({}, y, {
48060
- keys: [y.key]
48233
+ keys: [yKey]
48061
48234
  });
48062
48235
  var adjustedChartRepresentation = React.useMemo(function () {
48063
- return adjustTicks$2(_extends({}, chartCopy), width);
48236
+ return adjustTicks$1(_extends({}, chartCopy), width);
48064
48237
  }, [chartCopy, width]);
48065
48238
  var formattedChartDataForBarChart = _extends({}, adjustedChartRepresentation, {
48066
48239
  y: formattedYAxisForBarChart,
@@ -48182,15 +48355,14 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
48182
48355
  if (xScaleDataType === 'string') return xValue;
48183
48356
  return;
48184
48357
  }, [xScaleKey, xScaleDataType]);
48358
+ if (width === 0 || height === 0 || xScale == null) return null;
48185
48359
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
48186
- children: [jsxRuntime.jsxs("svg", {
48360
+ children: [jsxRuntime.jsxs(ChartWrapper$1, {
48187
48361
  width: width,
48188
- height: height - (options.showLegend ? 40 : 0),
48362
+ height: height,
48363
+ showLegend: options.showLegend,
48189
48364
  onMouseMove: handleMouseMove,
48190
48365
  onMouseLeave: handleMouseLeave,
48191
- style: {
48192
- display: 'block'
48193
- },
48194
48366
  children: [jsxRuntime.jsxs(group.Group, {
48195
48367
  left: margin.left,
48196
48368
  top: margin.top,
@@ -48334,7 +48506,7 @@ var Bar$1 = function Bar(_ref4) {
48334
48506
  });
48335
48507
  };
48336
48508
 
48337
- function getNiceInterval$2(interval) {
48509
+ function getNiceInterval$1(interval) {
48338
48510
  // Round the interval to a "nice" value (1, 2, 5, etc.)
48339
48511
  var exponent = Math.floor(Math.log10(interval));
48340
48512
  var fraction = interval / Math.pow(10, exponent);
@@ -48343,6 +48515,111 @@ function getNiceInterval$2(interval) {
48343
48515
  return niceFraction * Math.pow(10, exponent);
48344
48516
  }
48345
48517
 
48518
+ var getYTicks = function getYTicks(_ref) {
48519
+ var yMinValue = _ref.yMinValue,
48520
+ yMaxValue = _ref.yMaxValue,
48521
+ approxYAxisLabelCount = _ref.approxYAxisLabelCount,
48522
+ formattingFunctionY = _ref.formattingFunctionY;
48523
+ var yTicks = [];
48524
+ var yTickInterval = getNiceInterval$1((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
48525
+ for (var i = 0; i < approxYAxisLabelCount; i++) {
48526
+ var value = (yMinValue + i) * yTickInterval;
48527
+ var formattedValue = formattingFunctionY(value);
48528
+ yTicks.push({
48529
+ value: value,
48530
+ formattedValue: formattedValue,
48531
+ scaleValue: value
48532
+ });
48533
+ }
48534
+ return yTicks;
48535
+ };
48536
+
48537
+ var getRepresentationData = function getRepresentationData(_ref) {
48538
+ var content = _ref.content,
48539
+ xKey = _ref.xKey,
48540
+ yKey = _ref.yKey,
48541
+ approxYAxisLabelCount = _ref.approxYAxisLabelCount,
48542
+ showTotalBar = _ref.showTotalBar,
48543
+ formattingFunctionY = _ref.formattingFunctionY;
48544
+ var data = [];
48545
+ var steps = [];
48546
+ var xTicks = [];
48547
+ var yValueSum = 0;
48548
+ var yMinValue = 0;
48549
+ var yMaxValue = 0;
48550
+ content.forEach(function (dataItem, index) {
48551
+ var _data$push;
48552
+ var xValueIndex = 0;
48553
+ var yValueIndex = 1;
48554
+ var xValue = dataItem[xValueIndex].value;
48555
+ var xFormattedValue = dataItem[xValueIndex].formattedValue;
48556
+ var yValue = Number(dataItem[yValueIndex].value);
48557
+ var yValueDiff = yValue;
48558
+ if (index > 0) {
48559
+ var prevYValue = Number(content[index - 1][yValueIndex].value);
48560
+ yValueDiff = yValue - prevYValue;
48561
+ }
48562
+ var prevYValueSum = yValueSum;
48563
+ yValueSum += yValueDiff;
48564
+ data.push((_data$push = {}, _data$push[xKey] = {
48565
+ value: xValue,
48566
+ formattedValue: xFormattedValue
48567
+ }, _data$push[yKey] = {
48568
+ value: yValueDiff,
48569
+ formattedValue: formattingFunctionY(yValueDiff)
48570
+ }, _data$push));
48571
+ xTicks.push({
48572
+ value: xValue,
48573
+ formattedValue: xFormattedValue,
48574
+ scaleValue: xValue
48575
+ });
48576
+ steps.push({
48577
+ x: xValue,
48578
+ y: yValue,
48579
+ start: prevYValueSum,
48580
+ end: yValueSum
48581
+ });
48582
+ yMinValue = Math.floor(Math.min(yMinValue, yValue));
48583
+ yMaxValue = Math.ceil(Math.max(yMaxValue, yValue));
48584
+ });
48585
+ if (showTotalBar) {
48586
+ var _data$push2;
48587
+ var totalLabel = 'Total';
48588
+ steps.push({
48589
+ x: totalLabel,
48590
+ y: yValueSum,
48591
+ start: 0,
48592
+ end: yValueSum
48593
+ });
48594
+ data.push((_data$push2 = {}, _data$push2[xKey] = {
48595
+ value: totalLabel,
48596
+ formattedValue: totalLabel
48597
+ }, _data$push2[yKey] = {
48598
+ value: yValueSum,
48599
+ formattedValue: formattingFunctionY(yValueSum)
48600
+ }, _data$push2));
48601
+ xTicks.push({
48602
+ value: totalLabel,
48603
+ formattedValue: totalLabel,
48604
+ scaleValue: totalLabel
48605
+ });
48606
+ }
48607
+ var yTicks = getYTicks({
48608
+ yMinValue: yMinValue,
48609
+ yMaxValue: yMaxValue,
48610
+ approxYAxisLabelCount: approxYAxisLabelCount,
48611
+ formattingFunctionY: formattingFunctionY
48612
+ });
48613
+ return {
48614
+ data: data,
48615
+ steps: steps,
48616
+ xTicks: xTicks,
48617
+ yTicks: yTicks,
48618
+ yMinValue: yMinValue,
48619
+ yMaxValue: yMaxValue
48620
+ };
48621
+ };
48622
+
48346
48623
  var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentation(_ref) {
48347
48624
  var _formattedResult$fiel, _formattedResult$fiel2, _axisTitles$x, _axisTitles$y;
48348
48625
  var approxYAxisLabelCount = _ref.approxYAxisLabelCount,
@@ -48353,6 +48630,7 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
48353
48630
  numberFormatOptions = _ref.numberFormatOptions,
48354
48631
  pivotConfig = _ref.pivotConfig,
48355
48632
  result = _ref.result,
48633
+ showTotalBar = _ref.showTotalBar,
48356
48634
  _valueAlias = _ref.valueAlias,
48357
48635
  xAxisFormat = _ref.xAxisFormat,
48358
48636
  xAxisPrefix = _ref.xAxisPrefix,
@@ -48360,34 +48638,12 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
48360
48638
  yAxisFormat = _ref.yAxisFormat,
48361
48639
  yAxisPrefix = _ref.yAxisPrefix,
48362
48640
  yAxisPostfix = _ref.yAxisPostfix;
48363
- var allPrefixes = {};
48364
- var allPostfixes = {};
48365
- var nullValues = {};
48366
- var activeNumberFormats = {};
48367
48641
  var activeDateTimeFormats = {};
48368
- result.fields.forEach(function (field) {
48369
- if (pivotConfig.x.includes(field.id)) {
48370
- allPostfixes[field.id] = xAxisPostfix;
48371
- allPrefixes[field.id] = xAxisPrefix;
48372
- if (xAxisFormat) {
48373
- if (field.outputDataType === 'number' && numberFormatOptions[xAxisFormat]) {
48374
- activeNumberFormats[field.id] = xAxisFormat;
48375
- } else if (dateTimeFormatOptions[xAxisFormat]) {
48376
- activeDateTimeFormats[field.id] = xAxisFormat;
48377
- }
48378
- }
48379
- } else if (!pivotConfig.y.includes(field.id)) {
48380
- allPostfixes[field.id] = yAxisPostfix;
48381
- allPrefixes[field.id] = yAxisPrefix;
48382
- yAxisFormat = yAxisFormat || '_vizzly_compact';
48383
- if (numberFormatOptions[yAxisFormat]) {
48384
- activeNumberFormats[field.id] = yAxisFormat;
48385
- }
48386
- }
48387
-
48388
- // Set the null value aliases
48389
- nullValues[field.id] = nullValue;
48390
- });
48642
+ var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
48643
+ allPrefixes = _buildFieldFormatMaps.allPrefixes,
48644
+ allPostfixes = _buildFieldFormatMaps.allPostfixes,
48645
+ nullValues = _buildFieldFormatMaps.nullValues,
48646
+ activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
48391
48647
  var params = {
48392
48648
  defaultFormats: defaultFormats,
48393
48649
  dateTimeFormatOptions: dateTimeFormatOptions,
@@ -48411,6 +48667,18 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
48411
48667
  activeDateTimeFormats: activeDateTimeFormats
48412
48668
  };
48413
48669
  var formattedResult = formatResult(result, params);
48670
+ var formattingFunctionY = function formattingFunctionY(value) {
48671
+ // Use any y axis field as they are all formatted in the same way (for now...);
48672
+ var nonPivotField = formattedResult.fields.find(function (resultField) {
48673
+ return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
48674
+ });
48675
+ if (!nonPivotField) return '';
48676
+ return formattedResult.formatterFunc(value, {
48677
+ fieldId: nonPivotField.fieldId,
48678
+ "function": nonPivotField["function"],
48679
+ outputDataType: nonPivotField.outputDataType
48680
+ }).formattedValue;
48681
+ };
48414
48682
  var keys = formattedResult.fields.map(function (field) {
48415
48683
  var _ref2;
48416
48684
  var key = field.fieldId;
@@ -48425,58 +48693,21 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
48425
48693
  var xKey = (_formattedResult$fiel = formattedResult.fields[0]) == null ? void 0 : _formattedResult$fiel.fieldId;
48426
48694
  var yKey = (_formattedResult$fiel2 = formattedResult.fields[1]) == null ? void 0 : _formattedResult$fiel2.fieldId;
48427
48695
  var content = formattedResult.content;
48428
- var data = [];
48429
- var xTicks = [];
48430
- var yTicks = [];
48431
- var yMinValue = 0;
48432
- var yMaxValue = 0;
48433
- content.forEach(function (dataItem, index) {
48434
- var _data$push;
48435
- var xValueIndex = 0;
48436
- var yValueIndex = 1;
48437
- var xValue = dataItem[xValueIndex].value;
48438
- var xFormattedValue = dataItem[xValueIndex].formattedValue;
48439
- var yValue = dataItem[yValueIndex].value;
48440
- var yFormattedValue = dataItem[yValueIndex].formattedValue;
48441
- var yValueDiff = index === 0 ? yValue : yValue - content[index - 1][yValueIndex].value;
48442
- data.push((_data$push = {}, _data$push[xKey] = {
48443
- value: xValue,
48444
- formattedValue: xFormattedValue
48445
- }, _data$push[yKey] = {
48446
- value: yValueDiff,
48447
- formattedValue: yFormattedValue
48448
- }, _data$push));
48449
- xTicks.push({
48450
- value: xValue,
48451
- formattedValue: xFormattedValue,
48452
- scaleValue: xValue
48453
- });
48454
- yMinValue = Math.floor(Math.min(yMinValue, yValue));
48455
- yMaxValue = Math.ceil(Math.max(yMaxValue, yValue));
48456
- });
48457
- var formattingFunctionY = function formattingFunctionY(value) {
48458
- // Use any y axis field as they are all formatted in the same way (for now...);
48459
- var nonPivotField = formattedResult.fields.find(function (resultField) {
48460
- return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
48461
- });
48462
- if (!nonPivotField) return '';
48463
- return formattedResult.formatterFunc(value, {
48464
- fieldId: nonPivotField.fieldId,
48465
- "function": nonPivotField["function"],
48466
- outputDataType: nonPivotField.outputDataType
48467
- }).formattedValue;
48468
- };
48469
- var yTickInterval = getNiceInterval$2((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
48470
- for (var i = 0; i < approxYAxisLabelCount; i++) {
48471
- var value = (yMinValue + i) * yTickInterval;
48472
- var formattedValue = formattingFunctionY(value);
48473
- yTicks.push({
48474
- value: value,
48475
- formattedValue: formattedValue,
48476
- scaleValue: value
48477
- });
48478
- }
48479
- var chart = {
48696
+ var _getRepresentationDat = getRepresentationData({
48697
+ content: content,
48698
+ xKey: xKey,
48699
+ yKey: yKey,
48700
+ approxYAxisLabelCount: approxYAxisLabelCount,
48701
+ showTotalBar: showTotalBar,
48702
+ formattingFunctionY: formattingFunctionY
48703
+ }),
48704
+ data = _getRepresentationDat.data,
48705
+ steps = _getRepresentationDat.steps,
48706
+ xTicks = _getRepresentationDat.xTicks,
48707
+ yTicks = _getRepresentationDat.yTicks,
48708
+ yMinValue = _getRepresentationDat.yMinValue,
48709
+ yMaxValue = _getRepresentationDat.yMaxValue;
48710
+ var chartRepresentation = {
48480
48711
  keys: _extends({}, keys[0], keys[1]),
48481
48712
  x: {
48482
48713
  title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null,
@@ -48508,7 +48739,10 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
48508
48739
  },
48509
48740
  data: data
48510
48741
  };
48511
- return chart;
48742
+ return {
48743
+ waterfallChartRepresentation: chartRepresentation,
48744
+ waterfallChartSteps: steps
48745
+ };
48512
48746
  };
48513
48747
 
48514
48748
  var WaterfallChartView = function WaterfallChartView(props) {
@@ -48578,12 +48812,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
48578
48812
  if (isLoading(result)) return jsxRuntime.jsx(LoadingComponent, {});
48579
48813
  if (hasFailed(result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
48580
48814
  if (isEmpty(result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
48581
- var showHeadline = React.useMemo(function () {
48582
- return headlineAvailable(order, headline, timeDimension);
48583
- }, [order, headline, timeDimension]);
48815
+ var showHeadline = headlineAvailable(order, headline, timeDimension);
48584
48816
  var pivotConfig = init$c(props);
48585
- var chartRepresentation = React.useMemo(function () {
48586
- return buildWaterfallChartRepresentation({
48817
+ var _buildWaterfallChartR = buildWaterfallChartRepresentation({
48587
48818
  approxYAxisLabelCount: approxYAxisLabelCount === 'auto' ? 10 : approxYAxisLabelCount,
48588
48819
  axisTitles: axisTitles,
48589
48820
  dateTimeFormatOptions: dateTimeFormatOptions,
@@ -48592,6 +48823,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
48592
48823
  numberFormatOptions: numberFormatOptions,
48593
48824
  pivotConfig: pivotConfig,
48594
48825
  result: result,
48826
+ showTotalBar: true,
48595
48827
  valueAlias: valueAlias,
48596
48828
  xAxisFormat: xAxisFormat,
48597
48829
  xAxisPrefix: xAxisPrefix,
@@ -48599,8 +48831,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
48599
48831
  yAxisFormat: yAxisFormat,
48600
48832
  yAxisPrefix: yAxisPrefix,
48601
48833
  yAxisPostfix: yAxisPostfix
48602
- });
48603
- }, [approxYAxisLabelCount, axisTitles, dateTimeFormatOptions, defaultFormats, dataSetId, dimension, numberFormatOptions, pivotConfig, result, valueAlias, xAxisFormat, xAxisPrefix, xAxisPostfix, yAxisFormat, yAxisPrefix, yAxisPostfix]);
48834
+ }),
48835
+ chartRepresentation = _buildWaterfallChartR.waterfallChartRepresentation,
48836
+ steps = _buildWaterfallChartR.waterfallChartSteps;
48604
48837
  return jsxRuntime.jsx(React.Suspense, {
48605
48838
  fallback: jsxRuntime.jsx(LoadingComponent, {}),
48606
48839
  children: jsxRuntime.jsxs(ViewWrapper, {
@@ -48608,8 +48841,12 @@ var WaterfallChartView = function WaterfallChartView(props) {
48608
48841
  queriesAreChanging: queriesAreChanging,
48609
48842
  children: [jsxRuntime.jsx(ViewHeader, _extends({}, headerProps, {
48610
48843
  paddingBottom: showHeadline ? '0.5rem' : undefined
48611
- })), showHeadline && jsxRuntime.jsx(HeadlineStats, _extends({}, props)), jsxRuntime.jsx(ChartWrapper, {
48612
- disabledFeatures: library != null ? library : false,
48844
+ })), showHeadline && jsxRuntime.jsx(HeadlineStats, _extends({}, props)), jsxRuntime.jsx("div", {
48845
+ className: styles({
48846
+ flex: '1',
48847
+ position: 'relative'
48848
+ }),
48849
+ "aria-disabled": props.library,
48613
48850
  children: jsxRuntime.jsx(responsive.ParentSize, {
48614
48851
  style: {
48615
48852
  position: 'absolute',
@@ -48618,13 +48855,12 @@ var WaterfallChartView = function WaterfallChartView(props) {
48618
48855
  overflowX: 'hidden'
48619
48856
  },
48620
48857
  children: function children(parent) {
48858
+ if (chartRepresentation.data.length === 0) return jsxRuntime.jsx(LoadingComponent, {});
48621
48859
  return jsxRuntime.jsx(WaterfallChart$2, {
48622
48860
  width: parent.width,
48623
48861
  height: parent.height,
48624
48862
  options: {
48625
48863
  showLegend: showLegend(legend, (theme == null ? void 0 : theme.detail) === 'verbose'),
48626
- showTotalBar: true,
48627
- // Waterfall TODO: check if this should be configurable via dashboard
48628
48864
  showTooltipRoundedTotal: true,
48629
48865
  removeStroke: false,
48630
48866
  axis: {
@@ -48633,7 +48869,8 @@ var WaterfallChartView = function WaterfallChartView(props) {
48633
48869
  }
48634
48870
  },
48635
48871
  theme: theme == null ? void 0 : theme.charts,
48636
- chart: chartRepresentation
48872
+ chart: chartRepresentation,
48873
+ steps: steps
48637
48874
  });
48638
48875
  }
48639
48876
  })
@@ -48691,6 +48928,352 @@ var WaterfallChart$3 = function WaterfallChart(_ref) {
48691
48928
  }));
48692
48929
  };
48693
48930
 
48931
+ var buildAreaChartRepresentation = function buildAreaChartRepresentation(_ref) {
48932
+ var _xKeys$, _axisTitles$x, _axisTitles$y;
48933
+ var axisTitles = _ref.axisTitles,
48934
+ colors = _ref.colors,
48935
+ conditionalFormattingAttributes = _ref.conditionalFormattingAttributes,
48936
+ dateTimeFormatOptions = _ref.dateTimeFormatOptions,
48937
+ defaultFormats = _ref.defaultFormats,
48938
+ goalLineAttributes = _ref.goalLineAttributes,
48939
+ nullValue = _ref.nullValue,
48940
+ numberFormatOptions = _ref.numberFormatOptions,
48941
+ order = _ref.order,
48942
+ pivotConfig = _ref.pivotConfig,
48943
+ result = _ref.result,
48944
+ xAxisFormat = _ref.xAxisFormat,
48945
+ xAxisPostfix = _ref.xAxisPostfix,
48946
+ xAxisPrefix = _ref.xAxisPrefix,
48947
+ yAxisFormat = _ref.yAxisFormat,
48948
+ yAxisPostfix = _ref.yAxisPostfix,
48949
+ yAxisPrefix = _ref.yAxisPrefix,
48950
+ approxYAxisLabelCount = _ref.approxYAxisLabelCount,
48951
+ seriesLabelFormatter = _ref.seriesLabelFormatter,
48952
+ _valueAlias = _ref.valueAlias,
48953
+ stacked = _ref.stacked;
48954
+ var activeDateTimeFormats = {};
48955
+ var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
48956
+ allPrefixes = _buildFieldFormatMaps.allPrefixes,
48957
+ allPostfixes = _buildFieldFormatMaps.allPostfixes,
48958
+ nullValues = _buildFieldFormatMaps.nullValues,
48959
+ activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
48960
+
48961
+ // Build params for the result formatter.
48962
+ var params = {
48963
+ defaultFormats: defaultFormats,
48964
+ dateTimeFormatOptions: dateTimeFormatOptions,
48965
+ numberFormatOptions: numberFormatOptions,
48966
+ valueAlias: function valueAlias(params) {
48967
+ if (typeof _valueAlias === 'function') {
48968
+ // TODO; it is more useful providing this information separate,
48969
+ // rather than building it into an ID and returning it. Ideally all would be returned
48970
+ return String(_valueAlias({
48971
+ fieldId: id({
48972
+ field: params.fieldId,
48973
+ "function": params["function"]
48974
+ }),
48975
+ value: params.value
48976
+ }));
48977
+ }
48978
+ return undefined;
48979
+ },
48980
+ nullValue: nullValues,
48981
+ prefixes: allPrefixes,
48982
+ postfixes: allPostfixes,
48983
+ activeNumberFormats: activeNumberFormats,
48984
+ activeDateTimeFormats: activeDateTimeFormats
48985
+ };
48986
+ var formattedResult = formatResult(result, params);
48987
+
48988
+ // --------------------------------------------
48989
+ // --------------------------------------------
48990
+ // --------------------------------------------
48991
+ // --------------------------------------------
48992
+ // --------------------------------------------
48993
+ // --------------------------------------------
48994
+ // --------------------------------------------
48995
+ // --------------------------------------------
48996
+
48997
+ // ----- xKey -----
48998
+
48999
+ var xKeyField = getXKeyField(pivotConfig, result.fields);
49000
+
49001
+ // ----- Formatting ----
49002
+ // (value: any, noValueReplacement?: string) => string;
49003
+ var formattingFunctionY = function formattingFunctionY(value) {
49004
+ // Use any y axis field as they are all formatted in the same way (for now...);
49005
+ var nonPivotField = formattedResult.fields.find(function (resultField) {
49006
+ return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
49007
+ });
49008
+ if (!nonPivotField) return '';
49009
+ return formattedResult.formatterFunc(value, {
49010
+ fieldId: nonPivotField.fieldId,
49011
+ "function": nonPivotField["function"],
49012
+ outputDataType: nonPivotField.outputDataType
49013
+ }).formattedValue;
49014
+ };
49015
+
49016
+ // ----- Keys & Prep -----
49017
+ var xScaleDataType = (xKeyField == null ? void 0 : xKeyField.outputDataType) || 'string';
49018
+ var _formattedResultToSer = formattedResultToSeries(formattedResult, pivotConfig, seriesLabelFormatter),
49019
+ keys = _formattedResultToSer.keys,
49020
+ yKeys = _formattedResultToSer.yKeys,
49021
+ xKeys = _formattedResultToSer.xKeys,
49022
+ chartData = _formattedResultToSer.seriesData;
49023
+ var xKey = (_xKeys$ = xKeys[0]) != null ? _xKeys$ : null;
49024
+ var updatedData = function () {
49025
+ var hasMultipleGroups = result.fields.length > 2;
49026
+ var data = chartData;
49027
+ if (hasMultipleGroups) {
49028
+ data = fillMissingKeysForChartData(chartData);
49029
+ }
49030
+ if (stacked) {
49031
+ data = fillMissingKeysForChartData(data);
49032
+ }
49033
+ return data;
49034
+ }();
49035
+
49036
+ // ----- Goal Lines -----
49037
+
49038
+ var goalLines = getGoalLines({
49039
+ goalLineAttributes: goalLineAttributes,
49040
+ formattingFunctionY: formattingFunctionY
49041
+ });
49042
+
49043
+ // ----- Ticks -----
49044
+
49045
+ var ticks = getScaleAndTicks({
49046
+ data: updatedData,
49047
+ xKey: xKey,
49048
+ xScaleDataType: xScaleDataType,
49049
+ yKeys: yKeys,
49050
+ tickCountYAxis: approxYAxisLabelCount,
49051
+ formattingFunctionX: function formattingFunctionX$1(value) {
49052
+ return formattingFunctionX(value, formattedResult, xKeyField);
49053
+ },
49054
+ formattingFunctionY: formattingFunctionY,
49055
+ nullValue: nullValue,
49056
+ order: order,
49057
+ goalLines: goalLines
49058
+ });
49059
+
49060
+ // ----- Lines -----
49061
+
49062
+ var styleDefinition = getStyleDefinition({
49063
+ colors: colors,
49064
+ yKeys: yKeys,
49065
+ style: {
49066
+ toOpacity: 0.5,
49067
+ fromOpacity: 0.9,
49068
+ type: 'area'
49069
+ }
49070
+ });
49071
+
49072
+ // ----- Conditional Formatting -----
49073
+
49074
+ var conditionalFormattingRules = getConditionalFormatting({
49075
+ conditionalFormattingAttributes: conditionalFormattingAttributes
49076
+ });
49077
+ var chart = {
49078
+ keys: keys,
49079
+ x: {
49080
+ ticks: ticks.x.ticks,
49081
+ scale: {
49082
+ dataType: ticks.x.scale.dataType,
49083
+ key: ticks.x.scale.key,
49084
+ ordering: ticks.x.scale.ordering,
49085
+ min: ticks.x.scale.min,
49086
+ max: ticks.x.scale.max
49087
+ },
49088
+ key: xKey,
49089
+ postfix: xAxisPostfix,
49090
+ prefix: xAxisPrefix,
49091
+ title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null
49092
+ },
49093
+ y: {
49094
+ ticks: ticks.y.ticks,
49095
+ scale: {
49096
+ dataType: ticks.y.scale.dataType,
49097
+ key: ticks.y.scale.key,
49098
+ ordering: ticks.y.scale.ordering,
49099
+ min: ticks.y.scale.min,
49100
+ max: ticks.y.scale.max
49101
+ },
49102
+ keys: yKeys,
49103
+ postfix: yAxisPostfix,
49104
+ prefix: yAxisPrefix,
49105
+ title: (_axisTitles$y = axisTitles == null ? void 0 : axisTitles.y) != null ? _axisTitles$y : null
49106
+ },
49107
+ data: updatedData,
49108
+ areas: styleDefinition,
49109
+ conditionalFormattingRules: conditionalFormattingRules,
49110
+ goalLines: goalLines
49111
+ };
49112
+ return chart;
49113
+ };
49114
+
49115
+ var AreaChartV2View = function AreaChartV2View(props) {
49116
+ var _props$library, _props$attributes$vie;
49117
+ var _useDashboardBehaviou = useDashboardBehaviourContext(),
49118
+ textOverride = _useDashboardBehaviou.textOverride,
49119
+ valueAlias = _useDashboardBehaviou.valueAlias,
49120
+ labelFormat = _useDashboardBehaviou.labelFormat,
49121
+ queryEngineConfig = _useDashboardBehaviou.queryEngineConfig;
49122
+ var headerProps = {
49123
+ displayTitle: props.attributes.displayTitle,
49124
+ displaySubject: props.attributes.displaySubject,
49125
+ verified: props.attributes.protectedByOrganisation,
49126
+ library: (_props$library = props.library) != null ? _props$library : false,
49127
+ localFilters: props.localFilters,
49128
+ setLocalFilters: props.setLocalFilters,
49129
+ dataSet: props.dataSet,
49130
+ parameters: props == null ? void 0 : props.attributes.parameters,
49131
+ componentType: props == null ? void 0 : props.attributes.type,
49132
+ measure: props == null ? void 0 : props.attributes.measure,
49133
+ dimension: props == null ? void 0 : props.attributes.dimension,
49134
+ timeDimension: props.attributes.timeDimension,
49135
+ setPartialAttributes: props.setPartialAttributes,
49136
+ viewId: (_props$attributes$vie = props == null ? void 0 : props.attributes.viewId) != null ? _props$attributes$vie : '',
49137
+ order: props.attributes.order
49138
+ };
49139
+ var showHeadline = headlineAvailable(props.attributes.order, props.attributes.headline, null);
49140
+ var theme = useTheme();
49141
+ var AreaChartV2Component = getComponentInterface(props.attributes.type);
49142
+ var pivotConfig = init$c(props.attributes);
49143
+ var chartRepresentation = null;
49144
+ if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && AreaChartV2Component.isRunnable(props.attributes)) {
49145
+ var _theme$charts$colors, _theme$charts, _props$attributes$goa;
49146
+ chartRepresentation = buildAreaChartRepresentation({
49147
+ axisTitles: props.attributes.axisTitles,
49148
+ xAxisPostfix: props.attributes.xAxisPostfix,
49149
+ xAxisPrefix: props.attributes.xAxisPrefix,
49150
+ yAxisPostfix: props.attributes.yAxisPostfix,
49151
+ yAxisPrefix: props.attributes.yAxisPrefix,
49152
+ yAxisFormat: props.attributes.yAxisFormat,
49153
+ xAxisFormat: props.attributes.xAxisFormat,
49154
+ approxYAxisLabelCount: props.attributes.approxYAxisLabelCount === 'auto' ? 10 : props.attributes.approxYAxisLabelCount,
49155
+ colors: (_theme$charts$colors = theme == null || (_theme$charts = theme.charts) == null ? void 0 : _theme$charts.colors) != null ? _theme$charts$colors : DEFAULT_CHART_COLORS,
49156
+ valueAlias: valueAlias,
49157
+ nullValue: checkForNullValue(props.attributes.dataSetId, props.attributes.dimension, props.attributes.timeDimension, textOverride, valueAlias),
49158
+ result: props.result,
49159
+ pivotConfig: pivotConfig,
49160
+ order: props.attributes.order,
49161
+ numberFormatOptions: props.numberFormatOptions,
49162
+ dateTimeFormatOptions: props.dateTimeFormatOptions,
49163
+ goalLineAttributes: (_props$attributes$goa = props.attributes.goalLines) != null ? _props$attributes$goa : [],
49164
+ conditionalFormattingAttributes: props.attributes.conditionalFormattingRules,
49165
+ defaultFormats: props.defaultFormats,
49166
+ seriesLabelFormatter: function seriesLabelFormatter(labelFormatParams) {
49167
+ var _queryEngineConfig$su, _queryEngineConfig$su2, _queryEngineConfig$su3;
49168
+ var yResultField = labelFormatParams.yResultField,
49169
+ yPivotFields = labelFormatParams.yPivotFields,
49170
+ row = labelFormatParams.row;
49171
+ var formattedFunctionName = ((_queryEngineConfig$su = queryEngineConfig.supportedAggregates[yResultField["function"]]) == null ? void 0 : _queryEngineConfig$su.publicName) || ((_queryEngineConfig$su2 = queryEngineConfig.supportedTimeTruncFunctions[yResultField["function"]]) == null ? void 0 : _queryEngineConfig$su2.publicName) || ((_queryEngineConfig$su3 = queryEngineConfig.supportedTransformationFunctions[yResultField["function"]]) == null ? void 0 : _queryEngineConfig$su3.publicName);
49172
+ var formattedFunction = yResultField["function"] === 'none' ? '' : " \u2022 " + formattedFunctionName;
49173
+ var defaultLabelFormat = "" + yPivotFields.map(function (field) {
49174
+ return row[field.id].formattedValue;
49175
+ }).join(' • ') + (yPivotFields.length === 0 ? '' : ' • ') + yResultField.publicName + formattedFunction;
49176
+ if (!labelFormat) return defaultLabelFormat;
49177
+ return labelFormat({
49178
+ viewId: props.attributes.viewId,
49179
+ fieldId: yResultField.fieldId,
49180
+ func: yResultField["function"],
49181
+ type: 'areaChartV2',
49182
+ defaultLabel: defaultLabelFormat
49183
+ }) || defaultLabelFormat;
49184
+ },
49185
+ stacked: props.attributes.stacked
49186
+ });
49187
+ }
49188
+
49189
+ // When these are triggered they don't render the chart after they're resolved, potentially because component did no re-render?
49190
+ if (!AreaChartV2Component.isRunnable(props.attributes)) {
49191
+ return jsxRuntime.jsx(QueryUnderConstructionNotice, {
49192
+ title: "Missing parameters"
49193
+ });
49194
+ }
49195
+ if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
49196
+ if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
49197
+ if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
49198
+ return jsxRuntime.jsx(React.Suspense, {
49199
+ fallback: jsxRuntime.jsx(LoadingComponent, {}),
49200
+ children: jsxRuntime.jsxs(ViewWrapper, {
49201
+ id: props.id,
49202
+ queriesAreChanging: props.queriesAreChanging,
49203
+ children: [jsxRuntime.jsx(ViewHeader, _extends({}, headerProps, {
49204
+ paddingBottom: showHeadline ? '0.5rem' : undefined
49205
+ })), showHeadline && jsxRuntime.jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsxRuntime.jsx("div", {
49206
+ className: styles({
49207
+ flex: '1',
49208
+ position: 'relative'
49209
+ }),
49210
+ "aria-disabled": props.library,
49211
+ children: chartRepresentation && jsxRuntime.jsx(responsive.ParentSize, {
49212
+ style: {
49213
+ position: 'absolute',
49214
+ width: '100%',
49215
+ height: '100%',
49216
+ overflowX: 'hidden'
49217
+ },
49218
+ children: function children(parent) {
49219
+ var _props$attributes$vie2, _props$attributes$sta;
49220
+ if (chartRepresentation.areas.length === 0) return jsxRuntime.jsx(LoadingComponent, {});
49221
+ return jsxRuntime.jsx(v2.AreaChartV2, {
49222
+ width: parent.width,
49223
+ height: parent.height,
49224
+ chart: adjustTicks(chartRepresentation, parent.width, parent.height),
49225
+ uniqueId: (_props$attributes$vie2 = props.attributes.viewId) != null ? _props$attributes$vie2 : 'area-chart',
49226
+ options: {
49227
+ stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
49228
+ curve: props.attributes.lineCurve,
49229
+ removeStroke: false,
49230
+ showRoundedTotal: false,
49231
+ showLegend: props.attributes.legend,
49232
+ axis: {
49233
+ showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
49234
+ showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
49235
+ }
49236
+ },
49237
+ theme: theme == null ? void 0 : theme.charts
49238
+ });
49239
+ }
49240
+ })
49241
+ })]
49242
+ })
49243
+ });
49244
+ };
49245
+
49246
+ var AreaChartV2 = function AreaChartV2(props) {
49247
+ var _props$component = props.component,
49248
+ results = _props$component.results,
49249
+ attributes = _props$component.attributes,
49250
+ localFilters = _props$component.localFilters;
49251
+ var dashboardBehaviour = props.dashboardBehaviour;
49252
+ var _useComponentEffect = useComponentEffect(attributes, props.dataSet, dashboardBehaviour.queryEngineConfig, {
49253
+ localFilters: localFilters,
49254
+ globalFilters: props.globalFilters
49255
+ }, props.updateComponentAttributes, props.runQueriesCallback, props.setResults, dashboardBehaviour.variables),
49256
+ queriesAreChanging = _useComponentEffect.queriesAreChanging;
49257
+ return jsxRuntime.jsx(AreaChartV2View, {
49258
+ id: props.id,
49259
+ attributes: attributes,
49260
+ dataSet: props.dataSet,
49261
+ localFilters: props.component.localFilters,
49262
+ setLocalFilters: props.setLocalFilters,
49263
+ setPartialAttributes: function setPartialAttributes(changes) {
49264
+ return props.setPartialAttributes(changes);
49265
+ },
49266
+ result: results && results[0],
49267
+ queriesAreChanging: queriesAreChanging,
49268
+ numberFormatOptions: dashboardBehaviour.numberFormatOptions,
49269
+ dateTimeFormatOptions: dashboardBehaviour.dateTimeFormatOptions,
49270
+ defaultFormats: dashboardBehaviour.defaultFormats,
49271
+ propsForHeadline: props,
49272
+ idPrefix: props.idPrefix,
49273
+ library: props == null ? void 0 : props.library
49274
+ });
49275
+ };
49276
+
48694
49277
  var Component = function Component(props) {
48695
49278
  var _useDashboardContext = useDashboardContext(),
48696
49279
  dashboard = _useDashboardContext.dashboard;
@@ -48833,7 +49416,7 @@ var Component = function Component(props) {
48833
49416
  });
48834
49417
  },
48835
49418
  onError: dashboardBehaviour.onError,
48836
- children: jsxRuntime.jsx(AreaChart$3, {
49419
+ children: jsxRuntime.jsx(AreaChart$4, {
48837
49420
  id: props.id,
48838
49421
  setLocalFilters: props.setLocalFilters,
48839
49422
  dataSet: dataSet,
@@ -48931,6 +49514,32 @@ var Component = function Component(props) {
48931
49514
  })
48932
49515
  });
48933
49516
  }
49517
+ if (props.component.attributes.type == 'areaChartV2') {
49518
+ return jsxRuntime.jsx(ErrorBoundary, {
49519
+ renderOnError: function renderOnError(onManualRetry) {
49520
+ return jsxRuntime.jsx(ComponentErrorNotice, {
49521
+ onManualRetry: onManualRetry
49522
+ });
49523
+ },
49524
+ onError: dashboardBehaviour.onError,
49525
+ children: jsxRuntime.jsx(AreaChartV2, {
49526
+ id: props.id,
49527
+ setLocalFilters: props.setLocalFilters,
49528
+ dataSet: dataSet,
49529
+ updateComponentAttributes: function updateComponentAttributes(newAttributes) {
49530
+ return _updateComponentAttributes(newAttributes);
49531
+ },
49532
+ runQueriesCallback: props.runQueriesCallback,
49533
+ component: props.component,
49534
+ setResults: props.setResults,
49535
+ globalFilters: dashboard.globalFilters,
49536
+ dashboardBehaviour: dashboardBehaviour,
49537
+ library: props == null ? void 0 : props.library,
49538
+ idPrefix: idPrefix,
49539
+ setPartialAttributes: setPartialAttributes
49540
+ })
49541
+ });
49542
+ }
48934
49543
  if (props.component.attributes.type == 'pieChart') {
48935
49544
  return jsxRuntime.jsx(ErrorBoundary, {
48936
49545
  renderOnError: function renderOnError(onManualRetry) {
@@ -65343,7 +65952,7 @@ var View$3 = /*#__PURE__*/function () {
65343
65952
  };
65344
65953
  return View;
65345
65954
  }();
65346
- var AreaChart$4 = /*#__PURE__*/function (_View2) {
65955
+ var AreaChart$5 = /*#__PURE__*/function (_View2) {
65347
65956
  function AreaChart(attributes) {
65348
65957
  return _View2.call(this, _extends({}, attributes, {
65349
65958
  type: 'areaChart'
@@ -65712,6 +66321,8 @@ var toQueries$9 = commonToQueries;
65712
66321
 
65713
66322
  var toQueries$a = commonToQueries;
65714
66323
 
66324
+ var toQueries$b = commonToQueries;
66325
+
65715
66326
  var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngineConfig, params) {
65716
66327
  var line = build$a(dataSet, attributes.lineMeasure, attributes.order, attributes.lineDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
65717
66328
  var bar = build$a(dataSet, attributes.barMeasure, attributes.order, attributes.barDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
@@ -65720,7 +66331,7 @@ var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngin
65720
66331
  line: line
65721
66332
  };
65722
66333
  };
65723
- var toQueries$b = function toQueries(attributes, dataSet, queryEngineConfig, params) {
66334
+ var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, params) {
65724
66335
  var _buildMainQueries = buildMainQueries(attributes, dataSet, queryEngineConfig, params),
65725
66336
  line = _buildMainQueries.line,
65726
66337
  bar = _buildMainQueries.bar;
@@ -65778,7 +66389,7 @@ var buildQueries = function buildQueries(attributes, dataSet, queryEngineConfig,
65778
66389
  measureDescription: deltaQuery ? [mainQuery.measureDescription, deltaQuery.measureDescription] : [mainQuery.measureDescription]
65779
66390
  };
65780
66391
  };
65781
- var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, params) {
66392
+ var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, params) {
65782
66393
  var _buildQueries = buildQueries(attributes, dataSet, queryEngineConfig, params),
65783
66394
  queries = _buildQueries.queries,
65784
66395
  measureDescription = _buildQueries.measureDescription;
@@ -65789,7 +66400,7 @@ var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, par
65789
66400
  };
65790
66401
  };
65791
66402
 
65792
- var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, params) {
66403
+ var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, params) {
65793
66404
  var measures = [];
65794
66405
  attributes.xMeasure && measures.push(attributes.xMeasure);
65795
66406
  attributes.yMeasure && measures.push(attributes.yMeasure);
@@ -65803,7 +66414,7 @@ var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, par
65803
66414
  };
65804
66415
  };
65805
66416
 
65806
- var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, params) {
66417
+ var toQueries$f = function toQueries(attributes, dataSet, queryEngineConfig, params) {
65807
66418
  var measures = [];
65808
66419
  attributes.xMeasure && measures.push(attributes.xMeasure);
65809
66420
  attributes.yMeasure && measures.push(attributes.yMeasure);
@@ -65817,7 +66428,7 @@ var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, par
65817
66428
  };
65818
66429
  };
65819
66430
 
65820
- var toQueries$f = function toQueries$1(attributes, dataSet, queryEngineConfig, params) {
66431
+ var toQueries$g = function toQueries$1(attributes, dataSet, queryEngineConfig, params) {
65821
66432
  return toQueries([dataSet], [{
65822
66433
  measure: attributes.measure,
65823
66434
  dataSetId: dataSet.id,
@@ -65829,12 +66440,12 @@ var toQueries$f = function toQueries$1(attributes, dataSet, queryEngineConfig, p
65829
66440
  }], queryEngineConfig, params);
65830
66441
  };
65831
66442
 
65832
- var toQueries$g = commonToQueries;
65833
-
65834
66443
  var toQueries$h = commonToQueries;
65835
66444
 
65836
66445
  var toQueries$i = commonToQueries;
65837
66446
 
66447
+ var toQueries$j = commonToQueries;
66448
+
65838
66449
  var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet, queryEngineConfig, params) {
65839
66450
  switch (attributes.type) {
65840
66451
  case 'areaChart':
@@ -65849,30 +66460,32 @@ var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet
65849
66460
  return toQueries$6(attributes, dataSet, queryEngineConfig, params);
65850
66461
  case 'lineChartV2':
65851
66462
  return toQueries$7(attributes, dataSet, queryEngineConfig, params);
65852
- case 'pieChart':
66463
+ case 'areaChartV2':
65853
66464
  return toQueries$8(attributes, dataSet, queryEngineConfig, params);
65854
- case 'dataTable':
66465
+ case 'pieChart':
65855
66466
  return toQueries$9(attributes, dataSet, queryEngineConfig, params);
65856
- case 'basicTable':
66467
+ case 'dataTable':
65857
66468
  return toQueries$a(attributes, dataSet, queryEngineConfig, params);
65858
- case 'comboChart':
66469
+ case 'basicTable':
65859
66470
  return toQueries$b(attributes, dataSet, queryEngineConfig, params);
65860
- case 'singleStat':
66471
+ case 'comboChart':
65861
66472
  return toQueries$c(attributes, dataSet, queryEngineConfig, params);
66473
+ case 'singleStat':
66474
+ return toQueries$d(attributes, dataSet, queryEngineConfig, params);
65862
66475
  case 'progress':
65863
- return toQueries$c(attributes, dataSet, queryEngineConfig, params);
65864
- case 'scatterChart':
65865
66476
  return toQueries$d(attributes, dataSet, queryEngineConfig, params);
65866
- case 'bubbleChart':
66477
+ case 'scatterChart':
65867
66478
  return toQueries$e(attributes, dataSet, queryEngineConfig, params);
65868
- case 'mercatorMap':
66479
+ case 'bubbleChart':
65869
66480
  return toQueries$f(attributes, dataSet, queryEngineConfig, params);
65870
- case 'funnelChart':
66481
+ case 'mercatorMap':
65871
66482
  return toQueries$g(attributes, dataSet, queryEngineConfig, params);
65872
- case 'richText':
66483
+ case 'funnelChart':
65873
66484
  return toQueries$h(attributes, dataSet, queryEngineConfig, params);
65874
- case 'waterfallChart':
66485
+ case 'richText':
65875
66486
  return toQueries$i(attributes, dataSet, queryEngineConfig, params);
66487
+ case 'waterfallChart':
66488
+ return toQueries$j(attributes, dataSet, queryEngineConfig, params);
65876
66489
  default:
65877
66490
  throw 'Unsupported view when building query.';
65878
66491
  }
@@ -67420,7 +68033,7 @@ VizzlyServices.Dashboard = Dashboard$1;
67420
68033
  VizzlyServices.Editor = Editor;
67421
68034
  VizzlyServices.Header = Header;
67422
68035
  VizzlyServices.Library = Library$1;
67423
- VizzlyServices.AreaChart = AreaChart$4;
68036
+ VizzlyServices.AreaChart = AreaChart$5;
67424
68037
  VizzlyServices.LineChart = LineChart$6;
67425
68038
  VizzlyServices.BarChart = BarChart$6;
67426
68039
  VizzlyServices.PieChart = PieChart$4;
@@ -68744,7 +69357,8 @@ var attributesToAiView = function attributesToAiView(dataSet, originalAttributes
68744
69357
  if (attributes.type === 'richText') throw 'Rich text views are not supported by Vizzly AI.';
68745
69358
  if (attributes.type === 'lineChartV2') throw 'Line Chart V2 views are not supported by Vizzly AI.';
68746
69359
  if (attributes.type === 'bubbleChart') throw 'Bubble Chart views are not supported by Vizzly AI.';
68747
- if (attributes.type === 'barChartV2') throw 'Line Chart V2 views are not supported by Vizzly AI.';
69360
+ if (attributes.type === 'barChartV2') throw 'Bar Chart V2 views are not supported by Vizzly AI.';
69361
+ if (attributes.type === 'areaChartV2') throw 'Area Chart V2 views are not supported by Vizzly AI.';
68748
69362
  if (attributes.type === 'waterfallChart') throw 'Waterfall chart views are not supported by Vizzly AI.';
68749
69363
  var select = [];
68750
69364
  var group = [];