@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.
- package/dist/charts/src/v2/components/WaterfallChart/WaterfallChart.d.ts +3 -2
- package/dist/charts/src/v2/index.d.ts +1 -0
- package/dist/dashboard/src/contexts/GlobalProvider/useGlobalProvider.d.ts +6 -6
- package/dist/dashboard.cjs.development.js +1194 -580
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +1194 -580
- package/dist/results-driver/src/driver/VizzlyQuery/AreaChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/BarChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/BarChartV2/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/BarChartV2 copy/toQueries.d.ts +4 -0
- package/dist/results-driver/src/driver/VizzlyQuery/BasicTable/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/FunnelChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/HorizontalBarChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/LineChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/LineChartV2/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/PieChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/PivotTable/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/RichText/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/WaterfallChart/toQueries.d.ts +1 -1
- package/dist/results-driver/src/driver/VizzlyQuery/commonToQueries.d.ts +1 -1
- package/dist/shared-logic/src/AreaChartV2/attributesSchema.d.ts +3 -0
- package/dist/shared-logic/src/AreaChartV2/buildAreaChartRepresentation.d.ts +40 -0
- package/dist/shared-logic/src/AreaChartV2/constants.d.ts +3 -0
- package/dist/shared-logic/src/AreaChartV2/index.d.ts +4 -0
- package/dist/shared-logic/src/AreaChartV2/setAttributes.d.ts +4 -0
- package/dist/shared-logic/src/AreaChartV2/types.d.ts +1 -1
- package/dist/shared-logic/src/ChartsV2/adjustTicks.d.ts +3 -0
- package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/buildTrendAndForecast.d.ts +1 -1
- package/dist/shared-logic/src/ChartsV2/formattingFunctionAxis.d.ts +2 -0
- package/dist/shared-logic/src/{BarChartV2/getMinAndMax.d.ts → ChartsV2/getStackedMinAndMax.d.ts} +1 -1
- package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/getTrendsAndForecastsData.d.ts +1 -1
- package/dist/shared-logic/src/ChartsV2/types.d.ts +4 -3
- package/dist/shared-logic/src/Component/setAttributes.d.ts +1 -1
- package/dist/shared-logic/src/Component/sharedSchemas.d.ts +1 -0
- package/dist/shared-logic/src/Component/types.d.ts +26 -4
- package/dist/shared-logic/src/DataSet/DataSet.d.ts +1 -1
- package/dist/shared-logic/src/WaterfallChart/buildWaterfallChartRepresentation.d.ts +7 -2
- package/dist/shared-logic/src/WaterfallChart/getRepresentationData.d.ts +19 -0
- package/dist/shared-logic/src/WaterfallChart/getYTicks.d.ts +8 -0
- package/dist/shared-logic/src/WaterfallChart/types.d.ts +5 -15
- package/dist/shared-logic/src/getComponentInterface.d.ts +1 -0
- package/dist/shared-ui/src/api/useQueryEffect.d.ts +1 -1
- package/dist/shared-ui/src/components/AreaChartV2/AreaChartV2.d.ts +3 -0
- package/dist/shared-ui/src/components/AreaChartV2/AreaChartV2View.d.ts +17 -0
- package/dist/shared-ui/src/components/AreaChartV2/index.d.ts +2 -0
- package/dist/shared-ui/src/components/Component/types.d.ts +1 -0
- package/dist/shared-ui/src/components/HeadlineStats/HeadlineStats.d.ts +2 -2
- package/dist/shared-ui/src/components/LineChart/LineChartView.d.ts +1 -1
- package/dist/shared-ui/src/components/MercatorMap/View.d.ts +1 -1
- package/package.json +1 -1
- package/dist/shared-logic/src/BarChartV2/adjustTicks.d.ts +0 -3
- package/dist/shared-logic/src/LineChartV2/adjustTicks.d.ts +0 -3
- /package/dist/shared-logic/src/{BarChartV2 → ChartsV2}/fillMissingKeysForChartData.d.ts +0 -0
- /package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/getMinAndMax.d.ts +0 -0
- /package/dist/shared-logic/src/{LineChartV2 → ChartsV2}/getScaleAndTicks.d.ts +0 -0
- /package/dist/shared-logic/src/{BarChartV2/getScaleAndTicks.d.ts → ChartsV2/getStackedScaleAndTicks.d.ts} +0 -0
package/dist/dashboard.esm.js
CHANGED
|
@@ -55,6 +55,7 @@ import { AxisBottom as AxisBottom$1, AxisLeft as AxisLeft$1 } from '@visx/axis';
|
|
|
55
55
|
import { Text } from '@visx/text';
|
|
56
56
|
import { GridRows as GridRows$1 } from '@visx/grid';
|
|
57
57
|
import '@visx/point';
|
|
58
|
+
import { AreaChartV2 as AreaChartV2$1 } from './charts/src/v2';
|
|
58
59
|
import VisibilitySensor from 'react-visibility-sensor';
|
|
59
60
|
import ExcelJS from 'exceljs';
|
|
60
61
|
import { saveAs } from 'file-saver';
|
|
@@ -2722,6 +2723,7 @@ var timeDimensionQuerySchema = function timeDimensionQuerySchema(queryEngineConf
|
|
|
2722
2723
|
});
|
|
2723
2724
|
};
|
|
2724
2725
|
var lineCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step', 'stepBefore', 'stepAfter', 'dotted');
|
|
2726
|
+
var areaCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step');
|
|
2725
2727
|
var protectedFieldsMeasure = function protectedFieldsMeasure(queryEngineConfig) {
|
|
2726
2728
|
var _Joi$string6;
|
|
2727
2729
|
return Joi.array().items(Joi.object({
|
|
@@ -8162,7 +8164,7 @@ var RichText = function RichText(config) {
|
|
|
8162
8164
|
};
|
|
8163
8165
|
};
|
|
8164
8166
|
|
|
8165
|
-
var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
|
|
8167
|
+
var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'areaChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
|
|
8166
8168
|
/** @deprecated */
|
|
8167
8169
|
|
|
8168
8170
|
var ProgressType = /*#__PURE__*/function (ProgressType) {
|
|
@@ -8959,7 +8961,6 @@ var attributesSchema$e = function attributesSchema(config) {
|
|
|
8959
8961
|
var setAttributes$d = (function (config) {
|
|
8960
8962
|
return function (bubbleChart, partial) {
|
|
8961
8963
|
var newAttributes = setAttributes(bubbleChart, partial, attributesSchema$e(config));
|
|
8962
|
-
console.log(newAttributes, 'HERE');
|
|
8963
8964
|
var allowedOrderSpec = [];
|
|
8964
8965
|
if (newAttributes.xMeasure) {
|
|
8965
8966
|
allowedOrderSpec.push(newAttributes.xMeasure);
|
|
@@ -10010,6 +10011,379 @@ var WaterfallChart = function WaterfallChart(config) {
|
|
|
10010
10011
|
};
|
|
10011
10012
|
};
|
|
10012
10013
|
|
|
10014
|
+
var attributesSchema$h = function attributesSchema(config) {
|
|
10015
|
+
return Joi.object(_extends({}, baseAttributesSchema(config.attributesSchemaOptions), timeDimensionQuerySchema(config.queryEngineConfig, config.attributesSchemaOptions), {
|
|
10016
|
+
stacked: Joi.valid(true, false),
|
|
10017
|
+
legend: Joi.valid(true, false),
|
|
10018
|
+
type: Joi.valid('areaChartV2').required(),
|
|
10019
|
+
parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
|
|
10020
|
+
lineCurve: areaCurveSchema,
|
|
10021
|
+
conditionalFormattingRules: conditionalFormattingRulesSchema(config.queryEngineConfig),
|
|
10022
|
+
goalLines: goalLinesSchema(),
|
|
10023
|
+
axisTitles: axisTitleSchema(),
|
|
10024
|
+
headline: headlineSchema(),
|
|
10025
|
+
tags: tagsSchema(),
|
|
10026
|
+
trends: trendsSchema()
|
|
10027
|
+
}));
|
|
10028
|
+
};
|
|
10029
|
+
|
|
10030
|
+
var setAttributes$g = (function (config) {
|
|
10031
|
+
return function (lineChart, partial) {
|
|
10032
|
+
var newAttributes = setAttributes(lineChart, partial, attributesSchema$h(config));
|
|
10033
|
+
newAttributes = removeUnusedOrderFieldsFromTimeSeriesComponent(newAttributes);
|
|
10034
|
+
return newAttributes;
|
|
10035
|
+
};
|
|
10036
|
+
});
|
|
10037
|
+
|
|
10038
|
+
var CONSTANTS$j = {
|
|
10039
|
+
title: 'Area chart',
|
|
10040
|
+
description: 'Ideal for illustrating changes and trends over time with area graphs.',
|
|
10041
|
+
namespace: 'area_chart',
|
|
10042
|
+
data_panel: {
|
|
10043
|
+
data_set: {
|
|
10044
|
+
type: 'dataSet',
|
|
10045
|
+
title: 'Data set',
|
|
10046
|
+
description: 'What data do you want to use in this area chart?'
|
|
10047
|
+
},
|
|
10048
|
+
views: {
|
|
10049
|
+
type: 'views',
|
|
10050
|
+
title: 'View',
|
|
10051
|
+
description: ''
|
|
10052
|
+
},
|
|
10053
|
+
field_y_axis: {
|
|
10054
|
+
type: 'fieldCollector',
|
|
10055
|
+
title: 'Metric - Y Axis',
|
|
10056
|
+
description: 'What do you want each area to measure?',
|
|
10057
|
+
callToAction: 'Add metric'
|
|
10058
|
+
},
|
|
10059
|
+
drilldown: {
|
|
10060
|
+
type: 'drilldown',
|
|
10061
|
+
title: 'Drilldown',
|
|
10062
|
+
description: 'After clicking on a segment of this area chart, what information do you want to see next?'
|
|
10063
|
+
},
|
|
10064
|
+
field_x_axis: {
|
|
10065
|
+
type: 'fieldCollector',
|
|
10066
|
+
title: 'Grouping - X Axis',
|
|
10067
|
+
description: 'What do you want each area to represent? An example might be a `product category` field to represent each category as a area.',
|
|
10068
|
+
callToAction: 'Add grouping'
|
|
10069
|
+
},
|
|
10070
|
+
sort: {
|
|
10071
|
+
type: 'sort',
|
|
10072
|
+
title: 'Sort',
|
|
10073
|
+
description: 'Select the order of categories or time on the x Axis.'
|
|
10074
|
+
},
|
|
10075
|
+
filter: {
|
|
10076
|
+
type: 'filter',
|
|
10077
|
+
title: 'Filters',
|
|
10078
|
+
description: 'Only include the information you want to use in this area chart.'
|
|
10079
|
+
},
|
|
10080
|
+
custom_metrics: {
|
|
10081
|
+
type: 'customMetrics',
|
|
10082
|
+
title: 'Custom metrics',
|
|
10083
|
+
description: 'Build your own metrics, such as a percentage.'
|
|
10084
|
+
},
|
|
10085
|
+
limit: {
|
|
10086
|
+
type: 'limit',
|
|
10087
|
+
title: 'Limit',
|
|
10088
|
+
description: 'Set the maximum number of records to show on this area chart.'
|
|
10089
|
+
}
|
|
10090
|
+
},
|
|
10091
|
+
format_panel: {
|
|
10092
|
+
heading: {
|
|
10093
|
+
type: 'heading',
|
|
10094
|
+
title: 'Heading',
|
|
10095
|
+
description: '',
|
|
10096
|
+
subSectionDefinition: {
|
|
10097
|
+
title: {
|
|
10098
|
+
type: 'title',
|
|
10099
|
+
title: 'Title',
|
|
10100
|
+
description: '',
|
|
10101
|
+
namespace: 'title'
|
|
10102
|
+
},
|
|
10103
|
+
subject: {
|
|
10104
|
+
title: 'Subject',
|
|
10105
|
+
type: 'subject',
|
|
10106
|
+
description: '',
|
|
10107
|
+
namespace: 'subject'
|
|
10108
|
+
}
|
|
10109
|
+
}
|
|
10110
|
+
},
|
|
10111
|
+
chart_styles: {
|
|
10112
|
+
type: 'chartStyles',
|
|
10113
|
+
title: 'Chart Settings',
|
|
10114
|
+
description: '',
|
|
10115
|
+
subSectionDefinition: {
|
|
10116
|
+
stacked: {
|
|
10117
|
+
type: 'stacked',
|
|
10118
|
+
title: 'Layout',
|
|
10119
|
+
description: '',
|
|
10120
|
+
namespace: 'stacked'
|
|
10121
|
+
},
|
|
10122
|
+
curve: {
|
|
10123
|
+
type: 'curve',
|
|
10124
|
+
title: 'Area Style',
|
|
10125
|
+
description: '',
|
|
10126
|
+
namespace: 'curve'
|
|
10127
|
+
},
|
|
10128
|
+
legend: {
|
|
10129
|
+
type: 'legend',
|
|
10130
|
+
title: 'Show Legend',
|
|
10131
|
+
description: '',
|
|
10132
|
+
namespace: 'legend'
|
|
10133
|
+
}
|
|
10134
|
+
}
|
|
10135
|
+
},
|
|
10136
|
+
axis_labels: {
|
|
10137
|
+
type: 'axisLabels',
|
|
10138
|
+
title: 'Axis Preferences',
|
|
10139
|
+
description: '',
|
|
10140
|
+
subSectionDefinition: {
|
|
10141
|
+
x: {
|
|
10142
|
+
title: 'X Axis',
|
|
10143
|
+
description: '',
|
|
10144
|
+
namespace: 'x'
|
|
10145
|
+
},
|
|
10146
|
+
'x.prefix': {
|
|
10147
|
+
title: 'Prefix',
|
|
10148
|
+
description: '',
|
|
10149
|
+
namespace: 'x.prefix'
|
|
10150
|
+
},
|
|
10151
|
+
'x.postfix': {
|
|
10152
|
+
title: 'Postfix',
|
|
10153
|
+
description: '',
|
|
10154
|
+
namespace: 'x.postfix'
|
|
10155
|
+
},
|
|
10156
|
+
'x.format': {
|
|
10157
|
+
title: 'Format',
|
|
10158
|
+
description: '',
|
|
10159
|
+
namespace: 'x.format'
|
|
10160
|
+
},
|
|
10161
|
+
'x.count': {
|
|
10162
|
+
title: 'Label count',
|
|
10163
|
+
description: '',
|
|
10164
|
+
namespace: 'x.count'
|
|
10165
|
+
},
|
|
10166
|
+
'x.axis_title': {
|
|
10167
|
+
title: 'Title',
|
|
10168
|
+
description: '',
|
|
10169
|
+
namespace: 'x.axis_title'
|
|
10170
|
+
},
|
|
10171
|
+
y: {
|
|
10172
|
+
title: 'Y Axis',
|
|
10173
|
+
description: '',
|
|
10174
|
+
namespace: 'y'
|
|
10175
|
+
},
|
|
10176
|
+
'y.prefix': {
|
|
10177
|
+
title: 'Prefix',
|
|
10178
|
+
description: '',
|
|
10179
|
+
namespace: 'y.prefix'
|
|
10180
|
+
},
|
|
10181
|
+
'y.postfix': {
|
|
10182
|
+
title: 'Postfix',
|
|
10183
|
+
description: '',
|
|
10184
|
+
namespace: 'y.postfix'
|
|
10185
|
+
},
|
|
10186
|
+
'y.format': {
|
|
10187
|
+
title: 'Format',
|
|
10188
|
+
description: '',
|
|
10189
|
+
namespace: 'y.format'
|
|
10190
|
+
},
|
|
10191
|
+
'y.count': {
|
|
10192
|
+
title: 'Label count',
|
|
10193
|
+
description: '',
|
|
10194
|
+
namespace: 'y.count'
|
|
10195
|
+
},
|
|
10196
|
+
'y.axis_title': {
|
|
10197
|
+
title: 'Title',
|
|
10198
|
+
description: '',
|
|
10199
|
+
namespace: 'y.axis_title'
|
|
10200
|
+
}
|
|
10201
|
+
}
|
|
10202
|
+
},
|
|
10203
|
+
conditional_formatting: {
|
|
10204
|
+
type: 'conditionalFormatting',
|
|
10205
|
+
title: 'Conditional Formatting',
|
|
10206
|
+
description: ''
|
|
10207
|
+
},
|
|
10208
|
+
headline: {
|
|
10209
|
+
type: 'headline',
|
|
10210
|
+
title: 'Headarea',
|
|
10211
|
+
description: ''
|
|
10212
|
+
},
|
|
10213
|
+
trends: {
|
|
10214
|
+
type: 'trends',
|
|
10215
|
+
title: 'Trend lines',
|
|
10216
|
+
description: 'Specify a trend type for the area chart.'
|
|
10217
|
+
},
|
|
10218
|
+
goal_line: {
|
|
10219
|
+
type: 'goalLine',
|
|
10220
|
+
title: 'Goal lines',
|
|
10221
|
+
description: ''
|
|
10222
|
+
}
|
|
10223
|
+
}
|
|
10224
|
+
};
|
|
10225
|
+
|
|
10226
|
+
var AreaChart$1 = function AreaChart(config) {
|
|
10227
|
+
return {
|
|
10228
|
+
title: 'Area chart V2',
|
|
10229
|
+
description: 'Ideal for illustrating changes and trends over time with area graphs.',
|
|
10230
|
+
servicesClass: 'AreaChart',
|
|
10231
|
+
namespace: 'area_chart',
|
|
10232
|
+
dump: function dump(hydrated) {
|
|
10233
|
+
return hydrated;
|
|
10234
|
+
},
|
|
10235
|
+
load: function load(dumped) {
|
|
10236
|
+
var _dumped$tags, _dumped$trends;
|
|
10237
|
+
return {
|
|
10238
|
+
type: dumped.type,
|
|
10239
|
+
measure: upcastMeasure(dumped.measure),
|
|
10240
|
+
order: upcastOrder(dumped.order, dumped.timeDimension),
|
|
10241
|
+
dimension: upcastStringDimensionsToObject(dumped.dimension),
|
|
10242
|
+
// TODO: upcast dumped.timeDimension -> dimension
|
|
10243
|
+
displayTitle: dumped.displayTitle,
|
|
10244
|
+
displaySubject: dumped.displaySubject,
|
|
10245
|
+
protectedByOrganisation: dumped.protectedByOrganisation,
|
|
10246
|
+
viewId: upcastViewId(dumped.viewId),
|
|
10247
|
+
filter: upcastFilter(dumped.filter),
|
|
10248
|
+
dataSetId: dumped.dataSetId,
|
|
10249
|
+
limit: dumped.limit,
|
|
10250
|
+
timeDimension: null,
|
|
10251
|
+
xAxisPostfix: dumped.xAxisPostfix,
|
|
10252
|
+
xAxisPrefix: dumped.xAxisPrefix,
|
|
10253
|
+
yAxisPostfix: dumped.yAxisPostfix,
|
|
10254
|
+
yAxisPrefix: dumped.yAxisPrefix,
|
|
10255
|
+
yAxisFormat: dumped.yAxisFormat,
|
|
10256
|
+
xAxisFormat: dumped.xAxisFormat,
|
|
10257
|
+
lineCurve: dumped.lineCurve,
|
|
10258
|
+
conditionalFormattingRules: upcast$1(config.queryEngineConfig, dumped.conditionalFormattingRules),
|
|
10259
|
+
drilldown: dumped.drilldown,
|
|
10260
|
+
legend: dumped.legend,
|
|
10261
|
+
goalLines: dumped.goalLines,
|
|
10262
|
+
headline: upcastHeadline(dumped.headline, dumped.timeDimension),
|
|
10263
|
+
parameters: upcastParameters(dumped.parameters),
|
|
10264
|
+
approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
|
|
10265
|
+
approxYAxisLabelCount: upcastAxisLabel(dumped.approxYAxisLabelCount),
|
|
10266
|
+
axisTitles: dumped.axisTitles,
|
|
10267
|
+
tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
|
|
10268
|
+
trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
|
|
10269
|
+
stacked: dumped.stacked
|
|
10270
|
+
};
|
|
10271
|
+
},
|
|
10272
|
+
setAttributes: setAttributes$g(config),
|
|
10273
|
+
validate: function validate(attrs, dataSets) {
|
|
10274
|
+
return validateView(attrs, dataSets, config.queryEngineConfig);
|
|
10275
|
+
},
|
|
10276
|
+
init: function init(dataSetId, overrides) {
|
|
10277
|
+
return _extends({
|
|
10278
|
+
type: 'areaChartV2',
|
|
10279
|
+
measure: [],
|
|
10280
|
+
dimension: [],
|
|
10281
|
+
timeDimension: null,
|
|
10282
|
+
displayTitle: '',
|
|
10283
|
+
displaySubject: '',
|
|
10284
|
+
protectedByOrganisation: undefined,
|
|
10285
|
+
viewId: upcastViewId(overrides == null ? void 0 : overrides.viewId),
|
|
10286
|
+
filter: [],
|
|
10287
|
+
order: [],
|
|
10288
|
+
dataSetId: dataSetId,
|
|
10289
|
+
limit: 5000,
|
|
10290
|
+
xAxisPostfix: '',
|
|
10291
|
+
xAxisPrefix: '',
|
|
10292
|
+
yAxisPostfix: '',
|
|
10293
|
+
yAxisPrefix: '',
|
|
10294
|
+
yAxisFormat: null,
|
|
10295
|
+
xAxisFormat: null,
|
|
10296
|
+
lineCurve: 'natural',
|
|
10297
|
+
conditionalFormattingRules: [],
|
|
10298
|
+
drilldown: [],
|
|
10299
|
+
legend: true,
|
|
10300
|
+
goalLines: undefined,
|
|
10301
|
+
approxXAxisLabelCount: 'auto',
|
|
10302
|
+
approxYAxisLabelCount: 'auto',
|
|
10303
|
+
parameters: {},
|
|
10304
|
+
axisTitles: undefined,
|
|
10305
|
+
headline: undefined,
|
|
10306
|
+
tags: [],
|
|
10307
|
+
trends: [],
|
|
10308
|
+
stacked: false
|
|
10309
|
+
}, overrides);
|
|
10310
|
+
},
|
|
10311
|
+
createFeedback: createFeedback,
|
|
10312
|
+
schema: attributesSchema$h(config),
|
|
10313
|
+
removeField: function removeField(attrs, fieldId) {
|
|
10314
|
+
return removeField$1(attrs, fieldId, config.queryEngineConfig);
|
|
10315
|
+
},
|
|
10316
|
+
isRunnable: function isRunnable(hydrated) {
|
|
10317
|
+
return hydrated.measure.length > 0 && hydrated.dimension.length > 0;
|
|
10318
|
+
},
|
|
10319
|
+
autoGenerate: function autoGenerate(dataSet) {
|
|
10320
|
+
var _DataSet$buildQueryAt = buildQueryAttributes(dataSet, config.queryEngineConfig, 'lineChart'),
|
|
10321
|
+
measure = _DataSet$buildQueryAt.measure,
|
|
10322
|
+
dimension = _DataSet$buildQueryAt.dimension;
|
|
10323
|
+
return this.init(dataSet.id, {
|
|
10324
|
+
measure: [measure[0]],
|
|
10325
|
+
dimension: dimension
|
|
10326
|
+
});
|
|
10327
|
+
},
|
|
10328
|
+
dataPanelConfig: function dataPanelConfig() {
|
|
10329
|
+
return [namespace(CONSTANTS$j, 'data_set'), namespace(CONSTANTS$j, 'views'), _extends({}, namespace(CONSTANTS$j, 'field_y_axis'), {
|
|
10330
|
+
fieldFilterOptions: {
|
|
10331
|
+
forComponent: 'lineChart'
|
|
10332
|
+
},
|
|
10333
|
+
preSetPartialAttributes: function preSetPartialAttributes(values) {
|
|
10334
|
+
return {
|
|
10335
|
+
measure: values
|
|
10336
|
+
};
|
|
10337
|
+
},
|
|
10338
|
+
getValues: function getValues(attrs) {
|
|
10339
|
+
return attrs.measure;
|
|
10340
|
+
},
|
|
10341
|
+
testId: 'metric-input'
|
|
10342
|
+
}), _extends({}, namespace(CONSTANTS$j, 'field_x_axis'), {
|
|
10343
|
+
fieldFilterOptions: {
|
|
10344
|
+
forComponent: 'lineChart',
|
|
10345
|
+
onlyDimensions: true
|
|
10346
|
+
},
|
|
10347
|
+
preventDuplicates: false,
|
|
10348
|
+
// return all values in the dimension array instead of seperating out timeDimension
|
|
10349
|
+
preSetPartialAttributes: function preSetPartialAttributes(values) {
|
|
10350
|
+
return {
|
|
10351
|
+
dimension: [].concat(values)
|
|
10352
|
+
};
|
|
10353
|
+
},
|
|
10354
|
+
// does this need to be updated too?
|
|
10355
|
+
getValues: function getValues(attrs) {
|
|
10356
|
+
return [].concat(attrs.dimension);
|
|
10357
|
+
},
|
|
10358
|
+
maxAllowed: 2,
|
|
10359
|
+
testId: 'add-dimension'
|
|
10360
|
+
}), namespace(CONSTANTS$j, 'sort'), namespace(CONSTANTS$j, 'filter'), namespace(CONSTANTS$j, 'custom_metrics'), namespace(CONSTANTS$j, 'limit')];
|
|
10361
|
+
},
|
|
10362
|
+
formatPanelConfig: function formatPanelConfig() {
|
|
10363
|
+
return [headingConstant(CONSTANTS$j), chartStylesConstant(CONSTANTS$j, true, false), axisLabelsConstants(CONSTANTS$j), _extends({}, namespace(CONSTANTS$j, 'conditional_formatting'), {
|
|
10364
|
+
ruleType: 'lineColor'
|
|
10365
|
+
}), namespace(CONSTANTS$j, 'goal_line')];
|
|
10366
|
+
},
|
|
10367
|
+
supportedCustomFields: {
|
|
10368
|
+
calculatedField: false,
|
|
10369
|
+
percentages: true,
|
|
10370
|
+
dateCalculations: true,
|
|
10371
|
+
simpleMaths: true,
|
|
10372
|
+
rules: true,
|
|
10373
|
+
aggregateMaths: true,
|
|
10374
|
+
roundedNumbers: true,
|
|
10375
|
+
conditional: true
|
|
10376
|
+
},
|
|
10377
|
+
supportedFeatures: {
|
|
10378
|
+
parameters: true,
|
|
10379
|
+
colorGradient: false
|
|
10380
|
+
},
|
|
10381
|
+
setDataAttributesFromPreAggregatedDataSet: function setDataAttributesFromPreAggregatedDataSet$1(attributes, dataSet) {
|
|
10382
|
+
return setDataAttributesFromPreAggregatedDataSet(attributes, dataSet, this.setAttributes);
|
|
10383
|
+
}
|
|
10384
|
+
};
|
|
10385
|
+
};
|
|
10386
|
+
|
|
10013
10387
|
var EMPTY_CONFIG = {
|
|
10014
10388
|
queryEngineConfig: {
|
|
10015
10389
|
supportedFeatures: [],
|
|
@@ -10036,6 +10410,7 @@ function getComponentInterface(type, config) {
|
|
|
10036
10410
|
if (type == 'lineChart') return textOverrideComponent(LineChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10037
10411
|
if (type == 'lineChartV2') return textOverrideComponent(LineChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10038
10412
|
if (type == 'barChartV2') return textOverrideComponent(BarChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10413
|
+
if (type == 'areaChartV2') return textOverrideComponent(AreaChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10039
10414
|
if (type == 'mercatorMap') return textOverrideComponent(MercatorMap(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10040
10415
|
if (type == 'pieChart') return textOverrideComponent(PieChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10041
10416
|
if (type == 'progress') return textOverrideComponent(Progress(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
@@ -13192,7 +13567,7 @@ var buildDefaults = function buildDefaults(partialFeatureToggles) {
|
|
|
13192
13567
|
};
|
|
13193
13568
|
};
|
|
13194
13569
|
|
|
13195
|
-
var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
|
|
13570
|
+
var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'areaChartV2', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
|
|
13196
13571
|
var ALL_VIZZLY_COMPONENT_TYPES = /*#__PURE__*/[].concat(ALL_COMPONENT_TYPES).filter(function (type) {
|
|
13197
13572
|
return type != 'custom';
|
|
13198
13573
|
});
|
|
@@ -13532,7 +13907,7 @@ var saveable = function saveable(component, protectedComponent) {
|
|
|
13532
13907
|
};
|
|
13533
13908
|
};
|
|
13534
13909
|
|
|
13535
|
-
var attributesSchema$
|
|
13910
|
+
var attributesSchema$i = function attributesSchema(config) {
|
|
13536
13911
|
return Joi.alternatives().conditional('.type', {
|
|
13537
13912
|
is: 'barChart',
|
|
13538
13913
|
then: BarChart(config).schema
|
|
@@ -13554,6 +13929,9 @@ var attributesSchema$h = function attributesSchema(config) {
|
|
|
13554
13929
|
}).conditional('.type', {
|
|
13555
13930
|
is: 'barChartV2',
|
|
13556
13931
|
then: BarChart$1(config).schema
|
|
13932
|
+
}).conditional('.type', {
|
|
13933
|
+
is: 'areaChartV2',
|
|
13934
|
+
then: AreaChart$1(config).schema
|
|
13557
13935
|
}).conditional('.type', {
|
|
13558
13936
|
is: 'comboChart',
|
|
13559
13937
|
then: ComboChart(config).schema
|
|
@@ -20932,7 +21310,7 @@ var Combobox = function Combobox(props) {
|
|
|
20932
21310
|
});
|
|
20933
21311
|
};
|
|
20934
21312
|
|
|
20935
|
-
var attributesSchema$
|
|
21313
|
+
var attributesSchema$j = /*#__PURE__*/Joi.object({
|
|
20936
21314
|
displayTitle: /*#__PURE__*/Joi.string().min(1).required(),
|
|
20937
21315
|
colSpan: /*#__PURE__*/Joi.number().valid(12).required()
|
|
20938
21316
|
});
|
|
@@ -20949,7 +21327,7 @@ var isEmptyCell = /*#__PURE__*/Joi.object({
|
|
|
20949
21327
|
});
|
|
20950
21328
|
var isPopulatedCell = function isPopulatedCell(queryEngineConfig) {
|
|
20951
21329
|
return Joi.object({
|
|
20952
|
-
attributes: attributesSchema$
|
|
21330
|
+
attributes: attributesSchema$i({
|
|
20953
21331
|
queryEngineConfig: queryEngineConfig
|
|
20954
21332
|
}),
|
|
20955
21333
|
colSpan: colSpanSchema
|
|
@@ -20960,7 +21338,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
|
|
|
20960
21338
|
id: Joi.string(),
|
|
20961
21339
|
display: displaySchema(queryEngineConfig),
|
|
20962
21340
|
componentLibrary: Joi.array().required().items(Joi.object({
|
|
20963
|
-
attributes: attributesSchema$
|
|
21341
|
+
attributes: attributesSchema$i({
|
|
20964
21342
|
queryEngineConfig: queryEngineConfig
|
|
20965
21343
|
})
|
|
20966
21344
|
})),
|
|
@@ -20971,7 +21349,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
|
|
|
20971
21349
|
function displaySchema(queryEngineConfig) {
|
|
20972
21350
|
return Joi.array().required().items(Joi.object({
|
|
20973
21351
|
height: Joi.number().required(),
|
|
20974
|
-
components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$
|
|
21352
|
+
components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$j))
|
|
20975
21353
|
}));
|
|
20976
21354
|
}
|
|
20977
21355
|
|
|
@@ -21693,7 +22071,7 @@ var setHeaderComponent = function setHeaderComponent(state, action) {
|
|
|
21693
22071
|
newDisplayState.dashboard.display[rowIndex].components[cellIndex] = component;
|
|
21694
22072
|
return newDisplayState;
|
|
21695
22073
|
};
|
|
21696
|
-
var setAttributes$
|
|
22074
|
+
var setAttributes$h = function setAttributes(state, action) {
|
|
21697
22075
|
var attributes = action.attributes,
|
|
21698
22076
|
rowIndex = action.rowIndex,
|
|
21699
22077
|
cellIndex = action.cellIndex;
|
|
@@ -21978,7 +22356,7 @@ var reducer = function reducer(pipelineTransformationOptions) {
|
|
|
21978
22356
|
case 'swapComponents':
|
|
21979
22357
|
return swapComponents$1(state, action);
|
|
21980
22358
|
case 'setAttributes':
|
|
21981
|
-
return setAttributes$
|
|
22359
|
+
return setAttributes$h(state, action);
|
|
21982
22360
|
case 'addComponentToLibrary':
|
|
21983
22361
|
return addComponentToLibrary(state, action);
|
|
21984
22362
|
case 'setLocalFilters':
|
|
@@ -25323,7 +25701,7 @@ var RichText$1 = function RichText(props) {
|
|
|
25323
25701
|
})
|
|
25324
25702
|
}));
|
|
25325
25703
|
};
|
|
25326
|
-
var AreaChart$
|
|
25704
|
+
var AreaChart$2 = function AreaChart(props) {
|
|
25327
25705
|
return jsx("svg", _extends({
|
|
25328
25706
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25329
25707
|
viewBox: "0 0 512 512"
|
|
@@ -25592,7 +25970,10 @@ var WaterfallChart$1 = function WaterfallChart(props) {
|
|
|
25592
25970
|
|
|
25593
25971
|
var componentTypeToIconMapping = {
|
|
25594
25972
|
areaChart: function areaChart(props) {
|
|
25595
|
-
return AreaChart$
|
|
25973
|
+
return AreaChart$2(props);
|
|
25974
|
+
},
|
|
25975
|
+
areaChartV2: function areaChartV2(props) {
|
|
25976
|
+
return AreaChart$2(props);
|
|
25596
25977
|
},
|
|
25597
25978
|
barChart: function barChart(props) {
|
|
25598
25979
|
return BarChart$2(props);
|
|
@@ -32700,7 +33081,7 @@ var VizzlyXYChart = function VizzlyXYChart(props) {
|
|
|
32700
33081
|
});
|
|
32701
33082
|
};
|
|
32702
33083
|
|
|
32703
|
-
var AreaChart$
|
|
33084
|
+
var AreaChart$3 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32704
33085
|
var forceRerender = useChartForceRerender(ref);
|
|
32705
33086
|
if (forceRerender) return null;
|
|
32706
33087
|
return jsx(ParentSize, {
|
|
@@ -33651,7 +34032,7 @@ var AreaChartView = function AreaChartView(props) {
|
|
|
33651
34032
|
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
33652
34033
|
})), showHeadline && jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsx(ChartWrapper, {
|
|
33653
34034
|
disabledFeatures: (_props$library2 = props == null ? void 0 : props.library) != null ? _props$library2 : false,
|
|
33654
|
-
children: jsx(AreaChart$
|
|
34035
|
+
children: jsx(AreaChart$3, {
|
|
33655
34036
|
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
33656
34037
|
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
33657
34038
|
ref: ref,
|
|
@@ -33785,7 +34166,7 @@ var isDrilldownAvailable = function isDrilldownAvailable(props) {
|
|
|
33785
34166
|
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;
|
|
33786
34167
|
};
|
|
33787
34168
|
|
|
33788
|
-
var AreaChart$
|
|
34169
|
+
var AreaChart$4 = function AreaChart(props) {
|
|
33789
34170
|
var _props$dashboardBehav;
|
|
33790
34171
|
var _useState = useState(null),
|
|
33791
34172
|
onDrilldown = _useState[0],
|
|
@@ -41920,6 +42301,22 @@ function howManyTicksFitInWidth(ticks, maxWidth, avgCharWidth) {
|
|
|
41920
42301
|
}
|
|
41921
42302
|
return fittedTicks.length;
|
|
41922
42303
|
}
|
|
42304
|
+
function howManyTicksFitInHeight(ticks, height) {
|
|
42305
|
+
if (height > 180) return undefined;
|
|
42306
|
+
var currentHeight = 0;
|
|
42307
|
+
var fittedTicks = 0;
|
|
42308
|
+
var ASSUMED_AVERAGE_CHAR_HEIGHT = 28;
|
|
42309
|
+
for (var i = 0; i < ticks.length; i++) {
|
|
42310
|
+
var wordHeight = ASSUMED_AVERAGE_CHAR_HEIGHT;
|
|
42311
|
+
if (currentHeight + wordHeight <= height) {
|
|
42312
|
+
fittedTicks++;
|
|
42313
|
+
currentHeight += wordHeight;
|
|
42314
|
+
} else {
|
|
42315
|
+
break;
|
|
42316
|
+
}
|
|
42317
|
+
}
|
|
42318
|
+
return fittedTicks;
|
|
42319
|
+
}
|
|
41923
42320
|
function pickEquallySpaced(arr, numPicks) {
|
|
41924
42321
|
if (numPicks >= arr.length) {
|
|
41925
42322
|
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
@@ -41932,17 +42329,22 @@ function pickEquallySpaced(arr, numPicks) {
|
|
|
41932
42329
|
}
|
|
41933
42330
|
return result;
|
|
41934
42331
|
}
|
|
41935
|
-
|
|
41936
|
-
|
|
42332
|
+
function adjustTicks(representation, width, height) {
|
|
42333
|
+
representation = cloneDeep(representation);
|
|
41937
42334
|
|
|
41938
42335
|
// TODO; take this from the theme override...
|
|
41939
42336
|
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
41940
|
-
var
|
|
42337
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks || [], width, averageCharacterWidth);
|
|
42338
|
+
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks || [], height);
|
|
41941
42339
|
|
|
41942
42340
|
// @ts-ignore
|
|
41943
|
-
|
|
41944
|
-
|
|
41945
|
-
|
|
42341
|
+
representation.x.ticks = pickEquallySpaced(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
42342
|
+
if (numberOfYTicksFittingIntoSpace) {
|
|
42343
|
+
// @ts-ignore
|
|
42344
|
+
representation.y.ticks = pickEquallySpaced(representation.y.ticks, numberOfYTicksFittingIntoSpace);
|
|
42345
|
+
}
|
|
42346
|
+
return representation;
|
|
42347
|
+
}
|
|
41946
42348
|
|
|
41947
42349
|
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
41948
42350
|
var maxWidth = max(yTicks.map(function (tick) {
|
|
@@ -42912,135 +43314,6 @@ function getStyleDefinition(_ref) {
|
|
|
42912
43314
|
});
|
|
42913
43315
|
}
|
|
42914
43316
|
|
|
42915
|
-
var getMinAndMax = function getMinAndMax(_ref) {
|
|
42916
|
-
var data = _ref.data,
|
|
42917
|
-
keys = _ref.keys,
|
|
42918
|
-
dataType = _ref.dataType,
|
|
42919
|
-
goalLines = _ref.goalLines;
|
|
42920
|
-
if (keys.length === 0) return {
|
|
42921
|
-
max: null,
|
|
42922
|
-
min: null
|
|
42923
|
-
};
|
|
42924
|
-
if (dataType === 'date_time') {
|
|
42925
|
-
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
42926
|
-
return keys.map(function (key) {
|
|
42927
|
-
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
42928
|
-
});
|
|
42929
|
-
}));
|
|
42930
|
-
return {
|
|
42931
|
-
max: Math.max.apply(Math, dataToAnalyse),
|
|
42932
|
-
min: Math.min.apply(Math, dataToAnalyse)
|
|
42933
|
-
};
|
|
42934
|
-
} else if (dataType === 'number') {
|
|
42935
|
-
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
42936
|
-
return keys.map(function (key) {
|
|
42937
|
-
return dataItem[key] ? dataItem[key].value : 0;
|
|
42938
|
-
});
|
|
42939
|
-
}), goalLines ? goalLines.map(function (gL) {
|
|
42940
|
-
return gL.value;
|
|
42941
|
-
}) : []);
|
|
42942
|
-
return {
|
|
42943
|
-
max: Math.max.apply(Math, _dataToAnalyse),
|
|
42944
|
-
min: Math.min.apply(Math, _dataToAnalyse)
|
|
42945
|
-
};
|
|
42946
|
-
} else {
|
|
42947
|
-
return {
|
|
42948
|
-
max: null,
|
|
42949
|
-
min: null
|
|
42950
|
-
};
|
|
42951
|
-
}
|
|
42952
|
-
};
|
|
42953
|
-
|
|
42954
|
-
function getNiceInterval(interval) {
|
|
42955
|
-
// Round the interval to a "nice" value (1, 2, 5, etc.)
|
|
42956
|
-
var exponent = Math.floor(Math.log10(interval));
|
|
42957
|
-
var fraction = interval / Math.pow(10, exponent);
|
|
42958
|
-
var niceFraction;
|
|
42959
|
-
if (fraction <= 1.5) niceFraction = 1;else if (fraction <= 3) niceFraction = 2;else if (fraction <= 7) niceFraction = 5;else niceFraction = 10;
|
|
42960
|
-
return niceFraction * Math.pow(10, exponent);
|
|
42961
|
-
}
|
|
42962
|
-
var getScaleAndTicks = function getScaleAndTicks(_ref) {
|
|
42963
|
-
var _order$;
|
|
42964
|
-
var data = _ref.data,
|
|
42965
|
-
xKey = _ref.xKey,
|
|
42966
|
-
yKeys = _ref.yKeys,
|
|
42967
|
-
xScaleDataType = _ref.xScaleDataType,
|
|
42968
|
-
nullValue = _ref.nullValue,
|
|
42969
|
-
tickCountYAxis = _ref.tickCountYAxis,
|
|
42970
|
-
formattingFunctionX = _ref.formattingFunctionX,
|
|
42971
|
-
formattingFunctionY = _ref.formattingFunctionY,
|
|
42972
|
-
order = _ref.order,
|
|
42973
|
-
goalLines = _ref.goalLines;
|
|
42974
|
-
var xTicks = [];
|
|
42975
|
-
var yTicks = [];
|
|
42976
|
-
var xScale = {
|
|
42977
|
-
dataType: xScaleDataType,
|
|
42978
|
-
key: xKey,
|
|
42979
|
-
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
42980
|
-
};
|
|
42981
|
-
var x = getMinAndMax({
|
|
42982
|
-
data: data,
|
|
42983
|
-
keys: xScale.key === null ? [] : [xScale.key],
|
|
42984
|
-
dataType: xScale.dataType
|
|
42985
|
-
});
|
|
42986
|
-
if (xKey) {
|
|
42987
|
-
xTicks = data.map(function (dataItem) {
|
|
42988
|
-
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
42989
|
-
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
42990
|
-
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
42991
|
-
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 : '';
|
|
42992
|
-
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
42993
|
-
return {
|
|
42994
|
-
value: xValue !== null ? xValue : '',
|
|
42995
|
-
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
42996
|
-
scaleValue: xScaleValueAdjusted
|
|
42997
|
-
};
|
|
42998
|
-
});
|
|
42999
|
-
}
|
|
43000
|
-
// ----- Y Axis ("number") -----
|
|
43001
|
-
|
|
43002
|
-
var y = getMinAndMax({
|
|
43003
|
-
data: data,
|
|
43004
|
-
keys: yKeys,
|
|
43005
|
-
dataType: 'number',
|
|
43006
|
-
goalLines: goalLines
|
|
43007
|
-
});
|
|
43008
|
-
var maxY = y.max || 0;
|
|
43009
|
-
var minY = Math.min(y.min || 0, 0);
|
|
43010
|
-
var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
|
|
43011
|
-
for (var i = 0; i < tickCountYAxis; i++) {
|
|
43012
|
-
var _value = yTickInterval * i;
|
|
43013
|
-
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
43014
|
-
yTicks.push({
|
|
43015
|
-
value: _value,
|
|
43016
|
-
formattedValue: formattedValue,
|
|
43017
|
-
scaleValue: _value
|
|
43018
|
-
});
|
|
43019
|
-
}
|
|
43020
|
-
return {
|
|
43021
|
-
x: {
|
|
43022
|
-
ticks: xTicks,
|
|
43023
|
-
scale: {
|
|
43024
|
-
dataType: xScale.dataType,
|
|
43025
|
-
max: x.max,
|
|
43026
|
-
min: x.min,
|
|
43027
|
-
key: xScale.key,
|
|
43028
|
-
ordering: xScale.ordering
|
|
43029
|
-
}
|
|
43030
|
-
},
|
|
43031
|
-
y: {
|
|
43032
|
-
ticks: yTicks,
|
|
43033
|
-
scale: {
|
|
43034
|
-
dataType: 'number',
|
|
43035
|
-
key: null,
|
|
43036
|
-
ordering: 'asc',
|
|
43037
|
-
max: maxY,
|
|
43038
|
-
min: minY
|
|
43039
|
-
}
|
|
43040
|
-
}
|
|
43041
|
-
};
|
|
43042
|
-
};
|
|
43043
|
-
|
|
43044
43317
|
/**
|
|
43045
43318
|
* When provided with a result, and formatting parameters, it returns a
|
|
43046
43319
|
* populated result including the formatted value to show.
|
|
@@ -43489,6 +43762,180 @@ function buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xA
|
|
|
43489
43762
|
};
|
|
43490
43763
|
}
|
|
43491
43764
|
|
|
43765
|
+
var getStackedMinAndMax = function getStackedMinAndMax(_ref) {
|
|
43766
|
+
var data = _ref.data,
|
|
43767
|
+
keys = _ref.keys,
|
|
43768
|
+
dataType = _ref.dataType,
|
|
43769
|
+
goalLines = _ref.goalLines,
|
|
43770
|
+
stacked = _ref.stacked;
|
|
43771
|
+
if (keys.length === 0) return {
|
|
43772
|
+
max: null,
|
|
43773
|
+
min: null
|
|
43774
|
+
};
|
|
43775
|
+
if (stacked) {
|
|
43776
|
+
var totals = data.map(function (dataItem) {
|
|
43777
|
+
return keys.reduce(function (sum, key) {
|
|
43778
|
+
var value = dataItem[key] ? dataItem[key].value : 0;
|
|
43779
|
+
return sum + (typeof value === 'number' ? value : 0);
|
|
43780
|
+
}, 0);
|
|
43781
|
+
});
|
|
43782
|
+
var maxTotal = Math.max.apply(Math, totals);
|
|
43783
|
+
var minTotal = Math.min.apply(Math, totals);
|
|
43784
|
+
return {
|
|
43785
|
+
max: maxTotal,
|
|
43786
|
+
min: minTotal
|
|
43787
|
+
};
|
|
43788
|
+
}
|
|
43789
|
+
if (dataType === 'date_time') {
|
|
43790
|
+
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
43791
|
+
return keys.map(function (key) {
|
|
43792
|
+
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
43793
|
+
});
|
|
43794
|
+
}));
|
|
43795
|
+
return {
|
|
43796
|
+
max: Math.max.apply(Math, dataToAnalyse),
|
|
43797
|
+
min: Math.min.apply(Math, dataToAnalyse)
|
|
43798
|
+
};
|
|
43799
|
+
} else if (dataType === 'number') {
|
|
43800
|
+
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
43801
|
+
return keys.map(function (key) {
|
|
43802
|
+
return dataItem[key] ? dataItem[key].value : 0;
|
|
43803
|
+
});
|
|
43804
|
+
}), goalLines ? goalLines.map(function (gL) {
|
|
43805
|
+
return gL.value;
|
|
43806
|
+
}) : []);
|
|
43807
|
+
return {
|
|
43808
|
+
max: Math.max.apply(Math, _dataToAnalyse),
|
|
43809
|
+
min: Math.min.apply(Math, _dataToAnalyse)
|
|
43810
|
+
};
|
|
43811
|
+
} else {
|
|
43812
|
+
return {
|
|
43813
|
+
max: null,
|
|
43814
|
+
min: null
|
|
43815
|
+
};
|
|
43816
|
+
}
|
|
43817
|
+
};
|
|
43818
|
+
|
|
43819
|
+
function getNiceInterval(interval) {
|
|
43820
|
+
var exponent = Math.floor(Math.log10(interval));
|
|
43821
|
+
var fraction = interval / Math.pow(10, exponent);
|
|
43822
|
+
var niceFraction;
|
|
43823
|
+
if (fraction <= 1) {
|
|
43824
|
+
niceFraction = 1;
|
|
43825
|
+
} else if (fraction <= 1.25) {
|
|
43826
|
+
niceFraction = 1.25;
|
|
43827
|
+
} else if (fraction <= 1.5) {
|
|
43828
|
+
niceFraction = 1.5;
|
|
43829
|
+
} else if (fraction <= 2) {
|
|
43830
|
+
niceFraction = 2;
|
|
43831
|
+
} else if (fraction <= 2.5) {
|
|
43832
|
+
niceFraction = 2.5;
|
|
43833
|
+
} else if (fraction <= 3) {
|
|
43834
|
+
niceFraction = 3;
|
|
43835
|
+
} else if (fraction <= 5) {
|
|
43836
|
+
niceFraction = 5;
|
|
43837
|
+
} else if (fraction <= 7) {
|
|
43838
|
+
niceFraction = 7;
|
|
43839
|
+
} else if (fraction <= 10) {
|
|
43840
|
+
niceFraction = 10;
|
|
43841
|
+
} else {
|
|
43842
|
+
niceFraction = 10;
|
|
43843
|
+
}
|
|
43844
|
+
return niceFraction * Math.pow(10, exponent);
|
|
43845
|
+
}
|
|
43846
|
+
var getScaleAndTicks = function getScaleAndTicks(_ref) {
|
|
43847
|
+
var _order$;
|
|
43848
|
+
var data = _ref.data,
|
|
43849
|
+
xKey = _ref.xKey,
|
|
43850
|
+
yKeys = _ref.yKeys,
|
|
43851
|
+
xScaleDataType = _ref.xScaleDataType,
|
|
43852
|
+
nullValue = _ref.nullValue,
|
|
43853
|
+
tickCountYAxis = _ref.tickCountYAxis,
|
|
43854
|
+
formattingFunctionX = _ref.formattingFunctionX,
|
|
43855
|
+
formattingFunctionY = _ref.formattingFunctionY,
|
|
43856
|
+
order = _ref.order,
|
|
43857
|
+
goalLines = _ref.goalLines,
|
|
43858
|
+
stacked = _ref.stacked;
|
|
43859
|
+
var xTicks = [];
|
|
43860
|
+
var xScale = {
|
|
43861
|
+
dataType: xScaleDataType,
|
|
43862
|
+
key: xKey,
|
|
43863
|
+
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
43864
|
+
};
|
|
43865
|
+
var x = getStackedMinAndMax({
|
|
43866
|
+
data: data,
|
|
43867
|
+
keys: xScale.key === null ? [] : [xScale.key],
|
|
43868
|
+
dataType: xScale.dataType
|
|
43869
|
+
});
|
|
43870
|
+
if (xKey) {
|
|
43871
|
+
xTicks = data.map(function (dataItem) {
|
|
43872
|
+
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
43873
|
+
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
43874
|
+
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
43875
|
+
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 : '';
|
|
43876
|
+
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
43877
|
+
return {
|
|
43878
|
+
value: xValue !== null ? xValue : '',
|
|
43879
|
+
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
43880
|
+
scaleValue: xScaleValueAdjusted
|
|
43881
|
+
};
|
|
43882
|
+
});
|
|
43883
|
+
}
|
|
43884
|
+
// ----- Y Axis ("number") -----
|
|
43885
|
+
|
|
43886
|
+
var y = getStackedMinAndMax({
|
|
43887
|
+
data: data,
|
|
43888
|
+
keys: yKeys,
|
|
43889
|
+
dataType: 'number',
|
|
43890
|
+
goalLines: goalLines,
|
|
43891
|
+
stacked: stacked
|
|
43892
|
+
});
|
|
43893
|
+
var maxY = y.max || 0;
|
|
43894
|
+
var minY = Math.min(y.min || 0, 0);
|
|
43895
|
+
var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
|
|
43896
|
+
var yTicks = [];
|
|
43897
|
+
for (var i = 0; i < tickCountYAxis; i++) {
|
|
43898
|
+
var _value = minY + yTickInterval * i;
|
|
43899
|
+
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
43900
|
+
yTicks.push({
|
|
43901
|
+
value: _value,
|
|
43902
|
+
formattedValue: formattedValue,
|
|
43903
|
+
scaleValue: _value
|
|
43904
|
+
});
|
|
43905
|
+
}
|
|
43906
|
+
return {
|
|
43907
|
+
x: {
|
|
43908
|
+
ticks: xTicks,
|
|
43909
|
+
scale: {
|
|
43910
|
+
dataType: xScale.dataType,
|
|
43911
|
+
max: x.max,
|
|
43912
|
+
min: x.min,
|
|
43913
|
+
key: xScale.key,
|
|
43914
|
+
ordering: xScale.ordering
|
|
43915
|
+
}
|
|
43916
|
+
},
|
|
43917
|
+
y: {
|
|
43918
|
+
ticks: yTicks,
|
|
43919
|
+
scale: {
|
|
43920
|
+
dataType: 'number',
|
|
43921
|
+
key: null,
|
|
43922
|
+
ordering: 'asc',
|
|
43923
|
+
max: maxY,
|
|
43924
|
+
min: minY
|
|
43925
|
+
}
|
|
43926
|
+
}
|
|
43927
|
+
};
|
|
43928
|
+
};
|
|
43929
|
+
|
|
43930
|
+
var formattingFunctionX = function formattingFunctionX(value, formattedResult, xKeyField) {
|
|
43931
|
+
if (!xKeyField) return '';
|
|
43932
|
+
return formattedResult.formatterFunc(value, {
|
|
43933
|
+
fieldId: xKeyField.fieldId,
|
|
43934
|
+
"function": xKeyField["function"],
|
|
43935
|
+
outputDataType: xKeyField.outputDataType
|
|
43936
|
+
}).formattedValue;
|
|
43937
|
+
};
|
|
43938
|
+
|
|
43492
43939
|
var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
43493
43940
|
var _xKeys$, _axisTitles$x, _axisTitles$y;
|
|
43494
43941
|
var axisTitles = _ref.axisTitles,
|
|
@@ -43561,15 +44008,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43561
44008
|
|
|
43562
44009
|
// ----- Formatting -----
|
|
43563
44010
|
|
|
43564
|
-
var formattingFunctionX = function formattingFunctionX(value) {
|
|
43565
|
-
if (!xKeyField) return '';
|
|
43566
|
-
return formattedResult.formatterFunc(value, {
|
|
43567
|
-
fieldId: xKeyField.fieldId,
|
|
43568
|
-
"function": xKeyField["function"],
|
|
43569
|
-
outputDataType: xKeyField.outputDataType
|
|
43570
|
-
}).formattedValue;
|
|
43571
|
-
};
|
|
43572
|
-
|
|
43573
44011
|
// (value: any, noValueReplacement?: string) => string;
|
|
43574
44012
|
var formattingFunctionY = function formattingFunctionY(value) {
|
|
43575
44013
|
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
@@ -43598,7 +44036,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43598
44036
|
var orderFunction = order.length > 0 ? order[0]["function"] : undefined;
|
|
43599
44037
|
var trendsAndForecastData = getTrendsAndForecastsData({
|
|
43600
44038
|
chartData: chartData,
|
|
43601
|
-
formattingFunctionX: formattingFunctionX
|
|
44039
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
44040
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
44041
|
+
},
|
|
43602
44042
|
formattingFunctionY: formattingFunctionY,
|
|
43603
44043
|
keys: keys,
|
|
43604
44044
|
nullValue: nullValue,
|
|
@@ -43628,7 +44068,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43628
44068
|
xScaleDataType: xScaleDataType,
|
|
43629
44069
|
yKeys: yKeys,
|
|
43630
44070
|
tickCountYAxis: approxYAxisLabelCount,
|
|
43631
|
-
formattingFunctionX: formattingFunctionX
|
|
44071
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
44072
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
44073
|
+
},
|
|
43632
44074
|
formattingFunctionY: formattingFunctionY,
|
|
43633
44075
|
nullValue: nullValue,
|
|
43634
44076
|
order: order,
|
|
@@ -43690,62 +44132,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43690
44132
|
return chart;
|
|
43691
44133
|
};
|
|
43692
44134
|
|
|
43693
|
-
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
43694
|
-
function calculateWordWidth$1(word, avgCharWidth) {
|
|
43695
|
-
if (avgCharWidth === void 0) {
|
|
43696
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43697
|
-
}
|
|
43698
|
-
return word.length * avgCharWidth;
|
|
43699
|
-
}
|
|
43700
|
-
|
|
43701
|
-
/** Reduce width proportionally to simulate spacing / padding between ticks. */
|
|
43702
|
-
var widthWithSpacing$1 = function widthWithSpacing(width) {
|
|
43703
|
-
var THIRTY_PERCENT = 0.3;
|
|
43704
|
-
return width - width * THIRTY_PERCENT;
|
|
43705
|
-
};
|
|
43706
|
-
function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
|
|
43707
|
-
if (avgCharWidth === void 0) {
|
|
43708
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43709
|
-
}
|
|
43710
|
-
var fittedTicks = [];
|
|
43711
|
-
var currentWidth = 0;
|
|
43712
|
-
for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
|
|
43713
|
-
var tick = _step.value;
|
|
43714
|
-
var word = (tick == null ? void 0 : tick.formattedValue) || '';
|
|
43715
|
-
var wordWidth = calculateWordWidth$1(word, avgCharWidth);
|
|
43716
|
-
if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
|
|
43717
|
-
fittedTicks.push(tick);
|
|
43718
|
-
currentWidth += wordWidth + avgCharWidth; // Add space between words
|
|
43719
|
-
} else {
|
|
43720
|
-
break; // Stop if adding the word exceeds maxWidth
|
|
43721
|
-
}
|
|
43722
|
-
}
|
|
43723
|
-
return fittedTicks.length;
|
|
43724
|
-
}
|
|
43725
|
-
function pickEquallySpaced$1(arr, numPicks) {
|
|
43726
|
-
if (numPicks >= arr.length) {
|
|
43727
|
-
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
43728
|
-
}
|
|
43729
|
-
var result = [];
|
|
43730
|
-
var interval = (arr.length - 1) / (numPicks - 1);
|
|
43731
|
-
for (var i = 0; i < numPicks; i++) {
|
|
43732
|
-
var index = Math.round(i * interval); // Calculate index and round it
|
|
43733
|
-
result.push(arr[index]);
|
|
43734
|
-
}
|
|
43735
|
-
return result;
|
|
43736
|
-
}
|
|
43737
|
-
var adjustTicks$1 = function adjustTicks(lineChartRepresentation, width) {
|
|
43738
|
-
lineChartRepresentation = cloneDeep(lineChartRepresentation);
|
|
43739
|
-
|
|
43740
|
-
// TODO; take this from the theme override...
|
|
43741
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43742
|
-
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(lineChartRepresentation.x.ticks || [], width, averageCharacterWidth);
|
|
43743
|
-
|
|
43744
|
-
// @ts-ignore
|
|
43745
|
-
lineChartRepresentation.x.ticks = pickEquallySpaced$1(lineChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
|
|
43746
|
-
return lineChartRepresentation;
|
|
43747
|
-
};
|
|
43748
|
-
|
|
43749
44135
|
var LineChartV2View = function LineChartV2View(props) {
|
|
43750
44136
|
var _props$library, _props$attributes$vie;
|
|
43751
44137
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -43854,7 +44240,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
43854
44240
|
return jsx(LineChart$5, {
|
|
43855
44241
|
width: parent.width,
|
|
43856
44242
|
height: parent.height,
|
|
43857
|
-
chart: adjustTicks
|
|
44243
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
43858
44244
|
options: {
|
|
43859
44245
|
lineCurve: props.attributes.lineCurve,
|
|
43860
44246
|
removeStroke: false,
|
|
@@ -43862,8 +44248,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
43862
44248
|
showLegend: props.attributes.legend,
|
|
43863
44249
|
axis: {
|
|
43864
44250
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
43865
|
-
|
|
43866
|
-
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
|
|
44251
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
43867
44252
|
}
|
|
43868
44253
|
},
|
|
43869
44254
|
theme: theme == null ? void 0 : theme.charts
|
|
@@ -47185,171 +47570,6 @@ var Progress$2 = function Progress(props) {
|
|
|
47185
47570
|
}));
|
|
47186
47571
|
};
|
|
47187
47572
|
|
|
47188
|
-
var getMinAndMax$1 = function getMinAndMax(_ref) {
|
|
47189
|
-
var data = _ref.data,
|
|
47190
|
-
keys = _ref.keys,
|
|
47191
|
-
dataType = _ref.dataType,
|
|
47192
|
-
goalLines = _ref.goalLines,
|
|
47193
|
-
stacked = _ref.stacked;
|
|
47194
|
-
if (keys.length === 0) return {
|
|
47195
|
-
max: null,
|
|
47196
|
-
min: null
|
|
47197
|
-
};
|
|
47198
|
-
if (stacked) {
|
|
47199
|
-
var totals = data.map(function (dataItem) {
|
|
47200
|
-
return keys.reduce(function (sum, key) {
|
|
47201
|
-
var value = dataItem[key] ? dataItem[key].value : 0;
|
|
47202
|
-
return sum + (typeof value === 'number' ? value : 0);
|
|
47203
|
-
}, 0);
|
|
47204
|
-
});
|
|
47205
|
-
var maxTotal = Math.max.apply(Math, totals);
|
|
47206
|
-
var minTotal = Math.min.apply(Math, totals);
|
|
47207
|
-
return {
|
|
47208
|
-
max: maxTotal,
|
|
47209
|
-
min: minTotal
|
|
47210
|
-
};
|
|
47211
|
-
}
|
|
47212
|
-
if (dataType === 'date_time') {
|
|
47213
|
-
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
47214
|
-
return keys.map(function (key) {
|
|
47215
|
-
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
47216
|
-
});
|
|
47217
|
-
}));
|
|
47218
|
-
return {
|
|
47219
|
-
max: Math.max.apply(Math, dataToAnalyse),
|
|
47220
|
-
min: Math.min.apply(Math, dataToAnalyse)
|
|
47221
|
-
};
|
|
47222
|
-
} else if (dataType === 'number') {
|
|
47223
|
-
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
47224
|
-
return keys.map(function (key) {
|
|
47225
|
-
return dataItem[key] ? dataItem[key].value : 0;
|
|
47226
|
-
});
|
|
47227
|
-
}), goalLines ? goalLines.map(function (gL) {
|
|
47228
|
-
return gL.value;
|
|
47229
|
-
}) : []);
|
|
47230
|
-
return {
|
|
47231
|
-
max: Math.max.apply(Math, _dataToAnalyse),
|
|
47232
|
-
min: Math.min.apply(Math, _dataToAnalyse)
|
|
47233
|
-
};
|
|
47234
|
-
} else {
|
|
47235
|
-
return {
|
|
47236
|
-
max: null,
|
|
47237
|
-
min: null
|
|
47238
|
-
};
|
|
47239
|
-
}
|
|
47240
|
-
};
|
|
47241
|
-
|
|
47242
|
-
function getNiceInterval$1(interval) {
|
|
47243
|
-
var exponent = Math.floor(Math.log10(interval));
|
|
47244
|
-
var fraction = interval / Math.pow(10, exponent);
|
|
47245
|
-
var niceFraction;
|
|
47246
|
-
if (fraction <= 1) {
|
|
47247
|
-
niceFraction = 1;
|
|
47248
|
-
} else if (fraction <= 1.25) {
|
|
47249
|
-
niceFraction = 1.25;
|
|
47250
|
-
} else if (fraction <= 1.5) {
|
|
47251
|
-
niceFraction = 1.5;
|
|
47252
|
-
} else if (fraction <= 2) {
|
|
47253
|
-
niceFraction = 2;
|
|
47254
|
-
} else if (fraction <= 2.5) {
|
|
47255
|
-
niceFraction = 2.5;
|
|
47256
|
-
} else if (fraction <= 3) {
|
|
47257
|
-
niceFraction = 3;
|
|
47258
|
-
} else if (fraction <= 5) {
|
|
47259
|
-
niceFraction = 5;
|
|
47260
|
-
} else if (fraction <= 7) {
|
|
47261
|
-
niceFraction = 7;
|
|
47262
|
-
} else if (fraction <= 10) {
|
|
47263
|
-
niceFraction = 10;
|
|
47264
|
-
} else {
|
|
47265
|
-
niceFraction = 10;
|
|
47266
|
-
}
|
|
47267
|
-
return niceFraction * Math.pow(10, exponent);
|
|
47268
|
-
}
|
|
47269
|
-
var getScaleAndTicks$1 = function getScaleAndTicks(_ref) {
|
|
47270
|
-
var _order$;
|
|
47271
|
-
var data = _ref.data,
|
|
47272
|
-
xKey = _ref.xKey,
|
|
47273
|
-
yKeys = _ref.yKeys,
|
|
47274
|
-
xScaleDataType = _ref.xScaleDataType,
|
|
47275
|
-
nullValue = _ref.nullValue,
|
|
47276
|
-
tickCountYAxis = _ref.tickCountYAxis,
|
|
47277
|
-
formattingFunctionX = _ref.formattingFunctionX,
|
|
47278
|
-
formattingFunctionY = _ref.formattingFunctionY,
|
|
47279
|
-
order = _ref.order,
|
|
47280
|
-
goalLines = _ref.goalLines,
|
|
47281
|
-
stacked = _ref.stacked;
|
|
47282
|
-
var xTicks = [];
|
|
47283
|
-
var xScale = {
|
|
47284
|
-
dataType: xScaleDataType,
|
|
47285
|
-
key: xKey,
|
|
47286
|
-
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
47287
|
-
};
|
|
47288
|
-
var x = getMinAndMax$1({
|
|
47289
|
-
data: data,
|
|
47290
|
-
keys: xScale.key === null ? [] : [xScale.key],
|
|
47291
|
-
dataType: xScale.dataType
|
|
47292
|
-
});
|
|
47293
|
-
if (xKey) {
|
|
47294
|
-
xTicks = data.map(function (dataItem) {
|
|
47295
|
-
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
47296
|
-
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
47297
|
-
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
47298
|
-
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 : '';
|
|
47299
|
-
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
47300
|
-
return {
|
|
47301
|
-
value: xValue !== null ? xValue : '',
|
|
47302
|
-
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
47303
|
-
scaleValue: xScaleValueAdjusted
|
|
47304
|
-
};
|
|
47305
|
-
});
|
|
47306
|
-
}
|
|
47307
|
-
// ----- Y Axis ("number") -----
|
|
47308
|
-
|
|
47309
|
-
var y = getMinAndMax$1({
|
|
47310
|
-
data: data,
|
|
47311
|
-
keys: yKeys,
|
|
47312
|
-
dataType: 'number',
|
|
47313
|
-
goalLines: goalLines,
|
|
47314
|
-
stacked: stacked
|
|
47315
|
-
});
|
|
47316
|
-
var maxY = y.max || 0;
|
|
47317
|
-
var minY = Math.min(y.min || 0, 0);
|
|
47318
|
-
var yTickInterval = getNiceInterval$1((maxY - minY) / (tickCountYAxis - 1));
|
|
47319
|
-
var yTicks = [];
|
|
47320
|
-
for (var i = 0; i < tickCountYAxis; i++) {
|
|
47321
|
-
var _value = minY + yTickInterval * i;
|
|
47322
|
-
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
47323
|
-
yTicks.push({
|
|
47324
|
-
value: _value,
|
|
47325
|
-
formattedValue: formattedValue,
|
|
47326
|
-
scaleValue: _value
|
|
47327
|
-
});
|
|
47328
|
-
}
|
|
47329
|
-
return {
|
|
47330
|
-
x: {
|
|
47331
|
-
ticks: xTicks,
|
|
47332
|
-
scale: {
|
|
47333
|
-
dataType: xScale.dataType,
|
|
47334
|
-
max: x.max,
|
|
47335
|
-
min: x.min,
|
|
47336
|
-
key: xScale.key,
|
|
47337
|
-
ordering: xScale.ordering
|
|
47338
|
-
}
|
|
47339
|
-
},
|
|
47340
|
-
y: {
|
|
47341
|
-
ticks: yTicks,
|
|
47342
|
-
scale: {
|
|
47343
|
-
dataType: 'number',
|
|
47344
|
-
key: null,
|
|
47345
|
-
ordering: 'asc',
|
|
47346
|
-
max: maxY,
|
|
47347
|
-
min: minY
|
|
47348
|
-
}
|
|
47349
|
-
}
|
|
47350
|
-
};
|
|
47351
|
-
};
|
|
47352
|
-
|
|
47353
47573
|
function fillMissingKeysForChartData(data) {
|
|
47354
47574
|
var allKeys = new Set();
|
|
47355
47575
|
data.forEach(function (item) {
|
|
@@ -47443,15 +47663,6 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
|
|
|
47443
47663
|
|
|
47444
47664
|
// ----- Formatting -----
|
|
47445
47665
|
|
|
47446
|
-
var formattingFunctionX = function formattingFunctionX(value) {
|
|
47447
|
-
if (!xKeyField) return '';
|
|
47448
|
-
return formattedResult.formatterFunc(value, {
|
|
47449
|
-
fieldId: xKeyField.fieldId,
|
|
47450
|
-
"function": xKeyField["function"],
|
|
47451
|
-
outputDataType: xKeyField.outputDataType
|
|
47452
|
-
}).formattedValue;
|
|
47453
|
-
};
|
|
47454
|
-
|
|
47455
47666
|
// (value: any, noValueReplacement?: string) => string;
|
|
47456
47667
|
var formattingFunctionY = function formattingFunctionY(value) {
|
|
47457
47668
|
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
@@ -47495,13 +47706,15 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
|
|
|
47495
47706
|
|
|
47496
47707
|
// ----- Ticks -----
|
|
47497
47708
|
|
|
47498
|
-
var ticks = getScaleAndTicks
|
|
47709
|
+
var ticks = getScaleAndTicks({
|
|
47499
47710
|
data: updatedData,
|
|
47500
47711
|
xKey: xKey,
|
|
47501
47712
|
xScaleDataType: xScaleDataType,
|
|
47502
47713
|
yKeys: yKeys,
|
|
47503
47714
|
tickCountYAxis: approxYAxisLabelCount,
|
|
47504
|
-
formattingFunctionX: formattingFunctionX
|
|
47715
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
47716
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
47717
|
+
},
|
|
47505
47718
|
formattingFunctionY: formattingFunctionY,
|
|
47506
47719
|
nullValue: nullValue,
|
|
47507
47720
|
order: order,
|
|
@@ -47713,7 +47926,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
47713
47926
|
return jsx(BarChart$5, {
|
|
47714
47927
|
width: parent.width,
|
|
47715
47928
|
height: parent.height,
|
|
47716
|
-
chart: adjustTicks(chartRepresentation, parent.width),
|
|
47929
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
47717
47930
|
options: {
|
|
47718
47931
|
stacked: !!props.attributes.stacked,
|
|
47719
47932
|
removeStroke: false,
|
|
@@ -47721,8 +47934,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
47721
47934
|
showLegend: props.attributes.legend,
|
|
47722
47935
|
axis: {
|
|
47723
47936
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
47724
|
-
|
|
47725
|
-
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
|
|
47937
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
47726
47938
|
}
|
|
47727
47939
|
},
|
|
47728
47940
|
theme: theme == null ? void 0 : theme.charts,
|
|
@@ -47811,30 +48023,30 @@ function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
|
|
|
47811
48023
|
return fill;
|
|
47812
48024
|
}
|
|
47813
48025
|
|
|
47814
|
-
var ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47815
|
-
function calculateWordWidth$
|
|
48026
|
+
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
48027
|
+
function calculateWordWidth$1(word, avgCharWidth) {
|
|
47816
48028
|
if (avgCharWidth === void 0) {
|
|
47817
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
48029
|
+
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
47818
48030
|
}
|
|
47819
48031
|
return word.length * avgCharWidth;
|
|
47820
48032
|
}
|
|
47821
48033
|
|
|
47822
48034
|
/** Reduce width proportionally to simulate spacing / padding between ticks. */
|
|
47823
|
-
var widthWithSpacing$
|
|
48035
|
+
var widthWithSpacing$1 = function widthWithSpacing(width) {
|
|
47824
48036
|
var THIRTY_PERCENT = 0.3;
|
|
47825
48037
|
return width - width * THIRTY_PERCENT;
|
|
47826
48038
|
};
|
|
47827
|
-
function howManyTicksFitInWidth$
|
|
48039
|
+
function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
|
|
47828
48040
|
if (avgCharWidth === void 0) {
|
|
47829
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
48041
|
+
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
47830
48042
|
}
|
|
47831
48043
|
var fittedTicks = [];
|
|
47832
48044
|
var currentWidth = 0;
|
|
47833
48045
|
for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
|
|
47834
48046
|
var tick = _step.value;
|
|
47835
48047
|
var word = (tick == null ? void 0 : tick.formattedValue) || '';
|
|
47836
|
-
var wordWidth = calculateWordWidth$
|
|
47837
|
-
if (currentWidth + wordWidth <= widthWithSpacing$
|
|
48048
|
+
var wordWidth = calculateWordWidth$1(word, avgCharWidth);
|
|
48049
|
+
if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
|
|
47838
48050
|
fittedTicks.push(tick);
|
|
47839
48051
|
currentWidth += wordWidth + avgCharWidth; // Add space between words
|
|
47840
48052
|
} else {
|
|
@@ -47843,7 +48055,7 @@ function howManyTicksFitInWidth$2(ticks, maxWidth, avgCharWidth) {
|
|
|
47843
48055
|
}
|
|
47844
48056
|
return fittedTicks.length;
|
|
47845
48057
|
}
|
|
47846
|
-
function pickEquallySpaced$
|
|
48058
|
+
function pickEquallySpaced$1(arr, numPicks) {
|
|
47847
48059
|
if (numPicks >= arr.length) {
|
|
47848
48060
|
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
47849
48061
|
}
|
|
@@ -47855,19 +48067,19 @@ function pickEquallySpaced$2(arr, numPicks) {
|
|
|
47855
48067
|
}
|
|
47856
48068
|
return result;
|
|
47857
48069
|
}
|
|
47858
|
-
var adjustTicks$
|
|
48070
|
+
var adjustTicks$1 = function adjustTicks(waterfallChartRepresentation, width) {
|
|
47859
48071
|
waterfallChartRepresentation = cloneDeep(waterfallChartRepresentation);
|
|
47860
48072
|
|
|
47861
48073
|
// TODO; take this from the theme override...
|
|
47862
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47863
|
-
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$
|
|
48074
|
+
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
48075
|
+
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(waterfallChartRepresentation.x.ticks || [], width, averageCharacterWidth);
|
|
47864
48076
|
var MINIMUM_NUMBER_OF_TICKS = 2;
|
|
47865
48077
|
if (numberOfTicksFittingIntoSpace < MINIMUM_NUMBER_OF_TICKS) {
|
|
47866
48078
|
numberOfTicksFittingIntoSpace = MINIMUM_NUMBER_OF_TICKS;
|
|
47867
48079
|
}
|
|
47868
48080
|
|
|
47869
48081
|
// @ts-ignore
|
|
47870
|
-
waterfallChartRepresentation.x.ticks = pickEquallySpaced$
|
|
48082
|
+
waterfallChartRepresentation.x.ticks = pickEquallySpaced$1(waterfallChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
|
|
47871
48083
|
return waterfallChartRepresentation;
|
|
47872
48084
|
};
|
|
47873
48085
|
|
|
@@ -47997,17 +48209,13 @@ var Legend$2 = function Legend(_ref) {
|
|
|
47997
48209
|
color: 'green',
|
|
47998
48210
|
yKey: 'increase',
|
|
47999
48211
|
style: {
|
|
48000
|
-
type: '
|
|
48001
|
-
strokeDasharray: null,
|
|
48002
|
-
strokeWidth: 2
|
|
48212
|
+
type: 'bar'
|
|
48003
48213
|
}
|
|
48004
48214
|
}, {
|
|
48005
48215
|
color: 'red',
|
|
48006
48216
|
yKey: 'decrease',
|
|
48007
48217
|
style: {
|
|
48008
|
-
type: '
|
|
48009
|
-
strokeDasharray: null,
|
|
48010
|
-
strokeWidth: 2
|
|
48218
|
+
type: 'bar'
|
|
48011
48219
|
}
|
|
48012
48220
|
}];
|
|
48013
48221
|
var keys = {
|
|
@@ -48045,6 +48253,7 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
48045
48253
|
width = _ref.width,
|
|
48046
48254
|
options = _ref.options,
|
|
48047
48255
|
chart = _ref.chart,
|
|
48256
|
+
steps = _ref.steps,
|
|
48048
48257
|
theme = _ref.theme;
|
|
48049
48258
|
//Waterfall TODO: fix chart for other x types
|
|
48050
48259
|
if (chart.x.scale.dataType === 'date_time' || chart.x.scale.dataType === 'number') {
|
|
@@ -48060,10 +48269,10 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
48060
48269
|
hideTooltip = _useTooltip.hideTooltip,
|
|
48061
48270
|
showTooltip = _useTooltip.showTooltip;
|
|
48062
48271
|
var chartCopy = cloneDeep(chart);
|
|
48063
|
-
var
|
|
48064
|
-
x = chartCopy.x,
|
|
48272
|
+
var x = chartCopy.x,
|
|
48065
48273
|
y = chartCopy.y;
|
|
48066
|
-
var
|
|
48274
|
+
var xKey = x.key;
|
|
48275
|
+
var yKey = y.key;
|
|
48067
48276
|
var conditionalFormattingRules = [{
|
|
48068
48277
|
yKey: y.key,
|
|
48069
48278
|
operator: '>',
|
|
@@ -48075,47 +48284,11 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
48075
48284
|
value: 0,
|
|
48076
48285
|
color: 'red'
|
|
48077
48286
|
}];
|
|
48078
|
-
var xKey = x.key;
|
|
48079
|
-
var yKey = y.key;
|
|
48080
|
-
var cumulativeTotal = 0;
|
|
48081
|
-
var steps = data.map(function (item) {
|
|
48082
|
-
var xValue = item[xKey].value;
|
|
48083
|
-
var yValue = Number(item[yKey].value);
|
|
48084
|
-
var prevTotal = cumulativeTotal;
|
|
48085
|
-
cumulativeTotal += yValue;
|
|
48086
|
-
return {
|
|
48087
|
-
x: xValue,
|
|
48088
|
-
y: yValue,
|
|
48089
|
-
start: prevTotal,
|
|
48090
|
-
end: cumulativeTotal
|
|
48091
|
-
};
|
|
48092
|
-
});
|
|
48093
|
-
if (showTotalBar) {
|
|
48094
|
-
var _data$push;
|
|
48095
|
-
steps.push({
|
|
48096
|
-
x: "Total",
|
|
48097
|
-
y: cumulativeTotal,
|
|
48098
|
-
start: 0,
|
|
48099
|
-
end: cumulativeTotal
|
|
48100
|
-
});
|
|
48101
|
-
data.push((_data$push = {}, _data$push[x.key] = {
|
|
48102
|
-
value: "Total",
|
|
48103
|
-
formattedValue: "Total"
|
|
48104
|
-
}, _data$push[y.key] = {
|
|
48105
|
-
value: cumulativeTotal,
|
|
48106
|
-
formattedValue: null
|
|
48107
|
-
}, _data$push));
|
|
48108
|
-
x.ticks.push({
|
|
48109
|
-
value: "Total",
|
|
48110
|
-
formattedValue: "Total",
|
|
48111
|
-
scaleValue: "Total"
|
|
48112
|
-
});
|
|
48113
|
-
}
|
|
48114
48287
|
var formattedYAxisForBarChart = _extends({}, y, {
|
|
48115
|
-
keys: [
|
|
48288
|
+
keys: [yKey]
|
|
48116
48289
|
});
|
|
48117
48290
|
var adjustedChartRepresentation = useMemo(function () {
|
|
48118
|
-
return adjustTicks$
|
|
48291
|
+
return adjustTicks$1(_extends({}, chartCopy), width);
|
|
48119
48292
|
}, [chartCopy, width]);
|
|
48120
48293
|
var formattedChartDataForBarChart = _extends({}, adjustedChartRepresentation, {
|
|
48121
48294
|
y: formattedYAxisForBarChart,
|
|
@@ -48237,15 +48410,14 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
48237
48410
|
if (xScaleDataType === 'string') return xValue;
|
|
48238
48411
|
return;
|
|
48239
48412
|
}, [xScaleKey, xScaleDataType]);
|
|
48413
|
+
if (width === 0 || height === 0 || xScale == null) return null;
|
|
48240
48414
|
return jsxs(Fragment$1, {
|
|
48241
|
-
children: [jsxs(
|
|
48415
|
+
children: [jsxs(ChartWrapper$1, {
|
|
48242
48416
|
width: width,
|
|
48243
|
-
height: height
|
|
48417
|
+
height: height,
|
|
48418
|
+
showLegend: options.showLegend,
|
|
48244
48419
|
onMouseMove: handleMouseMove,
|
|
48245
48420
|
onMouseLeave: handleMouseLeave,
|
|
48246
|
-
style: {
|
|
48247
|
-
display: 'block'
|
|
48248
|
-
},
|
|
48249
48421
|
children: [jsxs(Group$2, {
|
|
48250
48422
|
left: margin.left,
|
|
48251
48423
|
top: margin.top,
|
|
@@ -48389,7 +48561,7 @@ var Bar$1 = function Bar(_ref4) {
|
|
|
48389
48561
|
});
|
|
48390
48562
|
};
|
|
48391
48563
|
|
|
48392
|
-
function getNiceInterval$
|
|
48564
|
+
function getNiceInterval$1(interval) {
|
|
48393
48565
|
// Round the interval to a "nice" value (1, 2, 5, etc.)
|
|
48394
48566
|
var exponent = Math.floor(Math.log10(interval));
|
|
48395
48567
|
var fraction = interval / Math.pow(10, exponent);
|
|
@@ -48398,6 +48570,111 @@ function getNiceInterval$2(interval) {
|
|
|
48398
48570
|
return niceFraction * Math.pow(10, exponent);
|
|
48399
48571
|
}
|
|
48400
48572
|
|
|
48573
|
+
var getYTicks = function getYTicks(_ref) {
|
|
48574
|
+
var yMinValue = _ref.yMinValue,
|
|
48575
|
+
yMaxValue = _ref.yMaxValue,
|
|
48576
|
+
approxYAxisLabelCount = _ref.approxYAxisLabelCount,
|
|
48577
|
+
formattingFunctionY = _ref.formattingFunctionY;
|
|
48578
|
+
var yTicks = [];
|
|
48579
|
+
var yTickInterval = getNiceInterval$1((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
|
|
48580
|
+
for (var i = 0; i < approxYAxisLabelCount; i++) {
|
|
48581
|
+
var value = (yMinValue + i) * yTickInterval;
|
|
48582
|
+
var formattedValue = formattingFunctionY(value);
|
|
48583
|
+
yTicks.push({
|
|
48584
|
+
value: value,
|
|
48585
|
+
formattedValue: formattedValue,
|
|
48586
|
+
scaleValue: value
|
|
48587
|
+
});
|
|
48588
|
+
}
|
|
48589
|
+
return yTicks;
|
|
48590
|
+
};
|
|
48591
|
+
|
|
48592
|
+
var getRepresentationData = function getRepresentationData(_ref) {
|
|
48593
|
+
var content = _ref.content,
|
|
48594
|
+
xKey = _ref.xKey,
|
|
48595
|
+
yKey = _ref.yKey,
|
|
48596
|
+
approxYAxisLabelCount = _ref.approxYAxisLabelCount,
|
|
48597
|
+
showTotalBar = _ref.showTotalBar,
|
|
48598
|
+
formattingFunctionY = _ref.formattingFunctionY;
|
|
48599
|
+
var data = [];
|
|
48600
|
+
var steps = [];
|
|
48601
|
+
var xTicks = [];
|
|
48602
|
+
var yValueSum = 0;
|
|
48603
|
+
var yMinValue = 0;
|
|
48604
|
+
var yMaxValue = 0;
|
|
48605
|
+
content.forEach(function (dataItem, index) {
|
|
48606
|
+
var _data$push;
|
|
48607
|
+
var xValueIndex = 0;
|
|
48608
|
+
var yValueIndex = 1;
|
|
48609
|
+
var xValue = dataItem[xValueIndex].value;
|
|
48610
|
+
var xFormattedValue = dataItem[xValueIndex].formattedValue;
|
|
48611
|
+
var yValue = Number(dataItem[yValueIndex].value);
|
|
48612
|
+
var yValueDiff = yValue;
|
|
48613
|
+
if (index > 0) {
|
|
48614
|
+
var prevYValue = Number(content[index - 1][yValueIndex].value);
|
|
48615
|
+
yValueDiff = yValue - prevYValue;
|
|
48616
|
+
}
|
|
48617
|
+
var prevYValueSum = yValueSum;
|
|
48618
|
+
yValueSum += yValueDiff;
|
|
48619
|
+
data.push((_data$push = {}, _data$push[xKey] = {
|
|
48620
|
+
value: xValue,
|
|
48621
|
+
formattedValue: xFormattedValue
|
|
48622
|
+
}, _data$push[yKey] = {
|
|
48623
|
+
value: yValueDiff,
|
|
48624
|
+
formattedValue: formattingFunctionY(yValueDiff)
|
|
48625
|
+
}, _data$push));
|
|
48626
|
+
xTicks.push({
|
|
48627
|
+
value: xValue,
|
|
48628
|
+
formattedValue: xFormattedValue,
|
|
48629
|
+
scaleValue: xValue
|
|
48630
|
+
});
|
|
48631
|
+
steps.push({
|
|
48632
|
+
x: xValue,
|
|
48633
|
+
y: yValue,
|
|
48634
|
+
start: prevYValueSum,
|
|
48635
|
+
end: yValueSum
|
|
48636
|
+
});
|
|
48637
|
+
yMinValue = Math.floor(Math.min(yMinValue, yValue));
|
|
48638
|
+
yMaxValue = Math.ceil(Math.max(yMaxValue, yValue));
|
|
48639
|
+
});
|
|
48640
|
+
if (showTotalBar) {
|
|
48641
|
+
var _data$push2;
|
|
48642
|
+
var totalLabel = 'Total';
|
|
48643
|
+
steps.push({
|
|
48644
|
+
x: totalLabel,
|
|
48645
|
+
y: yValueSum,
|
|
48646
|
+
start: 0,
|
|
48647
|
+
end: yValueSum
|
|
48648
|
+
});
|
|
48649
|
+
data.push((_data$push2 = {}, _data$push2[xKey] = {
|
|
48650
|
+
value: totalLabel,
|
|
48651
|
+
formattedValue: totalLabel
|
|
48652
|
+
}, _data$push2[yKey] = {
|
|
48653
|
+
value: yValueSum,
|
|
48654
|
+
formattedValue: formattingFunctionY(yValueSum)
|
|
48655
|
+
}, _data$push2));
|
|
48656
|
+
xTicks.push({
|
|
48657
|
+
value: totalLabel,
|
|
48658
|
+
formattedValue: totalLabel,
|
|
48659
|
+
scaleValue: totalLabel
|
|
48660
|
+
});
|
|
48661
|
+
}
|
|
48662
|
+
var yTicks = getYTicks({
|
|
48663
|
+
yMinValue: yMinValue,
|
|
48664
|
+
yMaxValue: yMaxValue,
|
|
48665
|
+
approxYAxisLabelCount: approxYAxisLabelCount,
|
|
48666
|
+
formattingFunctionY: formattingFunctionY
|
|
48667
|
+
});
|
|
48668
|
+
return {
|
|
48669
|
+
data: data,
|
|
48670
|
+
steps: steps,
|
|
48671
|
+
xTicks: xTicks,
|
|
48672
|
+
yTicks: yTicks,
|
|
48673
|
+
yMinValue: yMinValue,
|
|
48674
|
+
yMaxValue: yMaxValue
|
|
48675
|
+
};
|
|
48676
|
+
};
|
|
48677
|
+
|
|
48401
48678
|
var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentation(_ref) {
|
|
48402
48679
|
var _formattedResult$fiel, _formattedResult$fiel2, _axisTitles$x, _axisTitles$y;
|
|
48403
48680
|
var approxYAxisLabelCount = _ref.approxYAxisLabelCount,
|
|
@@ -48408,6 +48685,7 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48408
48685
|
numberFormatOptions = _ref.numberFormatOptions,
|
|
48409
48686
|
pivotConfig = _ref.pivotConfig,
|
|
48410
48687
|
result = _ref.result,
|
|
48688
|
+
showTotalBar = _ref.showTotalBar,
|
|
48411
48689
|
_valueAlias = _ref.valueAlias,
|
|
48412
48690
|
xAxisFormat = _ref.xAxisFormat,
|
|
48413
48691
|
xAxisPrefix = _ref.xAxisPrefix,
|
|
@@ -48415,34 +48693,12 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48415
48693
|
yAxisFormat = _ref.yAxisFormat,
|
|
48416
48694
|
yAxisPrefix = _ref.yAxisPrefix,
|
|
48417
48695
|
yAxisPostfix = _ref.yAxisPostfix;
|
|
48418
|
-
var allPrefixes = {};
|
|
48419
|
-
var allPostfixes = {};
|
|
48420
|
-
var nullValues = {};
|
|
48421
|
-
var activeNumberFormats = {};
|
|
48422
48696
|
var activeDateTimeFormats = {};
|
|
48423
|
-
result
|
|
48424
|
-
|
|
48425
|
-
|
|
48426
|
-
|
|
48427
|
-
|
|
48428
|
-
if (field.outputDataType === 'number' && numberFormatOptions[xAxisFormat]) {
|
|
48429
|
-
activeNumberFormats[field.id] = xAxisFormat;
|
|
48430
|
-
} else if (dateTimeFormatOptions[xAxisFormat]) {
|
|
48431
|
-
activeDateTimeFormats[field.id] = xAxisFormat;
|
|
48432
|
-
}
|
|
48433
|
-
}
|
|
48434
|
-
} else if (!pivotConfig.y.includes(field.id)) {
|
|
48435
|
-
allPostfixes[field.id] = yAxisPostfix;
|
|
48436
|
-
allPrefixes[field.id] = yAxisPrefix;
|
|
48437
|
-
yAxisFormat = yAxisFormat || '_vizzly_compact';
|
|
48438
|
-
if (numberFormatOptions[yAxisFormat]) {
|
|
48439
|
-
activeNumberFormats[field.id] = yAxisFormat;
|
|
48440
|
-
}
|
|
48441
|
-
}
|
|
48442
|
-
|
|
48443
|
-
// Set the null value aliases
|
|
48444
|
-
nullValues[field.id] = nullValue;
|
|
48445
|
-
});
|
|
48697
|
+
var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
|
|
48698
|
+
allPrefixes = _buildFieldFormatMaps.allPrefixes,
|
|
48699
|
+
allPostfixes = _buildFieldFormatMaps.allPostfixes,
|
|
48700
|
+
nullValues = _buildFieldFormatMaps.nullValues,
|
|
48701
|
+
activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
|
|
48446
48702
|
var params = {
|
|
48447
48703
|
defaultFormats: defaultFormats,
|
|
48448
48704
|
dateTimeFormatOptions: dateTimeFormatOptions,
|
|
@@ -48466,6 +48722,18 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48466
48722
|
activeDateTimeFormats: activeDateTimeFormats
|
|
48467
48723
|
};
|
|
48468
48724
|
var formattedResult = formatResult(result, params);
|
|
48725
|
+
var formattingFunctionY = function formattingFunctionY(value) {
|
|
48726
|
+
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
48727
|
+
var nonPivotField = formattedResult.fields.find(function (resultField) {
|
|
48728
|
+
return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
|
|
48729
|
+
});
|
|
48730
|
+
if (!nonPivotField) return '';
|
|
48731
|
+
return formattedResult.formatterFunc(value, {
|
|
48732
|
+
fieldId: nonPivotField.fieldId,
|
|
48733
|
+
"function": nonPivotField["function"],
|
|
48734
|
+
outputDataType: nonPivotField.outputDataType
|
|
48735
|
+
}).formattedValue;
|
|
48736
|
+
};
|
|
48469
48737
|
var keys = formattedResult.fields.map(function (field) {
|
|
48470
48738
|
var _ref2;
|
|
48471
48739
|
var key = field.fieldId;
|
|
@@ -48480,58 +48748,21 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48480
48748
|
var xKey = (_formattedResult$fiel = formattedResult.fields[0]) == null ? void 0 : _formattedResult$fiel.fieldId;
|
|
48481
48749
|
var yKey = (_formattedResult$fiel2 = formattedResult.fields[1]) == null ? void 0 : _formattedResult$fiel2.fieldId;
|
|
48482
48750
|
var content = formattedResult.content;
|
|
48483
|
-
var
|
|
48484
|
-
|
|
48485
|
-
|
|
48486
|
-
|
|
48487
|
-
|
|
48488
|
-
|
|
48489
|
-
|
|
48490
|
-
|
|
48491
|
-
|
|
48492
|
-
|
|
48493
|
-
|
|
48494
|
-
|
|
48495
|
-
|
|
48496
|
-
|
|
48497
|
-
|
|
48498
|
-
value: xValue,
|
|
48499
|
-
formattedValue: xFormattedValue
|
|
48500
|
-
}, _data$push[yKey] = {
|
|
48501
|
-
value: yValueDiff,
|
|
48502
|
-
formattedValue: yFormattedValue
|
|
48503
|
-
}, _data$push));
|
|
48504
|
-
xTicks.push({
|
|
48505
|
-
value: xValue,
|
|
48506
|
-
formattedValue: xFormattedValue,
|
|
48507
|
-
scaleValue: xValue
|
|
48508
|
-
});
|
|
48509
|
-
yMinValue = Math.floor(Math.min(yMinValue, yValue));
|
|
48510
|
-
yMaxValue = Math.ceil(Math.max(yMaxValue, yValue));
|
|
48511
|
-
});
|
|
48512
|
-
var formattingFunctionY = function formattingFunctionY(value) {
|
|
48513
|
-
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
48514
|
-
var nonPivotField = formattedResult.fields.find(function (resultField) {
|
|
48515
|
-
return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
|
|
48516
|
-
});
|
|
48517
|
-
if (!nonPivotField) return '';
|
|
48518
|
-
return formattedResult.formatterFunc(value, {
|
|
48519
|
-
fieldId: nonPivotField.fieldId,
|
|
48520
|
-
"function": nonPivotField["function"],
|
|
48521
|
-
outputDataType: nonPivotField.outputDataType
|
|
48522
|
-
}).formattedValue;
|
|
48523
|
-
};
|
|
48524
|
-
var yTickInterval = getNiceInterval$2((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
|
-
var chart = {
|
|
48751
|
+
var _getRepresentationDat = getRepresentationData({
|
|
48752
|
+
content: content,
|
|
48753
|
+
xKey: xKey,
|
|
48754
|
+
yKey: yKey,
|
|
48755
|
+
approxYAxisLabelCount: approxYAxisLabelCount,
|
|
48756
|
+
showTotalBar: showTotalBar,
|
|
48757
|
+
formattingFunctionY: formattingFunctionY
|
|
48758
|
+
}),
|
|
48759
|
+
data = _getRepresentationDat.data,
|
|
48760
|
+
steps = _getRepresentationDat.steps,
|
|
48761
|
+
xTicks = _getRepresentationDat.xTicks,
|
|
48762
|
+
yTicks = _getRepresentationDat.yTicks,
|
|
48763
|
+
yMinValue = _getRepresentationDat.yMinValue,
|
|
48764
|
+
yMaxValue = _getRepresentationDat.yMaxValue;
|
|
48765
|
+
var chartRepresentation = {
|
|
48535
48766
|
keys: _extends({}, keys[0], keys[1]),
|
|
48536
48767
|
x: {
|
|
48537
48768
|
title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null,
|
|
@@ -48563,7 +48794,10 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48563
48794
|
},
|
|
48564
48795
|
data: data
|
|
48565
48796
|
};
|
|
48566
|
-
return
|
|
48797
|
+
return {
|
|
48798
|
+
waterfallChartRepresentation: chartRepresentation,
|
|
48799
|
+
waterfallChartSteps: steps
|
|
48800
|
+
};
|
|
48567
48801
|
};
|
|
48568
48802
|
|
|
48569
48803
|
var WaterfallChartView = function WaterfallChartView(props) {
|
|
@@ -48633,12 +48867,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
48633
48867
|
if (isLoading(result)) return jsx(LoadingComponent, {});
|
|
48634
48868
|
if (hasFailed(result)) return jsx(FailedToLoadDataNotice, {});
|
|
48635
48869
|
if (isEmpty(result)) return jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
48636
|
-
var showHeadline =
|
|
48637
|
-
return headlineAvailable(order, headline, timeDimension);
|
|
48638
|
-
}, [order, headline, timeDimension]);
|
|
48870
|
+
var showHeadline = headlineAvailable(order, headline, timeDimension);
|
|
48639
48871
|
var pivotConfig = init$c(props);
|
|
48640
|
-
var
|
|
48641
|
-
return buildWaterfallChartRepresentation({
|
|
48872
|
+
var _buildWaterfallChartR = buildWaterfallChartRepresentation({
|
|
48642
48873
|
approxYAxisLabelCount: approxYAxisLabelCount === 'auto' ? 10 : approxYAxisLabelCount,
|
|
48643
48874
|
axisTitles: axisTitles,
|
|
48644
48875
|
dateTimeFormatOptions: dateTimeFormatOptions,
|
|
@@ -48647,6 +48878,7 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
48647
48878
|
numberFormatOptions: numberFormatOptions,
|
|
48648
48879
|
pivotConfig: pivotConfig,
|
|
48649
48880
|
result: result,
|
|
48881
|
+
showTotalBar: true,
|
|
48650
48882
|
valueAlias: valueAlias,
|
|
48651
48883
|
xAxisFormat: xAxisFormat,
|
|
48652
48884
|
xAxisPrefix: xAxisPrefix,
|
|
@@ -48654,8 +48886,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
48654
48886
|
yAxisFormat: yAxisFormat,
|
|
48655
48887
|
yAxisPrefix: yAxisPrefix,
|
|
48656
48888
|
yAxisPostfix: yAxisPostfix
|
|
48657
|
-
})
|
|
48658
|
-
|
|
48889
|
+
}),
|
|
48890
|
+
chartRepresentation = _buildWaterfallChartR.waterfallChartRepresentation,
|
|
48891
|
+
steps = _buildWaterfallChartR.waterfallChartSteps;
|
|
48659
48892
|
return jsx(Suspense, {
|
|
48660
48893
|
fallback: jsx(LoadingComponent, {}),
|
|
48661
48894
|
children: jsxs(ViewWrapper, {
|
|
@@ -48663,8 +48896,12 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
48663
48896
|
queriesAreChanging: queriesAreChanging,
|
|
48664
48897
|
children: [jsx(ViewHeader, _extends({}, headerProps, {
|
|
48665
48898
|
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
48666
|
-
})), showHeadline && jsx(HeadlineStats, _extends({}, props)), jsx(
|
|
48667
|
-
|
|
48899
|
+
})), showHeadline && jsx(HeadlineStats, _extends({}, props)), jsx("div", {
|
|
48900
|
+
className: styles({
|
|
48901
|
+
flex: '1',
|
|
48902
|
+
position: 'relative'
|
|
48903
|
+
}),
|
|
48904
|
+
"aria-disabled": props.library,
|
|
48668
48905
|
children: jsx(ParentSize, {
|
|
48669
48906
|
style: {
|
|
48670
48907
|
position: 'absolute',
|
|
@@ -48673,13 +48910,12 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
48673
48910
|
overflowX: 'hidden'
|
|
48674
48911
|
},
|
|
48675
48912
|
children: function children(parent) {
|
|
48913
|
+
if (chartRepresentation.data.length === 0) return jsx(LoadingComponent, {});
|
|
48676
48914
|
return jsx(WaterfallChart$2, {
|
|
48677
48915
|
width: parent.width,
|
|
48678
48916
|
height: parent.height,
|
|
48679
48917
|
options: {
|
|
48680
48918
|
showLegend: showLegend(legend, (theme == null ? void 0 : theme.detail) === 'verbose'),
|
|
48681
|
-
showTotalBar: true,
|
|
48682
|
-
// Waterfall TODO: check if this should be configurable via dashboard
|
|
48683
48919
|
showTooltipRoundedTotal: true,
|
|
48684
48920
|
removeStroke: false,
|
|
48685
48921
|
axis: {
|
|
@@ -48688,7 +48924,8 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
48688
48924
|
}
|
|
48689
48925
|
},
|
|
48690
48926
|
theme: theme == null ? void 0 : theme.charts,
|
|
48691
|
-
chart: chartRepresentation
|
|
48927
|
+
chart: chartRepresentation,
|
|
48928
|
+
steps: steps
|
|
48692
48929
|
});
|
|
48693
48930
|
}
|
|
48694
48931
|
})
|
|
@@ -48746,6 +48983,352 @@ var WaterfallChart$3 = function WaterfallChart(_ref) {
|
|
|
48746
48983
|
}));
|
|
48747
48984
|
};
|
|
48748
48985
|
|
|
48986
|
+
var buildAreaChartRepresentation = function buildAreaChartRepresentation(_ref) {
|
|
48987
|
+
var _xKeys$, _axisTitles$x, _axisTitles$y;
|
|
48988
|
+
var axisTitles = _ref.axisTitles,
|
|
48989
|
+
colors = _ref.colors,
|
|
48990
|
+
conditionalFormattingAttributes = _ref.conditionalFormattingAttributes,
|
|
48991
|
+
dateTimeFormatOptions = _ref.dateTimeFormatOptions,
|
|
48992
|
+
defaultFormats = _ref.defaultFormats,
|
|
48993
|
+
goalLineAttributes = _ref.goalLineAttributes,
|
|
48994
|
+
nullValue = _ref.nullValue,
|
|
48995
|
+
numberFormatOptions = _ref.numberFormatOptions,
|
|
48996
|
+
order = _ref.order,
|
|
48997
|
+
pivotConfig = _ref.pivotConfig,
|
|
48998
|
+
result = _ref.result,
|
|
48999
|
+
xAxisFormat = _ref.xAxisFormat,
|
|
49000
|
+
xAxisPostfix = _ref.xAxisPostfix,
|
|
49001
|
+
xAxisPrefix = _ref.xAxisPrefix,
|
|
49002
|
+
yAxisFormat = _ref.yAxisFormat,
|
|
49003
|
+
yAxisPostfix = _ref.yAxisPostfix,
|
|
49004
|
+
yAxisPrefix = _ref.yAxisPrefix,
|
|
49005
|
+
approxYAxisLabelCount = _ref.approxYAxisLabelCount,
|
|
49006
|
+
seriesLabelFormatter = _ref.seriesLabelFormatter,
|
|
49007
|
+
_valueAlias = _ref.valueAlias,
|
|
49008
|
+
stacked = _ref.stacked;
|
|
49009
|
+
var activeDateTimeFormats = {};
|
|
49010
|
+
var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
|
|
49011
|
+
allPrefixes = _buildFieldFormatMaps.allPrefixes,
|
|
49012
|
+
allPostfixes = _buildFieldFormatMaps.allPostfixes,
|
|
49013
|
+
nullValues = _buildFieldFormatMaps.nullValues,
|
|
49014
|
+
activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
|
|
49015
|
+
|
|
49016
|
+
// Build params for the result formatter.
|
|
49017
|
+
var params = {
|
|
49018
|
+
defaultFormats: defaultFormats,
|
|
49019
|
+
dateTimeFormatOptions: dateTimeFormatOptions,
|
|
49020
|
+
numberFormatOptions: numberFormatOptions,
|
|
49021
|
+
valueAlias: function valueAlias(params) {
|
|
49022
|
+
if (typeof _valueAlias === 'function') {
|
|
49023
|
+
// TODO; it is more useful providing this information separate,
|
|
49024
|
+
// rather than building it into an ID and returning it. Ideally all would be returned
|
|
49025
|
+
return String(_valueAlias({
|
|
49026
|
+
fieldId: id({
|
|
49027
|
+
field: params.fieldId,
|
|
49028
|
+
"function": params["function"]
|
|
49029
|
+
}),
|
|
49030
|
+
value: params.value
|
|
49031
|
+
}));
|
|
49032
|
+
}
|
|
49033
|
+
return undefined;
|
|
49034
|
+
},
|
|
49035
|
+
nullValue: nullValues,
|
|
49036
|
+
prefixes: allPrefixes,
|
|
49037
|
+
postfixes: allPostfixes,
|
|
49038
|
+
activeNumberFormats: activeNumberFormats,
|
|
49039
|
+
activeDateTimeFormats: activeDateTimeFormats
|
|
49040
|
+
};
|
|
49041
|
+
var formattedResult = formatResult(result, params);
|
|
49042
|
+
|
|
49043
|
+
// --------------------------------------------
|
|
49044
|
+
// --------------------------------------------
|
|
49045
|
+
// --------------------------------------------
|
|
49046
|
+
// --------------------------------------------
|
|
49047
|
+
// --------------------------------------------
|
|
49048
|
+
// --------------------------------------------
|
|
49049
|
+
// --------------------------------------------
|
|
49050
|
+
// --------------------------------------------
|
|
49051
|
+
|
|
49052
|
+
// ----- xKey -----
|
|
49053
|
+
|
|
49054
|
+
var xKeyField = getXKeyField(pivotConfig, result.fields);
|
|
49055
|
+
|
|
49056
|
+
// ----- Formatting ----
|
|
49057
|
+
// (value: any, noValueReplacement?: string) => string;
|
|
49058
|
+
var formattingFunctionY = function formattingFunctionY(value) {
|
|
49059
|
+
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
49060
|
+
var nonPivotField = formattedResult.fields.find(function (resultField) {
|
|
49061
|
+
return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
|
|
49062
|
+
});
|
|
49063
|
+
if (!nonPivotField) return '';
|
|
49064
|
+
return formattedResult.formatterFunc(value, {
|
|
49065
|
+
fieldId: nonPivotField.fieldId,
|
|
49066
|
+
"function": nonPivotField["function"],
|
|
49067
|
+
outputDataType: nonPivotField.outputDataType
|
|
49068
|
+
}).formattedValue;
|
|
49069
|
+
};
|
|
49070
|
+
|
|
49071
|
+
// ----- Keys & Prep -----
|
|
49072
|
+
var xScaleDataType = (xKeyField == null ? void 0 : xKeyField.outputDataType) || 'string';
|
|
49073
|
+
var _formattedResultToSer = formattedResultToSeries(formattedResult, pivotConfig, seriesLabelFormatter),
|
|
49074
|
+
keys = _formattedResultToSer.keys,
|
|
49075
|
+
yKeys = _formattedResultToSer.yKeys,
|
|
49076
|
+
xKeys = _formattedResultToSer.xKeys,
|
|
49077
|
+
chartData = _formattedResultToSer.seriesData;
|
|
49078
|
+
var xKey = (_xKeys$ = xKeys[0]) != null ? _xKeys$ : null;
|
|
49079
|
+
var updatedData = function () {
|
|
49080
|
+
var hasMultipleGroups = result.fields.length > 2;
|
|
49081
|
+
var data = chartData;
|
|
49082
|
+
if (hasMultipleGroups) {
|
|
49083
|
+
data = fillMissingKeysForChartData(chartData);
|
|
49084
|
+
}
|
|
49085
|
+
if (stacked) {
|
|
49086
|
+
data = fillMissingKeysForChartData(data);
|
|
49087
|
+
}
|
|
49088
|
+
return data;
|
|
49089
|
+
}();
|
|
49090
|
+
|
|
49091
|
+
// ----- Goal Lines -----
|
|
49092
|
+
|
|
49093
|
+
var goalLines = getGoalLines({
|
|
49094
|
+
goalLineAttributes: goalLineAttributes,
|
|
49095
|
+
formattingFunctionY: formattingFunctionY
|
|
49096
|
+
});
|
|
49097
|
+
|
|
49098
|
+
// ----- Ticks -----
|
|
49099
|
+
|
|
49100
|
+
var ticks = getScaleAndTicks({
|
|
49101
|
+
data: updatedData,
|
|
49102
|
+
xKey: xKey,
|
|
49103
|
+
xScaleDataType: xScaleDataType,
|
|
49104
|
+
yKeys: yKeys,
|
|
49105
|
+
tickCountYAxis: approxYAxisLabelCount,
|
|
49106
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
49107
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
49108
|
+
},
|
|
49109
|
+
formattingFunctionY: formattingFunctionY,
|
|
49110
|
+
nullValue: nullValue,
|
|
49111
|
+
order: order,
|
|
49112
|
+
goalLines: goalLines
|
|
49113
|
+
});
|
|
49114
|
+
|
|
49115
|
+
// ----- Lines -----
|
|
49116
|
+
|
|
49117
|
+
var styleDefinition = getStyleDefinition({
|
|
49118
|
+
colors: colors,
|
|
49119
|
+
yKeys: yKeys,
|
|
49120
|
+
style: {
|
|
49121
|
+
toOpacity: 0.5,
|
|
49122
|
+
fromOpacity: 0.9,
|
|
49123
|
+
type: 'area'
|
|
49124
|
+
}
|
|
49125
|
+
});
|
|
49126
|
+
|
|
49127
|
+
// ----- Conditional Formatting -----
|
|
49128
|
+
|
|
49129
|
+
var conditionalFormattingRules = getConditionalFormatting({
|
|
49130
|
+
conditionalFormattingAttributes: conditionalFormattingAttributes
|
|
49131
|
+
});
|
|
49132
|
+
var chart = {
|
|
49133
|
+
keys: keys,
|
|
49134
|
+
x: {
|
|
49135
|
+
ticks: ticks.x.ticks,
|
|
49136
|
+
scale: {
|
|
49137
|
+
dataType: ticks.x.scale.dataType,
|
|
49138
|
+
key: ticks.x.scale.key,
|
|
49139
|
+
ordering: ticks.x.scale.ordering,
|
|
49140
|
+
min: ticks.x.scale.min,
|
|
49141
|
+
max: ticks.x.scale.max
|
|
49142
|
+
},
|
|
49143
|
+
key: xKey,
|
|
49144
|
+
postfix: xAxisPostfix,
|
|
49145
|
+
prefix: xAxisPrefix,
|
|
49146
|
+
title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null
|
|
49147
|
+
},
|
|
49148
|
+
y: {
|
|
49149
|
+
ticks: ticks.y.ticks,
|
|
49150
|
+
scale: {
|
|
49151
|
+
dataType: ticks.y.scale.dataType,
|
|
49152
|
+
key: ticks.y.scale.key,
|
|
49153
|
+
ordering: ticks.y.scale.ordering,
|
|
49154
|
+
min: ticks.y.scale.min,
|
|
49155
|
+
max: ticks.y.scale.max
|
|
49156
|
+
},
|
|
49157
|
+
keys: yKeys,
|
|
49158
|
+
postfix: yAxisPostfix,
|
|
49159
|
+
prefix: yAxisPrefix,
|
|
49160
|
+
title: (_axisTitles$y = axisTitles == null ? void 0 : axisTitles.y) != null ? _axisTitles$y : null
|
|
49161
|
+
},
|
|
49162
|
+
data: updatedData,
|
|
49163
|
+
areas: styleDefinition,
|
|
49164
|
+
conditionalFormattingRules: conditionalFormattingRules,
|
|
49165
|
+
goalLines: goalLines
|
|
49166
|
+
};
|
|
49167
|
+
return chart;
|
|
49168
|
+
};
|
|
49169
|
+
|
|
49170
|
+
var AreaChartV2View = function AreaChartV2View(props) {
|
|
49171
|
+
var _props$library, _props$attributes$vie;
|
|
49172
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
49173
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
49174
|
+
valueAlias = _useDashboardBehaviou.valueAlias,
|
|
49175
|
+
labelFormat = _useDashboardBehaviou.labelFormat,
|
|
49176
|
+
queryEngineConfig = _useDashboardBehaviou.queryEngineConfig;
|
|
49177
|
+
var headerProps = {
|
|
49178
|
+
displayTitle: props.attributes.displayTitle,
|
|
49179
|
+
displaySubject: props.attributes.displaySubject,
|
|
49180
|
+
verified: props.attributes.protectedByOrganisation,
|
|
49181
|
+
library: (_props$library = props.library) != null ? _props$library : false,
|
|
49182
|
+
localFilters: props.localFilters,
|
|
49183
|
+
setLocalFilters: props.setLocalFilters,
|
|
49184
|
+
dataSet: props.dataSet,
|
|
49185
|
+
parameters: props == null ? void 0 : props.attributes.parameters,
|
|
49186
|
+
componentType: props == null ? void 0 : props.attributes.type,
|
|
49187
|
+
measure: props == null ? void 0 : props.attributes.measure,
|
|
49188
|
+
dimension: props == null ? void 0 : props.attributes.dimension,
|
|
49189
|
+
timeDimension: props.attributes.timeDimension,
|
|
49190
|
+
setPartialAttributes: props.setPartialAttributes,
|
|
49191
|
+
viewId: (_props$attributes$vie = props == null ? void 0 : props.attributes.viewId) != null ? _props$attributes$vie : '',
|
|
49192
|
+
order: props.attributes.order
|
|
49193
|
+
};
|
|
49194
|
+
var showHeadline = headlineAvailable(props.attributes.order, props.attributes.headline, null);
|
|
49195
|
+
var theme = useTheme();
|
|
49196
|
+
var AreaChartV2Component = getComponentInterface(props.attributes.type);
|
|
49197
|
+
var pivotConfig = init$c(props.attributes);
|
|
49198
|
+
var chartRepresentation = null;
|
|
49199
|
+
if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && AreaChartV2Component.isRunnable(props.attributes)) {
|
|
49200
|
+
var _theme$charts$colors, _theme$charts, _props$attributes$goa;
|
|
49201
|
+
chartRepresentation = buildAreaChartRepresentation({
|
|
49202
|
+
axisTitles: props.attributes.axisTitles,
|
|
49203
|
+
xAxisPostfix: props.attributes.xAxisPostfix,
|
|
49204
|
+
xAxisPrefix: props.attributes.xAxisPrefix,
|
|
49205
|
+
yAxisPostfix: props.attributes.yAxisPostfix,
|
|
49206
|
+
yAxisPrefix: props.attributes.yAxisPrefix,
|
|
49207
|
+
yAxisFormat: props.attributes.yAxisFormat,
|
|
49208
|
+
xAxisFormat: props.attributes.xAxisFormat,
|
|
49209
|
+
approxYAxisLabelCount: props.attributes.approxYAxisLabelCount === 'auto' ? 10 : props.attributes.approxYAxisLabelCount,
|
|
49210
|
+
colors: (_theme$charts$colors = theme == null || (_theme$charts = theme.charts) == null ? void 0 : _theme$charts.colors) != null ? _theme$charts$colors : DEFAULT_CHART_COLORS,
|
|
49211
|
+
valueAlias: valueAlias,
|
|
49212
|
+
nullValue: checkForNullValue(props.attributes.dataSetId, props.attributes.dimension, props.attributes.timeDimension, textOverride, valueAlias),
|
|
49213
|
+
result: props.result,
|
|
49214
|
+
pivotConfig: pivotConfig,
|
|
49215
|
+
order: props.attributes.order,
|
|
49216
|
+
numberFormatOptions: props.numberFormatOptions,
|
|
49217
|
+
dateTimeFormatOptions: props.dateTimeFormatOptions,
|
|
49218
|
+
goalLineAttributes: (_props$attributes$goa = props.attributes.goalLines) != null ? _props$attributes$goa : [],
|
|
49219
|
+
conditionalFormattingAttributes: props.attributes.conditionalFormattingRules,
|
|
49220
|
+
defaultFormats: props.defaultFormats,
|
|
49221
|
+
seriesLabelFormatter: function seriesLabelFormatter(labelFormatParams) {
|
|
49222
|
+
var _queryEngineConfig$su, _queryEngineConfig$su2, _queryEngineConfig$su3;
|
|
49223
|
+
var yResultField = labelFormatParams.yResultField,
|
|
49224
|
+
yPivotFields = labelFormatParams.yPivotFields,
|
|
49225
|
+
row = labelFormatParams.row;
|
|
49226
|
+
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);
|
|
49227
|
+
var formattedFunction = yResultField["function"] === 'none' ? '' : " \u2022 " + formattedFunctionName;
|
|
49228
|
+
var defaultLabelFormat = "" + yPivotFields.map(function (field) {
|
|
49229
|
+
return row[field.id].formattedValue;
|
|
49230
|
+
}).join(' • ') + (yPivotFields.length === 0 ? '' : ' • ') + yResultField.publicName + formattedFunction;
|
|
49231
|
+
if (!labelFormat) return defaultLabelFormat;
|
|
49232
|
+
return labelFormat({
|
|
49233
|
+
viewId: props.attributes.viewId,
|
|
49234
|
+
fieldId: yResultField.fieldId,
|
|
49235
|
+
func: yResultField["function"],
|
|
49236
|
+
type: 'areaChartV2',
|
|
49237
|
+
defaultLabel: defaultLabelFormat
|
|
49238
|
+
}) || defaultLabelFormat;
|
|
49239
|
+
},
|
|
49240
|
+
stacked: props.attributes.stacked
|
|
49241
|
+
});
|
|
49242
|
+
}
|
|
49243
|
+
|
|
49244
|
+
// When these are triggered they don't render the chart after they're resolved, potentially because component did no re-render?
|
|
49245
|
+
if (!AreaChartV2Component.isRunnable(props.attributes)) {
|
|
49246
|
+
return jsx(QueryUnderConstructionNotice, {
|
|
49247
|
+
title: "Missing parameters"
|
|
49248
|
+
});
|
|
49249
|
+
}
|
|
49250
|
+
if (isLoading(props.result)) return jsx(LoadingComponent, {});
|
|
49251
|
+
if (hasFailed(props.result)) return jsx(FailedToLoadDataNotice, {});
|
|
49252
|
+
if (isEmpty(props.result)) return jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
49253
|
+
return jsx(Suspense, {
|
|
49254
|
+
fallback: jsx(LoadingComponent, {}),
|
|
49255
|
+
children: jsxs(ViewWrapper, {
|
|
49256
|
+
id: props.id,
|
|
49257
|
+
queriesAreChanging: props.queriesAreChanging,
|
|
49258
|
+
children: [jsx(ViewHeader, _extends({}, headerProps, {
|
|
49259
|
+
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
49260
|
+
})), showHeadline && jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsx("div", {
|
|
49261
|
+
className: styles({
|
|
49262
|
+
flex: '1',
|
|
49263
|
+
position: 'relative'
|
|
49264
|
+
}),
|
|
49265
|
+
"aria-disabled": props.library,
|
|
49266
|
+
children: chartRepresentation && jsx(ParentSize, {
|
|
49267
|
+
style: {
|
|
49268
|
+
position: 'absolute',
|
|
49269
|
+
width: '100%',
|
|
49270
|
+
height: '100%',
|
|
49271
|
+
overflowX: 'hidden'
|
|
49272
|
+
},
|
|
49273
|
+
children: function children(parent) {
|
|
49274
|
+
var _props$attributes$vie2, _props$attributes$sta;
|
|
49275
|
+
if (chartRepresentation.areas.length === 0) return jsx(LoadingComponent, {});
|
|
49276
|
+
return jsx(AreaChartV2$1, {
|
|
49277
|
+
width: parent.width,
|
|
49278
|
+
height: parent.height,
|
|
49279
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
49280
|
+
uniqueId: (_props$attributes$vie2 = props.attributes.viewId) != null ? _props$attributes$vie2 : 'area-chart',
|
|
49281
|
+
options: {
|
|
49282
|
+
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
49283
|
+
curve: props.attributes.lineCurve,
|
|
49284
|
+
removeStroke: false,
|
|
49285
|
+
showRoundedTotal: false,
|
|
49286
|
+
showLegend: props.attributes.legend,
|
|
49287
|
+
axis: {
|
|
49288
|
+
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
49289
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
49290
|
+
}
|
|
49291
|
+
},
|
|
49292
|
+
theme: theme == null ? void 0 : theme.charts
|
|
49293
|
+
});
|
|
49294
|
+
}
|
|
49295
|
+
})
|
|
49296
|
+
})]
|
|
49297
|
+
})
|
|
49298
|
+
});
|
|
49299
|
+
};
|
|
49300
|
+
|
|
49301
|
+
var AreaChartV2 = function AreaChartV2(props) {
|
|
49302
|
+
var _props$component = props.component,
|
|
49303
|
+
results = _props$component.results,
|
|
49304
|
+
attributes = _props$component.attributes,
|
|
49305
|
+
localFilters = _props$component.localFilters;
|
|
49306
|
+
var dashboardBehaviour = props.dashboardBehaviour;
|
|
49307
|
+
var _useComponentEffect = useComponentEffect(attributes, props.dataSet, dashboardBehaviour.queryEngineConfig, {
|
|
49308
|
+
localFilters: localFilters,
|
|
49309
|
+
globalFilters: props.globalFilters
|
|
49310
|
+
}, props.updateComponentAttributes, props.runQueriesCallback, props.setResults, dashboardBehaviour.variables),
|
|
49311
|
+
queriesAreChanging = _useComponentEffect.queriesAreChanging;
|
|
49312
|
+
return jsx(AreaChartV2View, {
|
|
49313
|
+
id: props.id,
|
|
49314
|
+
attributes: attributes,
|
|
49315
|
+
dataSet: props.dataSet,
|
|
49316
|
+
localFilters: props.component.localFilters,
|
|
49317
|
+
setLocalFilters: props.setLocalFilters,
|
|
49318
|
+
setPartialAttributes: function setPartialAttributes(changes) {
|
|
49319
|
+
return props.setPartialAttributes(changes);
|
|
49320
|
+
},
|
|
49321
|
+
result: results && results[0],
|
|
49322
|
+
queriesAreChanging: queriesAreChanging,
|
|
49323
|
+
numberFormatOptions: dashboardBehaviour.numberFormatOptions,
|
|
49324
|
+
dateTimeFormatOptions: dashboardBehaviour.dateTimeFormatOptions,
|
|
49325
|
+
defaultFormats: dashboardBehaviour.defaultFormats,
|
|
49326
|
+
propsForHeadline: props,
|
|
49327
|
+
idPrefix: props.idPrefix,
|
|
49328
|
+
library: props == null ? void 0 : props.library
|
|
49329
|
+
});
|
|
49330
|
+
};
|
|
49331
|
+
|
|
48749
49332
|
var Component = function Component(props) {
|
|
48750
49333
|
var _useDashboardContext = useDashboardContext(),
|
|
48751
49334
|
dashboard = _useDashboardContext.dashboard;
|
|
@@ -48888,7 +49471,7 @@ var Component = function Component(props) {
|
|
|
48888
49471
|
});
|
|
48889
49472
|
},
|
|
48890
49473
|
onError: dashboardBehaviour.onError,
|
|
48891
|
-
children: jsx(AreaChart$
|
|
49474
|
+
children: jsx(AreaChart$4, {
|
|
48892
49475
|
id: props.id,
|
|
48893
49476
|
setLocalFilters: props.setLocalFilters,
|
|
48894
49477
|
dataSet: dataSet,
|
|
@@ -48986,6 +49569,32 @@ var Component = function Component(props) {
|
|
|
48986
49569
|
})
|
|
48987
49570
|
});
|
|
48988
49571
|
}
|
|
49572
|
+
if (props.component.attributes.type == 'areaChartV2') {
|
|
49573
|
+
return jsx(ErrorBoundary, {
|
|
49574
|
+
renderOnError: function renderOnError(onManualRetry) {
|
|
49575
|
+
return jsx(ComponentErrorNotice, {
|
|
49576
|
+
onManualRetry: onManualRetry
|
|
49577
|
+
});
|
|
49578
|
+
},
|
|
49579
|
+
onError: dashboardBehaviour.onError,
|
|
49580
|
+
children: jsx(AreaChartV2, {
|
|
49581
|
+
id: props.id,
|
|
49582
|
+
setLocalFilters: props.setLocalFilters,
|
|
49583
|
+
dataSet: dataSet,
|
|
49584
|
+
updateComponentAttributes: function updateComponentAttributes(newAttributes) {
|
|
49585
|
+
return _updateComponentAttributes(newAttributes);
|
|
49586
|
+
},
|
|
49587
|
+
runQueriesCallback: props.runQueriesCallback,
|
|
49588
|
+
component: props.component,
|
|
49589
|
+
setResults: props.setResults,
|
|
49590
|
+
globalFilters: dashboard.globalFilters,
|
|
49591
|
+
dashboardBehaviour: dashboardBehaviour,
|
|
49592
|
+
library: props == null ? void 0 : props.library,
|
|
49593
|
+
idPrefix: idPrefix,
|
|
49594
|
+
setPartialAttributes: setPartialAttributes
|
|
49595
|
+
})
|
|
49596
|
+
});
|
|
49597
|
+
}
|
|
48989
49598
|
if (props.component.attributes.type == 'pieChart') {
|
|
48990
49599
|
return jsx(ErrorBoundary, {
|
|
48991
49600
|
renderOnError: function renderOnError(onManualRetry) {
|
|
@@ -65398,7 +66007,7 @@ var View$3 = /*#__PURE__*/function () {
|
|
|
65398
66007
|
};
|
|
65399
66008
|
return View;
|
|
65400
66009
|
}();
|
|
65401
|
-
var AreaChart$
|
|
66010
|
+
var AreaChart$5 = /*#__PURE__*/function (_View2) {
|
|
65402
66011
|
function AreaChart(attributes) {
|
|
65403
66012
|
return _View2.call(this, _extends({}, attributes, {
|
|
65404
66013
|
type: 'areaChart'
|
|
@@ -65767,6 +66376,8 @@ var toQueries$9 = commonToQueries;
|
|
|
65767
66376
|
|
|
65768
66377
|
var toQueries$a = commonToQueries;
|
|
65769
66378
|
|
|
66379
|
+
var toQueries$b = commonToQueries;
|
|
66380
|
+
|
|
65770
66381
|
var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65771
66382
|
var line = build$a(dataSet, attributes.lineMeasure, attributes.order, attributes.lineDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
65772
66383
|
var bar = build$a(dataSet, attributes.barMeasure, attributes.order, attributes.barDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
@@ -65775,7 +66386,7 @@ var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngin
|
|
|
65775
66386
|
line: line
|
|
65776
66387
|
};
|
|
65777
66388
|
};
|
|
65778
|
-
var toQueries$
|
|
66389
|
+
var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65779
66390
|
var _buildMainQueries = buildMainQueries(attributes, dataSet, queryEngineConfig, params),
|
|
65780
66391
|
line = _buildMainQueries.line,
|
|
65781
66392
|
bar = _buildMainQueries.bar;
|
|
@@ -65833,7 +66444,7 @@ var buildQueries = function buildQueries(attributes, dataSet, queryEngineConfig,
|
|
|
65833
66444
|
measureDescription: deltaQuery ? [mainQuery.measureDescription, deltaQuery.measureDescription] : [mainQuery.measureDescription]
|
|
65834
66445
|
};
|
|
65835
66446
|
};
|
|
65836
|
-
var toQueries$
|
|
66447
|
+
var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65837
66448
|
var _buildQueries = buildQueries(attributes, dataSet, queryEngineConfig, params),
|
|
65838
66449
|
queries = _buildQueries.queries,
|
|
65839
66450
|
measureDescription = _buildQueries.measureDescription;
|
|
@@ -65844,7 +66455,7 @@ var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65844
66455
|
};
|
|
65845
66456
|
};
|
|
65846
66457
|
|
|
65847
|
-
var toQueries$
|
|
66458
|
+
var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65848
66459
|
var measures = [];
|
|
65849
66460
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
65850
66461
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
@@ -65858,7 +66469,7 @@ var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65858
66469
|
};
|
|
65859
66470
|
};
|
|
65860
66471
|
|
|
65861
|
-
var toQueries$
|
|
66472
|
+
var toQueries$f = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65862
66473
|
var measures = [];
|
|
65863
66474
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
65864
66475
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
@@ -65872,7 +66483,7 @@ var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65872
66483
|
};
|
|
65873
66484
|
};
|
|
65874
66485
|
|
|
65875
|
-
var toQueries$
|
|
66486
|
+
var toQueries$g = function toQueries$1(attributes, dataSet, queryEngineConfig, params) {
|
|
65876
66487
|
return toQueries([dataSet], [{
|
|
65877
66488
|
measure: attributes.measure,
|
|
65878
66489
|
dataSetId: dataSet.id,
|
|
@@ -65884,12 +66495,12 @@ var toQueries$f = function toQueries$1(attributes, dataSet, queryEngineConfig, p
|
|
|
65884
66495
|
}], queryEngineConfig, params);
|
|
65885
66496
|
};
|
|
65886
66497
|
|
|
65887
|
-
var toQueries$g = commonToQueries;
|
|
65888
|
-
|
|
65889
66498
|
var toQueries$h = commonToQueries;
|
|
65890
66499
|
|
|
65891
66500
|
var toQueries$i = commonToQueries;
|
|
65892
66501
|
|
|
66502
|
+
var toQueries$j = commonToQueries;
|
|
66503
|
+
|
|
65893
66504
|
var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65894
66505
|
switch (attributes.type) {
|
|
65895
66506
|
case 'areaChart':
|
|
@@ -65904,30 +66515,32 @@ var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet
|
|
|
65904
66515
|
return toQueries$6(attributes, dataSet, queryEngineConfig, params);
|
|
65905
66516
|
case 'lineChartV2':
|
|
65906
66517
|
return toQueries$7(attributes, dataSet, queryEngineConfig, params);
|
|
65907
|
-
case '
|
|
66518
|
+
case 'areaChartV2':
|
|
65908
66519
|
return toQueries$8(attributes, dataSet, queryEngineConfig, params);
|
|
65909
|
-
case '
|
|
66520
|
+
case 'pieChart':
|
|
65910
66521
|
return toQueries$9(attributes, dataSet, queryEngineConfig, params);
|
|
65911
|
-
case '
|
|
66522
|
+
case 'dataTable':
|
|
65912
66523
|
return toQueries$a(attributes, dataSet, queryEngineConfig, params);
|
|
65913
|
-
case '
|
|
66524
|
+
case 'basicTable':
|
|
65914
66525
|
return toQueries$b(attributes, dataSet, queryEngineConfig, params);
|
|
65915
|
-
case '
|
|
66526
|
+
case 'comboChart':
|
|
65916
66527
|
return toQueries$c(attributes, dataSet, queryEngineConfig, params);
|
|
66528
|
+
case 'singleStat':
|
|
66529
|
+
return toQueries$d(attributes, dataSet, queryEngineConfig, params);
|
|
65917
66530
|
case 'progress':
|
|
65918
|
-
return toQueries$c(attributes, dataSet, queryEngineConfig, params);
|
|
65919
|
-
case 'scatterChart':
|
|
65920
66531
|
return toQueries$d(attributes, dataSet, queryEngineConfig, params);
|
|
65921
|
-
case '
|
|
66532
|
+
case 'scatterChart':
|
|
65922
66533
|
return toQueries$e(attributes, dataSet, queryEngineConfig, params);
|
|
65923
|
-
case '
|
|
66534
|
+
case 'bubbleChart':
|
|
65924
66535
|
return toQueries$f(attributes, dataSet, queryEngineConfig, params);
|
|
65925
|
-
case '
|
|
66536
|
+
case 'mercatorMap':
|
|
65926
66537
|
return toQueries$g(attributes, dataSet, queryEngineConfig, params);
|
|
65927
|
-
case '
|
|
66538
|
+
case 'funnelChart':
|
|
65928
66539
|
return toQueries$h(attributes, dataSet, queryEngineConfig, params);
|
|
65929
|
-
case '
|
|
66540
|
+
case 'richText':
|
|
65930
66541
|
return toQueries$i(attributes, dataSet, queryEngineConfig, params);
|
|
66542
|
+
case 'waterfallChart':
|
|
66543
|
+
return toQueries$j(attributes, dataSet, queryEngineConfig, params);
|
|
65931
66544
|
default:
|
|
65932
66545
|
throw 'Unsupported view when building query.';
|
|
65933
66546
|
}
|
|
@@ -67475,7 +68088,7 @@ VizzlyServices.Dashboard = Dashboard$1;
|
|
|
67475
68088
|
VizzlyServices.Editor = Editor;
|
|
67476
68089
|
VizzlyServices.Header = Header;
|
|
67477
68090
|
VizzlyServices.Library = Library$1;
|
|
67478
|
-
VizzlyServices.AreaChart = AreaChart$
|
|
68091
|
+
VizzlyServices.AreaChart = AreaChart$5;
|
|
67479
68092
|
VizzlyServices.LineChart = LineChart$6;
|
|
67480
68093
|
VizzlyServices.BarChart = BarChart$6;
|
|
67481
68094
|
VizzlyServices.PieChart = PieChart$4;
|
|
@@ -68799,7 +69412,8 @@ var attributesToAiView = function attributesToAiView(dataSet, originalAttributes
|
|
|
68799
69412
|
if (attributes.type === 'richText') throw 'Rich text views are not supported by Vizzly AI.';
|
|
68800
69413
|
if (attributes.type === 'lineChartV2') throw 'Line Chart V2 views are not supported by Vizzly AI.';
|
|
68801
69414
|
if (attributes.type === 'bubbleChart') throw 'Bubble Chart views are not supported by Vizzly AI.';
|
|
68802
|
-
if (attributes.type === 'barChartV2') throw '
|
|
69415
|
+
if (attributes.type === 'barChartV2') throw 'Bar Chart V2 views are not supported by Vizzly AI.';
|
|
69416
|
+
if (attributes.type === 'areaChartV2') throw 'Area Chart V2 views are not supported by Vizzly AI.';
|
|
68803
69417
|
if (attributes.type === 'waterfallChart') throw 'Waterfall chart views are not supported by Vizzly AI.';
|
|
68804
69418
|
var select = [];
|
|
68805
69419
|
var group = [];
|