@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
package/dist/dashboard.esm.js
CHANGED
|
@@ -48,7 +48,6 @@ import { useWindowWidth } from '@react-hook/window-size';
|
|
|
48
48
|
import copy from 'copy-to-clipboard';
|
|
49
49
|
import html2canvas from 'html2canvas';
|
|
50
50
|
import jsPDF from 'jspdf';
|
|
51
|
-
import { BubbleChart as BubbleChart$3 } from './charts/src/BubbleChart';
|
|
52
51
|
import { RectClipPath } from '@visx/clip-path';
|
|
53
52
|
import { localPoint } from '@visx/event';
|
|
54
53
|
import { bisector } from '@visx/vendor/d3-array';
|
|
@@ -56,6 +55,7 @@ import { AxisBottom as AxisBottom$1, AxisLeft as AxisLeft$1 } from '@visx/axis';
|
|
|
56
55
|
import { Text } from '@visx/text';
|
|
57
56
|
import { GridRows as GridRows$1 } from '@visx/grid';
|
|
58
57
|
import '@visx/point';
|
|
58
|
+
import { AreaChartV2 as AreaChartV2$1 } from './charts/src/v2';
|
|
59
59
|
import VisibilitySensor from 'react-visibility-sensor';
|
|
60
60
|
import ExcelJS from 'exceljs';
|
|
61
61
|
import { saveAs } from 'file-saver';
|
|
@@ -2723,6 +2723,7 @@ var timeDimensionQuerySchema = function timeDimensionQuerySchema(queryEngineConf
|
|
|
2723
2723
|
});
|
|
2724
2724
|
};
|
|
2725
2725
|
var lineCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step', 'stepBefore', 'stepAfter', 'dotted');
|
|
2726
|
+
var areaCurveSchema = /*#__PURE__*/Joi.string().valid('natural', 'straight', 'step');
|
|
2726
2727
|
var protectedFieldsMeasure = function protectedFieldsMeasure(queryEngineConfig) {
|
|
2727
2728
|
var _Joi$string6;
|
|
2728
2729
|
return Joi.array().items(Joi.object({
|
|
@@ -8163,7 +8164,7 @@ var RichText = function RichText(config) {
|
|
|
8163
8164
|
};
|
|
8164
8165
|
};
|
|
8165
8166
|
|
|
8166
|
-
var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
|
|
8167
|
+
var componentTypes = ['areaChart', 'barChart', 'basicTable', 'bubbleChart', 'comboChart', 'custom', 'dataTable', 'funnelChart', 'horizontalBarChart', 'lineChart', 'lineChartV2', 'areaChartV2', 'barChartV2', 'mercatorMap', 'pieChart', 'progress', 'richText', 'scatterChart', 'singleStat', 'waterfallChart'];
|
|
8167
8168
|
/** @deprecated */
|
|
8168
8169
|
|
|
8169
8170
|
var ProgressType = /*#__PURE__*/function (ProgressType) {
|
|
@@ -8960,7 +8961,6 @@ var attributesSchema$e = function attributesSchema(config) {
|
|
|
8960
8961
|
var setAttributes$d = (function (config) {
|
|
8961
8962
|
return function (bubbleChart, partial) {
|
|
8962
8963
|
var newAttributes = setAttributes(bubbleChart, partial, attributesSchema$e(config));
|
|
8963
|
-
console.log(newAttributes, 'HERE');
|
|
8964
8964
|
var allowedOrderSpec = [];
|
|
8965
8965
|
if (newAttributes.xMeasure) {
|
|
8966
8966
|
allowedOrderSpec.push(newAttributes.xMeasure);
|
|
@@ -9331,7 +9331,7 @@ var BubbleChart = function BubbleChart(config) {
|
|
|
9331
9331
|
|
|
9332
9332
|
var attributesSchema$f = function attributesSchema(config) {
|
|
9333
9333
|
return Joi.object(_extends({}, baseAttributesSchema(config.attributesSchemaOptions), timeDimensionQuerySchema(config.queryEngineConfig, config.attributesSchemaOptions), {
|
|
9334
|
-
stacked: Joi.valid(true, false
|
|
9334
|
+
stacked: Joi.valid(true, false),
|
|
9335
9335
|
legend: Joi.valid(true, false),
|
|
9336
9336
|
type: Joi.valid('barChartV2').required(),
|
|
9337
9337
|
parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
|
|
@@ -10011,6 +10011,379 @@ var WaterfallChart = function WaterfallChart(config) {
|
|
|
10011
10011
|
};
|
|
10012
10012
|
};
|
|
10013
10013
|
|
|
10014
|
+
var attributesSchema$h = function attributesSchema(config) {
|
|
10015
|
+
return Joi.object(_extends({}, baseAttributesSchema(config.attributesSchemaOptions), timeDimensionQuerySchema(config.queryEngineConfig, config.attributesSchemaOptions), {
|
|
10016
|
+
stacked: Joi.valid(true, false),
|
|
10017
|
+
legend: Joi.valid(true, false),
|
|
10018
|
+
type: Joi.valid('areaChartV2').required(),
|
|
10019
|
+
parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
|
|
10020
|
+
lineCurve: areaCurveSchema,
|
|
10021
|
+
conditionalFormattingRules: conditionalFormattingRulesSchema(config.queryEngineConfig),
|
|
10022
|
+
goalLines: goalLinesSchema(),
|
|
10023
|
+
axisTitles: axisTitleSchema(),
|
|
10024
|
+
headline: headlineSchema(),
|
|
10025
|
+
tags: tagsSchema(),
|
|
10026
|
+
trends: trendsSchema()
|
|
10027
|
+
}));
|
|
10028
|
+
};
|
|
10029
|
+
|
|
10030
|
+
var setAttributes$g = (function (config) {
|
|
10031
|
+
return function (lineChart, partial) {
|
|
10032
|
+
var newAttributes = setAttributes(lineChart, partial, attributesSchema$h(config));
|
|
10033
|
+
newAttributes = removeUnusedOrderFieldsFromTimeSeriesComponent(newAttributes);
|
|
10034
|
+
return newAttributes;
|
|
10035
|
+
};
|
|
10036
|
+
});
|
|
10037
|
+
|
|
10038
|
+
var CONSTANTS$j = {
|
|
10039
|
+
title: 'Area chart',
|
|
10040
|
+
description: 'Ideal for illustrating changes and trends over time with area graphs.',
|
|
10041
|
+
namespace: 'area_chart',
|
|
10042
|
+
data_panel: {
|
|
10043
|
+
data_set: {
|
|
10044
|
+
type: 'dataSet',
|
|
10045
|
+
title: 'Data set',
|
|
10046
|
+
description: 'What data do you want to use in this area chart?'
|
|
10047
|
+
},
|
|
10048
|
+
views: {
|
|
10049
|
+
type: 'views',
|
|
10050
|
+
title: 'View',
|
|
10051
|
+
description: ''
|
|
10052
|
+
},
|
|
10053
|
+
field_y_axis: {
|
|
10054
|
+
type: 'fieldCollector',
|
|
10055
|
+
title: 'Metric - Y Axis',
|
|
10056
|
+
description: 'What do you want each area to measure?',
|
|
10057
|
+
callToAction: 'Add metric'
|
|
10058
|
+
},
|
|
10059
|
+
drilldown: {
|
|
10060
|
+
type: 'drilldown',
|
|
10061
|
+
title: 'Drilldown',
|
|
10062
|
+
description: 'After clicking on a segment of this area chart, what information do you want to see next?'
|
|
10063
|
+
},
|
|
10064
|
+
field_x_axis: {
|
|
10065
|
+
type: 'fieldCollector',
|
|
10066
|
+
title: 'Grouping - X Axis',
|
|
10067
|
+
description: 'What do you want each area to represent? An example might be a `product category` field to represent each category as a area.',
|
|
10068
|
+
callToAction: 'Add grouping'
|
|
10069
|
+
},
|
|
10070
|
+
sort: {
|
|
10071
|
+
type: 'sort',
|
|
10072
|
+
title: 'Sort',
|
|
10073
|
+
description: 'Select the order of categories or time on the x Axis.'
|
|
10074
|
+
},
|
|
10075
|
+
filter: {
|
|
10076
|
+
type: 'filter',
|
|
10077
|
+
title: 'Filters',
|
|
10078
|
+
description: 'Only include the information you want to use in this area chart.'
|
|
10079
|
+
},
|
|
10080
|
+
custom_metrics: {
|
|
10081
|
+
type: 'customMetrics',
|
|
10082
|
+
title: 'Custom metrics',
|
|
10083
|
+
description: 'Build your own metrics, such as a percentage.'
|
|
10084
|
+
},
|
|
10085
|
+
limit: {
|
|
10086
|
+
type: 'limit',
|
|
10087
|
+
title: 'Limit',
|
|
10088
|
+
description: 'Set the maximum number of records to show on this area chart.'
|
|
10089
|
+
}
|
|
10090
|
+
},
|
|
10091
|
+
format_panel: {
|
|
10092
|
+
heading: {
|
|
10093
|
+
type: 'heading',
|
|
10094
|
+
title: 'Heading',
|
|
10095
|
+
description: '',
|
|
10096
|
+
subSectionDefinition: {
|
|
10097
|
+
title: {
|
|
10098
|
+
type: 'title',
|
|
10099
|
+
title: 'Title',
|
|
10100
|
+
description: '',
|
|
10101
|
+
namespace: 'title'
|
|
10102
|
+
},
|
|
10103
|
+
subject: {
|
|
10104
|
+
title: 'Subject',
|
|
10105
|
+
type: 'subject',
|
|
10106
|
+
description: '',
|
|
10107
|
+
namespace: 'subject'
|
|
10108
|
+
}
|
|
10109
|
+
}
|
|
10110
|
+
},
|
|
10111
|
+
chart_styles: {
|
|
10112
|
+
type: 'chartStyles',
|
|
10113
|
+
title: 'Chart Settings',
|
|
10114
|
+
description: '',
|
|
10115
|
+
subSectionDefinition: {
|
|
10116
|
+
stacked: {
|
|
10117
|
+
type: 'stacked',
|
|
10118
|
+
title: 'Layout',
|
|
10119
|
+
description: '',
|
|
10120
|
+
namespace: 'stacked'
|
|
10121
|
+
},
|
|
10122
|
+
curve: {
|
|
10123
|
+
type: 'curve',
|
|
10124
|
+
title: 'Area Style',
|
|
10125
|
+
description: '',
|
|
10126
|
+
namespace: 'curve'
|
|
10127
|
+
},
|
|
10128
|
+
legend: {
|
|
10129
|
+
type: 'legend',
|
|
10130
|
+
title: 'Show Legend',
|
|
10131
|
+
description: '',
|
|
10132
|
+
namespace: 'legend'
|
|
10133
|
+
}
|
|
10134
|
+
}
|
|
10135
|
+
},
|
|
10136
|
+
axis_labels: {
|
|
10137
|
+
type: 'axisLabels',
|
|
10138
|
+
title: 'Axis Preferences',
|
|
10139
|
+
description: '',
|
|
10140
|
+
subSectionDefinition: {
|
|
10141
|
+
x: {
|
|
10142
|
+
title: 'X Axis',
|
|
10143
|
+
description: '',
|
|
10144
|
+
namespace: 'x'
|
|
10145
|
+
},
|
|
10146
|
+
'x.prefix': {
|
|
10147
|
+
title: 'Prefix',
|
|
10148
|
+
description: '',
|
|
10149
|
+
namespace: 'x.prefix'
|
|
10150
|
+
},
|
|
10151
|
+
'x.postfix': {
|
|
10152
|
+
title: 'Postfix',
|
|
10153
|
+
description: '',
|
|
10154
|
+
namespace: 'x.postfix'
|
|
10155
|
+
},
|
|
10156
|
+
'x.format': {
|
|
10157
|
+
title: 'Format',
|
|
10158
|
+
description: '',
|
|
10159
|
+
namespace: 'x.format'
|
|
10160
|
+
},
|
|
10161
|
+
'x.count': {
|
|
10162
|
+
title: 'Label count',
|
|
10163
|
+
description: '',
|
|
10164
|
+
namespace: 'x.count'
|
|
10165
|
+
},
|
|
10166
|
+
'x.axis_title': {
|
|
10167
|
+
title: 'Title',
|
|
10168
|
+
description: '',
|
|
10169
|
+
namespace: 'x.axis_title'
|
|
10170
|
+
},
|
|
10171
|
+
y: {
|
|
10172
|
+
title: 'Y Axis',
|
|
10173
|
+
description: '',
|
|
10174
|
+
namespace: 'y'
|
|
10175
|
+
},
|
|
10176
|
+
'y.prefix': {
|
|
10177
|
+
title: 'Prefix',
|
|
10178
|
+
description: '',
|
|
10179
|
+
namespace: 'y.prefix'
|
|
10180
|
+
},
|
|
10181
|
+
'y.postfix': {
|
|
10182
|
+
title: 'Postfix',
|
|
10183
|
+
description: '',
|
|
10184
|
+
namespace: 'y.postfix'
|
|
10185
|
+
},
|
|
10186
|
+
'y.format': {
|
|
10187
|
+
title: 'Format',
|
|
10188
|
+
description: '',
|
|
10189
|
+
namespace: 'y.format'
|
|
10190
|
+
},
|
|
10191
|
+
'y.count': {
|
|
10192
|
+
title: 'Label count',
|
|
10193
|
+
description: '',
|
|
10194
|
+
namespace: 'y.count'
|
|
10195
|
+
},
|
|
10196
|
+
'y.axis_title': {
|
|
10197
|
+
title: 'Title',
|
|
10198
|
+
description: '',
|
|
10199
|
+
namespace: 'y.axis_title'
|
|
10200
|
+
}
|
|
10201
|
+
}
|
|
10202
|
+
},
|
|
10203
|
+
conditional_formatting: {
|
|
10204
|
+
type: 'conditionalFormatting',
|
|
10205
|
+
title: 'Conditional Formatting',
|
|
10206
|
+
description: ''
|
|
10207
|
+
},
|
|
10208
|
+
headline: {
|
|
10209
|
+
type: 'headline',
|
|
10210
|
+
title: 'Headarea',
|
|
10211
|
+
description: ''
|
|
10212
|
+
},
|
|
10213
|
+
trends: {
|
|
10214
|
+
type: 'trends',
|
|
10215
|
+
title: 'Trend lines',
|
|
10216
|
+
description: 'Specify a trend type for the area chart.'
|
|
10217
|
+
},
|
|
10218
|
+
goal_line: {
|
|
10219
|
+
type: 'goalLine',
|
|
10220
|
+
title: 'Goal lines',
|
|
10221
|
+
description: ''
|
|
10222
|
+
}
|
|
10223
|
+
}
|
|
10224
|
+
};
|
|
10225
|
+
|
|
10226
|
+
var AreaChart$1 = function AreaChart(config) {
|
|
10227
|
+
return {
|
|
10228
|
+
title: 'Area chart V2',
|
|
10229
|
+
description: 'Ideal for illustrating changes and trends over time with area graphs.',
|
|
10230
|
+
servicesClass: 'AreaChart',
|
|
10231
|
+
namespace: 'area_chart',
|
|
10232
|
+
dump: function dump(hydrated) {
|
|
10233
|
+
return hydrated;
|
|
10234
|
+
},
|
|
10235
|
+
load: function load(dumped) {
|
|
10236
|
+
var _dumped$tags, _dumped$trends;
|
|
10237
|
+
return {
|
|
10238
|
+
type: dumped.type,
|
|
10239
|
+
measure: upcastMeasure(dumped.measure),
|
|
10240
|
+
order: upcastOrder(dumped.order, dumped.timeDimension),
|
|
10241
|
+
dimension: upcastStringDimensionsToObject(dumped.dimension),
|
|
10242
|
+
// TODO: upcast dumped.timeDimension -> dimension
|
|
10243
|
+
displayTitle: dumped.displayTitle,
|
|
10244
|
+
displaySubject: dumped.displaySubject,
|
|
10245
|
+
protectedByOrganisation: dumped.protectedByOrganisation,
|
|
10246
|
+
viewId: upcastViewId(dumped.viewId),
|
|
10247
|
+
filter: upcastFilter(dumped.filter),
|
|
10248
|
+
dataSetId: dumped.dataSetId,
|
|
10249
|
+
limit: dumped.limit,
|
|
10250
|
+
timeDimension: null,
|
|
10251
|
+
xAxisPostfix: dumped.xAxisPostfix,
|
|
10252
|
+
xAxisPrefix: dumped.xAxisPrefix,
|
|
10253
|
+
yAxisPostfix: dumped.yAxisPostfix,
|
|
10254
|
+
yAxisPrefix: dumped.yAxisPrefix,
|
|
10255
|
+
yAxisFormat: dumped.yAxisFormat,
|
|
10256
|
+
xAxisFormat: dumped.xAxisFormat,
|
|
10257
|
+
lineCurve: dumped.lineCurve,
|
|
10258
|
+
conditionalFormattingRules: upcast$1(config.queryEngineConfig, dumped.conditionalFormattingRules),
|
|
10259
|
+
drilldown: dumped.drilldown,
|
|
10260
|
+
legend: dumped.legend,
|
|
10261
|
+
goalLines: dumped.goalLines,
|
|
10262
|
+
headline: upcastHeadline(dumped.headline, dumped.timeDimension),
|
|
10263
|
+
parameters: upcastParameters(dumped.parameters),
|
|
10264
|
+
approxXAxisLabelCount: upcastAxisLabel(dumped.approxXAxisLabelCount),
|
|
10265
|
+
approxYAxisLabelCount: upcastAxisLabel(dumped.approxYAxisLabelCount),
|
|
10266
|
+
axisTitles: dumped.axisTitles,
|
|
10267
|
+
tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
|
|
10268
|
+
trends: (_dumped$trends = dumped.trends) != null ? _dumped$trends : [],
|
|
10269
|
+
stacked: dumped.stacked
|
|
10270
|
+
};
|
|
10271
|
+
},
|
|
10272
|
+
setAttributes: setAttributes$g(config),
|
|
10273
|
+
validate: function validate(attrs, dataSets) {
|
|
10274
|
+
return validateView(attrs, dataSets, config.queryEngineConfig);
|
|
10275
|
+
},
|
|
10276
|
+
init: function init(dataSetId, overrides) {
|
|
10277
|
+
return _extends({
|
|
10278
|
+
type: 'areaChartV2',
|
|
10279
|
+
measure: [],
|
|
10280
|
+
dimension: [],
|
|
10281
|
+
timeDimension: null,
|
|
10282
|
+
displayTitle: '',
|
|
10283
|
+
displaySubject: '',
|
|
10284
|
+
protectedByOrganisation: undefined,
|
|
10285
|
+
viewId: upcastViewId(overrides == null ? void 0 : overrides.viewId),
|
|
10286
|
+
filter: [],
|
|
10287
|
+
order: [],
|
|
10288
|
+
dataSetId: dataSetId,
|
|
10289
|
+
limit: 5000,
|
|
10290
|
+
xAxisPostfix: '',
|
|
10291
|
+
xAxisPrefix: '',
|
|
10292
|
+
yAxisPostfix: '',
|
|
10293
|
+
yAxisPrefix: '',
|
|
10294
|
+
yAxisFormat: null,
|
|
10295
|
+
xAxisFormat: null,
|
|
10296
|
+
lineCurve: 'natural',
|
|
10297
|
+
conditionalFormattingRules: [],
|
|
10298
|
+
drilldown: [],
|
|
10299
|
+
legend: true,
|
|
10300
|
+
goalLines: undefined,
|
|
10301
|
+
approxXAxisLabelCount: 'auto',
|
|
10302
|
+
approxYAxisLabelCount: 'auto',
|
|
10303
|
+
parameters: {},
|
|
10304
|
+
axisTitles: undefined,
|
|
10305
|
+
headline: undefined,
|
|
10306
|
+
tags: [],
|
|
10307
|
+
trends: [],
|
|
10308
|
+
stacked: false
|
|
10309
|
+
}, overrides);
|
|
10310
|
+
},
|
|
10311
|
+
createFeedback: createFeedback,
|
|
10312
|
+
schema: attributesSchema$h(config),
|
|
10313
|
+
removeField: function removeField(attrs, fieldId) {
|
|
10314
|
+
return removeField$1(attrs, fieldId, config.queryEngineConfig);
|
|
10315
|
+
},
|
|
10316
|
+
isRunnable: function isRunnable(hydrated) {
|
|
10317
|
+
return hydrated.measure.length > 0 && hydrated.dimension.length > 0;
|
|
10318
|
+
},
|
|
10319
|
+
autoGenerate: function autoGenerate(dataSet) {
|
|
10320
|
+
var _DataSet$buildQueryAt = buildQueryAttributes(dataSet, config.queryEngineConfig, 'lineChart'),
|
|
10321
|
+
measure = _DataSet$buildQueryAt.measure,
|
|
10322
|
+
dimension = _DataSet$buildQueryAt.dimension;
|
|
10323
|
+
return this.init(dataSet.id, {
|
|
10324
|
+
measure: [measure[0]],
|
|
10325
|
+
dimension: dimension
|
|
10326
|
+
});
|
|
10327
|
+
},
|
|
10328
|
+
dataPanelConfig: function dataPanelConfig() {
|
|
10329
|
+
return [namespace(CONSTANTS$j, 'data_set'), namespace(CONSTANTS$j, 'views'), _extends({}, namespace(CONSTANTS$j, 'field_y_axis'), {
|
|
10330
|
+
fieldFilterOptions: {
|
|
10331
|
+
forComponent: 'lineChart'
|
|
10332
|
+
},
|
|
10333
|
+
preSetPartialAttributes: function preSetPartialAttributes(values) {
|
|
10334
|
+
return {
|
|
10335
|
+
measure: values
|
|
10336
|
+
};
|
|
10337
|
+
},
|
|
10338
|
+
getValues: function getValues(attrs) {
|
|
10339
|
+
return attrs.measure;
|
|
10340
|
+
},
|
|
10341
|
+
testId: 'metric-input'
|
|
10342
|
+
}), _extends({}, namespace(CONSTANTS$j, 'field_x_axis'), {
|
|
10343
|
+
fieldFilterOptions: {
|
|
10344
|
+
forComponent: 'lineChart',
|
|
10345
|
+
onlyDimensions: true
|
|
10346
|
+
},
|
|
10347
|
+
preventDuplicates: false,
|
|
10348
|
+
// return all values in the dimension array instead of seperating out timeDimension
|
|
10349
|
+
preSetPartialAttributes: function preSetPartialAttributes(values) {
|
|
10350
|
+
return {
|
|
10351
|
+
dimension: [].concat(values)
|
|
10352
|
+
};
|
|
10353
|
+
},
|
|
10354
|
+
// does this need to be updated too?
|
|
10355
|
+
getValues: function getValues(attrs) {
|
|
10356
|
+
return [].concat(attrs.dimension);
|
|
10357
|
+
},
|
|
10358
|
+
maxAllowed: 2,
|
|
10359
|
+
testId: 'add-dimension'
|
|
10360
|
+
}), namespace(CONSTANTS$j, 'sort'), namespace(CONSTANTS$j, 'filter'), namespace(CONSTANTS$j, 'custom_metrics'), namespace(CONSTANTS$j, 'limit')];
|
|
10361
|
+
},
|
|
10362
|
+
formatPanelConfig: function formatPanelConfig() {
|
|
10363
|
+
return [headingConstant(CONSTANTS$j), chartStylesConstant(CONSTANTS$j, true, false), axisLabelsConstants(CONSTANTS$j), _extends({}, namespace(CONSTANTS$j, 'conditional_formatting'), {
|
|
10364
|
+
ruleType: 'lineColor'
|
|
10365
|
+
}), namespace(CONSTANTS$j, 'goal_line')];
|
|
10366
|
+
},
|
|
10367
|
+
supportedCustomFields: {
|
|
10368
|
+
calculatedField: false,
|
|
10369
|
+
percentages: true,
|
|
10370
|
+
dateCalculations: true,
|
|
10371
|
+
simpleMaths: true,
|
|
10372
|
+
rules: true,
|
|
10373
|
+
aggregateMaths: true,
|
|
10374
|
+
roundedNumbers: true,
|
|
10375
|
+
conditional: true
|
|
10376
|
+
},
|
|
10377
|
+
supportedFeatures: {
|
|
10378
|
+
parameters: true,
|
|
10379
|
+
colorGradient: false
|
|
10380
|
+
},
|
|
10381
|
+
setDataAttributesFromPreAggregatedDataSet: function setDataAttributesFromPreAggregatedDataSet$1(attributes, dataSet) {
|
|
10382
|
+
return setDataAttributesFromPreAggregatedDataSet(attributes, dataSet, this.setAttributes);
|
|
10383
|
+
}
|
|
10384
|
+
};
|
|
10385
|
+
};
|
|
10386
|
+
|
|
10014
10387
|
var EMPTY_CONFIG = {
|
|
10015
10388
|
queryEngineConfig: {
|
|
10016
10389
|
supportedFeatures: [],
|
|
@@ -10037,6 +10410,7 @@ function getComponentInterface(type, config) {
|
|
|
10037
10410
|
if (type == 'lineChart') return textOverrideComponent(LineChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10038
10411
|
if (type == 'lineChartV2') return textOverrideComponent(LineChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10039
10412
|
if (type == 'barChartV2') return textOverrideComponent(BarChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10413
|
+
if (type == 'areaChartV2') return textOverrideComponent(AreaChart$1(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10040
10414
|
if (type == 'mercatorMap') return textOverrideComponent(MercatorMap(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10041
10415
|
if (type == 'pieChart') return textOverrideComponent(PieChart(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
10042
10416
|
if (type == 'progress') return textOverrideComponent(Progress(config || EMPTY_CONFIG), config == null ? void 0 : config.textOverride);
|
|
@@ -13193,7 +13567,7 @@ var buildDefaults = function buildDefaults(partialFeatureToggles) {
|
|
|
13193
13567
|
};
|
|
13194
13568
|
};
|
|
13195
13569
|
|
|
13196
|
-
var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
|
|
13570
|
+
var ALL_COMPONENT_TYPES = ['barChart', 'bubbleChart', 'horizontalBarChart', 'funnelChart', 'areaChart', 'areaChartV2', 'lineChart', 'lineChartV2', 'barChartV2', 'scatterChart', 'pieChart', 'singleStat', 'dataTable', 'basicTable', 'comboChart', 'mercatorMap', 'progress', 'richText', 'custom', 'waterfallChart'];
|
|
13197
13571
|
var ALL_VIZZLY_COMPONENT_TYPES = /*#__PURE__*/[].concat(ALL_COMPONENT_TYPES).filter(function (type) {
|
|
13198
13572
|
return type != 'custom';
|
|
13199
13573
|
});
|
|
@@ -13533,7 +13907,7 @@ var saveable = function saveable(component, protectedComponent) {
|
|
|
13533
13907
|
};
|
|
13534
13908
|
};
|
|
13535
13909
|
|
|
13536
|
-
var attributesSchema$
|
|
13910
|
+
var attributesSchema$i = function attributesSchema(config) {
|
|
13537
13911
|
return Joi.alternatives().conditional('.type', {
|
|
13538
13912
|
is: 'barChart',
|
|
13539
13913
|
then: BarChart(config).schema
|
|
@@ -13555,6 +13929,9 @@ var attributesSchema$h = function attributesSchema(config) {
|
|
|
13555
13929
|
}).conditional('.type', {
|
|
13556
13930
|
is: 'barChartV2',
|
|
13557
13931
|
then: BarChart$1(config).schema
|
|
13932
|
+
}).conditional('.type', {
|
|
13933
|
+
is: 'areaChartV2',
|
|
13934
|
+
then: AreaChart$1(config).schema
|
|
13558
13935
|
}).conditional('.type', {
|
|
13559
13936
|
is: 'comboChart',
|
|
13560
13937
|
then: ComboChart(config).schema
|
|
@@ -20933,7 +21310,7 @@ var Combobox = function Combobox(props) {
|
|
|
20933
21310
|
});
|
|
20934
21311
|
};
|
|
20935
21312
|
|
|
20936
|
-
var attributesSchema$
|
|
21313
|
+
var attributesSchema$j = /*#__PURE__*/Joi.object({
|
|
20937
21314
|
displayTitle: /*#__PURE__*/Joi.string().min(1).required(),
|
|
20938
21315
|
colSpan: /*#__PURE__*/Joi.number().valid(12).required()
|
|
20939
21316
|
});
|
|
@@ -20950,7 +21327,7 @@ var isEmptyCell = /*#__PURE__*/Joi.object({
|
|
|
20950
21327
|
});
|
|
20951
21328
|
var isPopulatedCell = function isPopulatedCell(queryEngineConfig) {
|
|
20952
21329
|
return Joi.object({
|
|
20953
|
-
attributes: attributesSchema$
|
|
21330
|
+
attributes: attributesSchema$i({
|
|
20954
21331
|
queryEngineConfig: queryEngineConfig
|
|
20955
21332
|
}),
|
|
20956
21333
|
colSpan: colSpanSchema
|
|
@@ -20961,7 +21338,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
|
|
|
20961
21338
|
id: Joi.string(),
|
|
20962
21339
|
display: displaySchema(queryEngineConfig),
|
|
20963
21340
|
componentLibrary: Joi.array().required().items(Joi.object({
|
|
20964
|
-
attributes: attributesSchema$
|
|
21341
|
+
attributes: attributesSchema$i({
|
|
20965
21342
|
queryEngineConfig: queryEngineConfig
|
|
20966
21343
|
})
|
|
20967
21344
|
})),
|
|
@@ -20972,7 +21349,7 @@ var saveableDashboardDefinitionSchema = function saveableDashboardDefinitionSche
|
|
|
20972
21349
|
function displaySchema(queryEngineConfig) {
|
|
20973
21350
|
return Joi.array().required().items(Joi.object({
|
|
20974
21351
|
height: Joi.number().required(),
|
|
20975
|
-
components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$
|
|
21352
|
+
components: Joi.array().required().min(1).items(Joi.alternatives(isEmptyCell, isPopulatedCell(queryEngineConfig), attributesSchema$j))
|
|
20976
21353
|
}));
|
|
20977
21354
|
}
|
|
20978
21355
|
|
|
@@ -21694,7 +22071,7 @@ var setHeaderComponent = function setHeaderComponent(state, action) {
|
|
|
21694
22071
|
newDisplayState.dashboard.display[rowIndex].components[cellIndex] = component;
|
|
21695
22072
|
return newDisplayState;
|
|
21696
22073
|
};
|
|
21697
|
-
var setAttributes$
|
|
22074
|
+
var setAttributes$h = function setAttributes(state, action) {
|
|
21698
22075
|
var attributes = action.attributes,
|
|
21699
22076
|
rowIndex = action.rowIndex,
|
|
21700
22077
|
cellIndex = action.cellIndex;
|
|
@@ -21979,7 +22356,7 @@ var reducer = function reducer(pipelineTransformationOptions) {
|
|
|
21979
22356
|
case 'swapComponents':
|
|
21980
22357
|
return swapComponents$1(state, action);
|
|
21981
22358
|
case 'setAttributes':
|
|
21982
|
-
return setAttributes$
|
|
22359
|
+
return setAttributes$h(state, action);
|
|
21983
22360
|
case 'addComponentToLibrary':
|
|
21984
22361
|
return addComponentToLibrary(state, action);
|
|
21985
22362
|
case 'setLocalFilters':
|
|
@@ -25324,7 +25701,7 @@ var RichText$1 = function RichText(props) {
|
|
|
25324
25701
|
})
|
|
25325
25702
|
}));
|
|
25326
25703
|
};
|
|
25327
|
-
var AreaChart$
|
|
25704
|
+
var AreaChart$2 = function AreaChart(props) {
|
|
25328
25705
|
return jsx("svg", _extends({
|
|
25329
25706
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25330
25707
|
viewBox: "0 0 512 512"
|
|
@@ -25593,7 +25970,10 @@ var WaterfallChart$1 = function WaterfallChart(props) {
|
|
|
25593
25970
|
|
|
25594
25971
|
var componentTypeToIconMapping = {
|
|
25595
25972
|
areaChart: function areaChart(props) {
|
|
25596
|
-
return AreaChart$
|
|
25973
|
+
return AreaChart$2(props);
|
|
25974
|
+
},
|
|
25975
|
+
areaChartV2: function areaChartV2(props) {
|
|
25976
|
+
return AreaChart$2(props);
|
|
25597
25977
|
},
|
|
25598
25978
|
barChart: function barChart(props) {
|
|
25599
25979
|
return BarChart$2(props);
|
|
@@ -32701,7 +33081,7 @@ var VizzlyXYChart = function VizzlyXYChart(props) {
|
|
|
32701
33081
|
});
|
|
32702
33082
|
};
|
|
32703
33083
|
|
|
32704
|
-
var AreaChart$
|
|
33084
|
+
var AreaChart$3 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32705
33085
|
var forceRerender = useChartForceRerender(ref);
|
|
32706
33086
|
if (forceRerender) return null;
|
|
32707
33087
|
return jsx(ParentSize, {
|
|
@@ -33652,7 +34032,7 @@ var AreaChartView = function AreaChartView(props) {
|
|
|
33652
34032
|
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
33653
34033
|
})), showHeadline && jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsx(ChartWrapper, {
|
|
33654
34034
|
disabledFeatures: (_props$library2 = props == null ? void 0 : props.library) != null ? _props$library2 : false,
|
|
33655
|
-
children: jsx(AreaChart$
|
|
34035
|
+
children: jsx(AreaChart$3, {
|
|
33656
34036
|
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
33657
34037
|
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
33658
34038
|
ref: ref,
|
|
@@ -33786,7 +34166,7 @@ var isDrilldownAvailable = function isDrilldownAvailable(props) {
|
|
|
33786
34166
|
return (props == null || (_props$component = props.component) == null || (_props$component = _props$component.attributes) == null || (_props$component = _props$component.drilldown) == null ? void 0 : _props$component.length) > 0;
|
|
33787
34167
|
};
|
|
33788
34168
|
|
|
33789
|
-
var AreaChart$
|
|
34169
|
+
var AreaChart$4 = function AreaChart(props) {
|
|
33790
34170
|
var _props$dashboardBehav;
|
|
33791
34171
|
var _useState = useState(null),
|
|
33792
34172
|
onDrilldown = _useState[0],
|
|
@@ -40784,6 +41164,259 @@ var IconText = function IconText(props) {
|
|
|
40784
41164
|
});
|
|
40785
41165
|
};
|
|
40786
41166
|
|
|
41167
|
+
var accessors$1 = function accessors(xAxisIsTime, xKey, yKey, horizontal) {
|
|
41168
|
+
return {
|
|
41169
|
+
xAccessor: function xAccessor(d) {
|
|
41170
|
+
return d ? horizontal ? d[yKey] : xAxisIsTime ? new Date(d[xKey]) : d[xKey] : undefined;
|
|
41171
|
+
},
|
|
41172
|
+
yAccessor: function yAccessor(d) {
|
|
41173
|
+
return d ? horizontal ? xAxisIsTime ? new Date(d[xKey]) : d[xKey] : d[yKey] : undefined;
|
|
41174
|
+
}
|
|
41175
|
+
};
|
|
41176
|
+
};
|
|
41177
|
+
var DEFAULT_Y_AXIS_LABEL_COUNT$1 = 5;
|
|
41178
|
+
var VizzlyBubbleChart = function VizzlyBubbleChart(props) {
|
|
41179
|
+
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;
|
|
41180
|
+
var height = adjustHeight((_props$height = props == null ? void 0 : props.height) != null ? _props$height : 300, props == null ? void 0 : props.legend);
|
|
41181
|
+
var _props$approxYAxisLab = props.approxYAxisLabelCount,
|
|
41182
|
+
approxYAxisLabelCount = _props$approxYAxisLab === void 0 ? 'auto' : _props$approxYAxisLab,
|
|
41183
|
+
_props$approxXAxisLab = props.approxXAxisLabelCount,
|
|
41184
|
+
approxXAxisLabelCount = _props$approxXAxisLab === void 0 ? 'auto' : _props$approxXAxisLab,
|
|
41185
|
+
_props$removeStroke = props.removeStroke,
|
|
41186
|
+
removeStroke = _props$removeStroke === void 0 ? false : _props$removeStroke,
|
|
41187
|
+
_props$horizontal = props.horizontal,
|
|
41188
|
+
horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
|
|
41189
|
+
theme = props.theme,
|
|
41190
|
+
x = props.x;
|
|
41191
|
+
var xAxisIsTime = isXAxisTime(props.x, props.forceXAxisAsTime, props.bars, props.lines, props.areas);
|
|
41192
|
+
var axisLabelStyles = function axisLabelStyles(horizontal, labelTheme) {
|
|
41193
|
+
var _labelTheme$color, _labelTheme$fontSize, _labelTheme$fontWeigh, _labelTheme$fontFamil;
|
|
41194
|
+
return {
|
|
41195
|
+
fill: (_labelTheme$color = labelTheme == null ? void 0 : labelTheme.color) != null ? _labelTheme$color : 'rgba(0, 0, 0, 0.6)',
|
|
41196
|
+
fontSize: (_labelTheme$fontSize = labelTheme == null ? void 0 : labelTheme.fontSize) != null ? _labelTheme$fontSize : 9,
|
|
41197
|
+
fontWeight: (_labelTheme$fontWeigh = labelTheme == null ? void 0 : labelTheme.fontWeight) != null ? _labelTheme$fontWeigh : 700,
|
|
41198
|
+
fontFamily: (_labelTheme$fontFamil = labelTheme == null ? void 0 : labelTheme.fontFamily) != null ? _labelTheme$fontFamil : DEFAULT_CHART_FONT,
|
|
41199
|
+
textAnchor: horizontal ? 'end' : 'middle',
|
|
41200
|
+
scaleToFit: 'shrink-only'
|
|
41201
|
+
};
|
|
41202
|
+
};
|
|
41203
|
+
var _useXAxisLabelCount = useXAxisLabelCount(approxXAxisLabelCount, !(props != null && props.horizontal) && (props == null ? void 0 : props.forceXAxisAsTime)),
|
|
41204
|
+
widthRef = _useXAxisLabelCount[0],
|
|
41205
|
+
approximateXTickCount = _useXAxisLabelCount[1];
|
|
41206
|
+
var _useState = useState(undefined),
|
|
41207
|
+
nearestDatum = _useState[0];
|
|
41208
|
+
var _useState2 = useState(undefined),
|
|
41209
|
+
nearestTooltipDatums = _useState2[0];
|
|
41210
|
+
var colors = getConcatenatedProperties(props, 'colors');
|
|
41211
|
+
var customTheme = buildChartTheme(_extends({}, lightTheme, {
|
|
41212
|
+
colors: colors,
|
|
41213
|
+
tickLength: 0,
|
|
41214
|
+
gridColor: '',
|
|
41215
|
+
gridColorDark: ''
|
|
41216
|
+
}));
|
|
41217
|
+
var chartData = getConcatenatedProperties(props, 'data');
|
|
41218
|
+
var axisStrokeColor = (_theme$axis$stroke = theme == null || (_theme$axis = theme.axis) == null ? void 0 : _theme$axis.stroke) != null ? _theme$axis$stroke : '#eaeaea';
|
|
41219
|
+
var _getAxisType = getAxisType(approxXAxisLabelCount, approxYAxisLabelCount),
|
|
41220
|
+
xAxisType = _getAxisType.xAxisType,
|
|
41221
|
+
xAxisAttributes = _getAxisType.xAxisAttributes,
|
|
41222
|
+
yAxisType = _getAxisType.yAxisType;
|
|
41223
|
+
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;
|
|
41224
|
+
var _useMinMaxValue = useMinMaxValue(props),
|
|
41225
|
+
maxValue = _useMinMaxValue.maxValue,
|
|
41226
|
+
minValue = _useMinMaxValue.minValue;
|
|
41227
|
+
var leftWidth = getYAxisWidth(horizontal, (_props$forceXAxisAsTi = props.forceXAxisAsTime) != null ? _props$forceXAxisAsTi : false, props, theme, getConcatenatedProperties(props, 'data'), props.x);
|
|
41228
|
+
var margin = props.sparkline ? NO_MARGIN(props.yAxisOrientation !== 'right') : getDefaultMargins(horizontal, props.yAxisOrientation !== 'right', xAxisType, props == null ? void 0 : props.axisTitles, leftWidth);
|
|
41229
|
+
var getTrendLineStyle = function getTrendLineStyle(datumKey) {
|
|
41230
|
+
if (props.trends) {
|
|
41231
|
+
var _props$trends, _strokeDasharrayToBor, _indicatorProperties$, _indicatorProperties$2, _indicatorProperties$3, _indicatorProperties$4, _indicatorProperties$5, _indicatorProperties$6, _indicatorProperties$7, _indicatorProperties$8, _indicatorProperties$9;
|
|
41232
|
+
var indicatorKeyIndex = (_props$trends = props.trends) == null ? void 0 : _props$trends.keys.indexOf(datumKey);
|
|
41233
|
+
var indicatorProperties = props.trends;
|
|
41234
|
+
return {
|
|
41235
|
+
borderStyle: (_strokeDasharrayToBor = strokeDasharrayToBorderStyle((_indicatorProperties$ = indicatorProperties.strokeDasharray) == null ? void 0 : _indicatorProperties$[indicatorKeyIndex])) != null ? _strokeDasharrayToBor : 'dotted',
|
|
41236
|
+
borderWidth: 0,
|
|
41237
|
+
marginTop: (_indicatorProperties$2 = (_indicatorProperties$3 = indicatorProperties.strokeWidth) == null ? void 0 : _indicatorProperties$3[indicatorKeyIndex]) != null ? _indicatorProperties$2 : 2,
|
|
41238
|
+
borderTopWidth: (_indicatorProperties$4 = (_indicatorProperties$5 = indicatorProperties.strokeWidth) == null ? void 0 : _indicatorProperties$5[indicatorKeyIndex]) != null ? _indicatorProperties$4 : 2,
|
|
41239
|
+
borderColor: (_indicatorProperties$6 = (_indicatorProperties$7 = indicatorProperties.colors) == null ? void 0 : _indicatorProperties$7[indicatorKeyIndex]) != null ? _indicatorProperties$6 : '#1E1D2D',
|
|
41240
|
+
opacity: (_indicatorProperties$8 = (_indicatorProperties$9 = indicatorProperties.opacity) == null ? void 0 : _indicatorProperties$9[indicatorKeyIndex]) != null ? _indicatorProperties$8 : 1
|
|
41241
|
+
};
|
|
41242
|
+
}
|
|
41243
|
+
return undefined;
|
|
41244
|
+
};
|
|
41245
|
+
return jsxs("div", {
|
|
41246
|
+
ref: widthRef,
|
|
41247
|
+
style: {
|
|
41248
|
+
position: 'relative',
|
|
41249
|
+
height: height
|
|
41250
|
+
},
|
|
41251
|
+
className: "vizzly-xy-chart" + (props != null && (_props$bars2 = props.bars) != null && _props$bars2.funnelChart ? ' vizzly-xy-chart-funnel' : ''),
|
|
41252
|
+
"data-testid": "vizzly-" + (props == null ? void 0 : props.uniqueId) + "-chart",
|
|
41253
|
+
children: [jsxs(XYChart, {
|
|
41254
|
+
theme: customTheme,
|
|
41255
|
+
margin: margin,
|
|
41256
|
+
height: height,
|
|
41257
|
+
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)),
|
|
41258
|
+
yScale: getYScale(props == null ? void 0 : props.goalLine, maxValue, minValue, horizontal, xAxisIsTime),
|
|
41259
|
+
horizontal: horizontal,
|
|
41260
|
+
onPointerUp: function onPointerUp(params) {
|
|
41261
|
+
return props == null ? void 0 : props.onClick(nearestDatum, nearestTooltipDatums, params);
|
|
41262
|
+
},
|
|
41263
|
+
children: [jsx(Grid$1, {
|
|
41264
|
+
columns: horizontal,
|
|
41265
|
+
rows: !horizontal,
|
|
41266
|
+
stroke: "black",
|
|
41267
|
+
strokeDasharray: "0.5 5",
|
|
41268
|
+
strokeWidth: removeStroke ? 0 : 2,
|
|
41269
|
+
lineStyle: {
|
|
41270
|
+
strokeLinecap: 'round',
|
|
41271
|
+
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)'
|
|
41272
|
+
}
|
|
41273
|
+
}), !(props != null && props.sparkline) && jsxs(Fragment$1, {
|
|
41274
|
+
children: [xAxisType !== 'none' && jsx(Axis, _extends({}, xAxisAttributes, {
|
|
41275
|
+
tickLabelProps: function tickLabelProps() {
|
|
41276
|
+
var tickLabelProps = _extends({}, axisLabelStyles(horizontal, theme == null ? void 0 : theme.labels));
|
|
41277
|
+
if (!horizontal) {
|
|
41278
|
+
tickLabelProps['y'] = 15;
|
|
41279
|
+
}
|
|
41280
|
+
return tickLabelProps;
|
|
41281
|
+
},
|
|
41282
|
+
numTicks: xAxisType === 'end2end' ? numberOfXAxisPoints : approximateXTickCount,
|
|
41283
|
+
strokeWidth: removeStroke ? 0 : 1,
|
|
41284
|
+
tickStroke: "#eaeaea",
|
|
41285
|
+
stroke: horizontal ? 'transparent' : axisStrokeColor,
|
|
41286
|
+
orientation: horizontal ? 'left' : 'bottom',
|
|
41287
|
+
tickFormat: handleFormatXAxisLabel(props.formatXAxisLabel, props.forceXAxisAsTime || xAxisIsTime, chartData),
|
|
41288
|
+
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,
|
|
41289
|
+
children: function children(axisProps) {
|
|
41290
|
+
return jsx(XAxis, _extends({}, axisProps, {
|
|
41291
|
+
theme: theme,
|
|
41292
|
+
type: xAxisType,
|
|
41293
|
+
uniqueId: props == null ? void 0 : props.uniqueId,
|
|
41294
|
+
chartWidth: props == null ? void 0 : props.width,
|
|
41295
|
+
xAxisIsTime: !!props.forceXAxisAsTime,
|
|
41296
|
+
leftPanelWidth: leftWidth,
|
|
41297
|
+
axisHorizontal: props == null ? void 0 : props.horizontal
|
|
41298
|
+
}));
|
|
41299
|
+
}
|
|
41300
|
+
})), jsx(Axis, {
|
|
41301
|
+
labelOffset: 50,
|
|
41302
|
+
tickLabelProps: function tickLabelProps() {
|
|
41303
|
+
var tickLabelProps = _extends({}, axisLabelStyles(horizontal, theme == null ? void 0 : theme.labels));
|
|
41304
|
+
if (!horizontal && props.yAxisOrientation !== 'right') {
|
|
41305
|
+
tickLabelProps['width'] = LEFT_PANEL_WIDTH;
|
|
41306
|
+
tickLabelProps['textAnchor'] = 'middle';
|
|
41307
|
+
}
|
|
41308
|
+
return tickLabelProps;
|
|
41309
|
+
},
|
|
41310
|
+
hideAxisLine: true,
|
|
41311
|
+
numTicks: approxYAxisLabelCount === 'auto' ? DEFAULT_Y_AXIS_LABEL_COUNT$1 : approxYAxisLabelCount,
|
|
41312
|
+
strokeWidth: removeStroke ? 0 : 1,
|
|
41313
|
+
hideTicks: true,
|
|
41314
|
+
tickLength: !props.horizontal && props.yAxisOrientation !== 'right' ? LEFT_PANEL_WIDTH / 2 : 10,
|
|
41315
|
+
stroke: axisStrokeColor,
|
|
41316
|
+
orientation: horizontal ? 'bottom' : props.yAxisOrientation || 'left',
|
|
41317
|
+
tickFormat: formatYAxisLabel$1(props),
|
|
41318
|
+
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,
|
|
41319
|
+
children: function children(axisProps) {
|
|
41320
|
+
return jsx(YAxis, _extends({}, axisProps, {
|
|
41321
|
+
theme: theme,
|
|
41322
|
+
type: yAxisType,
|
|
41323
|
+
horizontal: horizontal,
|
|
41324
|
+
maxValueOfYAxis: props != null && props.formatYAxisLabel ? props == null ? void 0 : props.formatYAxisLabel(maxValue) : maxValue,
|
|
41325
|
+
uniqueId: props == null ? void 0 : props.uniqueId
|
|
41326
|
+
}));
|
|
41327
|
+
}
|
|
41328
|
+
})]
|
|
41329
|
+
}), jsx("style", {
|
|
41330
|
+
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 "
|
|
41331
|
+
}), props.lines && props.lines.keys.map(function (key, keyIndex) {
|
|
41332
|
+
var _props$lines3, _props$lines4;
|
|
41333
|
+
return jsx(GlyphSeries, _extends({
|
|
41334
|
+
size: function size(datum) {
|
|
41335
|
+
if (!datum || !datum.bubbleSize) return 5;
|
|
41336
|
+
return datum.bubbleSize;
|
|
41337
|
+
},
|
|
41338
|
+
dataKey: key,
|
|
41339
|
+
data: (_props$lines3 = props.lines) == null ? void 0 : _props$lines3.data
|
|
41340
|
+
}, accessors$1(xAxisIsTime, x, key, horizontal), {
|
|
41341
|
+
colorAccessor: (props == null || (_props$lines4 = props.lines) == null ? void 0 : _props$lines4.formatter) && getColorFromDatum(key, props == null ? void 0 : props.lines.formatter, colors, keyIndex)
|
|
41342
|
+
}), "scatter_chart_" + props.uniqueId + "_" + keyIndex);
|
|
41343
|
+
})]
|
|
41344
|
+
}), (props == null ? void 0 : props.legend) && jsx(Legend, {
|
|
41345
|
+
funnelChart: props == null || (_props$bars3 = props.bars) == null ? void 0 : _props$bars3.funnelChart
|
|
41346
|
+
// groupingCount={props}
|
|
41347
|
+
,
|
|
41348
|
+
keys: getConcatenatedProperties(props, 'keys'),
|
|
41349
|
+
colors: colors,
|
|
41350
|
+
typeIndex: getTypeIndex(props),
|
|
41351
|
+
formatSeriesName: props == null ? void 0 : props.formatSeriesName,
|
|
41352
|
+
formatter: props == null || (_props$bars4 = props.bars) == null ? void 0 : _props$bars4.formatter,
|
|
41353
|
+
data: (_props$bars5 = props.bars) == null ? void 0 : _props$bars5.data,
|
|
41354
|
+
conditionalFormattingPossibilities: props.conditionalFormattingPossibilities,
|
|
41355
|
+
getIndicatorStyles: getTrendLineStyle
|
|
41356
|
+
})]
|
|
41357
|
+
});
|
|
41358
|
+
};
|
|
41359
|
+
|
|
41360
|
+
var BubbleChart$2 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41361
|
+
var zValues = props.z ? props.data.map(function (d) {
|
|
41362
|
+
return d[props.z];
|
|
41363
|
+
}) : [];
|
|
41364
|
+
var normaliseArray = function normaliseArray(array, min, max) {
|
|
41365
|
+
var arrayMin = Math.min.apply(Math, array);
|
|
41366
|
+
var arrayMax = Math.max.apply(Math, array);
|
|
41367
|
+
return array.map(function (value) {
|
|
41368
|
+
return (value - arrayMin) / (arrayMax - arrayMin) * (max - min) + min;
|
|
41369
|
+
});
|
|
41370
|
+
};
|
|
41371
|
+
var scaledSizeValues = normaliseArray(zValues, 1, 30);
|
|
41372
|
+
var data = props.data.map(function (d, i) {
|
|
41373
|
+
return _extends({}, d, {
|
|
41374
|
+
bubbleSize: scaledSizeValues[i]
|
|
41375
|
+
});
|
|
41376
|
+
});
|
|
41377
|
+
var forceRerender = useChartForceRerender(ref);
|
|
41378
|
+
if (forceRerender) return null;
|
|
41379
|
+
return jsx(ParentSize, {
|
|
41380
|
+
children: function children(parent) {
|
|
41381
|
+
var _props$height, _props$width;
|
|
41382
|
+
return jsx(VizzlyBubbleChart, {
|
|
41383
|
+
isBubble: true,
|
|
41384
|
+
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
41385
|
+
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
41386
|
+
uniqueId: props.uniqueId,
|
|
41387
|
+
formatSeriesName: props.formatSeriesName,
|
|
41388
|
+
forceXAxisAsTime: props.forceXAxisAsTime,
|
|
41389
|
+
sparkline: props.sparkline,
|
|
41390
|
+
lines: {
|
|
41391
|
+
annotate: props.annotate || [],
|
|
41392
|
+
data: data,
|
|
41393
|
+
keys: props.keys,
|
|
41394
|
+
colors: props.colors,
|
|
41395
|
+
scatter: true
|
|
41396
|
+
},
|
|
41397
|
+
x: props.x,
|
|
41398
|
+
z: props.z,
|
|
41399
|
+
sharedTooltip: true,
|
|
41400
|
+
legend: props.legend,
|
|
41401
|
+
removeStroke: props == null ? void 0 : props.removeStroke,
|
|
41402
|
+
formatXAxisLabel: props == null ? void 0 : props.formatXAxisLabel,
|
|
41403
|
+
formatYAxisLabel: props == null ? void 0 : props.formatYAxisLabel,
|
|
41404
|
+
horizontal: props == null ? void 0 : props.horizontal,
|
|
41405
|
+
height: (_props$height = props == null ? void 0 : props.height) != null ? _props$height : parent == null ? void 0 : parent.height,
|
|
41406
|
+
width: (_props$width = props == null ? void 0 : props.width) != null ? _props$width : parent == null ? void 0 : parent.width,
|
|
41407
|
+
theme: props == null ? void 0 : props.theme,
|
|
41408
|
+
onClick: function onClick(datum) {
|
|
41409
|
+
return (props == null ? void 0 : props.onClick) && (props == null ? void 0 : props.onClick(datum));
|
|
41410
|
+
},
|
|
41411
|
+
goalLine: props == null ? void 0 : props.goalLine,
|
|
41412
|
+
axisTitles: props == null ? void 0 : props.axisTitles,
|
|
41413
|
+
idPrefix: props == null ? void 0 : props.idPrefix,
|
|
41414
|
+
popOverMenuStyles: props.popOverMenuStyles
|
|
41415
|
+
});
|
|
41416
|
+
}
|
|
41417
|
+
});
|
|
41418
|
+
});
|
|
41419
|
+
|
|
40787
41420
|
var defaultProps$6 = {
|
|
40788
41421
|
type: 'bubbleChart',
|
|
40789
41422
|
xMeasure: null,
|
|
@@ -40871,7 +41504,7 @@ var BubbleChartView = function BubbleChartView(props) {
|
|
|
40871
41504
|
queriesAreChanging: props.queriesAreChanging,
|
|
40872
41505
|
children: [jsx(ViewHeader, _extends({}, headerProps)), jsx(ChartWrapper, {
|
|
40873
41506
|
disabledFeatures: (_props$library2 = props.library) != null ? _props$library2 : false,
|
|
40874
|
-
children: jsx(BubbleChart$
|
|
41507
|
+
children: jsx(BubbleChart$2, {
|
|
40875
41508
|
ref: ref,
|
|
40876
41509
|
approxXAxisLabelCount: props.approxXAxisLabelCount,
|
|
40877
41510
|
approxYAxisLabelCount: props.approxYAxisLabelCount,
|
|
@@ -40916,7 +41549,7 @@ var BubbleChartView = function BubbleChartView(props) {
|
|
|
40916
41549
|
BubbleChartView.defaultProps = defaultProps$6;
|
|
40917
41550
|
var memoized$4 = /*#__PURE__*/memo(BubbleChartView, shouldUpdate);
|
|
40918
41551
|
|
|
40919
|
-
var BubbleChart$
|
|
41552
|
+
var BubbleChart$3 = function BubbleChart(props) {
|
|
40920
41553
|
var _props$dashboardBehav;
|
|
40921
41554
|
var _props$component = props.component,
|
|
40922
41555
|
results = _props$component.results,
|
|
@@ -41668,6 +42301,22 @@ function howManyTicksFitInWidth(ticks, maxWidth, avgCharWidth) {
|
|
|
41668
42301
|
}
|
|
41669
42302
|
return fittedTicks.length;
|
|
41670
42303
|
}
|
|
42304
|
+
function howManyTicksFitInHeight(ticks, height) {
|
|
42305
|
+
if (height > 180) return undefined;
|
|
42306
|
+
var currentHeight = 0;
|
|
42307
|
+
var fittedTicks = 0;
|
|
42308
|
+
var ASSUMED_AVERAGE_CHAR_HEIGHT = 28;
|
|
42309
|
+
for (var i = 0; i < ticks.length; i++) {
|
|
42310
|
+
var wordHeight = ASSUMED_AVERAGE_CHAR_HEIGHT;
|
|
42311
|
+
if (currentHeight + wordHeight <= height) {
|
|
42312
|
+
fittedTicks++;
|
|
42313
|
+
currentHeight += wordHeight;
|
|
42314
|
+
} else {
|
|
42315
|
+
break;
|
|
42316
|
+
}
|
|
42317
|
+
}
|
|
42318
|
+
return fittedTicks;
|
|
42319
|
+
}
|
|
41671
42320
|
function pickEquallySpaced(arr, numPicks) {
|
|
41672
42321
|
if (numPicks >= arr.length) {
|
|
41673
42322
|
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
@@ -41680,17 +42329,22 @@ function pickEquallySpaced(arr, numPicks) {
|
|
|
41680
42329
|
}
|
|
41681
42330
|
return result;
|
|
41682
42331
|
}
|
|
41683
|
-
|
|
41684
|
-
|
|
42332
|
+
function adjustTicks(representation, width, height) {
|
|
42333
|
+
representation = cloneDeep(representation);
|
|
41685
42334
|
|
|
41686
42335
|
// TODO; take this from the theme override...
|
|
41687
42336
|
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH;
|
|
41688
|
-
var
|
|
42337
|
+
var numberOfXTicksFittingIntoSpace = howManyTicksFitInWidth(representation.x.ticks || [], width, averageCharacterWidth);
|
|
42338
|
+
var numberOfYTicksFittingIntoSpace = howManyTicksFitInHeight(representation.y.ticks || [], height);
|
|
41689
42339
|
|
|
41690
42340
|
// @ts-ignore
|
|
41691
|
-
|
|
41692
|
-
|
|
41693
|
-
|
|
42341
|
+
representation.x.ticks = pickEquallySpaced(representation.x.ticks, numberOfXTicksFittingIntoSpace);
|
|
42342
|
+
if (numberOfYTicksFittingIntoSpace) {
|
|
42343
|
+
// @ts-ignore
|
|
42344
|
+
representation.y.ticks = pickEquallySpaced(representation.y.ticks, numberOfYTicksFittingIntoSpace);
|
|
42345
|
+
}
|
|
42346
|
+
return representation;
|
|
42347
|
+
}
|
|
41694
42348
|
|
|
41695
42349
|
var buildMargin = function buildMargin(yTicks, showYAxisLabels, hasYAxisTitle, hasXAxisTitle) {
|
|
41696
42350
|
var maxWidth = max(yTicks.map(function (tick) {
|
|
@@ -42660,135 +43314,6 @@ function getStyleDefinition(_ref) {
|
|
|
42660
43314
|
});
|
|
42661
43315
|
}
|
|
42662
43316
|
|
|
42663
|
-
var getMinAndMax = function getMinAndMax(_ref) {
|
|
42664
|
-
var data = _ref.data,
|
|
42665
|
-
keys = _ref.keys,
|
|
42666
|
-
dataType = _ref.dataType,
|
|
42667
|
-
goalLines = _ref.goalLines;
|
|
42668
|
-
if (keys.length === 0) return {
|
|
42669
|
-
max: null,
|
|
42670
|
-
min: null
|
|
42671
|
-
};
|
|
42672
|
-
if (dataType === 'date_time') {
|
|
42673
|
-
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
42674
|
-
return keys.map(function (key) {
|
|
42675
|
-
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
42676
|
-
});
|
|
42677
|
-
}));
|
|
42678
|
-
return {
|
|
42679
|
-
max: Math.max.apply(Math, dataToAnalyse),
|
|
42680
|
-
min: Math.min.apply(Math, dataToAnalyse)
|
|
42681
|
-
};
|
|
42682
|
-
} else if (dataType === 'number') {
|
|
42683
|
-
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
42684
|
-
return keys.map(function (key) {
|
|
42685
|
-
return dataItem[key] ? dataItem[key].value : 0;
|
|
42686
|
-
});
|
|
42687
|
-
}), goalLines ? goalLines.map(function (gL) {
|
|
42688
|
-
return gL.value;
|
|
42689
|
-
}) : []);
|
|
42690
|
-
return {
|
|
42691
|
-
max: Math.max.apply(Math, _dataToAnalyse),
|
|
42692
|
-
min: Math.min.apply(Math, _dataToAnalyse)
|
|
42693
|
-
};
|
|
42694
|
-
} else {
|
|
42695
|
-
return {
|
|
42696
|
-
max: null,
|
|
42697
|
-
min: null
|
|
42698
|
-
};
|
|
42699
|
-
}
|
|
42700
|
-
};
|
|
42701
|
-
|
|
42702
|
-
function getNiceInterval(interval) {
|
|
42703
|
-
// Round the interval to a "nice" value (1, 2, 5, etc.)
|
|
42704
|
-
var exponent = Math.floor(Math.log10(interval));
|
|
42705
|
-
var fraction = interval / Math.pow(10, exponent);
|
|
42706
|
-
var niceFraction;
|
|
42707
|
-
if (fraction <= 1.5) niceFraction = 1;else if (fraction <= 3) niceFraction = 2;else if (fraction <= 7) niceFraction = 5;else niceFraction = 10;
|
|
42708
|
-
return niceFraction * Math.pow(10, exponent);
|
|
42709
|
-
}
|
|
42710
|
-
var getScaleAndTicks = function getScaleAndTicks(_ref) {
|
|
42711
|
-
var _order$;
|
|
42712
|
-
var data = _ref.data,
|
|
42713
|
-
xKey = _ref.xKey,
|
|
42714
|
-
yKeys = _ref.yKeys,
|
|
42715
|
-
xScaleDataType = _ref.xScaleDataType,
|
|
42716
|
-
nullValue = _ref.nullValue,
|
|
42717
|
-
tickCountYAxis = _ref.tickCountYAxis,
|
|
42718
|
-
formattingFunctionX = _ref.formattingFunctionX,
|
|
42719
|
-
formattingFunctionY = _ref.formattingFunctionY,
|
|
42720
|
-
order = _ref.order,
|
|
42721
|
-
goalLines = _ref.goalLines;
|
|
42722
|
-
var xTicks = [];
|
|
42723
|
-
var yTicks = [];
|
|
42724
|
-
var xScale = {
|
|
42725
|
-
dataType: xScaleDataType,
|
|
42726
|
-
key: xKey,
|
|
42727
|
-
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
42728
|
-
};
|
|
42729
|
-
var x = getMinAndMax({
|
|
42730
|
-
data: data,
|
|
42731
|
-
keys: xScale.key === null ? [] : [xScale.key],
|
|
42732
|
-
dataType: xScale.dataType
|
|
42733
|
-
});
|
|
42734
|
-
if (xKey) {
|
|
42735
|
-
xTicks = data.map(function (dataItem) {
|
|
42736
|
-
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
42737
|
-
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
42738
|
-
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
42739
|
-
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 : '';
|
|
42740
|
-
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
42741
|
-
return {
|
|
42742
|
-
value: xValue !== null ? xValue : '',
|
|
42743
|
-
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
42744
|
-
scaleValue: xScaleValueAdjusted
|
|
42745
|
-
};
|
|
42746
|
-
});
|
|
42747
|
-
}
|
|
42748
|
-
// ----- Y Axis ("number") -----
|
|
42749
|
-
|
|
42750
|
-
var y = getMinAndMax({
|
|
42751
|
-
data: data,
|
|
42752
|
-
keys: yKeys,
|
|
42753
|
-
dataType: 'number',
|
|
42754
|
-
goalLines: goalLines
|
|
42755
|
-
});
|
|
42756
|
-
var maxY = y.max || 0;
|
|
42757
|
-
var minY = Math.min(y.min || 0, 0);
|
|
42758
|
-
var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
|
|
42759
|
-
for (var i = 0; i < tickCountYAxis; i++) {
|
|
42760
|
-
var _value = yTickInterval * i;
|
|
42761
|
-
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
42762
|
-
yTicks.push({
|
|
42763
|
-
value: _value,
|
|
42764
|
-
formattedValue: formattedValue,
|
|
42765
|
-
scaleValue: _value
|
|
42766
|
-
});
|
|
42767
|
-
}
|
|
42768
|
-
return {
|
|
42769
|
-
x: {
|
|
42770
|
-
ticks: xTicks,
|
|
42771
|
-
scale: {
|
|
42772
|
-
dataType: xScale.dataType,
|
|
42773
|
-
max: x.max,
|
|
42774
|
-
min: x.min,
|
|
42775
|
-
key: xScale.key,
|
|
42776
|
-
ordering: xScale.ordering
|
|
42777
|
-
}
|
|
42778
|
-
},
|
|
42779
|
-
y: {
|
|
42780
|
-
ticks: yTicks,
|
|
42781
|
-
scale: {
|
|
42782
|
-
dataType: 'number',
|
|
42783
|
-
key: null,
|
|
42784
|
-
ordering: 'asc',
|
|
42785
|
-
max: maxY,
|
|
42786
|
-
min: minY
|
|
42787
|
-
}
|
|
42788
|
-
}
|
|
42789
|
-
};
|
|
42790
|
-
};
|
|
42791
|
-
|
|
42792
43317
|
/**
|
|
42793
43318
|
* When provided with a result, and formatting parameters, it returns a
|
|
42794
43319
|
* populated result including the formatted value to show.
|
|
@@ -43237,6 +43762,180 @@ function buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xA
|
|
|
43237
43762
|
};
|
|
43238
43763
|
}
|
|
43239
43764
|
|
|
43765
|
+
var getStackedMinAndMax = function getStackedMinAndMax(_ref) {
|
|
43766
|
+
var data = _ref.data,
|
|
43767
|
+
keys = _ref.keys,
|
|
43768
|
+
dataType = _ref.dataType,
|
|
43769
|
+
goalLines = _ref.goalLines,
|
|
43770
|
+
stacked = _ref.stacked;
|
|
43771
|
+
if (keys.length === 0) return {
|
|
43772
|
+
max: null,
|
|
43773
|
+
min: null
|
|
43774
|
+
};
|
|
43775
|
+
if (stacked) {
|
|
43776
|
+
var totals = data.map(function (dataItem) {
|
|
43777
|
+
return keys.reduce(function (sum, key) {
|
|
43778
|
+
var value = dataItem[key] ? dataItem[key].value : 0;
|
|
43779
|
+
return sum + (typeof value === 'number' ? value : 0);
|
|
43780
|
+
}, 0);
|
|
43781
|
+
});
|
|
43782
|
+
var maxTotal = Math.max.apply(Math, totals);
|
|
43783
|
+
var minTotal = Math.min.apply(Math, totals);
|
|
43784
|
+
return {
|
|
43785
|
+
max: maxTotal,
|
|
43786
|
+
min: minTotal
|
|
43787
|
+
};
|
|
43788
|
+
}
|
|
43789
|
+
if (dataType === 'date_time') {
|
|
43790
|
+
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
43791
|
+
return keys.map(function (key) {
|
|
43792
|
+
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
43793
|
+
});
|
|
43794
|
+
}));
|
|
43795
|
+
return {
|
|
43796
|
+
max: Math.max.apply(Math, dataToAnalyse),
|
|
43797
|
+
min: Math.min.apply(Math, dataToAnalyse)
|
|
43798
|
+
};
|
|
43799
|
+
} else if (dataType === 'number') {
|
|
43800
|
+
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
43801
|
+
return keys.map(function (key) {
|
|
43802
|
+
return dataItem[key] ? dataItem[key].value : 0;
|
|
43803
|
+
});
|
|
43804
|
+
}), goalLines ? goalLines.map(function (gL) {
|
|
43805
|
+
return gL.value;
|
|
43806
|
+
}) : []);
|
|
43807
|
+
return {
|
|
43808
|
+
max: Math.max.apply(Math, _dataToAnalyse),
|
|
43809
|
+
min: Math.min.apply(Math, _dataToAnalyse)
|
|
43810
|
+
};
|
|
43811
|
+
} else {
|
|
43812
|
+
return {
|
|
43813
|
+
max: null,
|
|
43814
|
+
min: null
|
|
43815
|
+
};
|
|
43816
|
+
}
|
|
43817
|
+
};
|
|
43818
|
+
|
|
43819
|
+
function getNiceInterval(interval) {
|
|
43820
|
+
var exponent = Math.floor(Math.log10(interval));
|
|
43821
|
+
var fraction = interval / Math.pow(10, exponent);
|
|
43822
|
+
var niceFraction;
|
|
43823
|
+
if (fraction <= 1) {
|
|
43824
|
+
niceFraction = 1;
|
|
43825
|
+
} else if (fraction <= 1.25) {
|
|
43826
|
+
niceFraction = 1.25;
|
|
43827
|
+
} else if (fraction <= 1.5) {
|
|
43828
|
+
niceFraction = 1.5;
|
|
43829
|
+
} else if (fraction <= 2) {
|
|
43830
|
+
niceFraction = 2;
|
|
43831
|
+
} else if (fraction <= 2.5) {
|
|
43832
|
+
niceFraction = 2.5;
|
|
43833
|
+
} else if (fraction <= 3) {
|
|
43834
|
+
niceFraction = 3;
|
|
43835
|
+
} else if (fraction <= 5) {
|
|
43836
|
+
niceFraction = 5;
|
|
43837
|
+
} else if (fraction <= 7) {
|
|
43838
|
+
niceFraction = 7;
|
|
43839
|
+
} else if (fraction <= 10) {
|
|
43840
|
+
niceFraction = 10;
|
|
43841
|
+
} else {
|
|
43842
|
+
niceFraction = 10;
|
|
43843
|
+
}
|
|
43844
|
+
return niceFraction * Math.pow(10, exponent);
|
|
43845
|
+
}
|
|
43846
|
+
var getScaleAndTicks = function getScaleAndTicks(_ref) {
|
|
43847
|
+
var _order$;
|
|
43848
|
+
var data = _ref.data,
|
|
43849
|
+
xKey = _ref.xKey,
|
|
43850
|
+
yKeys = _ref.yKeys,
|
|
43851
|
+
xScaleDataType = _ref.xScaleDataType,
|
|
43852
|
+
nullValue = _ref.nullValue,
|
|
43853
|
+
tickCountYAxis = _ref.tickCountYAxis,
|
|
43854
|
+
formattingFunctionX = _ref.formattingFunctionX,
|
|
43855
|
+
formattingFunctionY = _ref.formattingFunctionY,
|
|
43856
|
+
order = _ref.order,
|
|
43857
|
+
goalLines = _ref.goalLines,
|
|
43858
|
+
stacked = _ref.stacked;
|
|
43859
|
+
var xTicks = [];
|
|
43860
|
+
var xScale = {
|
|
43861
|
+
dataType: xScaleDataType,
|
|
43862
|
+
key: xKey,
|
|
43863
|
+
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
43864
|
+
};
|
|
43865
|
+
var x = getStackedMinAndMax({
|
|
43866
|
+
data: data,
|
|
43867
|
+
keys: xScale.key === null ? [] : [xScale.key],
|
|
43868
|
+
dataType: xScale.dataType
|
|
43869
|
+
});
|
|
43870
|
+
if (xKey) {
|
|
43871
|
+
xTicks = data.map(function (dataItem) {
|
|
43872
|
+
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
43873
|
+
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
43874
|
+
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
43875
|
+
var xScaleValue = xScale.key !== null && (_dataItem$xScale$key = dataItem[xScale.key]) != null && _dataItem$xScale$key.value ? (_dataItem$xScale$key2 = dataItem[xScale.key]) == null ? void 0 : _dataItem$xScale$key2.value : '';
|
|
43876
|
+
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
43877
|
+
return {
|
|
43878
|
+
value: xValue !== null ? xValue : '',
|
|
43879
|
+
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
43880
|
+
scaleValue: xScaleValueAdjusted
|
|
43881
|
+
};
|
|
43882
|
+
});
|
|
43883
|
+
}
|
|
43884
|
+
// ----- Y Axis ("number") -----
|
|
43885
|
+
|
|
43886
|
+
var y = getStackedMinAndMax({
|
|
43887
|
+
data: data,
|
|
43888
|
+
keys: yKeys,
|
|
43889
|
+
dataType: 'number',
|
|
43890
|
+
goalLines: goalLines,
|
|
43891
|
+
stacked: stacked
|
|
43892
|
+
});
|
|
43893
|
+
var maxY = y.max || 0;
|
|
43894
|
+
var minY = Math.min(y.min || 0, 0);
|
|
43895
|
+
var yTickInterval = getNiceInterval((maxY - minY) / (tickCountYAxis - 1));
|
|
43896
|
+
var yTicks = [];
|
|
43897
|
+
for (var i = 0; i < tickCountYAxis; i++) {
|
|
43898
|
+
var _value = minY + yTickInterval * i;
|
|
43899
|
+
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
43900
|
+
yTicks.push({
|
|
43901
|
+
value: _value,
|
|
43902
|
+
formattedValue: formattedValue,
|
|
43903
|
+
scaleValue: _value
|
|
43904
|
+
});
|
|
43905
|
+
}
|
|
43906
|
+
return {
|
|
43907
|
+
x: {
|
|
43908
|
+
ticks: xTicks,
|
|
43909
|
+
scale: {
|
|
43910
|
+
dataType: xScale.dataType,
|
|
43911
|
+
max: x.max,
|
|
43912
|
+
min: x.min,
|
|
43913
|
+
key: xScale.key,
|
|
43914
|
+
ordering: xScale.ordering
|
|
43915
|
+
}
|
|
43916
|
+
},
|
|
43917
|
+
y: {
|
|
43918
|
+
ticks: yTicks,
|
|
43919
|
+
scale: {
|
|
43920
|
+
dataType: 'number',
|
|
43921
|
+
key: null,
|
|
43922
|
+
ordering: 'asc',
|
|
43923
|
+
max: maxY,
|
|
43924
|
+
min: minY
|
|
43925
|
+
}
|
|
43926
|
+
}
|
|
43927
|
+
};
|
|
43928
|
+
};
|
|
43929
|
+
|
|
43930
|
+
var formattingFunctionX = function formattingFunctionX(value, formattedResult, xKeyField) {
|
|
43931
|
+
if (!xKeyField) return '';
|
|
43932
|
+
return formattedResult.formatterFunc(value, {
|
|
43933
|
+
fieldId: xKeyField.fieldId,
|
|
43934
|
+
"function": xKeyField["function"],
|
|
43935
|
+
outputDataType: xKeyField.outputDataType
|
|
43936
|
+
}).formattedValue;
|
|
43937
|
+
};
|
|
43938
|
+
|
|
43240
43939
|
var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
43241
43940
|
var _xKeys$, _axisTitles$x, _axisTitles$y;
|
|
43242
43941
|
var axisTitles = _ref.axisTitles,
|
|
@@ -43309,15 +44008,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43309
44008
|
|
|
43310
44009
|
// ----- Formatting -----
|
|
43311
44010
|
|
|
43312
|
-
var formattingFunctionX = function formattingFunctionX(value) {
|
|
43313
|
-
if (!xKeyField) return '';
|
|
43314
|
-
return formattedResult.formatterFunc(value, {
|
|
43315
|
-
fieldId: xKeyField.fieldId,
|
|
43316
|
-
"function": xKeyField["function"],
|
|
43317
|
-
outputDataType: xKeyField.outputDataType
|
|
43318
|
-
}).formattedValue;
|
|
43319
|
-
};
|
|
43320
|
-
|
|
43321
44011
|
// (value: any, noValueReplacement?: string) => string;
|
|
43322
44012
|
var formattingFunctionY = function formattingFunctionY(value) {
|
|
43323
44013
|
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
@@ -43346,7 +44036,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43346
44036
|
var orderFunction = order.length > 0 ? order[0]["function"] : undefined;
|
|
43347
44037
|
var trendsAndForecastData = getTrendsAndForecastsData({
|
|
43348
44038
|
chartData: chartData,
|
|
43349
|
-
formattingFunctionX: formattingFunctionX
|
|
44039
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
44040
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
44041
|
+
},
|
|
43350
44042
|
formattingFunctionY: formattingFunctionY,
|
|
43351
44043
|
keys: keys,
|
|
43352
44044
|
nullValue: nullValue,
|
|
@@ -43376,7 +44068,9 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43376
44068
|
xScaleDataType: xScaleDataType,
|
|
43377
44069
|
yKeys: yKeys,
|
|
43378
44070
|
tickCountYAxis: approxYAxisLabelCount,
|
|
43379
|
-
formattingFunctionX: formattingFunctionX
|
|
44071
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
44072
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
44073
|
+
},
|
|
43380
44074
|
formattingFunctionY: formattingFunctionY,
|
|
43381
44075
|
nullValue: nullValue,
|
|
43382
44076
|
order: order,
|
|
@@ -43438,62 +44132,6 @@ var buildLineChartRepresentation = function buildLineChartRepresentation(_ref) {
|
|
|
43438
44132
|
return chart;
|
|
43439
44133
|
};
|
|
43440
44134
|
|
|
43441
|
-
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
43442
|
-
function calculateWordWidth$1(word, avgCharWidth) {
|
|
43443
|
-
if (avgCharWidth === void 0) {
|
|
43444
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43445
|
-
}
|
|
43446
|
-
return word.length * avgCharWidth;
|
|
43447
|
-
}
|
|
43448
|
-
|
|
43449
|
-
/** Reduce width proportionally to simulate spacing / padding between ticks. */
|
|
43450
|
-
var widthWithSpacing$1 = function widthWithSpacing(width) {
|
|
43451
|
-
var THIRTY_PERCENT = 0.3;
|
|
43452
|
-
return width - width * THIRTY_PERCENT;
|
|
43453
|
-
};
|
|
43454
|
-
function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
|
|
43455
|
-
if (avgCharWidth === void 0) {
|
|
43456
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43457
|
-
}
|
|
43458
|
-
var fittedTicks = [];
|
|
43459
|
-
var currentWidth = 0;
|
|
43460
|
-
for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
|
|
43461
|
-
var tick = _step.value;
|
|
43462
|
-
var word = (tick == null ? void 0 : tick.formattedValue) || '';
|
|
43463
|
-
var wordWidth = calculateWordWidth$1(word, avgCharWidth);
|
|
43464
|
-
if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
|
|
43465
|
-
fittedTicks.push(tick);
|
|
43466
|
-
currentWidth += wordWidth + avgCharWidth; // Add space between words
|
|
43467
|
-
} else {
|
|
43468
|
-
break; // Stop if adding the word exceeds maxWidth
|
|
43469
|
-
}
|
|
43470
|
-
}
|
|
43471
|
-
return fittedTicks.length;
|
|
43472
|
-
}
|
|
43473
|
-
function pickEquallySpaced$1(arr, numPicks) {
|
|
43474
|
-
if (numPicks >= arr.length) {
|
|
43475
|
-
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
43476
|
-
}
|
|
43477
|
-
var result = [];
|
|
43478
|
-
var interval = (arr.length - 1) / (numPicks - 1);
|
|
43479
|
-
for (var i = 0; i < numPicks; i++) {
|
|
43480
|
-
var index = Math.round(i * interval); // Calculate index and round it
|
|
43481
|
-
result.push(arr[index]);
|
|
43482
|
-
}
|
|
43483
|
-
return result;
|
|
43484
|
-
}
|
|
43485
|
-
var adjustTicks$1 = function adjustTicks(lineChartRepresentation, width) {
|
|
43486
|
-
lineChartRepresentation = cloneDeep(lineChartRepresentation);
|
|
43487
|
-
|
|
43488
|
-
// TODO; take this from the theme override...
|
|
43489
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
43490
|
-
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(lineChartRepresentation.x.ticks || [], width, averageCharacterWidth);
|
|
43491
|
-
|
|
43492
|
-
// @ts-ignore
|
|
43493
|
-
lineChartRepresentation.x.ticks = pickEquallySpaced$1(lineChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
|
|
43494
|
-
return lineChartRepresentation;
|
|
43495
|
-
};
|
|
43496
|
-
|
|
43497
44135
|
var LineChartV2View = function LineChartV2View(props) {
|
|
43498
44136
|
var _props$library, _props$attributes$vie;
|
|
43499
44137
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -43602,7 +44240,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
43602
44240
|
return jsx(LineChart$5, {
|
|
43603
44241
|
width: parent.width,
|
|
43604
44242
|
height: parent.height,
|
|
43605
|
-
chart: adjustTicks
|
|
44243
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
43606
44244
|
options: {
|
|
43607
44245
|
lineCurve: props.attributes.lineCurve,
|
|
43608
44246
|
removeStroke: false,
|
|
@@ -43610,8 +44248,7 @@ var LineChartV2View = function LineChartV2View(props) {
|
|
|
43610
44248
|
showLegend: props.attributes.legend,
|
|
43611
44249
|
axis: {
|
|
43612
44250
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
43613
|
-
|
|
43614
|
-
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
|
|
44251
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
43615
44252
|
}
|
|
43616
44253
|
},
|
|
43617
44254
|
theme: theme == null ? void 0 : theme.charts
|
|
@@ -46933,171 +47570,6 @@ var Progress$2 = function Progress(props) {
|
|
|
46933
47570
|
}));
|
|
46934
47571
|
};
|
|
46935
47572
|
|
|
46936
|
-
var getMinAndMax$1 = function getMinAndMax(_ref) {
|
|
46937
|
-
var data = _ref.data,
|
|
46938
|
-
keys = _ref.keys,
|
|
46939
|
-
dataType = _ref.dataType,
|
|
46940
|
-
goalLines = _ref.goalLines,
|
|
46941
|
-
stacked = _ref.stacked;
|
|
46942
|
-
if (keys.length === 0) return {
|
|
46943
|
-
max: null,
|
|
46944
|
-
min: null
|
|
46945
|
-
};
|
|
46946
|
-
if (stacked) {
|
|
46947
|
-
var totals = data.map(function (dataItem) {
|
|
46948
|
-
return keys.reduce(function (sum, key) {
|
|
46949
|
-
var value = dataItem[key] ? dataItem[key].value : 0;
|
|
46950
|
-
return sum + (typeof value === 'number' ? value : 0);
|
|
46951
|
-
}, 0);
|
|
46952
|
-
});
|
|
46953
|
-
var maxTotal = Math.max.apply(Math, totals);
|
|
46954
|
-
var minTotal = Math.min.apply(Math, totals);
|
|
46955
|
-
return {
|
|
46956
|
-
max: maxTotal,
|
|
46957
|
-
min: minTotal
|
|
46958
|
-
};
|
|
46959
|
-
}
|
|
46960
|
-
if (dataType === 'date_time') {
|
|
46961
|
-
var dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
46962
|
-
return keys.map(function (key) {
|
|
46963
|
-
return dataItem[key] ? new Date(dataItem[key].value).valueOf() : 0;
|
|
46964
|
-
});
|
|
46965
|
-
}));
|
|
46966
|
-
return {
|
|
46967
|
-
max: Math.max.apply(Math, dataToAnalyse),
|
|
46968
|
-
min: Math.min.apply(Math, dataToAnalyse)
|
|
46969
|
-
};
|
|
46970
|
-
} else if (dataType === 'number') {
|
|
46971
|
-
var _dataToAnalyse = [].concat(data.flatMap(function (dataItem) {
|
|
46972
|
-
return keys.map(function (key) {
|
|
46973
|
-
return dataItem[key] ? dataItem[key].value : 0;
|
|
46974
|
-
});
|
|
46975
|
-
}), goalLines ? goalLines.map(function (gL) {
|
|
46976
|
-
return gL.value;
|
|
46977
|
-
}) : []);
|
|
46978
|
-
return {
|
|
46979
|
-
max: Math.max.apply(Math, _dataToAnalyse),
|
|
46980
|
-
min: Math.min.apply(Math, _dataToAnalyse)
|
|
46981
|
-
};
|
|
46982
|
-
} else {
|
|
46983
|
-
return {
|
|
46984
|
-
max: null,
|
|
46985
|
-
min: null
|
|
46986
|
-
};
|
|
46987
|
-
}
|
|
46988
|
-
};
|
|
46989
|
-
|
|
46990
|
-
function getNiceInterval$1(interval) {
|
|
46991
|
-
var exponent = Math.floor(Math.log10(interval));
|
|
46992
|
-
var fraction = interval / Math.pow(10, exponent);
|
|
46993
|
-
var niceFraction;
|
|
46994
|
-
if (fraction <= 1) {
|
|
46995
|
-
niceFraction = 1;
|
|
46996
|
-
} else if (fraction <= 1.25) {
|
|
46997
|
-
niceFraction = 1.25;
|
|
46998
|
-
} else if (fraction <= 1.5) {
|
|
46999
|
-
niceFraction = 1.5;
|
|
47000
|
-
} else if (fraction <= 2) {
|
|
47001
|
-
niceFraction = 2;
|
|
47002
|
-
} else if (fraction <= 2.5) {
|
|
47003
|
-
niceFraction = 2.5;
|
|
47004
|
-
} else if (fraction <= 3) {
|
|
47005
|
-
niceFraction = 3;
|
|
47006
|
-
} else if (fraction <= 5) {
|
|
47007
|
-
niceFraction = 5;
|
|
47008
|
-
} else if (fraction <= 7) {
|
|
47009
|
-
niceFraction = 7;
|
|
47010
|
-
} else if (fraction <= 10) {
|
|
47011
|
-
niceFraction = 10;
|
|
47012
|
-
} else {
|
|
47013
|
-
niceFraction = 10;
|
|
47014
|
-
}
|
|
47015
|
-
return niceFraction * Math.pow(10, exponent);
|
|
47016
|
-
}
|
|
47017
|
-
var getScaleAndTicks$1 = function getScaleAndTicks(_ref) {
|
|
47018
|
-
var _order$;
|
|
47019
|
-
var data = _ref.data,
|
|
47020
|
-
xKey = _ref.xKey,
|
|
47021
|
-
yKeys = _ref.yKeys,
|
|
47022
|
-
xScaleDataType = _ref.xScaleDataType,
|
|
47023
|
-
nullValue = _ref.nullValue,
|
|
47024
|
-
tickCountYAxis = _ref.tickCountYAxis,
|
|
47025
|
-
formattingFunctionX = _ref.formattingFunctionX,
|
|
47026
|
-
formattingFunctionY = _ref.formattingFunctionY,
|
|
47027
|
-
order = _ref.order,
|
|
47028
|
-
goalLines = _ref.goalLines,
|
|
47029
|
-
stacked = _ref.stacked;
|
|
47030
|
-
var xTicks = [];
|
|
47031
|
-
var xScale = {
|
|
47032
|
-
dataType: xScaleDataType,
|
|
47033
|
-
key: xKey,
|
|
47034
|
-
ordering: ((_order$ = order[0]) == null ? void 0 : _order$.direction) || null
|
|
47035
|
-
};
|
|
47036
|
-
var x = getMinAndMax$1({
|
|
47037
|
-
data: data,
|
|
47038
|
-
keys: xScale.key === null ? [] : [xScale.key],
|
|
47039
|
-
dataType: xScale.dataType
|
|
47040
|
-
});
|
|
47041
|
-
if (xKey) {
|
|
47042
|
-
xTicks = data.map(function (dataItem) {
|
|
47043
|
-
var _dataItem$xKey, _dataItem$xScale$key, _dataItem$xScale$key2;
|
|
47044
|
-
var xValue = (_dataItem$xKey = dataItem[xKey]) != null && _dataItem$xKey.value ? dataItem[xKey].value : null;
|
|
47045
|
-
var xformattedValue = formattingFunctionX(xValue, nullValue);
|
|
47046
|
-
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 : '';
|
|
47047
|
-
var xScaleValueAdjusted = xScale.dataType === 'date_time' ? new Date(xScaleValue) : xScale.dataType === 'string' ? String(xScaleValue) : xScale.dataType === 'number' ? Number(xScaleValue) : xScaleValue;
|
|
47048
|
-
return {
|
|
47049
|
-
value: xValue !== null ? xValue : '',
|
|
47050
|
-
formattedValue: xformattedValue !== null ? "" + xformattedValue : null,
|
|
47051
|
-
scaleValue: xScaleValueAdjusted
|
|
47052
|
-
};
|
|
47053
|
-
});
|
|
47054
|
-
}
|
|
47055
|
-
// ----- Y Axis ("number") -----
|
|
47056
|
-
|
|
47057
|
-
var y = getMinAndMax$1({
|
|
47058
|
-
data: data,
|
|
47059
|
-
keys: yKeys,
|
|
47060
|
-
dataType: 'number',
|
|
47061
|
-
goalLines: goalLines,
|
|
47062
|
-
stacked: stacked
|
|
47063
|
-
});
|
|
47064
|
-
var maxY = y.max || 0;
|
|
47065
|
-
var minY = Math.min(y.min || 0, 0);
|
|
47066
|
-
var yTickInterval = getNiceInterval$1((maxY - minY) / (tickCountYAxis - 1));
|
|
47067
|
-
var yTicks = [];
|
|
47068
|
-
for (var i = 0; i < tickCountYAxis; i++) {
|
|
47069
|
-
var _value = minY + yTickInterval * i;
|
|
47070
|
-
var formattedValue = formattingFunctionY(_value, nullValue);
|
|
47071
|
-
yTicks.push({
|
|
47072
|
-
value: _value,
|
|
47073
|
-
formattedValue: formattedValue,
|
|
47074
|
-
scaleValue: _value
|
|
47075
|
-
});
|
|
47076
|
-
}
|
|
47077
|
-
return {
|
|
47078
|
-
x: {
|
|
47079
|
-
ticks: xTicks,
|
|
47080
|
-
scale: {
|
|
47081
|
-
dataType: xScale.dataType,
|
|
47082
|
-
max: x.max,
|
|
47083
|
-
min: x.min,
|
|
47084
|
-
key: xScale.key,
|
|
47085
|
-
ordering: xScale.ordering
|
|
47086
|
-
}
|
|
47087
|
-
},
|
|
47088
|
-
y: {
|
|
47089
|
-
ticks: yTicks,
|
|
47090
|
-
scale: {
|
|
47091
|
-
dataType: 'number',
|
|
47092
|
-
key: null,
|
|
47093
|
-
ordering: 'asc',
|
|
47094
|
-
max: maxY,
|
|
47095
|
-
min: minY
|
|
47096
|
-
}
|
|
47097
|
-
}
|
|
47098
|
-
};
|
|
47099
|
-
};
|
|
47100
|
-
|
|
47101
47573
|
function fillMissingKeysForChartData(data) {
|
|
47102
47574
|
var allKeys = new Set();
|
|
47103
47575
|
data.forEach(function (item) {
|
|
@@ -47191,15 +47663,6 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
|
|
|
47191
47663
|
|
|
47192
47664
|
// ----- Formatting -----
|
|
47193
47665
|
|
|
47194
|
-
var formattingFunctionX = function formattingFunctionX(value) {
|
|
47195
|
-
if (!xKeyField) return '';
|
|
47196
|
-
return formattedResult.formatterFunc(value, {
|
|
47197
|
-
fieldId: xKeyField.fieldId,
|
|
47198
|
-
"function": xKeyField["function"],
|
|
47199
|
-
outputDataType: xKeyField.outputDataType
|
|
47200
|
-
}).formattedValue;
|
|
47201
|
-
};
|
|
47202
|
-
|
|
47203
47666
|
// (value: any, noValueReplacement?: string) => string;
|
|
47204
47667
|
var formattingFunctionY = function formattingFunctionY(value) {
|
|
47205
47668
|
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
@@ -47243,13 +47706,15 @@ var buildBarChartRepresentation = function buildBarChartRepresentation(_ref) {
|
|
|
47243
47706
|
|
|
47244
47707
|
// ----- Ticks -----
|
|
47245
47708
|
|
|
47246
|
-
var ticks = getScaleAndTicks
|
|
47709
|
+
var ticks = getScaleAndTicks({
|
|
47247
47710
|
data: updatedData,
|
|
47248
47711
|
xKey: xKey,
|
|
47249
47712
|
xScaleDataType: xScaleDataType,
|
|
47250
47713
|
yKeys: yKeys,
|
|
47251
47714
|
tickCountYAxis: approxYAxisLabelCount,
|
|
47252
|
-
formattingFunctionX: formattingFunctionX
|
|
47715
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
47716
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
47717
|
+
},
|
|
47253
47718
|
formattingFunctionY: formattingFunctionY,
|
|
47254
47719
|
nullValue: nullValue,
|
|
47255
47720
|
order: order,
|
|
@@ -47461,7 +47926,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
47461
47926
|
return jsx(BarChart$5, {
|
|
47462
47927
|
width: parent.width,
|
|
47463
47928
|
height: parent.height,
|
|
47464
|
-
chart: adjustTicks(chartRepresentation, parent.width),
|
|
47929
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
47465
47930
|
options: {
|
|
47466
47931
|
stacked: !!props.attributes.stacked,
|
|
47467
47932
|
removeStroke: false,
|
|
@@ -47469,8 +47934,7 @@ var BarChartV2View = function BarChartV2View(props) {
|
|
|
47469
47934
|
showLegend: props.attributes.legend,
|
|
47470
47935
|
axis: {
|
|
47471
47936
|
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
47472
|
-
|
|
47473
|
-
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0 // shared-ui/src/library/StylePanel/AxisPreferenceSection.tsx
|
|
47937
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
47474
47938
|
}
|
|
47475
47939
|
},
|
|
47476
47940
|
theme: theme == null ? void 0 : theme.charts,
|
|
@@ -47559,30 +48023,30 @@ function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
|
|
|
47559
48023
|
return fill;
|
|
47560
48024
|
}
|
|
47561
48025
|
|
|
47562
|
-
var ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47563
|
-
function calculateWordWidth$
|
|
48026
|
+
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
48027
|
+
function calculateWordWidth$1(word, avgCharWidth) {
|
|
47564
48028
|
if (avgCharWidth === void 0) {
|
|
47565
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
48029
|
+
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
47566
48030
|
}
|
|
47567
48031
|
return word.length * avgCharWidth;
|
|
47568
48032
|
}
|
|
47569
48033
|
|
|
47570
48034
|
/** Reduce width proportionally to simulate spacing / padding between ticks. */
|
|
47571
|
-
var widthWithSpacing$
|
|
48035
|
+
var widthWithSpacing$1 = function widthWithSpacing(width) {
|
|
47572
48036
|
var THIRTY_PERCENT = 0.3;
|
|
47573
48037
|
return width - width * THIRTY_PERCENT;
|
|
47574
48038
|
};
|
|
47575
|
-
function howManyTicksFitInWidth$
|
|
48039
|
+
function howManyTicksFitInWidth$1(ticks, maxWidth, avgCharWidth) {
|
|
47576
48040
|
if (avgCharWidth === void 0) {
|
|
47577
|
-
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
48041
|
+
avgCharWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
47578
48042
|
}
|
|
47579
48043
|
var fittedTicks = [];
|
|
47580
48044
|
var currentWidth = 0;
|
|
47581
48045
|
for (var _iterator = _createForOfIteratorHelperLoose(ticks), _step; !(_step = _iterator()).done;) {
|
|
47582
48046
|
var tick = _step.value;
|
|
47583
48047
|
var word = (tick == null ? void 0 : tick.formattedValue) || '';
|
|
47584
|
-
var wordWidth = calculateWordWidth$
|
|
47585
|
-
if (currentWidth + wordWidth <= widthWithSpacing$
|
|
48048
|
+
var wordWidth = calculateWordWidth$1(word, avgCharWidth);
|
|
48049
|
+
if (currentWidth + wordWidth <= widthWithSpacing$1(maxWidth)) {
|
|
47586
48050
|
fittedTicks.push(tick);
|
|
47587
48051
|
currentWidth += wordWidth + avgCharWidth; // Add space between words
|
|
47588
48052
|
} else {
|
|
@@ -47591,7 +48055,7 @@ function howManyTicksFitInWidth$2(ticks, maxWidth, avgCharWidth) {
|
|
|
47591
48055
|
}
|
|
47592
48056
|
return fittedTicks.length;
|
|
47593
48057
|
}
|
|
47594
|
-
function pickEquallySpaced$
|
|
48058
|
+
function pickEquallySpaced$1(arr, numPicks) {
|
|
47595
48059
|
if (numPicks >= arr.length) {
|
|
47596
48060
|
return arr; // If numPicks is greater than or equal to the array length, return the whole array
|
|
47597
48061
|
}
|
|
@@ -47603,19 +48067,19 @@ function pickEquallySpaced$2(arr, numPicks) {
|
|
|
47603
48067
|
}
|
|
47604
48068
|
return result;
|
|
47605
48069
|
}
|
|
47606
|
-
var adjustTicks$
|
|
48070
|
+
var adjustTicks$1 = function adjustTicks(waterfallChartRepresentation, width) {
|
|
47607
48071
|
waterfallChartRepresentation = cloneDeep(waterfallChartRepresentation);
|
|
47608
48072
|
|
|
47609
48073
|
// TODO; take this from the theme override...
|
|
47610
|
-
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$
|
|
47611
|
-
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$
|
|
48074
|
+
var averageCharacterWidth = ASSUMED_AVERAGE_CHAR_WIDTH$1;
|
|
48075
|
+
var numberOfTicksFittingIntoSpace = howManyTicksFitInWidth$1(waterfallChartRepresentation.x.ticks || [], width, averageCharacterWidth);
|
|
47612
48076
|
var MINIMUM_NUMBER_OF_TICKS = 2;
|
|
47613
48077
|
if (numberOfTicksFittingIntoSpace < MINIMUM_NUMBER_OF_TICKS) {
|
|
47614
48078
|
numberOfTicksFittingIntoSpace = MINIMUM_NUMBER_OF_TICKS;
|
|
47615
48079
|
}
|
|
47616
48080
|
|
|
47617
48081
|
// @ts-ignore
|
|
47618
|
-
waterfallChartRepresentation.x.ticks = pickEquallySpaced$
|
|
48082
|
+
waterfallChartRepresentation.x.ticks = pickEquallySpaced$1(waterfallChartRepresentation.x.ticks, numberOfTicksFittingIntoSpace);
|
|
47619
48083
|
return waterfallChartRepresentation;
|
|
47620
48084
|
};
|
|
47621
48085
|
|
|
@@ -47863,7 +48327,7 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
47863
48327
|
keys: [y.key]
|
|
47864
48328
|
});
|
|
47865
48329
|
var adjustedChartRepresentation = useMemo(function () {
|
|
47866
|
-
return adjustTicks$
|
|
48330
|
+
return adjustTicks$1(_extends({}, chartCopy), width);
|
|
47867
48331
|
}, [chartCopy, width]);
|
|
47868
48332
|
var formattedChartDataForBarChart = _extends({}, adjustedChartRepresentation, {
|
|
47869
48333
|
y: formattedYAxisForBarChart,
|
|
@@ -48137,7 +48601,7 @@ var Bar$1 = function Bar(_ref4) {
|
|
|
48137
48601
|
});
|
|
48138
48602
|
};
|
|
48139
48603
|
|
|
48140
|
-
function getNiceInterval$
|
|
48604
|
+
function getNiceInterval$1(interval) {
|
|
48141
48605
|
// Round the interval to a "nice" value (1, 2, 5, etc.)
|
|
48142
48606
|
var exponent = Math.floor(Math.log10(interval));
|
|
48143
48607
|
var fraction = interval / Math.pow(10, exponent);
|
|
@@ -48269,7 +48733,7 @@ var buildWaterfallChartRepresentation = function buildWaterfallChartRepresentati
|
|
|
48269
48733
|
outputDataType: nonPivotField.outputDataType
|
|
48270
48734
|
}).formattedValue;
|
|
48271
48735
|
};
|
|
48272
|
-
var yTickInterval = getNiceInterval$
|
|
48736
|
+
var yTickInterval = getNiceInterval$1((yMaxValue - yMinValue) / (approxYAxisLabelCount - 1));
|
|
48273
48737
|
for (var i = 0; i < approxYAxisLabelCount; i++) {
|
|
48274
48738
|
var value = (yMinValue + i) * yTickInterval;
|
|
48275
48739
|
var formattedValue = formattingFunctionY(value);
|
|
@@ -48494,6 +48958,352 @@ var WaterfallChart$3 = function WaterfallChart(_ref) {
|
|
|
48494
48958
|
}));
|
|
48495
48959
|
};
|
|
48496
48960
|
|
|
48961
|
+
var buildAreaChartRepresentation = function buildAreaChartRepresentation(_ref) {
|
|
48962
|
+
var _xKeys$, _axisTitles$x, _axisTitles$y;
|
|
48963
|
+
var axisTitles = _ref.axisTitles,
|
|
48964
|
+
colors = _ref.colors,
|
|
48965
|
+
conditionalFormattingAttributes = _ref.conditionalFormattingAttributes,
|
|
48966
|
+
dateTimeFormatOptions = _ref.dateTimeFormatOptions,
|
|
48967
|
+
defaultFormats = _ref.defaultFormats,
|
|
48968
|
+
goalLineAttributes = _ref.goalLineAttributes,
|
|
48969
|
+
nullValue = _ref.nullValue,
|
|
48970
|
+
numberFormatOptions = _ref.numberFormatOptions,
|
|
48971
|
+
order = _ref.order,
|
|
48972
|
+
pivotConfig = _ref.pivotConfig,
|
|
48973
|
+
result = _ref.result,
|
|
48974
|
+
xAxisFormat = _ref.xAxisFormat,
|
|
48975
|
+
xAxisPostfix = _ref.xAxisPostfix,
|
|
48976
|
+
xAxisPrefix = _ref.xAxisPrefix,
|
|
48977
|
+
yAxisFormat = _ref.yAxisFormat,
|
|
48978
|
+
yAxisPostfix = _ref.yAxisPostfix,
|
|
48979
|
+
yAxisPrefix = _ref.yAxisPrefix,
|
|
48980
|
+
approxYAxisLabelCount = _ref.approxYAxisLabelCount,
|
|
48981
|
+
seriesLabelFormatter = _ref.seriesLabelFormatter,
|
|
48982
|
+
_valueAlias = _ref.valueAlias,
|
|
48983
|
+
stacked = _ref.stacked;
|
|
48984
|
+
var activeDateTimeFormats = {};
|
|
48985
|
+
var _buildFieldFormatMaps = buildFieldFormatMaps(result, pivotConfig, xAxisPrefix, xAxisPostfix, xAxisFormat, yAxisPrefix, yAxisPostfix, yAxisFormat, nullValue, numberFormatOptions),
|
|
48986
|
+
allPrefixes = _buildFieldFormatMaps.allPrefixes,
|
|
48987
|
+
allPostfixes = _buildFieldFormatMaps.allPostfixes,
|
|
48988
|
+
nullValues = _buildFieldFormatMaps.nullValues,
|
|
48989
|
+
activeNumberFormats = _buildFieldFormatMaps.activeNumberFormats;
|
|
48990
|
+
|
|
48991
|
+
// Build params for the result formatter.
|
|
48992
|
+
var params = {
|
|
48993
|
+
defaultFormats: defaultFormats,
|
|
48994
|
+
dateTimeFormatOptions: dateTimeFormatOptions,
|
|
48995
|
+
numberFormatOptions: numberFormatOptions,
|
|
48996
|
+
valueAlias: function valueAlias(params) {
|
|
48997
|
+
if (typeof _valueAlias === 'function') {
|
|
48998
|
+
// TODO; it is more useful providing this information separate,
|
|
48999
|
+
// rather than building it into an ID and returning it. Ideally all would be returned
|
|
49000
|
+
return String(_valueAlias({
|
|
49001
|
+
fieldId: id({
|
|
49002
|
+
field: params.fieldId,
|
|
49003
|
+
"function": params["function"]
|
|
49004
|
+
}),
|
|
49005
|
+
value: params.value
|
|
49006
|
+
}));
|
|
49007
|
+
}
|
|
49008
|
+
return undefined;
|
|
49009
|
+
},
|
|
49010
|
+
nullValue: nullValues,
|
|
49011
|
+
prefixes: allPrefixes,
|
|
49012
|
+
postfixes: allPostfixes,
|
|
49013
|
+
activeNumberFormats: activeNumberFormats,
|
|
49014
|
+
activeDateTimeFormats: activeDateTimeFormats
|
|
49015
|
+
};
|
|
49016
|
+
var formattedResult = formatResult(result, params);
|
|
49017
|
+
|
|
49018
|
+
// --------------------------------------------
|
|
49019
|
+
// --------------------------------------------
|
|
49020
|
+
// --------------------------------------------
|
|
49021
|
+
// --------------------------------------------
|
|
49022
|
+
// --------------------------------------------
|
|
49023
|
+
// --------------------------------------------
|
|
49024
|
+
// --------------------------------------------
|
|
49025
|
+
// --------------------------------------------
|
|
49026
|
+
|
|
49027
|
+
// ----- xKey -----
|
|
49028
|
+
|
|
49029
|
+
var xKeyField = getXKeyField(pivotConfig, result.fields);
|
|
49030
|
+
|
|
49031
|
+
// ----- Formatting ----
|
|
49032
|
+
// (value: any, noValueReplacement?: string) => string;
|
|
49033
|
+
var formattingFunctionY = function formattingFunctionY(value) {
|
|
49034
|
+
// Use any y axis field as they are all formatted in the same way (for now...);
|
|
49035
|
+
var nonPivotField = formattedResult.fields.find(function (resultField) {
|
|
49036
|
+
return ![].concat(pivotConfig.x, pivotConfig.y).includes(resultField.id);
|
|
49037
|
+
});
|
|
49038
|
+
if (!nonPivotField) return '';
|
|
49039
|
+
return formattedResult.formatterFunc(value, {
|
|
49040
|
+
fieldId: nonPivotField.fieldId,
|
|
49041
|
+
"function": nonPivotField["function"],
|
|
49042
|
+
outputDataType: nonPivotField.outputDataType
|
|
49043
|
+
}).formattedValue;
|
|
49044
|
+
};
|
|
49045
|
+
|
|
49046
|
+
// ----- Keys & Prep -----
|
|
49047
|
+
var xScaleDataType = (xKeyField == null ? void 0 : xKeyField.outputDataType) || 'string';
|
|
49048
|
+
var _formattedResultToSer = formattedResultToSeries(formattedResult, pivotConfig, seriesLabelFormatter),
|
|
49049
|
+
keys = _formattedResultToSer.keys,
|
|
49050
|
+
yKeys = _formattedResultToSer.yKeys,
|
|
49051
|
+
xKeys = _formattedResultToSer.xKeys,
|
|
49052
|
+
chartData = _formattedResultToSer.seriesData;
|
|
49053
|
+
var xKey = (_xKeys$ = xKeys[0]) != null ? _xKeys$ : null;
|
|
49054
|
+
var updatedData = function () {
|
|
49055
|
+
var hasMultipleGroups = result.fields.length > 2;
|
|
49056
|
+
var data = chartData;
|
|
49057
|
+
if (hasMultipleGroups) {
|
|
49058
|
+
data = fillMissingKeysForChartData(chartData);
|
|
49059
|
+
}
|
|
49060
|
+
if (stacked) {
|
|
49061
|
+
data = fillMissingKeysForChartData(data);
|
|
49062
|
+
}
|
|
49063
|
+
return data;
|
|
49064
|
+
}();
|
|
49065
|
+
|
|
49066
|
+
// ----- Goal Lines -----
|
|
49067
|
+
|
|
49068
|
+
var goalLines = getGoalLines({
|
|
49069
|
+
goalLineAttributes: goalLineAttributes,
|
|
49070
|
+
formattingFunctionY: formattingFunctionY
|
|
49071
|
+
});
|
|
49072
|
+
|
|
49073
|
+
// ----- Ticks -----
|
|
49074
|
+
|
|
49075
|
+
var ticks = getScaleAndTicks({
|
|
49076
|
+
data: updatedData,
|
|
49077
|
+
xKey: xKey,
|
|
49078
|
+
xScaleDataType: xScaleDataType,
|
|
49079
|
+
yKeys: yKeys,
|
|
49080
|
+
tickCountYAxis: approxYAxisLabelCount,
|
|
49081
|
+
formattingFunctionX: function formattingFunctionX$1(value) {
|
|
49082
|
+
return formattingFunctionX(value, formattedResult, xKeyField);
|
|
49083
|
+
},
|
|
49084
|
+
formattingFunctionY: formattingFunctionY,
|
|
49085
|
+
nullValue: nullValue,
|
|
49086
|
+
order: order,
|
|
49087
|
+
goalLines: goalLines
|
|
49088
|
+
});
|
|
49089
|
+
|
|
49090
|
+
// ----- Lines -----
|
|
49091
|
+
|
|
49092
|
+
var styleDefinition = getStyleDefinition({
|
|
49093
|
+
colors: colors,
|
|
49094
|
+
yKeys: yKeys,
|
|
49095
|
+
style: {
|
|
49096
|
+
toOpacity: 0.5,
|
|
49097
|
+
fromOpacity: 0.9,
|
|
49098
|
+
type: 'area'
|
|
49099
|
+
}
|
|
49100
|
+
});
|
|
49101
|
+
|
|
49102
|
+
// ----- Conditional Formatting -----
|
|
49103
|
+
|
|
49104
|
+
var conditionalFormattingRules = getConditionalFormatting({
|
|
49105
|
+
conditionalFormattingAttributes: conditionalFormattingAttributes
|
|
49106
|
+
});
|
|
49107
|
+
var chart = {
|
|
49108
|
+
keys: keys,
|
|
49109
|
+
x: {
|
|
49110
|
+
ticks: ticks.x.ticks,
|
|
49111
|
+
scale: {
|
|
49112
|
+
dataType: ticks.x.scale.dataType,
|
|
49113
|
+
key: ticks.x.scale.key,
|
|
49114
|
+
ordering: ticks.x.scale.ordering,
|
|
49115
|
+
min: ticks.x.scale.min,
|
|
49116
|
+
max: ticks.x.scale.max
|
|
49117
|
+
},
|
|
49118
|
+
key: xKey,
|
|
49119
|
+
postfix: xAxisPostfix,
|
|
49120
|
+
prefix: xAxisPrefix,
|
|
49121
|
+
title: (_axisTitles$x = axisTitles == null ? void 0 : axisTitles.x) != null ? _axisTitles$x : null
|
|
49122
|
+
},
|
|
49123
|
+
y: {
|
|
49124
|
+
ticks: ticks.y.ticks,
|
|
49125
|
+
scale: {
|
|
49126
|
+
dataType: ticks.y.scale.dataType,
|
|
49127
|
+
key: ticks.y.scale.key,
|
|
49128
|
+
ordering: ticks.y.scale.ordering,
|
|
49129
|
+
min: ticks.y.scale.min,
|
|
49130
|
+
max: ticks.y.scale.max
|
|
49131
|
+
},
|
|
49132
|
+
keys: yKeys,
|
|
49133
|
+
postfix: yAxisPostfix,
|
|
49134
|
+
prefix: yAxisPrefix,
|
|
49135
|
+
title: (_axisTitles$y = axisTitles == null ? void 0 : axisTitles.y) != null ? _axisTitles$y : null
|
|
49136
|
+
},
|
|
49137
|
+
data: updatedData,
|
|
49138
|
+
areas: styleDefinition,
|
|
49139
|
+
conditionalFormattingRules: conditionalFormattingRules,
|
|
49140
|
+
goalLines: goalLines
|
|
49141
|
+
};
|
|
49142
|
+
return chart;
|
|
49143
|
+
};
|
|
49144
|
+
|
|
49145
|
+
var AreaChartV2View = function AreaChartV2View(props) {
|
|
49146
|
+
var _props$library, _props$attributes$vie;
|
|
49147
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
49148
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
49149
|
+
valueAlias = _useDashboardBehaviou.valueAlias,
|
|
49150
|
+
labelFormat = _useDashboardBehaviou.labelFormat,
|
|
49151
|
+
queryEngineConfig = _useDashboardBehaviou.queryEngineConfig;
|
|
49152
|
+
var headerProps = {
|
|
49153
|
+
displayTitle: props.attributes.displayTitle,
|
|
49154
|
+
displaySubject: props.attributes.displaySubject,
|
|
49155
|
+
verified: props.attributes.protectedByOrganisation,
|
|
49156
|
+
library: (_props$library = props.library) != null ? _props$library : false,
|
|
49157
|
+
localFilters: props.localFilters,
|
|
49158
|
+
setLocalFilters: props.setLocalFilters,
|
|
49159
|
+
dataSet: props.dataSet,
|
|
49160
|
+
parameters: props == null ? void 0 : props.attributes.parameters,
|
|
49161
|
+
componentType: props == null ? void 0 : props.attributes.type,
|
|
49162
|
+
measure: props == null ? void 0 : props.attributes.measure,
|
|
49163
|
+
dimension: props == null ? void 0 : props.attributes.dimension,
|
|
49164
|
+
timeDimension: props.attributes.timeDimension,
|
|
49165
|
+
setPartialAttributes: props.setPartialAttributes,
|
|
49166
|
+
viewId: (_props$attributes$vie = props == null ? void 0 : props.attributes.viewId) != null ? _props$attributes$vie : '',
|
|
49167
|
+
order: props.attributes.order
|
|
49168
|
+
};
|
|
49169
|
+
var showHeadline = headlineAvailable(props.attributes.order, props.attributes.headline, null);
|
|
49170
|
+
var theme = useTheme();
|
|
49171
|
+
var AreaChartV2Component = getComponentInterface(props.attributes.type);
|
|
49172
|
+
var pivotConfig = init$c(props.attributes);
|
|
49173
|
+
var chartRepresentation = null;
|
|
49174
|
+
if (!isLoading(props.result) && !hasFailed(props.result) && !isEmpty(props.result) && AreaChartV2Component.isRunnable(props.attributes)) {
|
|
49175
|
+
var _theme$charts$colors, _theme$charts, _props$attributes$goa;
|
|
49176
|
+
chartRepresentation = buildAreaChartRepresentation({
|
|
49177
|
+
axisTitles: props.attributes.axisTitles,
|
|
49178
|
+
xAxisPostfix: props.attributes.xAxisPostfix,
|
|
49179
|
+
xAxisPrefix: props.attributes.xAxisPrefix,
|
|
49180
|
+
yAxisPostfix: props.attributes.yAxisPostfix,
|
|
49181
|
+
yAxisPrefix: props.attributes.yAxisPrefix,
|
|
49182
|
+
yAxisFormat: props.attributes.yAxisFormat,
|
|
49183
|
+
xAxisFormat: props.attributes.xAxisFormat,
|
|
49184
|
+
approxYAxisLabelCount: props.attributes.approxYAxisLabelCount === 'auto' ? 10 : props.attributes.approxYAxisLabelCount,
|
|
49185
|
+
colors: (_theme$charts$colors = theme == null || (_theme$charts = theme.charts) == null ? void 0 : _theme$charts.colors) != null ? _theme$charts$colors : DEFAULT_CHART_COLORS,
|
|
49186
|
+
valueAlias: valueAlias,
|
|
49187
|
+
nullValue: checkForNullValue(props.attributes.dataSetId, props.attributes.dimension, props.attributes.timeDimension, textOverride, valueAlias),
|
|
49188
|
+
result: props.result,
|
|
49189
|
+
pivotConfig: pivotConfig,
|
|
49190
|
+
order: props.attributes.order,
|
|
49191
|
+
numberFormatOptions: props.numberFormatOptions,
|
|
49192
|
+
dateTimeFormatOptions: props.dateTimeFormatOptions,
|
|
49193
|
+
goalLineAttributes: (_props$attributes$goa = props.attributes.goalLines) != null ? _props$attributes$goa : [],
|
|
49194
|
+
conditionalFormattingAttributes: props.attributes.conditionalFormattingRules,
|
|
49195
|
+
defaultFormats: props.defaultFormats,
|
|
49196
|
+
seriesLabelFormatter: function seriesLabelFormatter(labelFormatParams) {
|
|
49197
|
+
var _queryEngineConfig$su, _queryEngineConfig$su2, _queryEngineConfig$su3;
|
|
49198
|
+
var yResultField = labelFormatParams.yResultField,
|
|
49199
|
+
yPivotFields = labelFormatParams.yPivotFields,
|
|
49200
|
+
row = labelFormatParams.row;
|
|
49201
|
+
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);
|
|
49202
|
+
var formattedFunction = yResultField["function"] === 'none' ? '' : " \u2022 " + formattedFunctionName;
|
|
49203
|
+
var defaultLabelFormat = "" + yPivotFields.map(function (field) {
|
|
49204
|
+
return row[field.id].formattedValue;
|
|
49205
|
+
}).join(' • ') + (yPivotFields.length === 0 ? '' : ' • ') + yResultField.publicName + formattedFunction;
|
|
49206
|
+
if (!labelFormat) return defaultLabelFormat;
|
|
49207
|
+
return labelFormat({
|
|
49208
|
+
viewId: props.attributes.viewId,
|
|
49209
|
+
fieldId: yResultField.fieldId,
|
|
49210
|
+
func: yResultField["function"],
|
|
49211
|
+
type: 'areaChartV2',
|
|
49212
|
+
defaultLabel: defaultLabelFormat
|
|
49213
|
+
}) || defaultLabelFormat;
|
|
49214
|
+
},
|
|
49215
|
+
stacked: props.attributes.stacked
|
|
49216
|
+
});
|
|
49217
|
+
}
|
|
49218
|
+
|
|
49219
|
+
// When these are triggered they don't render the chart after they're resolved, potentially because component did no re-render?
|
|
49220
|
+
if (!AreaChartV2Component.isRunnable(props.attributes)) {
|
|
49221
|
+
return jsx(QueryUnderConstructionNotice, {
|
|
49222
|
+
title: "Missing parameters"
|
|
49223
|
+
});
|
|
49224
|
+
}
|
|
49225
|
+
if (isLoading(props.result)) return jsx(LoadingComponent, {});
|
|
49226
|
+
if (hasFailed(props.result)) return jsx(FailedToLoadDataNotice, {});
|
|
49227
|
+
if (isEmpty(props.result)) return jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
49228
|
+
return jsx(Suspense, {
|
|
49229
|
+
fallback: jsx(LoadingComponent, {}),
|
|
49230
|
+
children: jsxs(ViewWrapper, {
|
|
49231
|
+
id: props.id,
|
|
49232
|
+
queriesAreChanging: props.queriesAreChanging,
|
|
49233
|
+
children: [jsx(ViewHeader, _extends({}, headerProps, {
|
|
49234
|
+
paddingBottom: showHeadline ? '0.5rem' : undefined
|
|
49235
|
+
})), showHeadline && jsx(HeadlineStats, _extends({}, props.propsForHeadline)), jsx("div", {
|
|
49236
|
+
className: styles({
|
|
49237
|
+
flex: '1',
|
|
49238
|
+
position: 'relative'
|
|
49239
|
+
}),
|
|
49240
|
+
"aria-disabled": props.library,
|
|
49241
|
+
children: chartRepresentation && jsx(ParentSize, {
|
|
49242
|
+
style: {
|
|
49243
|
+
position: 'absolute',
|
|
49244
|
+
width: '100%',
|
|
49245
|
+
height: '100%',
|
|
49246
|
+
overflowX: 'hidden'
|
|
49247
|
+
},
|
|
49248
|
+
children: function children(parent) {
|
|
49249
|
+
var _props$attributes$vie2, _props$attributes$sta;
|
|
49250
|
+
if (chartRepresentation.areas.length === 0) return jsx(LoadingComponent, {});
|
|
49251
|
+
return jsx(AreaChartV2$1, {
|
|
49252
|
+
width: parent.width,
|
|
49253
|
+
height: parent.height,
|
|
49254
|
+
chart: adjustTicks(chartRepresentation, parent.width, parent.height),
|
|
49255
|
+
uniqueId: (_props$attributes$vie2 = props.attributes.viewId) != null ? _props$attributes$vie2 : 'area-chart',
|
|
49256
|
+
options: {
|
|
49257
|
+
stacked: (_props$attributes$sta = props.attributes.stacked) != null ? _props$attributes$sta : false,
|
|
49258
|
+
curve: props.attributes.lineCurve,
|
|
49259
|
+
removeStroke: false,
|
|
49260
|
+
showRoundedTotal: false,
|
|
49261
|
+
showLegend: props.attributes.legend,
|
|
49262
|
+
axis: {
|
|
49263
|
+
showXAxisLabels: props.attributes.approxXAxisLabelCount !== 0,
|
|
49264
|
+
showYAxisLabels: props.attributes.approxYAxisLabelCount !== 0
|
|
49265
|
+
}
|
|
49266
|
+
},
|
|
49267
|
+
theme: theme == null ? void 0 : theme.charts
|
|
49268
|
+
});
|
|
49269
|
+
}
|
|
49270
|
+
})
|
|
49271
|
+
})]
|
|
49272
|
+
})
|
|
49273
|
+
});
|
|
49274
|
+
};
|
|
49275
|
+
|
|
49276
|
+
var AreaChartV2 = function AreaChartV2(props) {
|
|
49277
|
+
var _props$component = props.component,
|
|
49278
|
+
results = _props$component.results,
|
|
49279
|
+
attributes = _props$component.attributes,
|
|
49280
|
+
localFilters = _props$component.localFilters;
|
|
49281
|
+
var dashboardBehaviour = props.dashboardBehaviour;
|
|
49282
|
+
var _useComponentEffect = useComponentEffect(attributes, props.dataSet, dashboardBehaviour.queryEngineConfig, {
|
|
49283
|
+
localFilters: localFilters,
|
|
49284
|
+
globalFilters: props.globalFilters
|
|
49285
|
+
}, props.updateComponentAttributes, props.runQueriesCallback, props.setResults, dashboardBehaviour.variables),
|
|
49286
|
+
queriesAreChanging = _useComponentEffect.queriesAreChanging;
|
|
49287
|
+
return jsx(AreaChartV2View, {
|
|
49288
|
+
id: props.id,
|
|
49289
|
+
attributes: attributes,
|
|
49290
|
+
dataSet: props.dataSet,
|
|
49291
|
+
localFilters: props.component.localFilters,
|
|
49292
|
+
setLocalFilters: props.setLocalFilters,
|
|
49293
|
+
setPartialAttributes: function setPartialAttributes(changes) {
|
|
49294
|
+
return props.setPartialAttributes(changes);
|
|
49295
|
+
},
|
|
49296
|
+
result: results && results[0],
|
|
49297
|
+
queriesAreChanging: queriesAreChanging,
|
|
49298
|
+
numberFormatOptions: dashboardBehaviour.numberFormatOptions,
|
|
49299
|
+
dateTimeFormatOptions: dashboardBehaviour.dateTimeFormatOptions,
|
|
49300
|
+
defaultFormats: dashboardBehaviour.defaultFormats,
|
|
49301
|
+
propsForHeadline: props,
|
|
49302
|
+
idPrefix: props.idPrefix,
|
|
49303
|
+
library: props == null ? void 0 : props.library
|
|
49304
|
+
});
|
|
49305
|
+
};
|
|
49306
|
+
|
|
48497
49307
|
var Component = function Component(props) {
|
|
48498
49308
|
var _useDashboardContext = useDashboardContext(),
|
|
48499
49309
|
dashboard = _useDashboardContext.dashboard;
|
|
@@ -48583,7 +49393,7 @@ var Component = function Component(props) {
|
|
|
48583
49393
|
});
|
|
48584
49394
|
},
|
|
48585
49395
|
onError: dashboardBehaviour.onError,
|
|
48586
|
-
children: jsx(BubbleChart$
|
|
49396
|
+
children: jsx(BubbleChart$3, {
|
|
48587
49397
|
id: props.id,
|
|
48588
49398
|
setLocalFilters: props.setLocalFilters,
|
|
48589
49399
|
dataSet: dataSet,
|
|
@@ -48636,7 +49446,7 @@ var Component = function Component(props) {
|
|
|
48636
49446
|
});
|
|
48637
49447
|
},
|
|
48638
49448
|
onError: dashboardBehaviour.onError,
|
|
48639
|
-
children: jsx(AreaChart$
|
|
49449
|
+
children: jsx(AreaChart$4, {
|
|
48640
49450
|
id: props.id,
|
|
48641
49451
|
setLocalFilters: props.setLocalFilters,
|
|
48642
49452
|
dataSet: dataSet,
|
|
@@ -48734,6 +49544,32 @@ var Component = function Component(props) {
|
|
|
48734
49544
|
})
|
|
48735
49545
|
});
|
|
48736
49546
|
}
|
|
49547
|
+
if (props.component.attributes.type == 'areaChartV2') {
|
|
49548
|
+
return jsx(ErrorBoundary, {
|
|
49549
|
+
renderOnError: function renderOnError(onManualRetry) {
|
|
49550
|
+
return jsx(ComponentErrorNotice, {
|
|
49551
|
+
onManualRetry: onManualRetry
|
|
49552
|
+
});
|
|
49553
|
+
},
|
|
49554
|
+
onError: dashboardBehaviour.onError,
|
|
49555
|
+
children: jsx(AreaChartV2, {
|
|
49556
|
+
id: props.id,
|
|
49557
|
+
setLocalFilters: props.setLocalFilters,
|
|
49558
|
+
dataSet: dataSet,
|
|
49559
|
+
updateComponentAttributes: function updateComponentAttributes(newAttributes) {
|
|
49560
|
+
return _updateComponentAttributes(newAttributes);
|
|
49561
|
+
},
|
|
49562
|
+
runQueriesCallback: props.runQueriesCallback,
|
|
49563
|
+
component: props.component,
|
|
49564
|
+
setResults: props.setResults,
|
|
49565
|
+
globalFilters: dashboard.globalFilters,
|
|
49566
|
+
dashboardBehaviour: dashboardBehaviour,
|
|
49567
|
+
library: props == null ? void 0 : props.library,
|
|
49568
|
+
idPrefix: idPrefix,
|
|
49569
|
+
setPartialAttributes: setPartialAttributes
|
|
49570
|
+
})
|
|
49571
|
+
});
|
|
49572
|
+
}
|
|
48737
49573
|
if (props.component.attributes.type == 'pieChart') {
|
|
48738
49574
|
return jsx(ErrorBoundary, {
|
|
48739
49575
|
renderOnError: function renderOnError(onManualRetry) {
|
|
@@ -57046,6 +57882,22 @@ var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
|
57046
57882
|
}
|
|
57047
57883
|
return options;
|
|
57048
57884
|
}();
|
|
57885
|
+
var layoutOptions = function () {
|
|
57886
|
+
var options = [{
|
|
57887
|
+
label: textOverride('grouped', 'Grouped'),
|
|
57888
|
+
value: false
|
|
57889
|
+
}, {
|
|
57890
|
+
label: textOverride('stacked', 'Stacked'),
|
|
57891
|
+
value: true
|
|
57892
|
+
}];
|
|
57893
|
+
if (attributes.type === 'barChart' || attributes.type === 'areaChart') {
|
|
57894
|
+
options.push({
|
|
57895
|
+
label: textOverride('stacked_100prc', 'Stacked (100%)'),
|
|
57896
|
+
value: '100%'
|
|
57897
|
+
});
|
|
57898
|
+
}
|
|
57899
|
+
return options;
|
|
57900
|
+
}();
|
|
57049
57901
|
return jsx(Section, {
|
|
57050
57902
|
title: section.title,
|
|
57051
57903
|
tooltip: section == null ? void 0 : section.description,
|
|
@@ -57065,16 +57917,7 @@ var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
|
57065
57917
|
stacked: stacked
|
|
57066
57918
|
});
|
|
57067
57919
|
},
|
|
57068
|
-
options:
|
|
57069
|
-
label: textOverride('grouped', 'Grouped'),
|
|
57070
|
-
value: false
|
|
57071
|
-
}, {
|
|
57072
|
-
label: textOverride('stacked', 'Stacked'),
|
|
57073
|
-
value: true
|
|
57074
|
-
}, {
|
|
57075
|
-
label: textOverride('stacked_100prc', 'Stacked (100%)'),
|
|
57076
|
-
value: '100%'
|
|
57077
|
-
}]
|
|
57920
|
+
options: layoutOptions
|
|
57078
57921
|
}), section.type === 'curve' && jsx(FormatSelectInput, {
|
|
57079
57922
|
label: section.title,
|
|
57080
57923
|
id: "format-layout-curve",
|
|
@@ -65139,7 +65982,7 @@ var View$3 = /*#__PURE__*/function () {
|
|
|
65139
65982
|
};
|
|
65140
65983
|
return View;
|
|
65141
65984
|
}();
|
|
65142
|
-
var AreaChart$
|
|
65985
|
+
var AreaChart$5 = /*#__PURE__*/function (_View2) {
|
|
65143
65986
|
function AreaChart(attributes) {
|
|
65144
65987
|
return _View2.call(this, _extends({}, attributes, {
|
|
65145
65988
|
type: 'areaChart'
|
|
@@ -65508,6 +66351,8 @@ var toQueries$9 = commonToQueries;
|
|
|
65508
66351
|
|
|
65509
66352
|
var toQueries$a = commonToQueries;
|
|
65510
66353
|
|
|
66354
|
+
var toQueries$b = commonToQueries;
|
|
66355
|
+
|
|
65511
66356
|
var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65512
66357
|
var line = build$a(dataSet, attributes.lineMeasure, attributes.order, attributes.lineDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
65513
66358
|
var bar = build$a(dataSet, attributes.barMeasure, attributes.order, attributes.barDimension, attributes.timeDimension, attributes.limit, attributes.offset, queryEngineConfig, params);
|
|
@@ -65516,7 +66361,7 @@ var buildMainQueries = function buildMainQueries(attributes, dataSet, queryEngin
|
|
|
65516
66361
|
line: line
|
|
65517
66362
|
};
|
|
65518
66363
|
};
|
|
65519
|
-
var toQueries$
|
|
66364
|
+
var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65520
66365
|
var _buildMainQueries = buildMainQueries(attributes, dataSet, queryEngineConfig, params),
|
|
65521
66366
|
line = _buildMainQueries.line,
|
|
65522
66367
|
bar = _buildMainQueries.bar;
|
|
@@ -65574,7 +66419,7 @@ var buildQueries = function buildQueries(attributes, dataSet, queryEngineConfig,
|
|
|
65574
66419
|
measureDescription: deltaQuery ? [mainQuery.measureDescription, deltaQuery.measureDescription] : [mainQuery.measureDescription]
|
|
65575
66420
|
};
|
|
65576
66421
|
};
|
|
65577
|
-
var toQueries$
|
|
66422
|
+
var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65578
66423
|
var _buildQueries = buildQueries(attributes, dataSet, queryEngineConfig, params),
|
|
65579
66424
|
queries = _buildQueries.queries,
|
|
65580
66425
|
measureDescription = _buildQueries.measureDescription;
|
|
@@ -65585,7 +66430,7 @@ var toQueries$c = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65585
66430
|
};
|
|
65586
66431
|
};
|
|
65587
66432
|
|
|
65588
|
-
var toQueries$
|
|
66433
|
+
var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65589
66434
|
var measures = [];
|
|
65590
66435
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
65591
66436
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
@@ -65599,7 +66444,7 @@ var toQueries$d = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65599
66444
|
};
|
|
65600
66445
|
};
|
|
65601
66446
|
|
|
65602
|
-
var toQueries$
|
|
66447
|
+
var toQueries$f = function toQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65603
66448
|
var measures = [];
|
|
65604
66449
|
attributes.xMeasure && measures.push(attributes.xMeasure);
|
|
65605
66450
|
attributes.yMeasure && measures.push(attributes.yMeasure);
|
|
@@ -65613,7 +66458,7 @@ var toQueries$e = function toQueries(attributes, dataSet, queryEngineConfig, par
|
|
|
65613
66458
|
};
|
|
65614
66459
|
};
|
|
65615
66460
|
|
|
65616
|
-
var toQueries$
|
|
66461
|
+
var toQueries$g = function toQueries$1(attributes, dataSet, queryEngineConfig, params) {
|
|
65617
66462
|
return toQueries([dataSet], [{
|
|
65618
66463
|
measure: attributes.measure,
|
|
65619
66464
|
dataSetId: dataSet.id,
|
|
@@ -65625,12 +66470,12 @@ var toQueries$f = function toQueries$1(attributes, dataSet, queryEngineConfig, p
|
|
|
65625
66470
|
}], queryEngineConfig, params);
|
|
65626
66471
|
};
|
|
65627
66472
|
|
|
65628
|
-
var toQueries$g = commonToQueries;
|
|
65629
|
-
|
|
65630
66473
|
var toQueries$h = commonToQueries;
|
|
65631
66474
|
|
|
65632
66475
|
var toQueries$i = commonToQueries;
|
|
65633
66476
|
|
|
66477
|
+
var toQueries$j = commonToQueries;
|
|
66478
|
+
|
|
65634
66479
|
var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet, queryEngineConfig, params) {
|
|
65635
66480
|
switch (attributes.type) {
|
|
65636
66481
|
case 'areaChart':
|
|
@@ -65645,30 +66490,32 @@ var buildVizzlyViewQueries = function buildVizzlyViewQueries(attributes, dataSet
|
|
|
65645
66490
|
return toQueries$6(attributes, dataSet, queryEngineConfig, params);
|
|
65646
66491
|
case 'lineChartV2':
|
|
65647
66492
|
return toQueries$7(attributes, dataSet, queryEngineConfig, params);
|
|
65648
|
-
case '
|
|
66493
|
+
case 'areaChartV2':
|
|
65649
66494
|
return toQueries$8(attributes, dataSet, queryEngineConfig, params);
|
|
65650
|
-
case '
|
|
66495
|
+
case 'pieChart':
|
|
65651
66496
|
return toQueries$9(attributes, dataSet, queryEngineConfig, params);
|
|
65652
|
-
case '
|
|
66497
|
+
case 'dataTable':
|
|
65653
66498
|
return toQueries$a(attributes, dataSet, queryEngineConfig, params);
|
|
65654
|
-
case '
|
|
66499
|
+
case 'basicTable':
|
|
65655
66500
|
return toQueries$b(attributes, dataSet, queryEngineConfig, params);
|
|
65656
|
-
case '
|
|
66501
|
+
case 'comboChart':
|
|
65657
66502
|
return toQueries$c(attributes, dataSet, queryEngineConfig, params);
|
|
66503
|
+
case 'singleStat':
|
|
66504
|
+
return toQueries$d(attributes, dataSet, queryEngineConfig, params);
|
|
65658
66505
|
case 'progress':
|
|
65659
|
-
return toQueries$c(attributes, dataSet, queryEngineConfig, params);
|
|
65660
|
-
case 'scatterChart':
|
|
65661
66506
|
return toQueries$d(attributes, dataSet, queryEngineConfig, params);
|
|
65662
|
-
case '
|
|
66507
|
+
case 'scatterChart':
|
|
65663
66508
|
return toQueries$e(attributes, dataSet, queryEngineConfig, params);
|
|
65664
|
-
case '
|
|
66509
|
+
case 'bubbleChart':
|
|
65665
66510
|
return toQueries$f(attributes, dataSet, queryEngineConfig, params);
|
|
65666
|
-
case '
|
|
66511
|
+
case 'mercatorMap':
|
|
65667
66512
|
return toQueries$g(attributes, dataSet, queryEngineConfig, params);
|
|
65668
|
-
case '
|
|
66513
|
+
case 'funnelChart':
|
|
65669
66514
|
return toQueries$h(attributes, dataSet, queryEngineConfig, params);
|
|
65670
|
-
case '
|
|
66515
|
+
case 'richText':
|
|
65671
66516
|
return toQueries$i(attributes, dataSet, queryEngineConfig, params);
|
|
66517
|
+
case 'waterfallChart':
|
|
66518
|
+
return toQueries$j(attributes, dataSet, queryEngineConfig, params);
|
|
65672
66519
|
default:
|
|
65673
66520
|
throw 'Unsupported view when building query.';
|
|
65674
66521
|
}
|
|
@@ -67216,7 +68063,7 @@ VizzlyServices.Dashboard = Dashboard$1;
|
|
|
67216
68063
|
VizzlyServices.Editor = Editor;
|
|
67217
68064
|
VizzlyServices.Header = Header;
|
|
67218
68065
|
VizzlyServices.Library = Library$1;
|
|
67219
|
-
VizzlyServices.AreaChart = AreaChart$
|
|
68066
|
+
VizzlyServices.AreaChart = AreaChart$5;
|
|
67220
68067
|
VizzlyServices.LineChart = LineChart$6;
|
|
67221
68068
|
VizzlyServices.BarChart = BarChart$6;
|
|
67222
68069
|
VizzlyServices.PieChart = PieChart$4;
|
|
@@ -68540,7 +69387,8 @@ var attributesToAiView = function attributesToAiView(dataSet, originalAttributes
|
|
|
68540
69387
|
if (attributes.type === 'richText') throw 'Rich text views are not supported by Vizzly AI.';
|
|
68541
69388
|
if (attributes.type === 'lineChartV2') throw 'Line Chart V2 views are not supported by Vizzly AI.';
|
|
68542
69389
|
if (attributes.type === 'bubbleChart') throw 'Bubble Chart views are not supported by Vizzly AI.';
|
|
68543
|
-
if (attributes.type === 'barChartV2') throw '
|
|
69390
|
+
if (attributes.type === 'barChartV2') throw 'Bar Chart V2 views are not supported by Vizzly AI.';
|
|
69391
|
+
if (attributes.type === 'areaChartV2') throw 'Area Chart V2 views are not supported by Vizzly AI.';
|
|
68544
69392
|
if (attributes.type === 'waterfallChart') throw 'Waterfall chart views are not supported by Vizzly AI.';
|
|
68545
69393
|
var select = [];
|
|
68546
69394
|
var group = [];
|