@vizzly/dashboard 0.14.4-dev-a92622560305a2aadfb851574db2d2f43a80cb14 → 0.14.4-dev-f592adcabadc611d0e867520c138d5a939466968
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/index.d.ts +1 -0
- package/dist/dashboard/src/contexts/GlobalProvider/useGlobalProvider.d.ts +6 -6
- package/dist/dashboard.cjs.development.js +1301 -453
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +1301 -453
- 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/BubbleChart/getAxisFormattingFunction.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/ChartsV2/getAxisFormattingFunction.d.ts +1 -1
- 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/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/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
|
@@ -57,7 +57,6 @@ var windowSize = require('@react-hook/window-size');
|
|
|
57
57
|
var copy = _interopDefault(require('copy-to-clipboard'));
|
|
58
58
|
var html2canvas = _interopDefault(require('html2canvas'));
|
|
59
59
|
var jsPDF = _interopDefault(require('jspdf'));
|
|
60
|
-
var BubbleChart$3 = require('./charts/src/BubbleChart');
|
|
61
60
|
var clipPath = require('@visx/clip-path');
|
|
62
61
|
var event = require('@visx/event');
|
|
63
62
|
var d3Array = require('@visx/vendor/d3-array');
|
|
@@ -65,6 +64,7 @@ var axis = require('@visx/axis');
|
|
|
65
64
|
var text$3 = require('@visx/text');
|
|
66
65
|
var grid = require('@visx/grid');
|
|
67
66
|
require('@visx/point');
|
|
67
|
+
var v2 = require('./charts/src/v2');
|
|
68
68
|
var VisibilitySensor = _interopDefault(require('react-visibility-sensor'));
|
|
69
69
|
var ExcelJS = _interopDefault(require('exceljs'));
|
|
70
70
|
var fileSaver = require('file-saver');
|
|
@@ -2732,6 +2732,7 @@ var timeDimensionQuerySchema = function timeDimensionQuerySchema(queryEngineConf
|
|
|
2732
2732
|
});
|
|
2733
2733
|
};
|
|
2734
2734
|
var lineCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step', 'stepBefore', 'stepAfter', 'dotted');
|
|
2735
|
+
var areaCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step');
|
|
2735
2736
|
var protectedFieldsMeasure = function protectedFieldsMeasure(queryEngineConfig) {
|
|
2736
2737
|
var _Joi$string6;
|
|
2737
2738
|
return Joi.array().items(Joi.object({
|
|
@@ -8172,7 +8173,7 @@ var RichText = function RichText(config) {
|
|
|
8172
8173
|
};
|
|
8173
8174
|
};
|
|
8174
8175
|
|
|
8175
|
-
var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
|
|
8176
|
+
var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'areaChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
|
|
8176
8177
|
/** @deprecated */
|
|
8177
8178
|
|
|
8178
8179
|
var ProgressType = /*#__PURE__*/function (ProgressType) {
|
|
@@ -8969,7 +8970,6 @@ var attributesSchema$e = function attributesSchema(config) {
|
|
|
8969
8970
|
var setAttributes$d = (function (config) {
|
|
8970
8971
|
return function (bubbleChart, partial) {
|
|
8971
8972
|
var newAttributes = setAttributes(bubbleChart, partial, attributesSchema$e(config));
|
|
8972
|
-
console.log(newAttributes, 'HERE');
|
|
8973
8973
|
var allowedOrderSpec = [];
|
|
8974
8974
|
if (newAttributes.xMeasure) {
|
|
8975
8975
|
allowedOrderSpec.push(newAttributes.xMeasure);
|
|
@@ -9340,7 +9340,7 @@ var BubbleChart = function BubbleChart(config) {
|
|
|
9340
9340
|
|
|
9341
9341
|
var attributesSchema$f = function attributesSchema(config) {
|
|
9342
9342
|
return Joi.object(_extends({}, baseAttributesSchema(config.attributesSchemaOptions), timeDimensionQuerySchema(config.queryEngineConfig, config.attributesSchemaOptions), {
|
|
9343
|
-
stacked: Joi.valid(true, false
|
|
9343
|
+
stacked: Joi.valid(true, false),
|
|
9344
9344
|
legend: Joi.valid(true, false),
|
|
9345
9345
|
type: Joi.valid('barChartV2').required(),
|
|
9346
9346
|
parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
|
|
@@ -10020,6 +10020,379 @@ var WaterfallChart = function WaterfallChart(config) {
|
|
|
10020
10020
|
};
|
|
10021
10021
|
};
|
|
10022
10022
|
|
|
10023
|
+
var attributesSchema$h = function attributesSchema(config) {
|
|
10024
|
+
return Joi.object(_extends({}, baseAttributesSchema(config.attributesSchemaOptions), timeDimensionQuerySchema(config.queryEngineConfig, config.attributesSchemaOptions), {
|
|
10025
|
+
stacked: Joi.valid(true, false),
|
|
10026
|
+
legend: Joi.valid(true, false),
|
|
10027
|
+
type: Joi.valid('areaChartV2').required(),
|
|
10028
|
+
parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
|
|
10029
|
+
lineCurve: areaCurveSchema,
|
|
10030
|
+
conditionalFormattingRules: conditionalFormattingRulesSchema(config.queryEngineConfig),
|
|
10031
|
+
goalLines: goalLinesSchema(),
|
|
10032
|
+
axisTitles: axisTitleSchema(),
|
|
10033
|
+
headline: headlineSchema(),
|
|
10034
|
+
tags: tagsSchema(),
|
|
10035
|
+
trends: trendsSchema()
|
|
10036
|
+
}));
|
|
10037
|
+
};
|
|
10038
|
+
|
|
10039
|
+
var setAttributes$g = (function (config) {
|
|
10040
|
+
return function (lineChart, partial) {
|
|
10041
|
+
var newAttributes = setAttributes(lineChart, partial, attributesSchema$h(config));
|
|
10042
|
+
newAttributes = removeUnusedOrderFieldsFromTimeSeriesComponent(newAttributes);
|
|
10043
|
+
return newAttributes;
|
|
10044
|
+
};
|
|
10045
|
+
});
|
|
10046
|
+
|
|
10047
|
+
var CONSTANTS$j = {
|
|
10048
|
+
title: 'Area chart',
|
|
10049
|
+
description: 'Ideal for illustrating changes and trends over time with area graphs.',
|
|
10050
|
+
namespace: 'area_chart',
|
|
10051
|
+
data_panel: {
|
|
10052
|
+
data_set: {
|
|
10053
|
+
type: 'dataSet',
|
|
10054
|
+
title: 'Data set',
|
|
10055
|
+
description: 'What data do you want to use in this area chart?'
|
|
10056
|
+
},
|
|
10057
|
+
views: {
|
|
10058
|
+
type: 'views',
|
|
10059
|
+
title: 'View',
|
|
10060
|
+
description: ''
|
|
10061
|
+
},
|
|
10062
|
+
field_y_axis: {
|
|
10063
|
+
type: 'fieldCollector',
|
|
10064
|
+
title: 'Metric - Y Axis',
|
|
10065
|
+
description: 'What do you want each area to measure?',
|
|
10066
|
+
callToAction: 'Add metric'
|
|
10067
|
+
},
|
|
10068
|
+
drilldown: {
|
|
10069
|
+
type: 'drilldown',
|
|
10070
|
+
title: 'Drilldown',
|
|
10071
|
+
description: 'After clicking on a segment of this area chart, what information do you want to see next?'
|
|
10072
|
+
},
|
|
10073
|
+
field_x_axis: {
|
|
10074
|
+
type: 'fieldCollector',
|
|
10075
|
+
title: 'Grouping - X Axis',
|
|
10076
|
+
description: 'What do you want each area to represent? An example might be a `product category` field to represent each category as a area.',
|
|
10077
|
+
callToAction: 'Add grouping'
|
|
10078
|
+
},
|
|
10079
|
+
sort: {
|
|
10080
|
+
type: 'sort',
|
|
10081
|
+
title: 'Sort',
|
|
10082
|
+
description: 'Select the order of categories or time on the x Axis.'
|
|
10083
|
+
},
|
|
10084
|
+
filter: {
|
|
10085
|
+
type: 'filter',
|
|
10086
|
+
title: 'Filters',
|
|
10087
|
+
description: 'Only include the information you want to use in this area chart.'
|
|
10088
|
+
},
|
|
10089
|
+
custom_metrics: {
|
|
10090
|
+
type: 'customMetrics',
|
|
10091
|
+
title: 'Custom metrics',
|
|
10092
|
+
description: 'Build your own metrics, such as a percentage.'
|
|
10093
|
+
},
|
|
10094
|
+
limit: {
|
|
10095
|
+
type: 'limit',
|
|
10096
|
+
title: 'Limit',
|
|
10097
|
+
description: 'Set the maximum number of records to show on this area chart.'
|
|
10098
|
+
}
|
|
10099
|
+
},
|
|
10100
|
+
format_panel: {
|
|
10101
|
+
heading: {
|
|
10102
|
+
type: 'heading',
|
|
10103
|
+
title: 'Heading',
|
|
10104
|
+
description: '',
|
|
10105
|
+
subSectionDefinition: {
|
|
10106
|
+
title: {
|
|
10107
|
+
type: 'title',
|
|
10108
|
+
title: 'Title',
|
|
10109
|
+
description: '',
|
|
10110
|
+
namespace: 'title'
|
|
10111
|
+
},
|
|
10112
|
+
subject: {
|
|
10113
|
+
title: 'Subject',
|
|
10114
|
+
type: 'subject',
|
|
10115
|
+
description: '',
|
|
10116
|
+
namespace: 'subject'
|
|
10117
|
+
}
|
|
10118
|
+
}
|
|
10119
|
+
},
|
|
10120
|
+
chart_styles: {
|
|
10121
|
+
type: 'chartStyles',
|
|
10122
|
+
title: 'Chart Settings',
|
|
10123
|
+
description: '',
|
|
10124
|
+
subSectionDefinition: {
|
|
10125
|
+
stacked: {
|
|
10126
|
+
type: 'stacked',
|
|
10127
|
+
title: 'Layout',
|
|
10128
|
+
description: '',
|
|
10129
|
+
namespace: 'stacked'
|
|
10130
|
+
},
|
|
10131
|
+
curve: {
|
|
10132
|
+
type: 'curve',
|
|
10133
|
+
title: 'Area Style',
|
|
10134
|
+
description: '',
|
|
10135
|
+
namespace: 'curve'
|
|
10136
|
+
},
|
|
10137
|
+
legend: {
|
|
10138
|
+
type: 'legend',
|
|
10139
|
+
title: 'Show Legend',
|
|
10140
|
+
description: '',
|
|
10141
|
+
namespace: 'legend'
|
|
10142
|
+
}
|
|
10143
|
+
}
|
|
10144
|
+
},
|
|
10145
|
+
axis_labels: {
|
|
10146
|
+
type: 'axisLabels',
|
|
10147
|
+
title: 'Axis Preferences',
|
|
10148
|
+
description: '',
|
|
10149
|
+
subSectionDefinition: {
|
|
10150
|
+
x: {
|
|
10151
|
+
title: 'X Axis',
|
|
10152
|
+
description: '',
|
|
10153
|
+
namespace: 'x'
|
|
10154
|
+
},
|
|
10155
|
+
'x.prefix': {
|
|
10156
|
+
title: 'Prefix',
|
|
10157
|
+
description: '',
|
|
10158
|
+
namespace: 'x.prefix'
|
|
10159
|
+
},
|
|
10160
|
+
'x.postfix': {
|
|
10161
|
+
title: 'Postfix',
|
|
10162
|
+
description: '',
|
|
10163
|
+
namespace: 'x.postfix'
|
|
10164
|
+
},
|
|
10165
|
+
'x.format': {
|
|
10166
|
+
title: 'Format',
|
|
10167
|
+
description: '',
|
|
10168
|
+
namespace: 'x.format'
|
|
10169
|
+
},
|
|
10170
|
+
'x.count': {
|
|
10171
|
+
title: 'Label count',
|
|
10172
|
+
description: '',
|
|
10173
|
+
namespace: 'x.count'
|
|
10174
|
+
},
|
|
10175
|
+
'x.axis_title': {
|
|
10176
|
+
title: 'Title',
|
|
10177
|
+
description: '',
|
|
10178
|
+
namespace: 'x.axis_title'
|
|
10179
|
+
},
|
|
10180
|
+
y: {
|
|
10181
|
+
title: 'Y Axis',
|
|
10182
|
+
description: '',
|
|
10183
|
+
namespace: 'y'
|
|
10184
|
+
},
|
|
10185
|
+
'y.prefix': {
|
|
10186
|
+
title: 'Prefix',
|
|
10187
|
+
description: '',
|
|
10188
|
+
namespace: 'y.prefix'
|
|
10189
|
+
},
|
|
10190
|
+
'y.postfix': {
|
|
10191
|
+
title: 'Postfix',
|
|
10192
|
+
description: '',
|
|
10193
|
+
namespace: 'y.postfix'
|
|
10194
|
+
},
|
|
10195
|
+
'y.format': {
|
|
10196
|
+
title: 'Format',
|
|
10197
|
+
description: '',
|
|
10198
|
+
namespace: 'y.format'
|
|
10199
|
+
},
|
|
10200
|
+
'y.count': {
|
|
10201
|
+
title: 'Label count',
|
|
10202
|
+
description: '',
|
|
10203
|
+
namespace: 'y.count'
|
|
10204
|
+
},
|
|
10205
|
+
'y.axis_title': {
|
|
10206
|
+
title: 'Title',
|
|
10207
|
+
description: '',
|
|
10208
|
+
namespace: 'y.axis_title'
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
},
|
|
10212
|
+
conditional_formatting: {
|
|
10213
|
+
type: 'conditionalFormatting',
|
|
10214
|
+
title: 'Conditional Formatting',
|
|
10215
|
+
description: ''
|
|
10216
|
+
},
|
|
10217
|
+
headline: {
|
|
10218
|
+
type: 'headline',
|
|
10219
|
+
title: 'Headarea',
|
|
10220
|
+
description: ''
|
|
10221
|
+
},
|
|
10222
|
+
trends: {
|
|
10223
|
+
type: 'trends',
|
|
10224
|
+
title: 'Trend lines',
|
|
10225
|
+
description: 'Specify a trend type for the area chart.'
|
|
10226
|
+
},
|
|
10227
|
+
goal_line: {
|
|
10228
|
+
type: 'goalLine',
|
|
10229
|
+
title: 'Goal lines',
|
|
10230
|
+
description: ''
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
};
|
|
10234
|
+
|
|
10235
|
+
var AreaChart$1 = function AreaChart(config) {
|
|
10236
|
+
return {
|
|
10237
|
+
title: 'Area chart V2',
|
|
10238
|
+
description: 'Ideal for illustrating changes and trends over time with area graphs.',
|
|
10239
|
+
servicesClass: 'AreaChart',
|
|
10240
|
+
namespace: 'area_chart',
|
|
10241
|
+
dump: function dump(hydrated) {
|
|
10242
|
+
return hydrated;
|
|
10243
|
+
},
|
|
10244
|
+
load: function load(dumped) {
|
|
10245
|
+
var _dumped$tags, _dumped$trends;
|
|
10246
|
+
return {
|
|
10247
|
+
type: dumped.type,
|
|
10248
|
+
measure: upcastMeasure(dumped.measure),
|
|
10249
|
+
order: upcastOrder(dumped.order, dumped.timeDimension),
|
|
10250
|
+
dimension: upcastStringDimensionsToObject(dumped.dimension),
|
|
10251
|
+
// TODO: upcast dumped.timeDimension -> dimension
|
|
10252
|
+
displayTitle: dumped.displayTitle,
|
|
10253
|
+
displaySubject: dumped.displaySubject,
|
|
10254
|
+
protectedByOrganisation: dumped.protectedByOrganisation,
|
|
10255
|
+
viewId: upcastViewId(dumped.viewId),
|
|
10256
|
+
filter: upcastFilter(dumped.filter),
|
|
10257
|
+
dataSetId: dumped.dataSetId,
|
|
10258
|
+
limit: dumped.limit,
|
|
10259
|
+
timeDimension: null,
|
|
10260
|
+
xAxisPostfix: dumped.xAxisPostfix,
|
|
10261
|
+
xAxisPrefix: dumped.xAxisPrefix,
|
|
10262
|
+
yAxisPostfix: dumped.yAxisPostfix,
|
|
10263
|
+
yAxisPrefix: dumped.yAxisPrefix,
|
|
10264
|
+
yAxisFormat: dumped.yAxisFormat,
|
|
10265
|
+
xAxisFormat: dumped.xAxisFormat,
|
|
10266
|
+
lineCurve: dumped.lineCurve,
|
|
10267
|
+
conditionalFormattingRules: upcast$1(config.queryEngineConfig, dumped.conditionalFormattingRules),
|
|
10268
|
+
drilldown: dumped.drilldown,
|
|
10269
|
+
legend: dumped.legend,
|
|
10270
|
+
goalLines: dumped.goalLines,
|
|
10271
|
+
headline: upcastHeadline(dumped.headline, dumped.timeDimension),
|
|
10272
|
+
parameters: upcastParameters(dumped.parameters),
|
|
10273
|
+
approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
|
|
10274
|
+
approxYAxisLabelCount: upcastAxisLabel(dumped.approxYAxisLabelCount),
|
|
10275
|
+
axisTitles: dumped.axisTitles,
|
|
10276
|
+
tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
|
|
10277
|
+
trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
|
|
10278
|
+
stacked: dumped.stacked
|
|
10279
|
+
};
|
|
10280
|
+
},
|
|
10281
|
+
setAttributes: setAttributes$g(config),
|
|
10282
|
+
validate: function validate(attrs, dataSets) {
|
|
10283
|
+
return validateView(attrs, dataSets, config.queryEngineConfig);
|
|
10284
|
+
},
|
|
10285
|
+
init: function init(dataSetId, overrides) {
|
|
10286
|
+
return _extends({
|
|
10287
|
+
type: 'areaChartV2',
|
|
10288
|
+
measure: [],
|
|
10289
|
+
dimension: [],
|
|
10290
|
+
timeDimension: null,
|
|
10291
|
+
displayTitle: '',
|
|
10292
|
+
displaySubject: '',
|
|
10293
|
+
protectedByOrganisation: undefined,
|
|
10294
|
+
viewId: upcastViewId(overrides == null ? void 0 : overrides.viewId),
|
|
10295
|
+
filter: [],
|
|
10296
|
+
order: [],
|
|
10297
|
+
dataSetId: dataSetId,
|
|
10298
|
+
limit: 5000,
|
|
10299
|
+
xAxisPostfix: '',
|
|
10300
|
+
xAxisPrefix: '',
|
|
10301
|
+
yAxisPostfix: '',
|
|
10302
|
+
yAxisPrefix: '',
|
|
10303
|
+
yAxisFormat: null,
|
|
10304
|
+
xAxisFormat: null,
|
|
10305
|
+
lineCurve: 'natural',
|
|
10306
|
+
conditionalFormattingRules: [],
|
|
10307
|
+
drilldown: [],
|
|
10308
|
+
legend: true,
|
|
10309
|
+
goalLines: undefined,
|
|
10310
|
+
approxXAxisLabelCount: 'auto',
|
|
10311
|
+
approxYAxisLabelCount: 'auto',
|
|
10312
|
+
parameters: {},
|
|
10313
|
+
axisTitles: undefined,
|
|
10314
|
+
headline: undefined,
|
|
10315
|
+
tags: [],
|
|
10316
|
+
trends: [],
|
|
10317
|
+
stacked: false
|
|
10318
|
+
}, overrides);
|
|
10319
|
+
},
|
|
10320
|
+
createFeedback: createFeedback,
|
|
10321
|
+
schema: attributesSchema$h(config),
|
|
10322
|
+
removeField: function removeField(attrs, fieldId) {
|
|
10323
|
+
return removeField$1(attrs, fieldId, config.queryEngineConfig);
|
|
10324
|
+
},
|
|
10325
|
+
isRunnable: function isRunnable(hydrated) {
|
|
10326
|
+
return hydrated.measure.length > 0 && hydrated.dimension.length > 0;
|
|
10327
|
+
},
|
|
10328
|
+
autoGenerate: function autoGenerate(dataSet) {
|
|
10329
|
+
var _DataSet$buildQueryAt = buildQueryAttributes(dataSet, config.queryEngineConfig, 'lineChart'),
|
|
10330
|
+
measure = _DataSet$buildQueryAt.measure,
|
|
10331
|
+
dimension = _DataSet$buildQueryAt.dimension;
|
|
10332
|
+
return this.init(dataSet.id, {
|
|
10333
|
+
measure: [measure[0]],
|
|
10334
|
+
dimension: dimension
|
|
10335
|
+
});
|
|
10336
|
+
},
|
|
10337
|
+
dataPanelConfig: function dataPanelConfig() {
|
|
10338
|
+
return [namespace(CONSTANTS$j, 'data_set'), namespace(CONSTANTS$j, 'views'), _extends({}, namespace(CONSTANTS$j, 'field_y_axis'), {
|
|
10339
|
+
fieldFilterOptions: {
|
|
10340
|
+
forComponent: 'lineChart'
|
|
10341
|
+
},
|
|
10342
|
+
preSetPartialAttributes: function preSetPartialAttributes(values) {
|
|
10343
|
+
return {
|
|
10344
|
+
measure: values
|
|
10345
|
+
};
|
|
10346
|
+
},
|
|
10347
|
+
getValues: function getValues(attrs) {
|
|
10348
|
+
return attrs.measure;
|
|
10349
|
+
},
|
|
10350
|
+
testId: 'metric-input'
|
|
10351
|
+
}), _extends({}, namespace(CONSTANTS$j, 'field_x_axis'), {
|
|
10352
|
+
fieldFilterOptions: {
|
|
10353
|
+
forComponent: 'lineChart',
|
|
10354
|
+
onlyDimensions: true
|
|
10355
|
+
},
|
|
10356
|
+
preventDuplicates: false,
|
|
10357
|
+
// return all values in the dimension array instead of seperating out timeDimension
|
|
10358
|
+
preSetPartialAttributes: function preSetPartialAttributes(values) {
|
|
10359
|
+
return {
|
|
10360
|
+
dimension: [].concat(values)
|
|
10361
|
+
};
|
|
10362
|
+
},
|
|
10363
|
+
// does this need to be updated too?
|
|
10364
|
+
getValues: function getValues(attrs) {
|
|
10365
|
+
return [].concat(attrs.dimension);
|
|
10366
|
+
},
|
|
10367
|
+
maxAllowed: 2,
|
|
10368
|
+
testId: 'add-dimension'
|
|
10369
|
+
}), namespace(CONSTANTS$j, 'sort'), namespace(CONSTANTS$j, 'filter'), namespace(CONSTANTS$j, 'custom_metrics'), namespace(CONSTANTS$j, 'limit')];
|
|
10370
|
+
},
|
|
10371
|
+
formatPanelConfig: function formatPanelConfig() {
|
|
10372
|
+
return [headingConstant(CONSTANTS$j), chartStylesConstant(CONSTANTS$j, true, false), axisLabelsConstants(CONSTANTS$j), _extends({}, namespace(CONSTANTS$j, 'conditional_formatting'), {
|
|
10373
|
+
ruleType: 'lineColor'
|
|
10374
|
+
}), namespace(CONSTANTS$j, 'goal_line')];
|
|
10375
|
+
},
|
|
10376
|
+
supportedCustomFields: {
|
|
10377
|
+
calculatedField: false,
|
|
10378
|
+
percentages: true,
|
|
10379
|
+
dateCalculations: true,
|
|
10380
|
+
simpleMaths: true,
|
|
10381
|
+
rules: true,
|
|
10382
|
+
aggregateMaths: true,
|
|
10383
|
+
roundedNumbers: true,
|
|
10384
|
+
conditional: true
|
|
10385
|
+
},
|
|
10386
|
+
supportedFeatures: {
|
|
10387
|
+
parameters: true,
|
|
10388
|
+
colorGradient: false
|
|
10389
|
+
},
|
|
10390
|
+
setDataAttributesFromPreAggregatedDataSet: function setDataAttributesFromPreAggregatedDataSet$1(attributes, dataSet) {
|
|
10391
|
+
return setDataAttributesFromPreAggregatedDataSet(attributes, dataSet, this.setAttributes);
|
|
10392
|
+
}
|
|
10393
|
+
};
|
|
10394
|
+
};
|
|
10395
|
+
|
|
10023
10396
|
var EMPTY_CONFIG = {
|
|
10024
10397
|
queryEngineConfig: {
|
|
10025
10398
|
supportedFeatures: [],
|
|
@@ -10046,6 +10419,7 @@ function getComponentInterface(type, config) {
|
|
|
10046
10419
|
if (type == 'lineChart') return textOverrideComponent(LineChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10047
10420
|
if (type == 'lineChartV2') return textOverrideComponent(LineChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10048
10421
|
if (type == 'barChartV2') return textOverrideComponent(BarChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10422
|
+
if (type == 'areaChartV2') return textOverrideComponent(AreaChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10049
10423
|
if (type == 'mercatorMap') return textOverrideComponent(MercatorMap(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10050
10424
|
if (type == 'pieChart') return textOverrideComponent(PieChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10051
10425
|
if (type == 'progress') return textOverrideComponent(Progress(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
@@ -13198,7 +13572,7 @@ var buildDefaults = function buildDefaults(partialFeatureToggles) {
|
|
|
13198
13572
|
};
|
|
13199
13573
|
};
|
|
13200
13574
|
|
|
13201
|
-
var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
|
|
13575
|
+
var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'areaChartV2', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
|
|
13202
13576
|
var ALL_VIZZLY_COMPONENT_TYPES = /*#__PURE__*/[].concat(ALL_COMPONENT_TYPES).filter(function (type) {
|
|
13203
13577
|
return type != 'custom';
|
|
13204
13578
|
});
|
|
@@ -13538,7 +13912,7 @@ var saveable = function saveable(component, protectedComponent) {
|
|
|
13538
13912
|
};
|
|
13539
13913
|
};
|
|
13540
13914
|
|
|
13541
|
-
var attributesSchema$
|
|
13915
|
+
var attributesSchema$i = function attributesSchema(config) {
|
|
13542
13916
|
return Joi.alternatives().conditional('.type', {
|
|
13543
13917
|
is: 'barChart',
|
|
13544
13918
|
then: BarChart(config).schema
|
|
@@ -13560,6 +13934,9 @@ var attributesSchema$h = function attributesSchema(config) {
|
|
|
13560
13934
|
}).conditional('.type', {
|
|
13561
13935
|
is: 'barChartV2',
|
|
13562
13936
|
then: BarChart$1(config).schema
|
|
13937
|
+
}).conditional('.type', {
|
|
13938
|
+
is: 'areaChartV2',
|
|
13939
|
+
then: AreaChart$1(config).schema
|
|
13563
13940
|
}).conditional('.type', {
|
|
13564
13941
|
is: 'comboChart',
|
|
13565
13942
|
then: ComboChart(config).schema
|
|
@@ -20905,7 +21282,7 @@ var Combobox = function Combobox(props) {
|
|
|
20905
21282
|
});
|
|
20906
21283
|
};
|
|
20907
21284
|
|
|
20908
|
-
var attributesSchema$
|
|
21285
|
+
var attributesSchema$j = /*#__PURE__*/Joi.object({
|
|
20909
21286
|
displayTitle: /*#__PURE__*/Joi.string().min(1).required(),
|
|
20910
21287
|
colSpan: /*#__PURE__*/Joi.number().valid(12).required()
|
|
20911
21288
|
});
|
|
@@ -20922,7 +21299,7 @@ var isEmptyCell = /*#__PURE__*/Joi.object({
|
|
|
20922
21299
|
});
|
|
20923
21300
|
var isPopulatedCell = function isPopulatedCell(queryEngineConfig) {
|
|
20924
21301
|
return Joi.object({
|
|
20925
|
-
attributes: attributesSchema$
|
|
21302
|
+
attributes: attributesSchema$i({
|
|
20926
21303
|
queryEngineConfig: queryEngineConfig
|
|
20927
21304
|
}),
|
|
20928
21305
|
colSpan: colSpanSchema
|
|
@@ -20933,7 +21310,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
|
|
|
20933
21310
|
id: Joi.string(),
|
|
20934
21311
|
display: displaySchema(queryEngineConfig),
|
|
20935
21312
|
componentLibrary: Joi.array().required().items(Joi.object({
|
|
20936
|
-
attributes: attributesSchema$
|
|
21313
|
+
attributes: attributesSchema$i({
|
|
20937
21314
|
queryEngineConfig: queryEngineConfig
|
|
20938
21315
|
})
|
|
20939
21316
|
})),
|
|
@@ -20944,7 +21321,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
|
|
|
20944
21321
|
function displaySchema(queryEngineConfig) {
|
|
20945
21322
|
return Joi.array().required().items(Joi.object({
|
|
20946
21323
|
height: Joi.number().required(),
|
|
20947
|
-
components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$
|
|
21324
|
+
components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$j))
|
|
20948
21325
|
}));
|
|
20949
21326
|
}
|
|
20950
21327
|
|
|
@@ -21666,7 +22043,7 @@ var setHeaderComponent = function setHeaderComponent(state, action) {
|
|
|
21666
22043
|
newDisplayState.dashboard.display[rowIndex].components[cellIndex] = component;
|
|
21667
22044
|
return newDisplayState;
|
|
21668
22045
|
};
|
|
21669
|
-
var setAttributes$
|
|
22046
|
+
var setAttributes$h = function setAttributes(state, action) {
|
|
21670
22047
|
var attributes = action.attributes,
|
|
21671
22048
|
rowIndex = action.rowIndex,
|
|
21672
22049
|
cellIndex = action.cellIndex;
|
|
@@ -21951,7 +22328,7 @@ var reducer = function reducer(pipelineTransformationOptions) {
|
|
|
21951
22328
|
case 'swapComponents':
|
|
21952
22329
|
return swapComponents$1(state, action);
|
|
21953
22330
|
case 'setAttributes':
|
|
21954
|
-
return setAttributes$
|
|
22331
|
+
return setAttributes$h(state, action);
|
|
21955
22332
|
case 'addComponentToLibrary':
|
|
21956
22333
|
return addComponentToLibrary(state, action);
|
|
21957
22334
|
case 'setLocalFilters':
|
|
@@ -25296,7 +25673,7 @@ var RichText$1 = function RichText(props) {
|
|
|
25296
25673
|
})
|
|
25297
25674
|
}));
|
|
25298
25675
|
};
|
|
25299
|
-
var AreaChart$
|
|
25676
|
+
var AreaChart$2 = function AreaChart(props) {
|
|
25300
25677
|
return jsxRuntime.jsx("svg", _extends({
|
|
25301
25678
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25302
25679
|
viewBox: "0 0 512 512"
|
|
@@ -25565,7 +25942,10 @@ var WaterfallChart$1 = function WaterfallChart(props) {
|
|
|
25565
25942
|
|
|
25566
25943
|
var componentTypeToIconMapping = {
|
|
25567
25944
|
areaChart: function areaChart(props) {
|
|
25568
|
-
return AreaChart$
|
|
25945
|
+
return AreaChart$2(props);
|
|
25946
|
+
},
|
|
25947
|
+
areaChartV2: function areaChartV2(props) {
|
|
25948
|
+
return AreaChart$2(props);
|
|
25569
25949
|
},
|
|
25570
25950
|
barChart: function barChart(props) {
|
|
25571
25951
|
return BarChart$2(props);
|
|
@@ -32664,7 +33044,7 @@ var VizzlyXYChart = function VizzlyXYChart(props) {
|
|
|
32664
33044
|
});
|
|
32665
33045
|
};
|
|
32666
33046
|
|
|
32667
|
-
var AreaChart$
|
|
33047
|
+
var AreaChart$3 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
32668
33048
|
var forceRerender = useChartForceRerender(ref);
|
|
32669
33049
|
if (forceRerender) return null;
|
|
32670
33050
|
return jsxRuntime.jsx(responsive.ParentSize, {
|
|
@@ -33615,7 +33995,7 @@ var AreaChartView = function AreaChartView(props) {
|
|
|
33615
33995
|
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
33616
33996
|
})), showHeadline && jsxRuntime.jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsxRuntime.jsx(ChartWrapper, {
|
|
33617
33997
|
disabledFeatures: (_props$library2 = props == null ? void 0 : props.library) != null ? _props$library2 : false,
|
|
33618
|
-
children: jsxRuntime.jsx(AreaChart$
|
|
33998
|
+
children: jsxRuntime.jsx(AreaChart$3, {
|
|
33619
33999
|
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
33620
34000
|
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
33621
34001
|
ref: ref,
|
|
@@ -33749,7 +34129,7 @@ var isDrilldownAvailable = function isDrilldownAvailable(props) {
|
|
|
33749
34129
|
return (props == null || (_props$component = props.component) == null || (_props$component = _props$component.attributes) == null || (_props$component = _props$component.drilldown) == null ? void 0 : _props$component.length) > 0;
|
|
33750
34130
|
};
|
|
33751
34131
|
|
|
33752
|
-
var AreaChart$
|
|
34132
|
+
var AreaChart$4 = function AreaChart(props) {
|
|
33753
34133
|
var _props$dashboardBehav;
|
|
33754
34134
|
var _useState = React.useState(null),
|
|
33755
34135
|
onDrilldown = _useState[0],
|
|
@@ -40747,6 +41127,259 @@ var IconText = function IconText(props) {
|
|
|
40747
41127
|
});
|
|
40748
41128
|
};
|
|
40749
41129
|
|
|
41130
|
+
var accessors$1 = function accessors(xAxisIsTime, xKey, yKey, horizontal) {
|
|
41131
|
+
return {
|
|
41132
|
+
xAccessor: function xAccessor(d) {
|
|
41133
|
+
return d ? horizontal ? d[yKey] : xAxisIsTime ? new Date(d[xKey]) : d[xKey] : undefined;
|
|
41134
|
+
},
|
|
41135
|
+
yAccessor: function yAccessor(d) {
|
|
41136
|
+
return d ? horizontal ? xAxisIsTime ? new Date(d[xKey]) : d[xKey] : d[yKey] : undefined;
|
|
41137
|
+
}
|
|
41138
|
+
};
|
|
41139
|
+
};
|
|
41140
|
+
var DEFAULT_Y_AXIS_LABEL_COUNT$1 = 5;
|
|
41141
|
+
var VizzlyBubbleChart = function VizzlyBubbleChart(props) {
|
|
41142
|
+
var _props$height, _theme$axis$stroke, _theme$axis, _ref, _props$lines$data$len, _props$lines, _props$areas, _props$bars, _props$forceXAxisAsTi, _props$bars2, _props$lines2, _theme$grid$stroke, _theme$grid, _props$axisTitles, _props$axisTitles2, _props$axisTitles3, _props$axisTitles4, _props$bars3, _props$bars4, _props$bars5;
|
|
41143
|
+
var height = adjustHeight((_props$height = props == null ? void 0 : props.height) != null ? _props$height : 300, props == null ? void 0 : props.legend);
|
|
41144
|
+
var _props$approxYAxisLab = props.approxYAxisLabelCount,
|
|
41145
|
+
approxYAxisLabelCount = _props$approxYAxisLab === void 0 ? 'auto' : _props$approxYAxisLab,
|
|
41146
|
+
_props$approxXAxisLab = props.approxXAxisLabelCount,
|
|
41147
|
+
approxXAxisLabelCount = _props$approxXAxisLab === void 0 ? 'auto' : _props$approxXAxisLab,
|
|
41148
|
+
_props$removeStroke = props.removeStroke,
|
|
41149
|
+
removeStroke = _props$removeStroke === void 0 ? false : _props$removeStroke,
|
|
41150
|
+
_props$horizontal = props.horizontal,
|
|
41151
|
+
horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
|
|
41152
|
+
theme = props.theme,
|
|
41153
|
+
x = props.x;
|
|
41154
|
+
var xAxisIsTime = isXAxisTime(props.x, props.forceXAxisAsTime, props.bars, props.lines, props.areas);
|
|
41155
|
+
var axisLabelStyles = function axisLabelStyles(horizontal, labelTheme) {
|
|
41156
|
+
var _labelTheme$color, _labelTheme$fontSize, _labelTheme$fontWeigh, _labelTheme$fontFamil;
|
|
41157
|
+
return {
|
|
41158
|
+
fill: (_labelTheme$color = labelTheme == null ? void 0 : labelTheme.color) != null ? _labelTheme$color : 'rgba(0, 0, 0, 0.6)',
|
|
41159
|
+
fontSize: (_labelTheme$fontSize = labelTheme == null ? void 0 : labelTheme.fontSize) != null ? _labelTheme$fontSize : 9,
|
|
41160
|
+
fontWeight: (_labelTheme$fontWeigh = labelTheme == null ? void 0 : labelTheme.fontWeight) != null ? _labelTheme$fontWeigh : 700,
|
|
41161
|
+
fontFamily: (_labelTheme$fontFamil = labelTheme == null ? void 0 : labelTheme.fontFamily) != null ? _labelTheme$fontFamil : DEFAULT_CHART_FONT,
|
|
41162
|
+
textAnchor: horizontal ? 'end' : 'middle',
|
|
41163
|
+
scaleToFit: 'shrink-only'
|
|
41164
|
+
};
|
|
41165
|
+
};
|
|
41166
|
+
var _useXAxisLabelCount = useXAxisLabelCount(approxXAxisLabelCount, !(props != null && props.horizontal) && (props == null ? void 0 : props.forceXAxisAsTime)),
|
|
41167
|
+
widthRef = _useXAxisLabelCount[0],
|
|
41168
|
+
approximateXTickCount = _useXAxisLabelCount[1];
|
|
41169
|
+
var _useState = React.useState(undefined),
|
|
41170
|
+
nearestDatum = _useState[0];
|
|
41171
|
+
var _useState2 = React.useState(undefined),
|
|
41172
|
+
nearestTooltipDatums = _useState2[0];
|
|
41173
|
+
var colors = getConcatenatedProperties(props, 'colors');
|
|
41174
|
+
var customTheme = xychart.buildChartTheme(_extends({}, xychart.lightTheme, {
|
|
41175
|
+
colors: colors,
|
|
41176
|
+
tickLength: 0,
|
|
41177
|
+
gridColor: '',
|
|
41178
|
+
gridColorDark: ''
|
|
41179
|
+
}));
|
|
41180
|
+
var chartData = getConcatenatedProperties(props, 'data');
|
|
41181
|
+
var axisStrokeColor = (_theme$axis$stroke = theme == null || (_theme$axis = theme.axis) == null ? void 0 : _theme$axis.stroke) != null ? _theme$axis$stroke : '#eaeaea';
|
|
41182
|
+
var _getAxisType = getAxisType(approxXAxisLabelCount, approxYAxisLabelCount),
|
|
41183
|
+
xAxisType = _getAxisType.xAxisType,
|
|
41184
|
+
xAxisAttributes = _getAxisType.xAxisAttributes,
|
|
41185
|
+
yAxisType = _getAxisType.yAxisType;
|
|
41186
|
+
var numberOfXAxisPoints = (_ref = (_props$lines$data$len = props == null || (_props$lines = props.lines) == null ? void 0 : _props$lines.data.length) != null ? _props$lines$data$len : props == null || (_props$areas = props.areas) == null || (_props$areas = _props$areas.data) == null ? void 0 : _props$areas.length) != null ? _ref : (_props$bars = props.bars) == null ? void 0 : _props$bars.data.length;
|
|
41187
|
+
var _useMinMaxValue = useMinMaxValue(props),
|
|
41188
|
+
maxValue = _useMinMaxValue.maxValue,
|
|
41189
|
+
minValue = _useMinMaxValue.minValue;
|
|
41190
|
+
var leftWidth = getYAxisWidth(horizontal, (_props$forceXAxisAsTi = props.forceXAxisAsTime) != null ? _props$forceXAxisAsTi : false, props, theme, getConcatenatedProperties(props, 'data'), props.x);
|
|
41191
|
+
var margin = props.sparkline ? NO_MARGIN(props.yAxisOrientation !== 'right') : getDefaultMargins(horizontal, props.yAxisOrientation !== 'right', xAxisType, props == null ? void 0 : props.axisTitles, leftWidth);
|
|
41192
|
+
var getTrendLineStyle = function getTrendLineStyle(datumKey) {
|
|
41193
|
+
if (props.trends) {
|
|
41194
|
+
var _props$trends, _strokeDasharrayToBor, _indicatorProperties$, _indicatorProperties$2, _indicatorProperties$3, _indicatorProperties$4, _indicatorProperties$5, _indicatorProperties$6, _indicatorProperties$7, _indicatorProperties$8, _indicatorProperties$9;
|
|
41195
|
+
var indicatorKeyIndex = (_props$trends = props.trends) == null ? void 0 : _props$trends.keys.indexOf(datumKey);
|
|
41196
|
+
var indicatorProperties = props.trends;
|
|
41197
|
+
return {
|
|
41198
|
+
borderStyle: (_strokeDasharrayToBor = strokeDasharrayToBorderStyle((_indicatorProperties$ = indicatorProperties.strokeDasharray) == null ? void 0 : _indicatorProperties$[indicatorKeyIndex])) != null ? _strokeDasharrayToBor : 'dotted',
|
|
41199
|
+
borderWidth: 0,
|
|
41200
|
+
marginTop: (_indicatorProperties$2 = (_indicatorProperties$3 = indicatorProperties.strokeWidth) == null ? void 0 : _indicatorProperties$3[indicatorKeyIndex]) != null ? _indicatorProperties$2 : 2,
|
|
41201
|
+
borderTopWidth: (_indicatorProperties$4 = (_indicatorProperties$5 = indicatorProperties.strokeWidth) == null ? void 0 : _indicatorProperties$5[indicatorKeyIndex]) != null ? _indicatorProperties$4 : 2,
|
|
41202
|
+
borderColor: (_indicatorProperties$6 = (_indicatorProperties$7 = indicatorProperties.colors) == null ? void 0 : _indicatorProperties$7[indicatorKeyIndex]) != null ? _indicatorProperties$6 : '#1E1D2D',
|
|
41203
|
+
opacity: (_indicatorProperties$8 = (_indicatorProperties$9 = indicatorProperties.opacity) == null ? void 0 : _indicatorProperties$9[indicatorKeyIndex]) != null ? _indicatorProperties$8 : 1
|
|
41204
|
+
};
|
|
41205
|
+
}
|
|
41206
|
+
return undefined;
|
|
41207
|
+
};
|
|
41208
|
+
return jsxRuntime.jsxs("div", {
|
|
41209
|
+
ref: widthRef,
|
|
41210
|
+
style: {
|
|
41211
|
+
position: 'relative',
|
|
41212
|
+
height: height
|
|
41213
|
+
},
|
|
41214
|
+
className: "vizzly-xy-chart" + (props != null && (_props$bars2 = props.bars) != null && _props$bars2.funnelChart ? ' vizzly-xy-chart-funnel' : ''),
|
|
41215
|
+
"data-testid": "vizzly-" + (props == null ? void 0 : props.uniqueId) + "-chart",
|
|
41216
|
+
children: [jsxRuntime.jsxs(xychart.XYChart, {
|
|
41217
|
+
theme: customTheme,
|
|
41218
|
+
margin: margin,
|
|
41219
|
+
height: height,
|
|
41220
|
+
xScale: getScale('x', horizontal, xAxisIsTime, props == null || (_props$lines2 = props.lines) == null ? void 0 : _props$lines2.scatter, !!(props != null && props.lines) || !!(props != null && props.areas)),
|
|
41221
|
+
yScale: getYScale(props == null ? void 0 : props.goalLine, maxValue, minValue, horizontal, xAxisIsTime),
|
|
41222
|
+
horizontal: horizontal,
|
|
41223
|
+
onPointerUp: function onPointerUp(params) {
|
|
41224
|
+
return props == null ? void 0 : props.onClick(nearestDatum, nearestTooltipDatums, params);
|
|
41225
|
+
},
|
|
41226
|
+
children: [jsxRuntime.jsx(xychart.Grid, {
|
|
41227
|
+
columns: horizontal,
|
|
41228
|
+
rows: !horizontal,
|
|
41229
|
+
stroke: "black",
|
|
41230
|
+
strokeDasharray: "0.5 5",
|
|
41231
|
+
strokeWidth: removeStroke ? 0 : 2,
|
|
41232
|
+
lineStyle: {
|
|
41233
|
+
strokeLinecap: 'round',
|
|
41234
|
+
stroke: (_theme$grid$stroke = theme == null || (_theme$grid = theme.grid) == null ? void 0 : _theme$grid.stroke) != null ? _theme$grid$stroke : 'rgba(200, 200, 200, 0.2)'
|
|
41235
|
+
}
|
|
41236
|
+
}), !(props != null && props.sparkline) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
41237
|
+
children: [xAxisType !== 'none' && jsxRuntime.jsx(xychart.Axis, _extends({}, xAxisAttributes, {
|
|
41238
|
+
tickLabelProps: function tickLabelProps() {
|
|
41239
|
+
var tickLabelProps = _extends({}, axisLabelStyles(horizontal, theme == null ? void 0 : theme.labels));
|
|
41240
|
+
if (!horizontal) {
|
|
41241
|
+
tickLabelProps['y'] = 15;
|
|
41242
|
+
}
|
|
41243
|
+
return tickLabelProps;
|
|
41244
|
+
},
|
|
41245
|
+
numTicks: xAxisType === 'end2end' ? numberOfXAxisPoints : approximateXTickCount,
|
|
41246
|
+
strokeWidth: removeStroke ? 0 : 1,
|
|
41247
|
+
tickStroke: "#eaeaea",
|
|
41248
|
+
stroke: horizontal ? 'transparent' : axisStrokeColor,
|
|
41249
|
+
orientation: horizontal ? 'left' : 'bottom',
|
|
41250
|
+
tickFormat: handleFormatXAxisLabel(props.formatXAxisLabel, props.forceXAxisAsTime || xAxisIsTime, chartData),
|
|
41251
|
+
label: horizontal ? props == null || (_props$axisTitles = props.axisTitles) == null ? void 0 : _props$axisTitles.y : props == null || (_props$axisTitles2 = props.axisTitles) == null ? void 0 : _props$axisTitles2.x,
|
|
41252
|
+
children: function children(axisProps) {
|
|
41253
|
+
return jsxRuntime.jsx(XAxis, _extends({}, axisProps, {
|
|
41254
|
+
theme: theme,
|
|
41255
|
+
type: xAxisType,
|
|
41256
|
+
uniqueId: props == null ? void 0 : props.uniqueId,
|
|
41257
|
+
chartWidth: props == null ? void 0 : props.width,
|
|
41258
|
+
xAxisIsTime: !!props.forceXAxisAsTime,
|
|
41259
|
+
leftPanelWidth: leftWidth,
|
|
41260
|
+
axisHorizontal: props == null ? void 0 : props.horizontal
|
|
41261
|
+
}));
|
|
41262
|
+
}
|
|
41263
|
+
})), jsxRuntime.jsx(xychart.Axis, {
|
|
41264
|
+
labelOffset: 50,
|
|
41265
|
+
tickLabelProps: function tickLabelProps() {
|
|
41266
|
+
var tickLabelProps = _extends({}, axisLabelStyles(horizontal, theme == null ? void 0 : theme.labels));
|
|
41267
|
+
if (!horizontal && props.yAxisOrientation !== 'right') {
|
|
41268
|
+
tickLabelProps['width'] = LEFT_PANEL_WIDTH;
|
|
41269
|
+
tickLabelProps['textAnchor'] = 'middle';
|
|
41270
|
+
}
|
|
41271
|
+
return tickLabelProps;
|
|
41272
|
+
},
|
|
41273
|
+
hideAxisLine: true,
|
|
41274
|
+
numTicks: approxYAxisLabelCount === 'auto' ? DEFAULT_Y_AXIS_LABEL_COUNT$1 : approxYAxisLabelCount,
|
|
41275
|
+
strokeWidth: removeStroke ? 0 : 1,
|
|
41276
|
+
hideTicks: true,
|
|
41277
|
+
tickLength: !props.horizontal && props.yAxisOrientation !== 'right' ? LEFT_PANEL_WIDTH / 2 : 10,
|
|
41278
|
+
stroke: axisStrokeColor,
|
|
41279
|
+
orientation: horizontal ? 'bottom' : props.yAxisOrientation || 'left',
|
|
41280
|
+
tickFormat: formatYAxisLabel$1(props),
|
|
41281
|
+
label: horizontal ? props == null || (_props$axisTitles3 = props.axisTitles) == null ? void 0 : _props$axisTitles3.x : props == null || (_props$axisTitles4 = props.axisTitles) == null ? void 0 : _props$axisTitles4.y,
|
|
41282
|
+
children: function children(axisProps) {
|
|
41283
|
+
return jsxRuntime.jsx(YAxis, _extends({}, axisProps, {
|
|
41284
|
+
theme: theme,
|
|
41285
|
+
type: yAxisType,
|
|
41286
|
+
horizontal: horizontal,
|
|
41287
|
+
maxValueOfYAxis: props != null && props.formatYAxisLabel ? props == null ? void 0 : props.formatYAxisLabel(maxValue) : maxValue,
|
|
41288
|
+
uniqueId: props == null ? void 0 : props.uniqueId
|
|
41289
|
+
}));
|
|
41290
|
+
}
|
|
41291
|
+
})]
|
|
41292
|
+
}), jsxRuntime.jsx("style", {
|
|
41293
|
+
children: "\n .visx-bar-stack .visx-bar {\n stroke: #fff;\n stroke-width: 2px;\n }\n .vizzly-xy-chart-funnel .visx-bar-stack .visx-bar {\n stroke-width: 0;\n }\n .visx-tooltip-glyph svg {\n max-width: 10px\n height: 10px;\n }\n " + TOOLTIP_ZINDEX + "\n "
|
|
41294
|
+
}), props.lines && props.lines.keys.map(function (key, keyIndex) {
|
|
41295
|
+
var _props$lines3, _props$lines4;
|
|
41296
|
+
return jsxRuntime.jsx(xychart.GlyphSeries, _extends({
|
|
41297
|
+
size: function size(datum) {
|
|
41298
|
+
if (!datum || !datum.bubbleSize) return 5;
|
|
41299
|
+
return datum.bubbleSize;
|
|
41300
|
+
},
|
|
41301
|
+
dataKey: key,
|
|
41302
|
+
data: (_props$lines3 = props.lines) == null ? void 0 : _props$lines3.data
|
|
41303
|
+
}, accessors$1(xAxisIsTime, x, key, horizontal), {
|
|
41304
|
+
colorAccessor: (props == null || (_props$lines4 = props.lines) == null ? void 0 : _props$lines4.formatter) && getColorFromDatum(key, props == null ? void 0 : props.lines.formatter, colors, keyIndex)
|
|
41305
|
+
}), "scatter_chart_" + props.uniqueId + "_" + keyIndex);
|
|
41306
|
+
})]
|
|
41307
|
+
}), (props == null ? void 0 : props.legend) && jsxRuntime.jsx(Legend, {
|
|
41308
|
+
funnelChart: props == null || (_props$bars3 = props.bars) == null ? void 0 : _props$bars3.funnelChart
|
|
41309
|
+
// groupingCount={props}
|
|
41310
|
+
,
|
|
41311
|
+
keys: getConcatenatedProperties(props, 'keys'),
|
|
41312
|
+
colors: colors,
|
|
41313
|
+
typeIndex: getTypeIndex(props),
|
|
41314
|
+
formatSeriesName: props == null ? void 0 : props.formatSeriesName,
|
|
41315
|
+
formatter: props == null || (_props$bars4 = props.bars) == null ? void 0 : _props$bars4.formatter,
|
|
41316
|
+
data: (_props$bars5 = props.bars) == null ? void 0 : _props$bars5.data,
|
|
41317
|
+
conditionalFormattingPossibilities: props.conditionalFormattingPossibilities,
|
|
41318
|
+
getIndicatorStyles: getTrendLineStyle
|
|
41319
|
+
})]
|
|
41320
|
+
});
|
|
41321
|
+
};
|
|
41322
|
+
|
|
41323
|
+
var BubbleChart$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
41324
|
+
var zValues = props.z ? props.data.map(function (d) {
|
|
41325
|
+
return d[props.z];
|
|
41326
|
+
}) : [];
|
|
41327
|
+
var normaliseArray = function normaliseArray(array, min, max) {
|
|
41328
|
+
var arrayMin = Math.min.apply(Math, array);
|
|
41329
|
+
var arrayMax = Math.max.apply(Math, array);
|
|
41330
|
+
return array.map(function (value) {
|
|
41331
|
+
return (value - arrayMin) / (arrayMax - arrayMin) * (max - min) + min;
|
|
41332
|
+
});
|
|
41333
|
+
};
|
|
41334
|
+
var scaledSizeValues = normaliseArray(zValues, 1, 30);
|
|
41335
|
+
var data = props.data.map(function (d, i) {
|
|
41336
|
+
return _extends({}, d, {
|
|
41337
|
+
bubbleSize: scaledSizeValues[i]
|
|
41338
|
+
});
|
|
41339
|
+
});
|
|
41340
|
+
var forceRerender = useChartForceRerender(ref);
|
|
41341
|
+
if (forceRerender) return null;
|
|
41342
|
+
return jsxRuntime.jsx(responsive.ParentSize, {
|
|
41343
|
+
children: function children(parent) {
|
|
41344
|
+
var _props$height, _props$width;
|
|
41345
|
+
return jsxRuntime.jsx(VizzlyBubbleChart, {
|
|
41346
|
+
isBubble: true,
|
|
41347
|
+
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
41348
|
+
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
41349
|
+
uniqueId: props.uniqueId,
|
|
41350
|
+
formatSeriesName: props.formatSeriesName,
|
|
41351
|
+
forceXAxisAsTime: props.forceXAxisAsTime,
|
|
41352
|
+
sparkline: props.sparkline,
|
|
41353
|
+
lines: {
|
|
41354
|
+
annotate: props.annotate || [],
|
|
41355
|
+
data: data,
|
|
41356
|
+
keys: props.keys,
|
|
41357
|
+
colors: props.colors,
|
|
41358
|
+
scatter: true
|
|
41359
|
+
},
|
|
41360
|
+
x: props.x,
|
|
41361
|
+
z: props.z,
|
|
41362
|
+
sharedTooltip: true,
|
|
41363
|
+
legend: props.legend,
|
|
41364
|
+
removeStroke: props == null ? void 0 : props.removeStroke,
|
|
41365
|
+
formatXAxisLabel: props == null ? void 0 : props.formatXAxisLabel,
|
|
41366
|
+
formatYAxisLabel: props == null ? void 0 : props.formatYAxisLabel,
|
|
41367
|
+
horizontal: props == null ? void 0 : props.horizontal,
|
|
41368
|
+
height: (_props$height = props == null ? void 0 : props.height) != null ? _props$height : parent == null ? void 0 : parent.height,
|
|
41369
|
+
width: (_props$width = props == null ? void 0 : props.width) != null ? _props$width : parent == null ? void 0 : parent.width,
|
|
41370
|
+
theme: props == null ? void 0 : props.theme,
|
|
41371
|
+
onClick: function onClick(datum) {
|
|
41372
|
+
return (props == null ? void 0 : props.onClick) && (props == null ? void 0 : props.onClick(datum));
|
|
41373
|
+
},
|
|
41374
|
+
goalLine: props == null ? void 0 : props.goalLine,
|
|
41375
|
+
axisTitles: props == null ? void 0 : props.axisTitles,
|
|
41376
|
+
idPrefix: props == null ? void 0 : props.idPrefix,
|
|
41377
|
+
popOverMenuStyles: props.popOverMenuStyles
|
|
41378
|
+
});
|
|
41379
|
+
}
|
|
41380
|
+
});
|
|
41381
|
+
});
|
|
41382
|
+
|
|
40750
41383
|
var defaultProps$6 = {
|
|
40751
41384
|
type: 'bubbleChart',
|
|
40752
41385
|
xMeasure: null,
|
|
@@ -40834,7 +41467,7 @@ var BubbleChartView = function BubbleChartView(props) {
|
|
|
40834
41467
|
queriesAreChanging: props.queriesAreChanging,
|
|
40835
41468
|
children: [jsxRuntime.jsx(ViewHeader, _extends({}, headerProps)), jsxRuntime.jsx(ChartWrapper, {
|
|
40836
41469
|
disabledFeatures: (_props$library2 = props.library) != null ? _props$library2 : false,
|
|
40837
|
-
children: jsxRuntime.jsx(BubbleChart$
|
|
41470
|
+
children: jsxRuntime.jsx(BubbleChart$2, {
|
|
40838
41471
|
ref: ref,
|
|
40839
41472
|
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
40840
41473
|
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
@@ -40879,7 +41512,7 @@ var BubbleChartView = function BubbleChartView(props) {
|
|
|
40879
41512
|
BubbleChartView.defaultProps = defaultProps$6;
|
|
40880
41513
|
var memoized$4 = /*#__PURE__*/React.memo(BubbleChartView, shouldUpdate);
|
|
40881
41514
|
|
|
40882
|
-
var BubbleChart$
|
|
41515
|
+
var BubbleChart$3 = function BubbleChart(props) {
|
|
40883
41516
|
var _props$dashboardBehav;
|
|
40884
41517
|
var _props$component = props.component,
|
|
40885
41518
|
results = _props$component.results,
|
|
@@ -41619,6 +42252,22 @@ function howManyTicksFitInWidth(ticks, maxWidth, avgCharWidth) {
|
|
|
41619
42252
|
}
|
|
41620
42253
|
return fittedTicks.length;
|
|
41621
42254
|
}
|
|
42255
|
+
function howManyTicksFitInHeight(ticks, height) {
|
|
42256
|
+
if (height > 180) return undefined;
|
|
42257
|
+
var currentHeight = 0;
|
|
42258
|
+
var fittedTicks = 0;
|
|
42259
|
+
var ASSUMED_AVERAGE_CHAR_HEIGHT = 28;
|
|
42260
|
+
for (var i = 0; i < ticks.length; i++) {
|
|
42261
|
+
var wordHeight = ASSUMED_AVERAGE_CHAR_HEIGHT;
|
|
42262
|
+
if (currentHeight + wordHeight <= height) {
|
|
42263
|
+
fittedTicks++;
|
|
42264
|
+
currentHeight += wordHeight;
|
|
42265
|
+
} else {
|
|
42266
|
+
break;
|
|
42267
|
+
}
|
|
42268
|
+
}
|
|
42269
|
+
return fittedTicks;
|
|
42270
|
+
}
|
|
41622
42271
|
function pickEquallySpaced(arr, numPicks) {
|
|
41623
42272
|
if (numPicks >= arr.length) {
|
|
41624
42273
|
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
@@ -41631,17 +42280,22 @@ function pickEquallySpaced(arr, numPicks) {
|
|
|
41631
42280
|
}
|
|
41632
42281
|
return result;
|
|
41633
42282
|
}
|
|
41634
|
-
|
|
41635
|
-
|
|
42283
|
+
function adjustTicks(representation, width, height) {
|
|
42284
|
+
representation = _.cloneDeep(representation);
|
|
41636
42285
|
|
|
41637
42286
|
// TODO; take this from the theme override...
|
|
41638
42287
|
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
41639
|
-
var
|
|
42288
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks || [], width, averageCharacterWidth);
|
|
42289
|
+
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks || [], height);
|
|
41640
42290
|
|
|
41641
42291
|
// @ts-ignore
|
|
41642
|
-
|
|
41643
|
-
|
|
41644
|
-
|
|
42292
|
+
representation.x.ticks = pickEquallySpaced(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
42293
|
+
if (numberOfYTicksFittingIntoSpace) {
|
|
42294
|
+
// @ts-ignore
|
|
42295
|
+
representation.y.ticks = pickEquallySpaced(representation.y.ticks, numberOfYTicksFittingIntoSpace);
|
|
42296
|
+
}
|
|
42297
|
+
return representation;
|
|
42298
|
+
}
|
|
41645
42299
|
|
|
41646
42300
|
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
41647
42301
|
var maxWidth = _.max(yTicks.map(function (tick) {
|
|
@@ -42605,135 +43259,6 @@ function getStyleDefinition(_ref) {
|
|
|
42605
43259
|
});
|
|
42606
43260
|
}
|
|
42607
43261
|
|
|
42608
|
-
var getMinAndMax = function getMinAndMax(_ref) {
|
|
42609
|
-
var data = _ref.data,
|
|
42610
|
-
keys = _ref.keys,
|
|
42611
|
-
dataType = _ref.dataType,
|
|
42612
|
-
goalLines = _ref.goalLines;
|
|
42613
|
-
if (keys.length === 0) return {
|
|
42614
|
-
max: null,
|
|
42615
|
-
min: null
|
|
42616
|
-
};
|
|
42617
|
-
if (dataType === 'date_time') {
|
|
42618
|
-
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
42619
|
-
return keys.map(function (key) {
|
|
42620
|
-
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
42621
|
-
});
|
|
42622
|
-
}));
|
|
42623
|
-
return {
|
|
42624
|
-
max: Math.max.apply(Math, dataToAnalyse),
|
|
42625
|
-
min: Math.min.apply(Math, dataToAnalyse)
|
|
42626
|
-
};
|
|
42627
|
-
} else if (dataType === 'number') {
|
|
42628
|
-
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
42629
|
-
return keys.map(function (key) {
|
|
42630
|
-
return dataItem[key] ? dataItem[key].value : 0;
|
|
42631
|
-
});
|
|
42632
|
-
}), goalLines ? goalLines.map(function (gL) {
|
|
42633
|
-
return gL.value;
|
|
42634
|
-
}) : []);
|
|
42635
|
-
return {
|
|
42636
|
-
max: Math.max.apply(Math, _dataToAnalyse),
|
|
42637
|
-
min: Math.min.apply(Math, _dataToAnalyse)
|
|
42638
|
-
};
|
|
42639
|
-
} else {
|
|
42640
|
-
return {
|
|
42641
|
-
max: null,
|
|
42642
|
-
min: null
|
|
42643
|
-
};
|
|
42644
|
-
}
|
|
42645
|
-
};
|
|
42646
|
-
|
|
42647
|
-
function getNiceInterval(interval) {
|
|
42648
|
-
// Round the interval to a "nice" value (1, 2, 5, etc.)
|
|
42649
|
-
var exponent = Math.floor(Math.log10(interval));
|
|
42650
|
-
var fraction = interval / Math.pow(10, exponent);
|
|
42651
|
-
var niceFraction;
|
|
42652
|
-
if (fraction <= 1.5) niceFraction = 1;else if (fraction <= 3) niceFraction = 2;else if (fraction <= 7) niceFraction = 5;else niceFraction = 10;
|
|
42653
|
-
return niceFraction * Math.pow(10, exponent);
|
|
42654
|
-
}
|
|
42655
|
-
var getScaleAndTicks = function getScaleAndTicks(_ref) {
|
|
42656
|
-
var _order$;
|
|
42657
|
-
var data = _ref.data,
|
|
42658
|
-
xKey = _ref.xKey,
|
|
42659
|
-
yKeys = _ref.yKeys,
|
|
42660
|
-
xScaleDataType = _ref.xScaleDataType,
|
|
42661
|
-
nullValue = _ref.nullValue,
|
|
42662
|
-
tickCountYAxis = _ref.tickCountYAxis,
|
|
42663
|
-
formattingFunctionX = _ref.formattingFunctionX,
|
|
42664
|
-
formattingFunctionY = _ref.formattingFunctionY,
|
|
42665
|
-
order = _ref.order,
|
|
42666
|
-
goalLines = _ref.goalLines;
|
|
42667
|
-
var xTicks = [];
|
|
42668
|
-
var yTicks = [];
|
|
42669
|
-
var xScale = {
|
|
42670
|
-
dataType: xScaleDataType,
|
|
42671
|
-
key: xKey,
|
|
42672
|
-
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
42673
|
-
};
|
|
42674
|
-
var x = getMinAndMax({
|
|
42675
|
-
data: data,
|
|
42676
|
-
keys: xScale.key === null ? [] : [xScale.key],
|
|
42677
|
-
dataType: xScale.dataType
|
|
42678
|
-
});
|
|
42679
|
-
if (xKey) {
|
|
42680
|
-
xTicks = data.map(function (dataItem) {
|
|
42681
|
-
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
42682
|
-
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
42683
|
-
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
42684
|
-
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 : '';
|
|
42685
|
-
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
42686
|
-
return {
|
|
42687
|
-
value: xValue !== null ? xValue : '',
|
|
42688
|
-
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
42689
|
-
scaleValue: xScaleValueAdjusted
|
|
42690
|
-
};
|
|
42691
|
-
});
|
|
42692
|
-
}
|
|
42693
|
-
// ----- Y Axis ("number") -----
|
|
42694
|
-
|
|
42695
|
-
var y = getMinAndMax({
|
|
42696
|
-
data: data,
|
|
42697
|
-
keys: yKeys,
|
|
42698
|
-
dataType: 'number',
|
|
42699
|
-
goalLines: goalLines
|
|
42700
|
-
});
|
|
42701
|
-
var maxY = y.max || 0;
|
|
42702
|
-
var minY = Math.min(y.min || 0, 0);
|
|
42703
|
-
var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
|
|
42704
|
-
for (var i = 0; i < tickCountYAxis; i++) {
|
|
42705
|
-
var _value = yTickInterval * i;
|
|
42706
|
-
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
42707
|
-
yTicks.push({
|
|
42708
|
-
value: _value,
|
|
42709
|
-
formattedValue: formattedValue,
|
|
42710
|
-
scaleValue: _value
|
|
42711
|
-
});
|
|
42712
|
-
}
|
|
42713
|
-
return {
|
|
42714
|
-
x: {
|
|
42715
|
-
ticks: xTicks,
|
|
42716
|
-
scale: {
|
|
42717
|
-
dataType: xScale.dataType,
|
|
42718
|
-
max: x.max,
|
|
42719
|
-
min: x.min,
|
|
42720
|
-
key: xScale.key,
|
|
42721
|
-
ordering: xScale.ordering
|
|
42722
|
-
}
|
|
42723
|
-
},
|
|
42724
|
-
y: {
|
|
42725
|
-
ticks: yTicks,
|
|
42726
|
-
scale: {
|
|
42727
|
-
dataType: 'number',
|
|
42728
|
-
key: null,
|
|
42729
|
-
ordering: 'asc',
|
|
42730
|
-
max: maxY,
|
|
42731
|
-
min: minY
|
|
42732
|
-
}
|
|
42733
|
-
}
|
|
42734
|
-
};
|
|
42735
|
-
};
|
|
42736
|
-
|
|
42737
43262
|
/**
|
|
42738
43263
|
* When provided with a result, and formatting parameters, it returns a
|
|
42739
43264
|
* populated result including the formatted value to show.
|
|
@@ -43182,6 +43707,180 @@ function buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xA
|
|
|
43182
43707
|
};
|
|
43183
43708
|
}
|
|
43184
43709
|
|
|
43710
|
+
var getStackedMinAndMax = function getStackedMinAndMax(_ref) {
|
|
43711
|
+
var data = _ref.data,
|
|
43712
|
+
keys = _ref.keys,
|
|
43713
|
+
dataType = _ref.dataType,
|
|
43714
|
+
goalLines = _ref.goalLines,
|
|
43715
|
+
stacked = _ref.stacked;
|
|
43716
|
+
if (keys.length === 0) return {
|
|
43717
|
+
max: null,
|
|
43718
|
+
min: null
|
|
43719
|
+
};
|
|
43720
|
+
if (stacked) {
|
|
43721
|
+
var totals = data.map(function (dataItem) {
|
|
43722
|
+
return keys.reduce(function (sum, key) {
|
|
43723
|
+
var value = dataItem[key] ? dataItem[key].value : 0;
|
|
43724
|
+
return sum + (typeof value === 'number' ? value : 0);
|
|
43725
|
+
}, 0);
|
|
43726
|
+
});
|
|
43727
|
+
var maxTotal = Math.max.apply(Math, totals);
|
|
43728
|
+
var minTotal = Math.min.apply(Math, totals);
|
|
43729
|
+
return {
|
|
43730
|
+
max: maxTotal,
|
|
43731
|
+
min: minTotal
|
|
43732
|
+
};
|
|
43733
|
+
}
|
|
43734
|
+
if (dataType === 'date_time') {
|
|
43735
|
+
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
43736
|
+
return keys.map(function (key) {
|
|
43737
|
+
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
43738
|
+
});
|
|
43739
|
+
}));
|
|
43740
|
+
return {
|
|
43741
|
+
max: Math.max.apply(Math, dataToAnalyse),
|
|
43742
|
+
min: Math.min.apply(Math, dataToAnalyse)
|
|
43743
|
+
};
|
|
43744
|
+
} else if (dataType === 'number') {
|
|
43745
|
+
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
43746
|
+
return keys.map(function (key) {
|
|
43747
|
+
return dataItem[key] ? dataItem[key].value : 0;
|
|
43748
|
+
});
|
|
43749
|
+
}), goalLines ? goalLines.map(function (gL) {
|
|
43750
|
+
return gL.value;
|
|
43751
|
+
}) : []);
|
|
43752
|
+
return {
|
|
43753
|
+
max: Math.max.apply(Math, _dataToAnalyse),
|
|
43754
|
+
min: Math.min.apply(Math, _dataToAnalyse)
|
|
43755
|
+
};
|
|
43756
|
+
} else {
|
|
43757
|
+
return {
|
|
43758
|
+
max: null,
|
|
43759
|
+
min: null
|
|
43760
|
+
};
|
|
43761
|
+
}
|
|
43762
|
+
};
|
|
43763
|
+
|
|
43764
|
+
function getNiceInterval(interval) {
|
|
43765
|
+
var exponent = Math.floor(Math.log10(interval));
|
|
43766
|
+
var fraction = interval / Math.pow(10, exponent);
|
|
43767
|
+
var niceFraction;
|
|
43768
|
+
if (fraction <= 1) {
|
|
43769
|
+
niceFraction = 1;
|
|
43770
|
+
} else if (fraction <= 1.25) {
|
|
43771
|
+
niceFraction = 1.25;
|
|
43772
|
+
} else if (fraction <= 1.5) {
|
|
43773
|
+
niceFraction = 1.5;
|
|
43774
|
+
} else if (fraction <= 2) {
|
|
43775
|
+
niceFraction = 2;
|
|
43776
|
+
} else if (fraction <= 2.5) {
|
|
43777
|
+
niceFraction = 2.5;
|
|
43778
|
+
} else if (fraction <= 3) {
|
|
43779
|
+
niceFraction = 3;
|
|
43780
|
+
} else if (fraction <= 5) {
|
|
43781
|
+
niceFraction = 5;
|
|
43782
|
+
} else if (fraction <= 7) {
|
|
43783
|
+
niceFraction = 7;
|
|
43784
|
+
} else if (fraction <= 10) {
|
|
43785
|
+
niceFraction = 10;
|
|
43786
|
+
} else {
|
|
43787
|
+
niceFraction = 10;
|
|
43788
|
+
}
|
|
43789
|
+
return niceFraction * Math.pow(10, exponent);
|
|
43790
|
+
}
|
|
43791
|
+
var getScaleAndTicks = function getScaleAndTicks(_ref) {
|
|
43792
|
+
var _order$;
|
|
43793
|
+
var data = _ref.data,
|
|
43794
|
+
xKey = _ref.xKey,
|
|
43795
|
+
yKeys = _ref.yKeys,
|
|
43796
|
+
xScaleDataType = _ref.xScaleDataType,
|
|
43797
|
+
nullValue = _ref.nullValue,
|
|
43798
|
+
tickCountYAxis = _ref.tickCountYAxis,
|
|
43799
|
+
formattingFunctionX = _ref.formattingFunctionX,
|
|
43800
|
+
formattingFunctionY = _ref.formattingFunctionY,
|
|
43801
|
+
order = _ref.order,
|
|
43802
|
+
goalLines = _ref.goalLines,
|
|
43803
|
+
stacked = _ref.stacked;
|
|
43804
|
+
var xTicks = [];
|
|
43805
|
+
var xScale = {
|
|
43806
|
+
dataType: xScaleDataType,
|
|
43807
|
+
key: xKey,
|
|
43808
|
+
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
43809
|
+
};
|
|
43810
|
+
var x = getStackedMinAndMax({
|
|
43811
|
+
data: data,
|
|
43812
|
+
keys: xScale.key === null ? [] : [xScale.key],
|
|
43813
|
+
dataType: xScale.dataType
|
|
43814
|
+
});
|
|
43815
|
+
if (xKey) {
|
|
43816
|
+
xTicks = data.map(function (dataItem) {
|
|
43817
|
+
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
43818
|
+
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
43819
|
+
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
43820
|
+
var xScaleValue = xScale.key !== null && (_dataItem$xScale$key = dataItem[xScale.key]) != null && _dataItem$xScale$key.value ? (_dataItem$xScale$key2 = dataItem[xScale.key]) == null ? void 0 : _dataItem$xScale$key2.value : '';
|
|
43821
|
+
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
43822
|
+
return {
|
|
43823
|
+
value: xValue !== null ? xValue : '',
|
|
43824
|
+
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
43825
|
+
scaleValue: xScaleValueAdjusted
|
|
43826
|
+
};
|
|
43827
|
+
});
|
|
43828
|
+
}
|
|
43829
|
+
// ----- Y Axis ("number") -----
|
|
43830
|
+
|
|
43831
|
+
var y = getStackedMinAndMax({
|
|
43832
|
+
data: data,
|
|
43833
|
+
keys: yKeys,
|
|
43834
|
+
dataType: 'number',
|
|
43835
|
+
goalLines: goalLines,
|
|
43836
|
+
stacked: stacked
|
|
43837
|
+
});
|
|
43838
|
+
var maxY = y.max || 0;
|
|
43839
|
+
var minY = Math.min(y.min || 0, 0);
|
|
43840
|
+
var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
|
|
43841
|
+
var yTicks = [];
|
|
43842
|
+
for (var i = 0; i < tickCountYAxis; i++) {
|
|
43843
|
+
var _value = minY + yTickInterval * i;
|
|
43844
|
+
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
43845
|
+
yTicks.push({
|
|
43846
|
+
value: _value,
|
|
43847
|
+
formattedValue: formattedValue,
|
|
43848
|
+
scaleValue: _value
|
|
43849
|
+
});
|
|
43850
|
+
}
|
|
43851
|
+
return {
|
|
43852
|
+
x: {
|
|
43853
|
+
ticks: xTicks,
|
|
43854
|
+
scale: {
|
|
43855
|
+
dataType: xScale.dataType,
|
|
43856
|
+
max: x.max,
|
|
43857
|
+
min: x.min,
|
|
43858
|
+
key: xScale.key,
|
|
43859
|
+
ordering: xScale.ordering
|
|
43860
|
+
}
|
|
43861
|
+
},
|
|
43862
|
+
y: {
|
|
43863
|
+
ticks: yTicks,
|
|
43864
|
+
scale: {
|
|
43865
|
+
dataType: 'number',
|
|
43866
|
+
key: null,
|
|
43867
|
+
ordering: 'asc',
|
|
43868
|
+
max: maxY,
|
|
43869
|
+
min: minY
|
|
43870
|
+
}
|
|
43871
|
+
}
|
|
43872
|
+
};
|
|
43873
|
+
};
|
|
43874
|
+
|
|
43875
|
+
var formattingFunctionX = function formattingFunctionX(value, formattedResult, xKeyField) {
|
|
43876
|
+
if (!xKeyField) return '';
|
|
43877
|
+
return formattedResult.formatterFunc(value, {
|
|
43878
|
+
fieldId: xKeyField.fieldId,
|
|
43879
|
+
"function": xKeyField["function"],
|
|
43880
|
+
outputDataType: xKeyField.outputDataType
|
|
43881
|
+
}).formattedValue;
|
|
43882
|
+
};
|
|
43883
|
+
|
|
43185
43884
|
var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
43186
43885
|
var _xKeys$, _axisTitles$x, _axisTitles$y;
|
|
43187
43886
|
var axisTitles = _ref.axisTitles,
|
|
@@ -43254,15 +43953,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43254
43953
|
|
|
43255
43954
|
// ----- Formatting -----
|
|
43256
43955
|
|
|
43257
|
-
var formattingFunctionX = function formattingFunctionX(value) {
|
|
43258
|
-
if (!xKeyField) return '';
|
|
43259
|
-
return formattedResult.formatterFunc(value, {
|
|
43260
|
-
fieldId: xKeyField.fieldId,
|
|
43261
|
-
"function": xKeyField["function"],
|
|
43262
|
-
outputDataType: xKeyField.outputDataType
|
|
43263
|
-
}).formattedValue;
|
|
43264
|
-
};
|
|
43265
|
-
|
|
43266
43956
|
// (value: any, noValueReplacement?: string) => string;
|
|
43267
43957
|
var formattingFunctionY = function formattingFunctionY(value) {
|
|
43268
43958
|
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
@@ -43291,7 +43981,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43291
43981
|
var orderFunction = order.length > 0 ? order[0]["function"] : undefined;
|
|
43292
43982
|
var trendsAndForecastData = getTrendsAndForecastsData({
|
|
43293
43983
|
chartData: chartData,
|
|
43294
|
-
formattingFunctionX: formattingFunctionX
|
|
43984
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
43985
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
43986
|
+
},
|
|
43295
43987
|
formattingFunctionY: formattingFunctionY,
|
|
43296
43988
|
keys: keys,
|
|
43297
43989
|
nullValue: nullValue,
|
|
@@ -43321,7 +44013,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43321
44013
|
xScaleDataType: xScaleDataType,
|
|
43322
44014
|
yKeys: yKeys,
|
|
43323
44015
|
tickCountYAxis: approxYAxisLabelCount,
|
|
43324
|
-
formattingFunctionX: formattingFunctionX
|
|
44016
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
44017
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
44018
|
+
},
|
|
43325
44019
|
formattingFunctionY: formattingFunctionY,
|
|
43326
44020
|
nullValue: nullValue,
|
|
43327
44021
|
order: order,
|
|
@@ -43383,62 +44077,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43383
44077
|
return chart;
|
|
43384
44078
|
};
|
|
43385
44079
|
|
|
43386
|
-
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
43387
|
-
function calculateWordWidth$1(word, avgCharWidth) {
|
|
43388
|
-
if (avgCharWidth === void 0) {
|
|
43389
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43390
|
-
}
|
|
43391
|
-
return word.length * avgCharWidth;
|
|
43392
|
-
}
|
|
43393
|
-
|
|
43394
|
-
/** Reduce width proportionally to simulate spacing / padding between ticks. */
|
|
43395
|
-
var widthWithSpacing$1 = function widthWithSpacing(width) {
|
|
43396
|
-
var THIRTY_PERCENT = 0.3;
|
|
43397
|
-
return width - width * THIRTY_PERCENT;
|
|
43398
|
-
};
|
|
43399
|
-
function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
|
|
43400
|
-
if (avgCharWidth === void 0) {
|
|
43401
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43402
|
-
}
|
|
43403
|
-
var fittedTicks = [];
|
|
43404
|
-
var currentWidth = 0;
|
|
43405
|
-
for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
|
|
43406
|
-
var tick = _step.value;
|
|
43407
|
-
var word = (tick == null ? void 0 : tick.formattedValue) || '';
|
|
43408
|
-
var wordWidth = calculateWordWidth$1(word, avgCharWidth);
|
|
43409
|
-
if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
|
|
43410
|
-
fittedTicks.push(tick);
|
|
43411
|
-
currentWidth += wordWidth + avgCharWidth; // Add space between words
|
|
43412
|
-
} else {
|
|
43413
|
-
break; // Stop if adding the word exceeds maxWidth
|
|
43414
|
-
}
|
|
43415
|
-
}
|
|
43416
|
-
return fittedTicks.length;
|
|
43417
|
-
}
|
|
43418
|
-
function pickEquallySpaced$1(arr, numPicks) {
|
|
43419
|
-
if (numPicks >= arr.length) {
|
|
43420
|
-
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
43421
|
-
}
|
|
43422
|
-
var result = [];
|
|
43423
|
-
var interval = (arr.length - 1) / (numPicks - 1);
|
|
43424
|
-
for (var i = 0; i < numPicks; i++) {
|
|
43425
|
-
var index = Math.round(i * interval); // Calculate index and round it
|
|
43426
|
-
result.push(arr[index]);
|
|
43427
|
-
}
|
|
43428
|
-
return result;
|
|
43429
|
-
}
|
|
43430
|
-
var adjustTicks$1 = function adjustTicks(lineChartRepresentation, width) {
|
|
43431
|
-
lineChartRepresentation = _.cloneDeep(lineChartRepresentation);
|
|
43432
|
-
|
|
43433
|
-
// TODO; take this from the theme override...
|
|
43434
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43435
|
-
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(lineChartRepresentation.x.ticks || [], width, averageCharacterWidth);
|
|
43436
|
-
|
|
43437
|
-
// @ts-ignore
|
|
43438
|
-
lineChartRepresentation.x.ticks = pickEquallySpaced$1(lineChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
|
|
43439
|
-
return lineChartRepresentation;
|
|
43440
|
-
};
|
|
43441
|
-
|
|
43442
44080
|
var LineChartV2View = function LineChartV2View(props) {
|
|
43443
44081
|
var _props$library, _props$attributes$vie;
|
|
43444
44082
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -43547,7 +44185,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
43547
44185
|
return jsxRuntime.jsx(LineChart$5, {
|
|
43548
44186
|
width: parent.width,
|
|
43549
44187
|
height: parent.height,
|
|
43550
|
-
chart: adjustTicks
|
|
44188
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
43551
44189
|
options: {
|
|
43552
44190
|
lineCurve: props.attributes.lineCurve,
|
|
43553
44191
|
removeStroke: false,
|
|
@@ -43555,8 +44193,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
43555
44193
|
showLegend: props.attributes.legend,
|
|
43556
44194
|
axis: {
|
|
43557
44195
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
43558
|
-
|
|
43559
|
-
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
|
|
44196
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
43560
44197
|
}
|
|
43561
44198
|
},
|
|
43562
44199
|
theme: theme == null ? void 0 : theme.charts
|
|
@@ -46878,171 +47515,6 @@ var Progress$2 = function Progress(props) {
|
|
|
46878
47515
|
}));
|
|
46879
47516
|
};
|
|
46880
47517
|
|
|
46881
|
-
var getMinAndMax$1 = function getMinAndMax(_ref) {
|
|
46882
|
-
var data = _ref.data,
|
|
46883
|
-
keys = _ref.keys,
|
|
46884
|
-
dataType = _ref.dataType,
|
|
46885
|
-
goalLines = _ref.goalLines,
|
|
46886
|
-
stacked = _ref.stacked;
|
|
46887
|
-
if (keys.length === 0) return {
|
|
46888
|
-
max: null,
|
|
46889
|
-
min: null
|
|
46890
|
-
};
|
|
46891
|
-
if (stacked) {
|
|
46892
|
-
var totals = data.map(function (dataItem) {
|
|
46893
|
-
return keys.reduce(function (sum, key) {
|
|
46894
|
-
var value = dataItem[key] ? dataItem[key].value : 0;
|
|
46895
|
-
return sum + (typeof value === 'number' ? value : 0);
|
|
46896
|
-
}, 0);
|
|
46897
|
-
});
|
|
46898
|
-
var maxTotal = Math.max.apply(Math, totals);
|
|
46899
|
-
var minTotal = Math.min.apply(Math, totals);
|
|
46900
|
-
return {
|
|
46901
|
-
max: maxTotal,
|
|
46902
|
-
min: minTotal
|
|
46903
|
-
};
|
|
46904
|
-
}
|
|
46905
|
-
if (dataType === 'date_time') {
|
|
46906
|
-
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
46907
|
-
return keys.map(function (key) {
|
|
46908
|
-
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
46909
|
-
});
|
|
46910
|
-
}));
|
|
46911
|
-
return {
|
|
46912
|
-
max: Math.max.apply(Math, dataToAnalyse),
|
|
46913
|
-
min: Math.min.apply(Math, dataToAnalyse)
|
|
46914
|
-
};
|
|
46915
|
-
} else if (dataType === 'number') {
|
|
46916
|
-
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
46917
|
-
return keys.map(function (key) {
|
|
46918
|
-
return dataItem[key] ? dataItem[key].value : 0;
|
|
46919
|
-
});
|
|
46920
|
-
}), goalLines ? goalLines.map(function (gL) {
|
|
46921
|
-
return gL.value;
|
|
46922
|
-
}) : []);
|
|
46923
|
-
return {
|
|
46924
|
-
max: Math.max.apply(Math, _dataToAnalyse),
|
|
46925
|
-
min: Math.min.apply(Math, _dataToAnalyse)
|
|
46926
|
-
};
|
|
46927
|
-
} else {
|
|
46928
|
-
return {
|
|
46929
|
-
max: null,
|
|
46930
|
-
min: null
|
|
46931
|
-
};
|
|
46932
|
-
}
|
|
46933
|
-
};
|
|
46934
|
-
|
|
46935
|
-
function getNiceInterval$1(interval) {
|
|
46936
|
-
var exponent = Math.floor(Math.log10(interval));
|
|
46937
|
-
var fraction = interval / Math.pow(10, exponent);
|
|
46938
|
-
var niceFraction;
|
|
46939
|
-
if (fraction <= 1) {
|
|
46940
|
-
niceFraction = 1;
|
|
46941
|
-
} else if (fraction <= 1.25) {
|
|
46942
|
-
niceFraction = 1.25;
|
|
46943
|
-
} else if (fraction <= 1.5) {
|
|
46944
|
-
niceFraction = 1.5;
|
|
46945
|
-
} else if (fraction <= 2) {
|
|
46946
|
-
niceFraction = 2;
|
|
46947
|
-
} else if (fraction <= 2.5) {
|
|
46948
|
-
niceFraction = 2.5;
|
|
46949
|
-
} else if (fraction <= 3) {
|
|
46950
|
-
niceFraction = 3;
|
|
46951
|
-
} else if (fraction <= 5) {
|
|
46952
|
-
niceFraction = 5;
|
|
46953
|
-
} else if (fraction <= 7) {
|
|
46954
|
-
niceFraction = 7;
|
|
46955
|
-
} else if (fraction <= 10) {
|
|
46956
|
-
niceFraction = 10;
|
|
46957
|
-
} else {
|
|
46958
|
-
niceFraction = 10;
|
|
46959
|
-
}
|
|
46960
|
-
return niceFraction * Math.pow(10, exponent);
|
|
46961
|
-
}
|
|
46962
|
-
var getScaleAndTicks$1 = function getScaleAndTicks(_ref) {
|
|
46963
|
-
var _order$;
|
|
46964
|
-
var data = _ref.data,
|
|
46965
|
-
xKey = _ref.xKey,
|
|
46966
|
-
yKeys = _ref.yKeys,
|
|
46967
|
-
xScaleDataType = _ref.xScaleDataType,
|
|
46968
|
-
nullValue = _ref.nullValue,
|
|
46969
|
-
tickCountYAxis = _ref.tickCountYAxis,
|
|
46970
|
-
formattingFunctionX = _ref.formattingFunctionX,
|
|
46971
|
-
formattingFunctionY = _ref.formattingFunctionY,
|
|
46972
|
-
order = _ref.order,
|
|
46973
|
-
goalLines = _ref.goalLines,
|
|
46974
|
-
stacked = _ref.stacked;
|
|
46975
|
-
var xTicks = [];
|
|
46976
|
-
var xScale = {
|
|
46977
|
-
dataType: xScaleDataType,
|
|
46978
|
-
key: xKey,
|
|
46979
|
-
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
46980
|
-
};
|
|
46981
|
-
var x = getMinAndMax$1({
|
|
46982
|
-
data: data,
|
|
46983
|
-
keys: xScale.key === null ? [] : [xScale.key],
|
|
46984
|
-
dataType: xScale.dataType
|
|
46985
|
-
});
|
|
46986
|
-
if (xKey) {
|
|
46987
|
-
xTicks = data.map(function (dataItem) {
|
|
46988
|
-
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
46989
|
-
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
46990
|
-
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
46991
|
-
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 : '';
|
|
46992
|
-
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
46993
|
-
return {
|
|
46994
|
-
value: xValue !== null ? xValue : '',
|
|
46995
|
-
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
46996
|
-
scaleValue: xScaleValueAdjusted
|
|
46997
|
-
};
|
|
46998
|
-
});
|
|
46999
|
-
}
|
|
47000
|
-
// ----- Y Axis ("number") -----
|
|
47001
|
-
|
|
47002
|
-
var y = getMinAndMax$1({
|
|
47003
|
-
data: data,
|
|
47004
|
-
keys: yKeys,
|
|
47005
|
-
dataType: 'number',
|
|
47006
|
-
goalLines: goalLines,
|
|
47007
|
-
stacked: stacked
|
|
47008
|
-
});
|
|
47009
|
-
var maxY = y.max || 0;
|
|
47010
|
-
var minY = Math.min(y.min || 0, 0);
|
|
47011
|
-
var yTickInterval = getNiceInterval$1((maxY - minY) / (tickCountYAxis - 1));
|
|
47012
|
-
var yTicks = [];
|
|
47013
|
-
for (var i = 0; i < tickCountYAxis; i++) {
|
|
47014
|
-
var _value = minY + yTickInterval * i;
|
|
47015
|
-
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
47016
|
-
yTicks.push({
|
|
47017
|
-
value: _value,
|
|
47018
|
-
formattedValue: formattedValue,
|
|
47019
|
-
scaleValue: _value
|
|
47020
|
-
});
|
|
47021
|
-
}
|
|
47022
|
-
return {
|
|
47023
|
-
x: {
|
|
47024
|
-
ticks: xTicks,
|
|
47025
|
-
scale: {
|
|
47026
|
-
dataType: xScale.dataType,
|
|
47027
|
-
max: x.max,
|
|
47028
|
-
min: x.min,
|
|
47029
|
-
key: xScale.key,
|
|
47030
|
-
ordering: xScale.ordering
|
|
47031
|
-
}
|
|
47032
|
-
},
|
|
47033
|
-
y: {
|
|
47034
|
-
ticks: yTicks,
|
|
47035
|
-
scale: {
|
|
47036
|
-
dataType: 'number',
|
|
47037
|
-
key: null,
|
|
47038
|
-
ordering: 'asc',
|
|
47039
|
-
max: maxY,
|
|
47040
|
-
min: minY
|
|
47041
|
-
}
|
|
47042
|
-
}
|
|
47043
|
-
};
|
|
47044
|
-
};
|
|
47045
|
-
|
|
47046
47518
|
function fillMissingKeysForChartData(data) {
|
|
47047
47519
|
var allKeys = new Set();
|
|
47048
47520
|
data.forEach(function (item) {
|
|
@@ -47136,15 +47608,6 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
|
|
|
47136
47608
|
|
|
47137
47609
|
// ----- Formatting -----
|
|
47138
47610
|
|
|
47139
|
-
var formattingFunctionX = function formattingFunctionX(value) {
|
|
47140
|
-
if (!xKeyField) return '';
|
|
47141
|
-
return formattedResult.formatterFunc(value, {
|
|
47142
|
-
fieldId: xKeyField.fieldId,
|
|
47143
|
-
"function": xKeyField["function"],
|
|
47144
|
-
outputDataType: xKeyField.outputDataType
|
|
47145
|
-
}).formattedValue;
|
|
47146
|
-
};
|
|
47147
|
-
|
|
47148
47611
|
// (value: any, noValueReplacement?: string) => string;
|
|
47149
47612
|
var formattingFunctionY = function formattingFunctionY(value) {
|
|
47150
47613
|
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
@@ -47188,13 +47651,15 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
|
|
|
47188
47651
|
|
|
47189
47652
|
// ----- Ticks -----
|
|
47190
47653
|
|
|
47191
|
-
var ticks = getScaleAndTicks
|
|
47654
|
+
var ticks = getScaleAndTicks({
|
|
47192
47655
|
data: updatedData,
|
|
47193
47656
|
xKey: xKey,
|
|
47194
47657
|
xScaleDataType: xScaleDataType,
|
|
47195
47658
|
yKeys: yKeys,
|
|
47196
47659
|
tickCountYAxis: approxYAxisLabelCount,
|
|
47197
|
-
formattingFunctionX: formattingFunctionX
|
|
47660
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
47661
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
47662
|
+
},
|
|
47198
47663
|
formattingFunctionY: formattingFunctionY,
|
|
47199
47664
|
nullValue: nullValue,
|
|
47200
47665
|
order: order,
|
|
@@ -47406,7 +47871,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
47406
47871
|
return jsxRuntime.jsx(BarChart$5, {
|
|
47407
47872
|
width: parent.width,
|
|
47408
47873
|
height: parent.height,
|
|
47409
|
-
chart: adjustTicks(chartRepresentation, parent.width),
|
|
47874
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
47410
47875
|
options: {
|
|
47411
47876
|
stacked: !!props.attributes.stacked,
|
|
47412
47877
|
removeStroke: false,
|
|
@@ -47414,8 +47879,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
47414
47879
|
showLegend: props.attributes.legend,
|
|
47415
47880
|
axis: {
|
|
47416
47881
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
47417
|
-
|
|
47418
|
-
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
|
|
47882
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
47419
47883
|
}
|
|
47420
47884
|
},
|
|
47421
47885
|
theme: theme == null ? void 0 : theme.charts,
|
|
@@ -47504,30 +47968,30 @@ function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
|
|
|
47504
47968
|
return fill;
|
|
47505
47969
|
}
|
|
47506
47970
|
|
|
47507
|
-
var ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47508
|
-
function calculateWordWidth$
|
|
47971
|
+
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
47972
|
+
function calculateWordWidth$1(word, avgCharWidth) {
|
|
47509
47973
|
if (avgCharWidth === void 0) {
|
|
47510
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47974
|
+
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
47511
47975
|
}
|
|
47512
47976
|
return word.length * avgCharWidth;
|
|
47513
47977
|
}
|
|
47514
47978
|
|
|
47515
47979
|
/** Reduce width proportionally to simulate spacing / padding between ticks. */
|
|
47516
|
-
var widthWithSpacing$
|
|
47980
|
+
var widthWithSpacing$1 = function widthWithSpacing(width) {
|
|
47517
47981
|
var THIRTY_PERCENT = 0.3;
|
|
47518
47982
|
return width - width * THIRTY_PERCENT;
|
|
47519
47983
|
};
|
|
47520
|
-
function howManyTicksFitInWidth$
|
|
47984
|
+
function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
|
|
47521
47985
|
if (avgCharWidth === void 0) {
|
|
47522
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47986
|
+
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
47523
47987
|
}
|
|
47524
47988
|
var fittedTicks = [];
|
|
47525
47989
|
var currentWidth = 0;
|
|
47526
47990
|
for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
|
|
47527
47991
|
var tick = _step.value;
|
|
47528
47992
|
var word = (tick == null ? void 0 : tick.formattedValue) || '';
|
|
47529
|
-
var wordWidth = calculateWordWidth$
|
|
47530
|
-
if (currentWidth + wordWidth <= widthWithSpacing$
|
|
47993
|
+
var wordWidth = calculateWordWidth$1(word, avgCharWidth);
|
|
47994
|
+
if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
|
|
47531
47995
|
fittedTicks.push(tick);
|
|
47532
47996
|
currentWidth += wordWidth + avgCharWidth; // Add space between words
|
|
47533
47997
|
} else {
|
|
@@ -47536,7 +48000,7 @@ function howManyTicksFitInWidth$2(ticks, maxWidth, avgCharWidth) {
|
|
|
47536
48000
|
}
|
|
47537
48001
|
return fittedTicks.length;
|
|
47538
48002
|
}
|
|
47539
|
-
function pickEquallySpaced$
|
|
48003
|
+
function pickEquallySpaced$1(arr, numPicks) {
|
|
47540
48004
|
if (numPicks >= arr.length) {
|
|
47541
48005
|
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
47542
48006
|
}
|
|
@@ -47548,19 +48012,19 @@ function pickEquallySpaced$2(arr, numPicks) {
|
|
|
47548
48012
|
}
|
|
47549
48013
|
return result;
|
|
47550
48014
|
}
|
|
47551
|
-
var adjustTicks$
|
|
48015
|
+
var adjustTicks$1 = function adjustTicks(waterfallChartRepresentation, width) {
|
|
47552
48016
|
waterfallChartRepresentation = _.cloneDeep(waterfallChartRepresentation);
|
|
47553
48017
|
|
|
47554
48018
|
// TODO; take this from the theme override...
|
|
47555
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47556
|
-
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$
|
|
48019
|
+
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
48020
|
+
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(waterfallChartRepresentation.x.ticks || [], width, averageCharacterWidth);
|
|
47557
48021
|
var MINIMUM_NUMBER_OF_TICKS = 2;
|
|
47558
48022
|
if (numberOfTicksFittingIntoSpace < MINIMUM_NUMBER_OF_TICKS) {
|
|
47559
48023
|
numberOfTicksFittingIntoSpace = MINIMUM_NUMBER_OF_TICKS;
|
|
47560
48024
|
}
|
|
47561
48025
|
|
|
47562
48026
|
// @ts-ignore
|
|
47563
|
-
waterfallChartRepresentation.x.ticks = pickEquallySpaced$
|
|
48027
|
+
waterfallChartRepresentation.x.ticks = pickEquallySpaced$1(waterfallChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
|
|
47564
48028
|
return waterfallChartRepresentation;
|
|
47565
48029
|
};
|
|
47566
48030
|
|
|
@@ -47808,7 +48272,7 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
47808
48272
|
keys: [y.key]
|
|
47809
48273
|
});
|
|
47810
48274
|
var adjustedChartRepresentation = React.useMemo(function () {
|
|
47811
|
-
return adjustTicks$
|
|
48275
|
+
return adjustTicks$1(_extends({}, chartCopy), width);
|
|
47812
48276
|
}, [chartCopy, width]);
|
|
47813
48277
|
var formattedChartDataForBarChart = _extends({}, adjustedChartRepresentation, {
|
|
47814
48278
|
y: formattedYAxisForBarChart,
|
|
@@ -48082,7 +48546,7 @@ var Bar$1 = function Bar(_ref4) {
|
|
|
48082
48546
|
});
|
|
48083
48547
|
};
|
|
48084
48548
|
|
|
48085
|
-
function getNiceInterval$
|
|
48549
|
+
function getNiceInterval$1(interval) {
|
|
48086
48550
|
// Round the interval to a "nice" value (1, 2, 5, etc.)
|
|
48087
48551
|
var exponent = Math.floor(Math.log10(interval));
|
|
48088
48552
|
var fraction = interval / Math.pow(10, exponent);
|
|
@@ -48214,7 +48678,7 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48214
48678
|
outputDataType: nonPivotField.outputDataType
|
|
48215
48679
|
}).formattedValue;
|
|
48216
48680
|
};
|
|
48217
|
-
var yTickInterval = getNiceInterval$
|
|
48681
|
+
var yTickInterval = getNiceInterval$1((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
|
|
48218
48682
|
for (var i = 0; i < approxYAxisLabelCount; i++) {
|
|
48219
48683
|
var value = (yMinValue + i) * yTickInterval;
|
|
48220
48684
|
var formattedValue = formattingFunctionY(value);
|
|
@@ -48439,6 +48903,352 @@ var WaterfallChart$3 = function WaterfallChart(_ref) {
|
|
|
48439
48903
|
}));
|
|
48440
48904
|
};
|
|
48441
48905
|
|
|
48906
|
+
var buildAreaChartRepresentation = function buildAreaChartRepresentation(_ref) {
|
|
48907
|
+
var _xKeys$, _axisTitles$x, _axisTitles$y;
|
|
48908
|
+
var axisTitles = _ref.axisTitles,
|
|
48909
|
+
colors = _ref.colors,
|
|
48910
|
+
conditionalFormattingAttributes = _ref.conditionalFormattingAttributes,
|
|
48911
|
+
dateTimeFormatOptions = _ref.dateTimeFormatOptions,
|
|
48912
|
+
defaultFormats = _ref.defaultFormats,
|
|
48913
|
+
goalLineAttributes = _ref.goalLineAttributes,
|
|
48914
|
+
nullValue = _ref.nullValue,
|
|
48915
|
+
numberFormatOptions = _ref.numberFormatOptions,
|
|
48916
|
+
order = _ref.order,
|
|
48917
|
+
pivotConfig = _ref.pivotConfig,
|
|
48918
|
+
result = _ref.result,
|
|
48919
|
+
xAxisFormat = _ref.xAxisFormat,
|
|
48920
|
+
xAxisPostfix = _ref.xAxisPostfix,
|
|
48921
|
+
xAxisPrefix = _ref.xAxisPrefix,
|
|
48922
|
+
yAxisFormat = _ref.yAxisFormat,
|
|
48923
|
+
yAxisPostfix = _ref.yAxisPostfix,
|
|
48924
|
+
yAxisPrefix = _ref.yAxisPrefix,
|
|
48925
|
+
approxYAxisLabelCount = _ref.approxYAxisLabelCount,
|
|
48926
|
+
seriesLabelFormatter = _ref.seriesLabelFormatter,
|
|
48927
|
+
_valueAlias = _ref.valueAlias,
|
|
48928
|
+
stacked = _ref.stacked;
|
|
48929
|
+
var activeDateTimeFormats = {};
|
|
48930
|
+
var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
|
|
48931
|
+
allPrefixes = _buildFieldFormatMaps.allPrefixes,
|
|
48932
|
+
allPostfixes = _buildFieldFormatMaps.allPostfixes,
|
|
48933
|
+
nullValues = _buildFieldFormatMaps.nullValues,
|
|
48934
|
+
activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
|
|
48935
|
+
|
|
48936
|
+
// Build params for the result formatter.
|
|
48937
|
+
var params = {
|
|
48938
|
+
defaultFormats: defaultFormats,
|
|
48939
|
+
dateTimeFormatOptions: dateTimeFormatOptions,
|
|
48940
|
+
numberFormatOptions: numberFormatOptions,
|
|
48941
|
+
valueAlias: function valueAlias(params) {
|
|
48942
|
+
if (typeof _valueAlias === 'function') {
|
|
48943
|
+
// TODO; it is more useful providing this information separate,
|
|
48944
|
+
// rather than building it into an ID and returning it. Ideally all would be returned
|
|
48945
|
+
return String(_valueAlias({
|
|
48946
|
+
fieldId: id({
|
|
48947
|
+
field: params.fieldId,
|
|
48948
|
+
"function": params["function"]
|
|
48949
|
+
}),
|
|
48950
|
+
value: params.value
|
|
48951
|
+
}));
|
|
48952
|
+
}
|
|
48953
|
+
return undefined;
|
|
48954
|
+
},
|
|
48955
|
+
nullValue: nullValues,
|
|
48956
|
+
prefixes: allPrefixes,
|
|
48957
|
+
postfixes: allPostfixes,
|
|
48958
|
+
activeNumberFormats: activeNumberFormats,
|
|
48959
|
+
activeDateTimeFormats: activeDateTimeFormats
|
|
48960
|
+
};
|
|
48961
|
+
var formattedResult = formatResult(result, params);
|
|
48962
|
+
|
|
48963
|
+
// --------------------------------------------
|
|
48964
|
+
// --------------------------------------------
|
|
48965
|
+
// --------------------------------------------
|
|
48966
|
+
// --------------------------------------------
|
|
48967
|
+
// --------------------------------------------
|
|
48968
|
+
// --------------------------------------------
|
|
48969
|
+
// --------------------------------------------
|
|
48970
|
+
// --------------------------------------------
|
|
48971
|
+
|
|
48972
|
+
// ----- xKey -----
|
|
48973
|
+
|
|
48974
|
+
var xKeyField = getXKeyField(pivotConfig, result.fields);
|
|
48975
|
+
|
|
48976
|
+
// ----- Formatting ----
|
|
48977
|
+
// (value: any, noValueReplacement?: string) => string;
|
|
48978
|
+
var formattingFunctionY = function formattingFunctionY(value) {
|
|
48979
|
+
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
48980
|
+
var nonPivotField = formattedResult.fields.find(function (resultField) {
|
|
48981
|
+
return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
|
|
48982
|
+
});
|
|
48983
|
+
if (!nonPivotField) return '';
|
|
48984
|
+
return formattedResult.formatterFunc(value, {
|
|
48985
|
+
fieldId: nonPivotField.fieldId,
|
|
48986
|
+
"function": nonPivotField["function"],
|
|
48987
|
+
outputDataType: nonPivotField.outputDataType
|
|
48988
|
+
}).formattedValue;
|
|
48989
|
+
};
|
|
48990
|
+
|
|
48991
|
+
// ----- Keys & Prep -----
|
|
48992
|
+
var xScaleDataType = (xKeyField == null ? void 0 : xKeyField.outputDataType) || 'string';
|
|
48993
|
+
var _formattedResultToSer = formattedResultToSeries(formattedResult, pivotConfig, seriesLabelFormatter),
|
|
48994
|
+
keys = _formattedResultToSer.keys,
|
|
48995
|
+
yKeys = _formattedResultToSer.yKeys,
|
|
48996
|
+
xKeys = _formattedResultToSer.xKeys,
|
|
48997
|
+
chartData = _formattedResultToSer.seriesData;
|
|
48998
|
+
var xKey = (_xKeys$ = xKeys[0]) != null ? _xKeys$ : null;
|
|
48999
|
+
var updatedData = function () {
|
|
49000
|
+
var hasMultipleGroups = result.fields.length > 2;
|
|
49001
|
+
var data = chartData;
|
|
49002
|
+
if (hasMultipleGroups) {
|
|
49003
|
+
data = fillMissingKeysForChartData(chartData);
|
|
49004
|
+
}
|
|
49005
|
+
if (stacked) {
|
|
49006
|
+
data = fillMissingKeysForChartData(data);
|
|
49007
|
+
}
|
|
49008
|
+
return data;
|
|
49009
|
+
}();
|
|
49010
|
+
|
|
49011
|
+
// ----- Goal Lines -----
|
|
49012
|
+
|
|
49013
|
+
var goalLines = getGoalLines({
|
|
49014
|
+
goalLineAttributes: goalLineAttributes,
|
|
49015
|
+
formattingFunctionY: formattingFunctionY
|
|
49016
|
+
});
|
|
49017
|
+
|
|
49018
|
+
// ----- Ticks -----
|
|
49019
|
+
|
|
49020
|
+
var ticks = getScaleAndTicks({
|
|
49021
|
+
data: updatedData,
|
|
49022
|
+
xKey: xKey,
|
|
49023
|
+
xScaleDataType: xScaleDataType,
|
|
49024
|
+
yKeys: yKeys,
|
|
49025
|
+
tickCountYAxis: approxYAxisLabelCount,
|
|
49026
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
49027
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
49028
|
+
},
|
|
49029
|
+
formattingFunctionY: formattingFunctionY,
|
|
49030
|
+
nullValue: nullValue,
|
|
49031
|
+
order: order,
|
|
49032
|
+
goalLines: goalLines
|
|
49033
|
+
});
|
|
49034
|
+
|
|
49035
|
+
// ----- Lines -----
|
|
49036
|
+
|
|
49037
|
+
var styleDefinition = getStyleDefinition({
|
|
49038
|
+
colors: colors,
|
|
49039
|
+
yKeys: yKeys,
|
|
49040
|
+
style: {
|
|
49041
|
+
toOpacity: 0.5,
|
|
49042
|
+
fromOpacity: 0.9,
|
|
49043
|
+
type: 'area'
|
|
49044
|
+
}
|
|
49045
|
+
});
|
|
49046
|
+
|
|
49047
|
+
// ----- Conditional Formatting -----
|
|
49048
|
+
|
|
49049
|
+
var conditionalFormattingRules = getConditionalFormatting({
|
|
49050
|
+
conditionalFormattingAttributes: conditionalFormattingAttributes
|
|
49051
|
+
});
|
|
49052
|
+
var chart = {
|
|
49053
|
+
keys: keys,
|
|
49054
|
+
x: {
|
|
49055
|
+
ticks: ticks.x.ticks,
|
|
49056
|
+
scale: {
|
|
49057
|
+
dataType: ticks.x.scale.dataType,
|
|
49058
|
+
key: ticks.x.scale.key,
|
|
49059
|
+
ordering: ticks.x.scale.ordering,
|
|
49060
|
+
min: ticks.x.scale.min,
|
|
49061
|
+
max: ticks.x.scale.max
|
|
49062
|
+
},
|
|
49063
|
+
key: xKey,
|
|
49064
|
+
postfix: xAxisPostfix,
|
|
49065
|
+
prefix: xAxisPrefix,
|
|
49066
|
+
title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null
|
|
49067
|
+
},
|
|
49068
|
+
y: {
|
|
49069
|
+
ticks: ticks.y.ticks,
|
|
49070
|
+
scale: {
|
|
49071
|
+
dataType: ticks.y.scale.dataType,
|
|
49072
|
+
key: ticks.y.scale.key,
|
|
49073
|
+
ordering: ticks.y.scale.ordering,
|
|
49074
|
+
min: ticks.y.scale.min,
|
|
49075
|
+
max: ticks.y.scale.max
|
|
49076
|
+
},
|
|
49077
|
+
keys: yKeys,
|
|
49078
|
+
postfix: yAxisPostfix,
|
|
49079
|
+
prefix: yAxisPrefix,
|
|
49080
|
+
title: (_axisTitles$y = axisTitles == null ? void 0 : axisTitles.y) != null ? _axisTitles$y : null
|
|
49081
|
+
},
|
|
49082
|
+
data: updatedData,
|
|
49083
|
+
areas: styleDefinition,
|
|
49084
|
+
conditionalFormattingRules: conditionalFormattingRules,
|
|
49085
|
+
goalLines: goalLines
|
|
49086
|
+
};
|
|
49087
|
+
return chart;
|
|
49088
|
+
};
|
|
49089
|
+
|
|
49090
|
+
var AreaChartV2View = function AreaChartV2View(props) {
|
|
49091
|
+
var _props$library, _props$attributes$vie;
|
|
49092
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
49093
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
49094
|
+
valueAlias = _useDashboardBehaviou.valueAlias,
|
|
49095
|
+
labelFormat = _useDashboardBehaviou.labelFormat,
|
|
49096
|
+
queryEngineConfig = _useDashboardBehaviou.queryEngineConfig;
|
|
49097
|
+
var headerProps = {
|
|
49098
|
+
displayTitle: props.attributes.displayTitle,
|
|
49099
|
+
displaySubject: props.attributes.displaySubject,
|
|
49100
|
+
verified: props.attributes.protectedByOrganisation,
|
|
49101
|
+
library: (_props$library = props.library) != null ? _props$library : false,
|
|
49102
|
+
localFilters: props.localFilters,
|
|
49103
|
+
setLocalFilters: props.setLocalFilters,
|
|
49104
|
+
dataSet: props.dataSet,
|
|
49105
|
+
parameters: props == null ? void 0 : props.attributes.parameters,
|
|
49106
|
+
componentType: props == null ? void 0 : props.attributes.type,
|
|
49107
|
+
measure: props == null ? void 0 : props.attributes.measure,
|
|
49108
|
+
dimension: props == null ? void 0 : props.attributes.dimension,
|
|
49109
|
+
timeDimension: props.attributes.timeDimension,
|
|
49110
|
+
setPartialAttributes: props.setPartialAttributes,
|
|
49111
|
+
viewId: (_props$attributes$vie = props == null ? void 0 : props.attributes.viewId) != null ? _props$attributes$vie : '',
|
|
49112
|
+
order: props.attributes.order
|
|
49113
|
+
};
|
|
49114
|
+
var showHeadline = headlineAvailable(props.attributes.order, props.attributes.headline, null);
|
|
49115
|
+
var theme = useTheme();
|
|
49116
|
+
var AreaChartV2Component = getComponentInterface(props.attributes.type);
|
|
49117
|
+
var pivotConfig = init$c(props.attributes);
|
|
49118
|
+
var chartRepresentation = null;
|
|
49119
|
+
if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && AreaChartV2Component.isRunnable(props.attributes)) {
|
|
49120
|
+
var _theme$charts$colors, _theme$charts, _props$attributes$goa;
|
|
49121
|
+
chartRepresentation = buildAreaChartRepresentation({
|
|
49122
|
+
axisTitles: props.attributes.axisTitles,
|
|
49123
|
+
xAxisPostfix: props.attributes.xAxisPostfix,
|
|
49124
|
+
xAxisPrefix: props.attributes.xAxisPrefix,
|
|
49125
|
+
yAxisPostfix: props.attributes.yAxisPostfix,
|
|
49126
|
+
yAxisPrefix: props.attributes.yAxisPrefix,
|
|
49127
|
+
yAxisFormat: props.attributes.yAxisFormat,
|
|
49128
|
+
xAxisFormat: props.attributes.xAxisFormat,
|
|
49129
|
+
approxYAxisLabelCount: props.attributes.approxYAxisLabelCount === 'auto' ? 10 : props.attributes.approxYAxisLabelCount,
|
|
49130
|
+
colors: (_theme$charts$colors = theme == null || (_theme$charts = theme.charts) == null ? void 0 : _theme$charts.colors) != null ? _theme$charts$colors : DEFAULT_CHART_COLORS,
|
|
49131
|
+
valueAlias: valueAlias,
|
|
49132
|
+
nullValue: checkForNullValue(props.attributes.dataSetId, props.attributes.dimension, props.attributes.timeDimension, textOverride, valueAlias),
|
|
49133
|
+
result: props.result,
|
|
49134
|
+
pivotConfig: pivotConfig,
|
|
49135
|
+
order: props.attributes.order,
|
|
49136
|
+
numberFormatOptions: props.numberFormatOptions,
|
|
49137
|
+
dateTimeFormatOptions: props.dateTimeFormatOptions,
|
|
49138
|
+
goalLineAttributes: (_props$attributes$goa = props.attributes.goalLines) != null ? _props$attributes$goa : [],
|
|
49139
|
+
conditionalFormattingAttributes: props.attributes.conditionalFormattingRules,
|
|
49140
|
+
defaultFormats: props.defaultFormats,
|
|
49141
|
+
seriesLabelFormatter: function seriesLabelFormatter(labelFormatParams) {
|
|
49142
|
+
var _queryEngineConfig$su, _queryEngineConfig$su2, _queryEngineConfig$su3;
|
|
49143
|
+
var yResultField = labelFormatParams.yResultField,
|
|
49144
|
+
yPivotFields = labelFormatParams.yPivotFields,
|
|
49145
|
+
row = labelFormatParams.row;
|
|
49146
|
+
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);
|
|
49147
|
+
var formattedFunction = yResultField["function"] === 'none' ? '' : " \u2022 " + formattedFunctionName;
|
|
49148
|
+
var defaultLabelFormat = "" + yPivotFields.map(function (field) {
|
|
49149
|
+
return row[field.id].formattedValue;
|
|
49150
|
+
}).join(' • ') + (yPivotFields.length === 0 ? '' : ' • ') + yResultField.publicName + formattedFunction;
|
|
49151
|
+
if (!labelFormat) return defaultLabelFormat;
|
|
49152
|
+
return labelFormat({
|
|
49153
|
+
viewId: props.attributes.viewId,
|
|
49154
|
+
fieldId: yResultField.fieldId,
|
|
49155
|
+
func: yResultField["function"],
|
|
49156
|
+
type: 'areaChartV2',
|
|
49157
|
+
defaultLabel: defaultLabelFormat
|
|
49158
|
+
}) || defaultLabelFormat;
|
|
49159
|
+
},
|
|
49160
|
+
stacked: props.attributes.stacked
|
|
49161
|
+
});
|
|
49162
|
+
}
|
|
49163
|
+
|
|
49164
|
+
// When these are triggered they don't render the chart after they're resolved, potentially because component did no re-render?
|
|
49165
|
+
if (!AreaChartV2Component.isRunnable(props.attributes)) {
|
|
49166
|
+
return jsxRuntime.jsx(QueryUnderConstructionNotice, {
|
|
49167
|
+
title: "Missing parameters"
|
|
49168
|
+
});
|
|
49169
|
+
}
|
|
49170
|
+
if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
|
|
49171
|
+
if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
|
|
49172
|
+
if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
49173
|
+
return jsxRuntime.jsx(React.Suspense, {
|
|
49174
|
+
fallback: jsxRuntime.jsx(LoadingComponent, {}),
|
|
49175
|
+
children: jsxRuntime.jsxs(ViewWrapper, {
|
|
49176
|
+
id: props.id,
|
|
49177
|
+
queriesAreChanging: props.queriesAreChanging,
|
|
49178
|
+
children: [jsxRuntime.jsx(ViewHeader, _extends({}, headerProps, {
|
|
49179
|
+
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
49180
|
+
})), showHeadline && jsxRuntime.jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsxRuntime.jsx("div", {
|
|
49181
|
+
className: styles({
|
|
49182
|
+
flex: '1',
|
|
49183
|
+
position: 'relative'
|
|
49184
|
+
}),
|
|
49185
|
+
"aria-disabled": props.library,
|
|
49186
|
+
children: chartRepresentation && jsxRuntime.jsx(responsive.ParentSize, {
|
|
49187
|
+
style: {
|
|
49188
|
+
position: 'absolute',
|
|
49189
|
+
width: '100%',
|
|
49190
|
+
height: '100%',
|
|
49191
|
+
overflowX: 'hidden'
|
|
49192
|
+
},
|
|
49193
|
+
children: function children(parent) {
|
|
49194
|
+
var _props$attributes$vie2, _props$attributes$sta;
|
|
49195
|
+
if (chartRepresentation.areas.length === 0) return jsxRuntime.jsx(LoadingComponent, {});
|
|
49196
|
+
return jsxRuntime.jsx(v2.AreaChartV2, {
|
|
49197
|
+
width: parent.width,
|
|
49198
|
+
height: parent.height,
|
|
49199
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
49200
|
+
uniqueId: (_props$attributes$vie2 = props.attributes.viewId) != null ? _props$attributes$vie2 : 'area-chart',
|
|
49201
|
+
options: {
|
|
49202
|
+
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
49203
|
+
curve: props.attributes.lineCurve,
|
|
49204
|
+
removeStroke: false,
|
|
49205
|
+
showRoundedTotal: false,
|
|
49206
|
+
showLegend: props.attributes.legend,
|
|
49207
|
+
axis: {
|
|
49208
|
+
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
49209
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
49210
|
+
}
|
|
49211
|
+
},
|
|
49212
|
+
theme: theme == null ? void 0 : theme.charts
|
|
49213
|
+
});
|
|
49214
|
+
}
|
|
49215
|
+
})
|
|
49216
|
+
})]
|
|
49217
|
+
})
|
|
49218
|
+
});
|
|
49219
|
+
};
|
|
49220
|
+
|
|
49221
|
+
var AreaChartV2 = function AreaChartV2(props) {
|
|
49222
|
+
var _props$component = props.component,
|
|
49223
|
+
results = _props$component.results,
|
|
49224
|
+
attributes = _props$component.attributes,
|
|
49225
|
+
localFilters = _props$component.localFilters;
|
|
49226
|
+
var dashboardBehaviour = props.dashboardBehaviour;
|
|
49227
|
+
var _useComponentEffect = useComponentEffect(attributes, props.dataSet, dashboardBehaviour.queryEngineConfig, {
|
|
49228
|
+
localFilters: localFilters,
|
|
49229
|
+
globalFilters: props.globalFilters
|
|
49230
|
+
}, props.updateComponentAttributes, props.runQueriesCallback, props.setResults, dashboardBehaviour.variables),
|
|
49231
|
+
queriesAreChanging = _useComponentEffect.queriesAreChanging;
|
|
49232
|
+
return jsxRuntime.jsx(AreaChartV2View, {
|
|
49233
|
+
id: props.id,
|
|
49234
|
+
attributes: attributes,
|
|
49235
|
+
dataSet: props.dataSet,
|
|
49236
|
+
localFilters: props.component.localFilters,
|
|
49237
|
+
setLocalFilters: props.setLocalFilters,
|
|
49238
|
+
setPartialAttributes: function setPartialAttributes(changes) {
|
|
49239
|
+
return props.setPartialAttributes(changes);
|
|
49240
|
+
},
|
|
49241
|
+
result: results && results[0],
|
|
49242
|
+
queriesAreChanging: queriesAreChanging,
|
|
49243
|
+
numberFormatOptions: dashboardBehaviour.numberFormatOptions,
|
|
49244
|
+
dateTimeFormatOptions: dashboardBehaviour.dateTimeFormatOptions,
|
|
49245
|
+
defaultFormats: dashboardBehaviour.defaultFormats,
|
|
49246
|
+
propsForHeadline: props,
|
|
49247
|
+
idPrefix: props.idPrefix,
|
|
49248
|
+
library: props == null ? void 0 : props.library
|
|
49249
|
+
});
|
|
49250
|
+
};
|
|
49251
|
+
|
|
48442
49252
|
var Component = function Component(props) {
|
|
48443
49253
|
var _useDashboardContext = useDashboardContext(),
|
|
48444
49254
|
dashboard = _useDashboardContext.dashboard;
|
|
@@ -48528,7 +49338,7 @@ var Component = function Component(props) {
|
|
|
48528
49338
|
});
|
|
48529
49339
|
},
|
|
48530
49340
|
onError: dashboardBehaviour.onError,
|
|
48531
|
-
children: jsxRuntime.jsx(BubbleChart$
|
|
49341
|
+
children: jsxRuntime.jsx(BubbleChart$3, {
|
|
48532
49342
|
id: props.id,
|
|
48533
49343
|
setLocalFilters: props.setLocalFilters,
|
|
48534
49344
|
dataSet: dataSet,
|
|
@@ -48581,7 +49391,7 @@ var Component = function Component(props) {
|
|
|
48581
49391
|
});
|
|
48582
49392
|
},
|
|
48583
49393
|
onError: dashboardBehaviour.onError,
|
|
48584
|
-
children: jsxRuntime.jsx(AreaChart$
|
|
49394
|
+
children: jsxRuntime.jsx(AreaChart$4, {
|
|
48585
49395
|
id: props.id,
|
|
48586
49396
|
setLocalFilters: props.setLocalFilters,
|
|
48587
49397
|
dataSet: dataSet,
|
|
@@ -48679,6 +49489,32 @@ var Component = function Component(props) {
|
|
|
48679
49489
|
})
|
|
48680
49490
|
});
|
|
48681
49491
|
}
|
|
49492
|
+
if (props.component.attributes.type == 'areaChartV2') {
|
|
49493
|
+
return jsxRuntime.jsx(ErrorBoundary, {
|
|
49494
|
+
renderOnError: function renderOnError(onManualRetry) {
|
|
49495
|
+
return jsxRuntime.jsx(ComponentErrorNotice, {
|
|
49496
|
+
onManualRetry: onManualRetry
|
|
49497
|
+
});
|
|
49498
|
+
},
|
|
49499
|
+
onError: dashboardBehaviour.onError,
|
|
49500
|
+
children: jsxRuntime.jsx(AreaChartV2, {
|
|
49501
|
+
id: props.id,
|
|
49502
|
+
setLocalFilters: props.setLocalFilters,
|
|
49503
|
+
dataSet: dataSet,
|
|
49504
|
+
updateComponentAttributes: function updateComponentAttributes(newAttributes) {
|
|
49505
|
+
return _updateComponentAttributes(newAttributes);
|
|
49506
|
+
},
|
|
49507
|
+
runQueriesCallback: props.runQueriesCallback,
|
|
49508
|
+
component: props.component,
|
|
49509
|
+
setResults: props.setResults,
|
|
49510
|
+
globalFilters: dashboard.globalFilters,
|
|
49511
|
+
dashboardBehaviour: dashboardBehaviour,
|
|
49512
|
+
library: props == null ? void 0 : props.library,
|
|
49513
|
+
idPrefix: idPrefix,
|
|
49514
|
+
setPartialAttributes: setPartialAttributes
|
|
49515
|
+
})
|
|
49516
|
+
});
|
|
49517
|
+
}
|
|
48682
49518
|
if (props.component.attributes.type == 'pieChart') {
|
|
48683
49519
|
return jsxRuntime.jsx(ErrorBoundary, {
|
|
48684
49520
|
renderOnError: function renderOnError(onManualRetry) {
|
|
@@ -56991,6 +57827,22 @@ var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
|
56991
57827
|
}
|
|
56992
57828
|
return options;
|
|
56993
57829
|
}();
|
|
57830
|
+
var layoutOptions = function () {
|
|
57831
|
+
var options = [{
|
|
57832
|
+
label: textOverride('grouped', 'Grouped'),
|
|
57833
|
+
value: false
|
|
57834
|
+
}, {
|
|
57835
|
+
label: textOverride('stacked', 'Stacked'),
|
|
57836
|
+
value: true
|
|
57837
|
+
}];
|
|
57838
|
+
if (attributes.type === 'barChart' || attributes.type === 'areaChart') {
|
|
57839
|
+
options.push({
|
|
57840
|
+
label: textOverride('stacked_100prc', 'Stacked (100%)'),
|
|
57841
|
+
value: '100%'
|
|
57842
|
+
});
|
|
57843
|
+
}
|
|
57844
|
+
return options;
|
|
57845
|
+
}();
|
|
56994
57846
|
return jsxRuntime.jsx(Section, {
|
|
56995
57847
|
title: section.title,
|
|
56996
57848
|
tooltip: section == null ? void 0 : section.description,
|
|
@@ -57010,16 +57862,7 @@ var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
|
57010
57862
|
stacked: stacked
|
|
57011
57863
|
});
|
|
57012
57864
|
},
|
|
57013
|
-
options:
|
|
57014
|
-
label: textOverride('grouped', 'Grouped'),
|
|
57015
|
-
value: false
|
|
57016
|
-
}, {
|
|
57017
|
-
label: textOverride('stacked', 'Stacked'),
|
|
57018
|
-
value: true
|
|
57019
|
-
}, {
|
|
57020
|
-
label: textOverride('stacked_100prc', 'Stacked (100%)'),
|
|
57021
|
-
value: '100%'
|
|
57022
|
-
}]
|
|
57865
|
+
options: layoutOptions
|
|
57023
57866
|
}), section.type === 'curve' && jsxRuntime.jsx(FormatSelectInput, {
|
|
57024
57867
|
label: section.title,
|
|
57025
57868
|
id: "format-layout-curve",
|
|
@@ -65084,7 +65927,7 @@ var View$3 = /*#__PURE__*/function () {
|
|
|
65084
65927
|
};
|
|
65085
65928
|
return View;
|
|
65086
65929
|
}();
|
|
65087
|
-
var AreaChart$
|
|
65930
|
+
var AreaChart$5 = /*#__PURE__*/function (_View2) {
|
|
65088
65931
|
function AreaChart(attributes) {
|
|
65089
65932
|
return _View2.call(this, _extends({}, attributes, {
|
|
65090
65933
|
type: 'areaChart'
|
|
@@ -65453,6 +66296,8 @@ var toQueries$9 = commonToQueries;
|
|
|
65453
66296
|
|
|
65454
66297
|
var toQueries$a = commonToQueries;
|
|
65455
66298
|
|
|
66299
|
+
var toQueries$b = commonToQueries;
|
|
66300
|
+
|
|
65456
66301
|
var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65457
66302
|
var line = build$a(dataSet, attributes.lineMeasure, attributes.order, attributes.lineDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
65458
66303
|
var bar = build$a(dataSet, attributes.barMeasure, attributes.order, attributes.barDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
@@ -65461,7 +66306,7 @@ var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngin
|
|
|
65461
66306
|
line: line
|
|
65462
66307
|
};
|
|
65463
66308
|
};
|
|
65464
|
-
var toQueries$
|
|
66309
|
+
var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65465
66310
|
var _buildMainQueries = buildMainQueries(attributes, dataSet, queryEngineConfig, params),
|
|
65466
66311
|
line = _buildMainQueries.line,
|
|
65467
66312
|
bar = _buildMainQueries.bar;
|
|
@@ -65519,7 +66364,7 @@ var buildQueries = function buildQueries(attributes, dataSet, queryEngineConfig,
|
|
|
65519
66364
|
measureDescription: deltaQuery ? [mainQuery.measureDescription, deltaQuery.measureDescription] : [mainQuery.measureDescription]
|
|
65520
66365
|
};
|
|
65521
66366
|
};
|
|
65522
|
-
var toQueries$
|
|
66367
|
+
var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65523
66368
|
var _buildQueries = buildQueries(attributes, dataSet, queryEngineConfig, params),
|
|
65524
66369
|
queries = _buildQueries.queries,
|
|
65525
66370
|
measureDescription = _buildQueries.measureDescription;
|
|
@@ -65530,7 +66375,7 @@ var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65530
66375
|
};
|
|
65531
66376
|
};
|
|
65532
66377
|
|
|
65533
|
-
var toQueries$
|
|
66378
|
+
var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65534
66379
|
var measures = [];
|
|
65535
66380
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
65536
66381
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
@@ -65544,7 +66389,7 @@ var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65544
66389
|
};
|
|
65545
66390
|
};
|
|
65546
66391
|
|
|
65547
|
-
var toQueries$
|
|
66392
|
+
var toQueries$f = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65548
66393
|
var measures = [];
|
|
65549
66394
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
65550
66395
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
@@ -65558,7 +66403,7 @@ var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65558
66403
|
};
|
|
65559
66404
|
};
|
|
65560
66405
|
|
|
65561
|
-
var toQueries$
|
|
66406
|
+
var toQueries$g = function toQueries$1(attributes, dataSet, queryEngineConfig, params) {
|
|
65562
66407
|
return toQueries([dataSet], [{
|
|
65563
66408
|
measure: attributes.measure,
|
|
65564
66409
|
dataSetId: dataSet.id,
|
|
@@ -65570,12 +66415,12 @@ var toQueries$f = function toQueries$1(attributes, dataSet, queryEngineConfig, p
|
|
|
65570
66415
|
}], queryEngineConfig, params);
|
|
65571
66416
|
};
|
|
65572
66417
|
|
|
65573
|
-
var toQueries$g = commonToQueries;
|
|
65574
|
-
|
|
65575
66418
|
var toQueries$h = commonToQueries;
|
|
65576
66419
|
|
|
65577
66420
|
var toQueries$i = commonToQueries;
|
|
65578
66421
|
|
|
66422
|
+
var toQueries$j = commonToQueries;
|
|
66423
|
+
|
|
65579
66424
|
var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65580
66425
|
switch (attributes.type) {
|
|
65581
66426
|
case 'areaChart':
|
|
@@ -65590,30 +66435,32 @@ var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet
|
|
|
65590
66435
|
return toQueries$6(attributes, dataSet, queryEngineConfig, params);
|
|
65591
66436
|
case 'lineChartV2':
|
|
65592
66437
|
return toQueries$7(attributes, dataSet, queryEngineConfig, params);
|
|
65593
|
-
case '
|
|
66438
|
+
case 'areaChartV2':
|
|
65594
66439
|
return toQueries$8(attributes, dataSet, queryEngineConfig, params);
|
|
65595
|
-
case '
|
|
66440
|
+
case 'pieChart':
|
|
65596
66441
|
return toQueries$9(attributes, dataSet, queryEngineConfig, params);
|
|
65597
|
-
case '
|
|
66442
|
+
case 'dataTable':
|
|
65598
66443
|
return toQueries$a(attributes, dataSet, queryEngineConfig, params);
|
|
65599
|
-
case '
|
|
66444
|
+
case 'basicTable':
|
|
65600
66445
|
return toQueries$b(attributes, dataSet, queryEngineConfig, params);
|
|
65601
|
-
case '
|
|
66446
|
+
case 'comboChart':
|
|
65602
66447
|
return toQueries$c(attributes, dataSet, queryEngineConfig, params);
|
|
66448
|
+
case 'singleStat':
|
|
66449
|
+
return toQueries$d(attributes, dataSet, queryEngineConfig, params);
|
|
65603
66450
|
case 'progress':
|
|
65604
|
-
return toQueries$c(attributes, dataSet, queryEngineConfig, params);
|
|
65605
|
-
case 'scatterChart':
|
|
65606
66451
|
return toQueries$d(attributes, dataSet, queryEngineConfig, params);
|
|
65607
|
-
case '
|
|
66452
|
+
case 'scatterChart':
|
|
65608
66453
|
return toQueries$e(attributes, dataSet, queryEngineConfig, params);
|
|
65609
|
-
case '
|
|
66454
|
+
case 'bubbleChart':
|
|
65610
66455
|
return toQueries$f(attributes, dataSet, queryEngineConfig, params);
|
|
65611
|
-
case '
|
|
66456
|
+
case 'mercatorMap':
|
|
65612
66457
|
return toQueries$g(attributes, dataSet, queryEngineConfig, params);
|
|
65613
|
-
case '
|
|
66458
|
+
case 'funnelChart':
|
|
65614
66459
|
return toQueries$h(attributes, dataSet, queryEngineConfig, params);
|
|
65615
|
-
case '
|
|
66460
|
+
case 'richText':
|
|
65616
66461
|
return toQueries$i(attributes, dataSet, queryEngineConfig, params);
|
|
66462
|
+
case 'waterfallChart':
|
|
66463
|
+
return toQueries$j(attributes, dataSet, queryEngineConfig, params);
|
|
65617
66464
|
default:
|
|
65618
66465
|
throw 'Unsupported view when building query.';
|
|
65619
66466
|
}
|
|
@@ -67161,7 +68008,7 @@ VizzlyServices.Dashboard = Dashboard$1;
|
|
|
67161
68008
|
VizzlyServices.Editor = Editor;
|
|
67162
68009
|
VizzlyServices.Header = Header;
|
|
67163
68010
|
VizzlyServices.Library = Library$1;
|
|
67164
|
-
VizzlyServices.AreaChart = AreaChart$
|
|
68011
|
+
VizzlyServices.AreaChart = AreaChart$5;
|
|
67165
68012
|
VizzlyServices.LineChart = LineChart$6;
|
|
67166
68013
|
VizzlyServices.BarChart = BarChart$6;
|
|
67167
68014
|
VizzlyServices.PieChart = PieChart$4;
|
|
@@ -68485,7 +69332,8 @@ var attributesToAiView = function attributesToAiView(dataSet, originalAttributes
|
|
|
68485
69332
|
if (attributes.type === 'richText') throw 'Rich text views are not supported by Vizzly AI.';
|
|
68486
69333
|
if (attributes.type === 'lineChartV2') throw 'Line Chart V2 views are not supported by Vizzly AI.';
|
|
68487
69334
|
if (attributes.type === 'bubbleChart') throw 'Bubble Chart views are not supported by Vizzly AI.';
|
|
68488
|
-
if (attributes.type === 'barChartV2') throw '
|
|
69335
|
+
if (attributes.type === 'barChartV2') throw 'Bar Chart V2 views are not supported by Vizzly AI.';
|
|
69336
|
+
if (attributes.type === 'areaChartV2') throw 'Area Chart V2 views are not supported by Vizzly AI.';
|
|
68489
69337
|
if (attributes.type === 'waterfallChart') throw 'Waterfall chart views are not supported by Vizzly AI.';
|
|
68490
69338
|
var select = [];
|
|
68491
69339
|
var group = [];
|