@qrvey/utils 1.11.0 → 1.12.0-0-chart-v2-0
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/adapters/chartBuilderAdapter.d.ts +35 -0
- package/dist/charts/adapters/chartBuilderAdapter.js +647 -0
- package/dist/charts/adapters/chartBuilderDefinitions.d.ts +568 -0
- package/dist/charts/adapters/chartBuilderDefinitions.js +31 -0
- package/dist/charts/adapters/chartBuilderParse.d.ts +9 -0
- package/dist/charts/adapters/chartBuilderParse.js +416 -0
- package/dist/charts/adapters/index.d.ts +1 -0
- package/dist/charts/adapters/index.js +1 -0
- package/dist/charts/helpers/chartBuilder.d.ts +53 -0
- package/dist/charts/helpers/chartBuilder.js +190 -0
- package/dist/cjs/charts/adapters/chartBuilderAdapter.d.ts +35 -0
- package/dist/cjs/charts/adapters/chartBuilderAdapter.js +654 -0
- package/dist/cjs/charts/adapters/chartBuilderDefinitions.d.ts +568 -0
- package/dist/cjs/charts/adapters/chartBuilderDefinitions.js +34 -0
- package/dist/cjs/charts/adapters/chartBuilderParse.d.ts +9 -0
- package/dist/cjs/charts/adapters/chartBuilderParse.js +421 -0
- package/dist/cjs/charts/adapters/index.d.ts +1 -0
- package/dist/cjs/charts/adapters/index.js +1 -0
- package/dist/cjs/charts/helpers/chartBuilder.d.ts +53 -0
- package/dist/cjs/charts/helpers/chartBuilder.js +212 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderAxisStyle.d.ts +4 -0
- package/dist/cjs/globalization/interfaces/common/II18nRelativeDates.d.ts +8 -0
- package/dist/cjs/globalization/interfaces/common/II18nRelativeDates.js +2 -0
- package/dist/cjs/globalization/interfaces/common/II18nUnits.d.ts +6 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +4 -0
- package/dist/cjs/globalization/labels/common/I18N_COMMON.js +2 -10
- package/dist/cjs/globalization/labels/common/I18N_RELATIVE_DATES.d.ts +2 -0
- package/dist/cjs/globalization/labels/common/I18N_RELATIVE_DATES.js +11 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderAxisStyle.d.ts +4 -0
- package/dist/globalization/interfaces/common/II18nRelativeDates.d.ts +8 -0
- package/dist/globalization/interfaces/common/II18nRelativeDates.js +1 -0
- package/dist/globalization/interfaces/common/II18nUnits.d.ts +6 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +4 -0
- package/dist/globalization/labels/common/I18N_COMMON.js +2 -10
- package/dist/globalization/labels/common/I18N_RELATIVE_DATES.d.ts +2 -0
- package/dist/globalization/labels/common/I18N_RELATIVE_DATES.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { _get, capitalize, getSortByType } from "../helpers/chartBuilder";
|
|
2
|
+
export function parseStyleSettingByType(type, { stylesSettings, globalSettings, isGrouped }, optsCombo = {}) {
|
|
3
|
+
var _a, _b, _c, _d;
|
|
4
|
+
const { theme, color, thickness, line_style: style, line_type: straight, y_axis, data_labels, symbol_type: symbol, symbol_fill: fill, opacity, } = stylesSettings;
|
|
5
|
+
const y_axis_format = _get(y_axis, "format.value") === "General" /* FORMATS.GENERAL */
|
|
6
|
+
? "Default" /* FORMATS.DEFAULT */
|
|
7
|
+
: _get(y_axis, "format.value");
|
|
8
|
+
const pie_labels = _get(data_labels, "pie_labels.format.value") === "General" /* FORMATS.GENERAL */
|
|
9
|
+
? "Default" /* FORMATS.DEFAULT */
|
|
10
|
+
: _get(data_labels, "pie_labels.format.value");
|
|
11
|
+
const heat_map_labels = _get(data_labels, "heat_map_labels.format.value") === "General" /* FORMATS.GENERAL */
|
|
12
|
+
? "Default" /* FORMATS.DEFAULT */
|
|
13
|
+
: _get(data_labels, "heat_map_labels.format.value");
|
|
14
|
+
const format = {
|
|
15
|
+
y_axis: y_axis_format,
|
|
16
|
+
data_labels: type === "PIE_CHART" /* CHART_TYPE.PIE_CHART */ ? pie_labels : heat_map_labels,
|
|
17
|
+
};
|
|
18
|
+
return ({
|
|
19
|
+
["BAR_CHART" /* CHART_TYPE.BAR_CHART */]: {
|
|
20
|
+
color,
|
|
21
|
+
theme,
|
|
22
|
+
orientation: stylesSettings.orientation,
|
|
23
|
+
format,
|
|
24
|
+
},
|
|
25
|
+
["BAR_CHART_MS" /* CHART_TYPE.BAR_CHART_MS */]: {
|
|
26
|
+
color,
|
|
27
|
+
theme,
|
|
28
|
+
orientation: "VERTICAL" /* CHART_ORIENTATION.VERTICAL */,
|
|
29
|
+
format,
|
|
30
|
+
},
|
|
31
|
+
["SYMBOL_CHART" /* CHART_TYPE.SYMBOL_CHART */]: { color, theme, fill, symbol, format },
|
|
32
|
+
["SYMBOL_CHART_MS" /* CHART_TYPE.SYMBOL_CHART_MS */]: { color, theme, format, fill, symbol },
|
|
33
|
+
["LINE_CHART" /* CHART_TYPE.LINE_CHART */]: {
|
|
34
|
+
color,
|
|
35
|
+
theme,
|
|
36
|
+
thickness,
|
|
37
|
+
straight,
|
|
38
|
+
style,
|
|
39
|
+
format,
|
|
40
|
+
},
|
|
41
|
+
["LINE_CHART_MS" /* CHART_TYPE.LINE_CHART_MS */]: {
|
|
42
|
+
color,
|
|
43
|
+
theme,
|
|
44
|
+
thickness,
|
|
45
|
+
straight,
|
|
46
|
+
style,
|
|
47
|
+
format,
|
|
48
|
+
},
|
|
49
|
+
["COMBO_CHART" /* CHART_TYPE.COMBO_CHART */]: {
|
|
50
|
+
custom_color: optsCombo.custom_color,
|
|
51
|
+
custom_theme: optsCombo.custom_theme,
|
|
52
|
+
match_colors: optsCombo.match_colors,
|
|
53
|
+
color_type: optsCombo.color_type,
|
|
54
|
+
color: [optsCombo.color],
|
|
55
|
+
theme: optsCombo.theme,
|
|
56
|
+
thickness: optsCombo.thickness,
|
|
57
|
+
straight: optsCombo.line_type,
|
|
58
|
+
style: optsCombo.line_style,
|
|
59
|
+
format: Object.assign(Object.assign({}, format), { y_axis: optsCombo.format || _get(optsCombo, "y_axis.format.value") }),
|
|
60
|
+
symbol: optsCombo.symbol_type,
|
|
61
|
+
fill: optsCombo.symbol_fill,
|
|
62
|
+
axis_scale: _get(optsCombo, "y_axis.scale"),
|
|
63
|
+
},
|
|
64
|
+
["HEATMAP_CHART" /* CHART_TYPE.HEATMAP_CHART */]: {
|
|
65
|
+
orientation: "VERTICAL" /* CHART_ORIENTATION.VERTICAL */,
|
|
66
|
+
format,
|
|
67
|
+
},
|
|
68
|
+
["WORD_CLOUD" /* CHART_TYPE.WORD_CLOUD */]: {},
|
|
69
|
+
["PIE_CHART" /* CHART_TYPE.PIE_CHART */]: {
|
|
70
|
+
color,
|
|
71
|
+
theme,
|
|
72
|
+
format,
|
|
73
|
+
pielabel: ((_a = stylesSettings.data_labels) === null || _a === void 0 ? void 0 : _a.pie_labels)
|
|
74
|
+
? (_b = stylesSettings.data_labels.pie_labels) === null || _b === void 0 ? void 0 : _b.position
|
|
75
|
+
: "outside" /* PIE_LABEL_POSITION.OUTSIDE */,
|
|
76
|
+
donut: stylesSettings.pie_type === "donut" /* PIE_TYPE.DONUT */,
|
|
77
|
+
data_labels: (_c = stylesSettings.data_labels) === null || _c === void 0 ? void 0 : _c.value,
|
|
78
|
+
percent_labels: stylesSettings.percent_labels,
|
|
79
|
+
visible_labels: (_d = stylesSettings.data_labels) === null || _d === void 0 ? void 0 : _d.visible,
|
|
80
|
+
},
|
|
81
|
+
["MINMAX_CHART" /* CHART_TYPE.MINMAX_CHART */]: {
|
|
82
|
+
color,
|
|
83
|
+
theme,
|
|
84
|
+
symbol,
|
|
85
|
+
fill,
|
|
86
|
+
thickness,
|
|
87
|
+
straight,
|
|
88
|
+
style,
|
|
89
|
+
orientation: stylesSettings.orientation,
|
|
90
|
+
format,
|
|
91
|
+
opacity,
|
|
92
|
+
},
|
|
93
|
+
["REFERENCE" /* CHART_TYPE.REFERENCE */]: {
|
|
94
|
+
color,
|
|
95
|
+
theme,
|
|
96
|
+
fill: "None",
|
|
97
|
+
thickness,
|
|
98
|
+
style: "Solid",
|
|
99
|
+
opacity: 20,
|
|
100
|
+
},
|
|
101
|
+
["TREND" /* CHART_TYPE.TREND */]: { color, theme, style: "Solid", thickness },
|
|
102
|
+
["SMALL_MULTIPLES" /* CHART_TYPE.SMALL_MULTIPLES */]: {
|
|
103
|
+
maxMultiplePanels: 4,
|
|
104
|
+
displayMultiplePanels: false,
|
|
105
|
+
displayBorder: false,
|
|
106
|
+
labels: { axis: true },
|
|
107
|
+
},
|
|
108
|
+
["BOXWHISKER_CHART" /* CHART_TYPE.BOXWHISKER_CHART */]: {
|
|
109
|
+
thickness,
|
|
110
|
+
opacity: (100 - opacity) / 10,
|
|
111
|
+
displaySymbol: _get(stylesSettings, "outliers.value"),
|
|
112
|
+
symbol: _get(stylesSettings, "outliers.symbol_type"),
|
|
113
|
+
fill: _get(stylesSettings, "outliers.symbol_fill"),
|
|
114
|
+
orientation: stylesSettings.orientation,
|
|
115
|
+
},
|
|
116
|
+
["GEO_CHART" /* CHART_TYPE.GEO_CHART */]: {
|
|
117
|
+
baseMap: { text: "Streets", label: "mapbox://styles/mapbox/streets-v11" /* BASE_MAPS.STREET */ },
|
|
118
|
+
symbol: "circle",
|
|
119
|
+
opacity: 5,
|
|
120
|
+
mapborder: true,
|
|
121
|
+
mapRegion: { text: "Default", label: "DEFAULT" },
|
|
122
|
+
},
|
|
123
|
+
["GEO_CHART_BUBBLE" /* CHART_TYPE.GEO_CHART_BUBBLE */]: Object.assign({}, parseMaps(stylesSettings)),
|
|
124
|
+
["GEO_CHART_DOT" /* CHART_TYPE.GEO_CHART_DOT */]: Object.assign(Object.assign({}, parseMaps(stylesSettings)), { symbol, symbolfill: fill === "Filled" /* SYMBOL_FILL.FILLED */ }),
|
|
125
|
+
["GEO_CHART_CHOROPLETH" /* CHART_TYPE.GEO_CHART_CHOROPLETH */]: Object.assign({}, parseMaps(stylesSettings)),
|
|
126
|
+
["CROSSTAB_CHART" /* CHART_TYPE.CROSSTAB_CHART */]: {
|
|
127
|
+
format: _get(stylesSettings, "format.value"),
|
|
128
|
+
groupedTotals: {
|
|
129
|
+
label: _get(globalSettings, "crosstab_totals.value", false)
|
|
130
|
+
? _get(globalSettings, "crosstab_totals.option", "SHOW" /* CROSSTAB_TOTALS_VISUAL.SHOW */)
|
|
131
|
+
: "DONTSHOW" /* CROSSTAB_TOTALS_VISUAL.DONTSHOW */,
|
|
132
|
+
},
|
|
133
|
+
groupedSubtotals: {
|
|
134
|
+
label: _get(globalSettings, "crosstab_subtotals", false)
|
|
135
|
+
? "SHOW" /* CROSSTAB_TOTALS_VISUAL.SHOW */
|
|
136
|
+
: "DONTSHOW" /* CROSSTAB_TOTALS_VISUAL.DONTSHOW */,
|
|
137
|
+
},
|
|
138
|
+
rowsMaxDataPoints: _get(globalSettings, "max_rows.value", true),
|
|
139
|
+
columnsMaxDataPoints: _get(globalSettings, "max_groups.value", true),
|
|
140
|
+
maxRowNumDataPoints: _get(globalSettings, "max_rows.option", true),
|
|
141
|
+
maxColumnsNumDataPoints: _get(globalSettings, "max_groups.option", true),
|
|
142
|
+
},
|
|
143
|
+
["TABLE_CHART" /* CHART_TYPE.TABLE_CHART */]: {
|
|
144
|
+
sorting: _get(globalSettings, "table_menu.sorting"),
|
|
145
|
+
value_view: _get(globalSettings, "table_menu.value_view"),
|
|
146
|
+
totals: _get(globalSettings, "table_menu.totals"),
|
|
147
|
+
pagination: isGrouped
|
|
148
|
+
? {
|
|
149
|
+
enabled: false,
|
|
150
|
+
recordsPage: 30,
|
|
151
|
+
}
|
|
152
|
+
: _get(globalSettings, "table_menu.pagination"),
|
|
153
|
+
},
|
|
154
|
+
["EXPANDABLE_TABLE_CHART" /* CHART_TYPE.EXPANDABLE_TABLE_CHART */]: {
|
|
155
|
+
sorting: _get(globalSettings, "table_menu.sorting"),
|
|
156
|
+
value_view: _get(globalSettings, "table_menu.value_view"),
|
|
157
|
+
totals: _get(globalSettings, "table_menu.totals"),
|
|
158
|
+
},
|
|
159
|
+
["INDICATOR" /* CHART_TYPE.INDICATOR_METRIC */]: {
|
|
160
|
+
iconPosition: { label: _get(stylesSettings, "indicator_position") },
|
|
161
|
+
},
|
|
162
|
+
["DIAL" /* CHART_TYPE.DIAL_METRIC */]: {
|
|
163
|
+
color,
|
|
164
|
+
theme,
|
|
165
|
+
thresholdOpacity: opacity,
|
|
166
|
+
showComparison: _get(stylesSettings, "metric_comparison.value"),
|
|
167
|
+
comparisonColor: _get(stylesSettings, "metric_comparison.color"),
|
|
168
|
+
gaugeStyle: { label: _get(stylesSettings, "gauge") },
|
|
169
|
+
circleSize: { label: _get(stylesSettings, "dial_size") },
|
|
170
|
+
},
|
|
171
|
+
["BULLET" /* CHART_TYPE.BULLET_METRIC */]: {
|
|
172
|
+
color,
|
|
173
|
+
theme,
|
|
174
|
+
thresholdOpacity: opacity,
|
|
175
|
+
targetLabel: _get(stylesSettings, "bullet_target.label"),
|
|
176
|
+
targetColor: _get(stylesSettings, "bullet_target.color"),
|
|
177
|
+
targetIndicator: _get(stylesSettings, "bullet_target.indicator"),
|
|
178
|
+
targetValue: _get(stylesSettings, "bullet_target.value"),
|
|
179
|
+
},
|
|
180
|
+
["FUNNEL_CHART" /* CHART_TYPE.FUNNEL_CHART */]: Object.assign(Object.assign({}, stylesSettings), { orientation: stylesSettings.orientation }),
|
|
181
|
+
}[type] || {});
|
|
182
|
+
}
|
|
183
|
+
function parseMaps(stylesSettings) {
|
|
184
|
+
const { value, steps, min_value, max_value } = stylesSettings.custom_scale || {};
|
|
185
|
+
return {
|
|
186
|
+
baseMap: { label: _get(stylesSettings, "base_map") },
|
|
187
|
+
mapRegion: { label: _get(stylesSettings, "map_region") },
|
|
188
|
+
mapborder: _get(stylesSettings, "map_borders"),
|
|
189
|
+
opacity: _get(stylesSettings, "opacity", 10) / 10,
|
|
190
|
+
mapClustering: _get(stylesSettings, "map_clustering"),
|
|
191
|
+
mapDataLabels: _get(stylesSettings, "data_labels.value"),
|
|
192
|
+
color: {
|
|
193
|
+
values: (stylesSettings.theme || []).slice(0, 5),
|
|
194
|
+
},
|
|
195
|
+
custom: {
|
|
196
|
+
steps,
|
|
197
|
+
min: min_value,
|
|
198
|
+
max: max_value,
|
|
199
|
+
},
|
|
200
|
+
scale: {
|
|
201
|
+
type: value ? "Custom" : "Auto",
|
|
202
|
+
order: stylesSettings.reverse_color ? "Reverse" : "Default",
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function parseLabels(type, stylesSettings) {
|
|
207
|
+
var _a, _b, _c, _d, _e;
|
|
208
|
+
const noLabelCharts = [
|
|
209
|
+
"CROSSTAB_CHART" /* CHART_TYPE.CROSSTAB_CHART */,
|
|
210
|
+
"TABLE_CHART" /* CHART_TYPE.TABLE_CHART */,
|
|
211
|
+
"EXPANDABLE_TABLE_CHART" /* CHART_TYPE.EXPANDABLE_TABLE_CHART */,
|
|
212
|
+
"INDICATOR" /* CHART_TYPE.INDICATOR_METRIC */,
|
|
213
|
+
"DIAL" /* CHART_TYPE.DIAL_METRIC */,
|
|
214
|
+
"BULLET" /* CHART_TYPE.BULLET_METRIC */,
|
|
215
|
+
];
|
|
216
|
+
if (noLabelCharts.includes(type))
|
|
217
|
+
return false;
|
|
218
|
+
if (type === "PIE_CHART" /* CHART_TYPE.PIE_CHART */)
|
|
219
|
+
return stylesSettings.data_labels.value;
|
|
220
|
+
const labels = {
|
|
221
|
+
axis: {
|
|
222
|
+
x: {
|
|
223
|
+
enabled: stylesSettings.x_axis.showAxisTitle,
|
|
224
|
+
fontColor: stylesSettings.x_axis.fontColor,
|
|
225
|
+
fontSize: stylesSettings.x_axis.fontSize,
|
|
226
|
+
fontType: stylesSettings.x_axis.fontType,
|
|
227
|
+
fontWeight: stylesSettings.x_axis.fontWeight,
|
|
228
|
+
},
|
|
229
|
+
y: {
|
|
230
|
+
enabled: stylesSettings.y_axis.showAxisTitle,
|
|
231
|
+
fontColor: stylesSettings.y_axis.fontColor,
|
|
232
|
+
fontSize: stylesSettings.y_axis.fontSize,
|
|
233
|
+
fontType: stylesSettings.y_axis.fontType,
|
|
234
|
+
fontWeight: stylesSettings.y_axis.fontWeight,
|
|
235
|
+
},
|
|
236
|
+
pivot: {
|
|
237
|
+
enabled: (_a = stylesSettings === null || stylesSettings === void 0 ? void 0 : stylesSettings.pivot_axis) === null || _a === void 0 ? void 0 : _a.showAxisTitle,
|
|
238
|
+
fontColor: (_b = stylesSettings === null || stylesSettings === void 0 ? void 0 : stylesSettings.pivot_axis) === null || _b === void 0 ? void 0 : _b.fontColor,
|
|
239
|
+
fontSize: (_c = stylesSettings === null || stylesSettings === void 0 ? void 0 : stylesSettings.pivot_axis) === null || _c === void 0 ? void 0 : _c.fontSize,
|
|
240
|
+
fontType: (_d = stylesSettings === null || stylesSettings === void 0 ? void 0 : stylesSettings.pivot_axis) === null || _d === void 0 ? void 0 : _d.fontType,
|
|
241
|
+
fontWeight: (_e = stylesSettings === null || stylesSettings === void 0 ? void 0 : stylesSettings.pivot_axis) === null || _e === void 0 ? void 0 : _e.fontWeight,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
value: {
|
|
245
|
+
x: {
|
|
246
|
+
enabled: stylesSettings.x_axis.values,
|
|
247
|
+
rotation: stylesSettings.x_axis.rotation,
|
|
248
|
+
fontColor: stylesSettings.x_axis.fontColorValues,
|
|
249
|
+
fontSize: stylesSettings.x_axis.fontSizeValues,
|
|
250
|
+
fontType: stylesSettings.x_axis.fontTypeValues,
|
|
251
|
+
fontWeight: stylesSettings.x_axis.fontWeightValues,
|
|
252
|
+
},
|
|
253
|
+
y: {
|
|
254
|
+
enabled: stylesSettings.y_axis.values,
|
|
255
|
+
rotation: stylesSettings.y_axis.rotation,
|
|
256
|
+
fontColor: stylesSettings.y_axis.fontColorValues,
|
|
257
|
+
fontSize: stylesSettings.y_axis.fontSizeValues,
|
|
258
|
+
fontType: stylesSettings.y_axis.fontTypeValues,
|
|
259
|
+
fontWeight: stylesSettings.y_axis.fontWeightValues,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
data: {
|
|
263
|
+
enabled: stylesSettings.data_labels.value,
|
|
264
|
+
border: _get(stylesSettings, "data_labels.simple_labels.border", true),
|
|
265
|
+
},
|
|
266
|
+
scale: {
|
|
267
|
+
x: stylesSettings.x_axis.scale,
|
|
268
|
+
y: stylesSettings.y_axis.scale,
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
if (type === "HEATMAP_CHART" /* CHART_TYPE.HEATMAP_CHART */)
|
|
272
|
+
delete labels.data;
|
|
273
|
+
return labels;
|
|
274
|
+
}
|
|
275
|
+
function parseHeatMap(stylesSettings) {
|
|
276
|
+
return {
|
|
277
|
+
celltext: _get(stylesSettings, "data_labels.value"),
|
|
278
|
+
color: {
|
|
279
|
+
values: (stylesSettings.theme || []).slice(0, 5),
|
|
280
|
+
},
|
|
281
|
+
custom: {
|
|
282
|
+
steps: _get(stylesSettings, "custom_scale.steps"),
|
|
283
|
+
min: _get(stylesSettings, "custom_scale.min_value"),
|
|
284
|
+
max: _get(stylesSettings, "custom_scale.max_value"),
|
|
285
|
+
},
|
|
286
|
+
gap: Object.assign({}, stylesSettings.gaps),
|
|
287
|
+
yAxisRotation: _get(stylesSettings, "y_axis.rotation"),
|
|
288
|
+
labelRotation: _get(stylesSettings, "pivot_axis.rotation"),
|
|
289
|
+
scale: {
|
|
290
|
+
type: _get(stylesSettings, "custom_scale.value") ? "Custom" : "Auto",
|
|
291
|
+
order: stylesSettings.reverse_color ? "Reverse" : "Default",
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function parseTableChart({ stylesSettings, globalSettings }) {
|
|
296
|
+
return {
|
|
297
|
+
size: globalSettings.size,
|
|
298
|
+
maxNumGroups: _get(globalSettings, "max_groups.option"),
|
|
299
|
+
theme: {
|
|
300
|
+
name: "Theme 1",
|
|
301
|
+
values: stylesSettings.color,
|
|
302
|
+
},
|
|
303
|
+
maxNumRows: _get(globalSettings, "max_rows.option"),
|
|
304
|
+
sort_by_column: _get(globalSettings, "sort_by_column"),
|
|
305
|
+
sort_by_multi_columns: _get(globalSettings, "sort_by_multi_columns"),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function parseCrosstabChart({ stylesSettings, globalSettings }) {
|
|
309
|
+
return {
|
|
310
|
+
size: globalSettings.size,
|
|
311
|
+
theme: {
|
|
312
|
+
name: "Theme 1",
|
|
313
|
+
values: stylesSettings.color,
|
|
314
|
+
},
|
|
315
|
+
labels: _get(globalSettings, "crosstab_labels.value"),
|
|
316
|
+
sortX: _get(globalSettings, "crosstab_labels.option.sorting"),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function parseMetricGlobal({ globalSettings, stylesSettings, }) {
|
|
320
|
+
let format = _get(stylesSettings, "format.value", "Default" /* FORMATS.DEFAULT */);
|
|
321
|
+
const templateFormat = _get(stylesSettings, "format.template") ||
|
|
322
|
+
_get(stylesSettings, "y_axis.format.template");
|
|
323
|
+
if (_get(stylesSettings, "format.value", "") === "Numeric" /* FORMATS.NUMERIC */)
|
|
324
|
+
format = "Decimal" /* FORMATS.DECIMAL */;
|
|
325
|
+
return {
|
|
326
|
+
numberFormat: format,
|
|
327
|
+
templateFormat,
|
|
328
|
+
comparisonType: "CHANGE",
|
|
329
|
+
desctription: false,
|
|
330
|
+
animation: _get(stylesSettings, "animation", {}),
|
|
331
|
+
indicator_font: _get(stylesSettings, "indicator_font", {}),
|
|
332
|
+
indicator_symbol: _get(stylesSettings, "indicator_symbol", {}),
|
|
333
|
+
comparison_font: _get(stylesSettings, "comparison_font", {}),
|
|
334
|
+
decimals: _get(stylesSettings, "format.decimals", 2),
|
|
335
|
+
currency: { label: _get(stylesSettings, "format.currency", "$") },
|
|
336
|
+
fixedScale: {
|
|
337
|
+
min: _get(globalSettings, "metric_scale.value", false)
|
|
338
|
+
? _get(globalSettings, "metric_scale.min_value")
|
|
339
|
+
: null,
|
|
340
|
+
max: _get(globalSettings, "metric_scale.value", false)
|
|
341
|
+
? _get(globalSettings, "metric_scale.max_value")
|
|
342
|
+
: null,
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
export function parseGlobalSettingByType(type, { stylesSettings, globalSettings, dimensions }) {
|
|
347
|
+
const theme = { values: stylesSettings.theme };
|
|
348
|
+
const typeCategory = _get(dimensions === null || dimensions === void 0 ? void 0 : dimensions.categories, "[0].type");
|
|
349
|
+
const typeValue = _get(dimensions === null || dimensions === void 0 ? void 0 : dimensions.values, "[0].type");
|
|
350
|
+
const trueTypeCategory = typeCategory || typeValue;
|
|
351
|
+
const base = {
|
|
352
|
+
color_type: _get(stylesSettings, "color_type"),
|
|
353
|
+
match_colors: _get(stylesSettings, "match_colors"),
|
|
354
|
+
custom_color: _get(stylesSettings, "custom_color"),
|
|
355
|
+
custom_theme: _get(stylesSettings, "custom_theme"),
|
|
356
|
+
theme,
|
|
357
|
+
size: globalSettings.size,
|
|
358
|
+
labels: parseLabels(type, stylesSettings),
|
|
359
|
+
legends: globalSettings.legend
|
|
360
|
+
? globalSettings.legend !== "NONE" /* LEGEND_STATE.NONE */
|
|
361
|
+
: false,
|
|
362
|
+
tooltips: _get(globalSettings, "tooltips.value"),
|
|
363
|
+
custom_tooltips: _get(globalSettings, "tooltips.advanced"),
|
|
364
|
+
scale: {
|
|
365
|
+
type: _get(stylesSettings, "custom_scale.value") ? "Custom" : "Auto",
|
|
366
|
+
order: stylesSettings.reverse_color ? "Reverse" : "Default",
|
|
367
|
+
},
|
|
368
|
+
// size: 3,
|
|
369
|
+
sortX: getSortByType(globalSettings, type),
|
|
370
|
+
sortAggregation: globalSettings.aggregation_sort,
|
|
371
|
+
sortCalculation: globalSettings.table_calculation_sort,
|
|
372
|
+
calculation_direction: globalSettings.calculation_direction,
|
|
373
|
+
maxNumValuePoints: _get(globalSettings, "max_value_point.option", 500),
|
|
374
|
+
maxNumDataPoints: _get(globalSettings, "max_data_point.option"),
|
|
375
|
+
maxDataPoints: trueTypeCategory === "DATE"
|
|
376
|
+
? false
|
|
377
|
+
: _get(globalSettings, "max_data_point.value"),
|
|
378
|
+
average: globalSettings.average,
|
|
379
|
+
startDate: globalSettings.startDate,
|
|
380
|
+
endDate: globalSettings.endDate,
|
|
381
|
+
startTime: globalSettings.startTime,
|
|
382
|
+
endTime: globalSettings.endTime,
|
|
383
|
+
startNumeric: globalSettings.startNumeric,
|
|
384
|
+
endNumeric: globalSettings.endNumeric,
|
|
385
|
+
chartVersion: _get(globalSettings, "chartVersion"),
|
|
386
|
+
};
|
|
387
|
+
return ({
|
|
388
|
+
["BAR_CHART" /* CHART_TYPE.BAR_CHART */]: Object.assign(Object.assign({}, base), { hideShading: !stylesSettings.shadding, fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
389
|
+
["BAR_CHART_MS" /* CHART_TYPE.BAR_CHART_MS */]: Object.assign(Object.assign({}, base), { hideShading: true, fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
390
|
+
["SYMBOL_CHART" /* CHART_TYPE.SYMBOL_CHART */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
391
|
+
["SYMBOL_CHART_MS" /* CHART_TYPE.SYMBOL_CHART_MS */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
392
|
+
["LINE_CHART" /* CHART_TYPE.LINE_CHART */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
393
|
+
["LINE_CHART_MS" /* CHART_TYPE.LINE_CHART_MS */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
394
|
+
["COMBO_CHART" /* CHART_TYPE.COMBO_CHART */]: Object.assign(Object.assign({}, base), { hideShading: true, fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
395
|
+
["HEATMAP_CHART" /* CHART_TYPE.HEATMAP_CHART */]: Object.assign(Object.assign({}, base), parseHeatMap(stylesSettings)),
|
|
396
|
+
["WORD_CLOUD" /* CHART_TYPE.WORD_CLOUD */]: Object.assign({}, base),
|
|
397
|
+
["MINMAX_CHART" /* CHART_TYPE.MINMAX_CHART */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
398
|
+
["PIE_CHART" /* CHART_TYPE.PIE_CHART */]: Object.assign({}, base),
|
|
399
|
+
["REFERENCE" /* CHART_TYPE.REFERENCE */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
400
|
+
["TREND" /* CHART_TYPE.TREND */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
401
|
+
["SMALL_MULTIPLES" /* CHART_TYPE.SMALL_MULTIPLES */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
402
|
+
["BOXWHISKER_CHART" /* CHART_TYPE.BOXWHISKER_CHART */]: Object.assign(Object.assign({}, base), { enableDataLabels: true, labelRotation: _get(stylesSettings, "x_axis.rotation"), orientation: capitalize((stylesSettings.orientation || "").toString()), hasPivot: globalSettings.hasPivot }),
|
|
403
|
+
["GEO_CHART_BUBBLE" /* CHART_TYPE.GEO_CHART_BUBBLE */]: Object.assign(Object.assign({}, base), { theme: { values: [stylesSettings.color] } }),
|
|
404
|
+
["GEO_CHART_DOT" /* CHART_TYPE.GEO_CHART_DOT */]: Object.assign(Object.assign({}, base), { theme: { values: [stylesSettings.color] }, legends: false }),
|
|
405
|
+
["GEO_CHART_CHOROPLETH" /* CHART_TYPE.GEO_CHART_CHOROPLETH */]: Object.assign(Object.assign({}, base), { theme: { values: [stylesSettings.color] } }),
|
|
406
|
+
["GEO_CHART" /* CHART_TYPE.GEO_CHART */]: Object.assign({}, base),
|
|
407
|
+
["CROSSTAB_CHART" /* CHART_TYPE.CROSSTAB_CHART */]: Object.assign({}, parseCrosstabChart({ globalSettings, stylesSettings })),
|
|
408
|
+
["TABLE_CHART" /* CHART_TYPE.TABLE_CHART */]: Object.assign({}, parseTableChart({ globalSettings, stylesSettings })),
|
|
409
|
+
["EXPANDABLE_TABLE_CHART" /* CHART_TYPE.EXPANDABLE_TABLE_CHART */]: Object.assign({}, parseTableChart({ globalSettings, stylesSettings })),
|
|
410
|
+
["INDICATOR" /* CHART_TYPE.INDICATOR_METRIC */]: Object.assign(Object.assign({}, parseMetricGlobal({ globalSettings, stylesSettings })), { tooltips: base.tooltips, custom_tooltips: base.custom_tooltips }),
|
|
411
|
+
["DIAL" /* CHART_TYPE.DIAL_METRIC */]: Object.assign(Object.assign({}, parseMetricGlobal({ globalSettings, stylesSettings })), { legend: base.legends, tooltips: base.tooltips, custom_tooltips: base.custom_tooltips }),
|
|
412
|
+
["BULLET" /* CHART_TYPE.BULLET_METRIC */]: Object.assign(Object.assign({}, parseMetricGlobal({ globalSettings, stylesSettings })), { legend: base.legends, tooltips: base.tooltips, custom_tooltips: base.custom_tooltips }),
|
|
413
|
+
["FUNNEL_CHART" /* CHART_TYPE.FUNNEL_CHART */]: Object.assign(Object.assign({}, base), { fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
414
|
+
["COMBINED_CHART" /* CHART_TYPE.COMBINED_CHART */]: Object.assign(Object.assign({}, base), { hideShading: true, fit_panel: _get(globalSettings, "fit_panel", false) }),
|
|
415
|
+
}[type] || {});
|
|
416
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChartType, TIME_PERIOD, TP_CUSTOM_RANGE } from "../adapters/chartBuilderDefinitions";
|
|
2
|
+
/**
|
|
3
|
+
* simple deepclone
|
|
4
|
+
*/
|
|
5
|
+
export declare const jsonCopy: <T = any>(obj?: string | T) => T;
|
|
6
|
+
export declare const _cloneDeep: <T = any>(obj?: string | T) => T;
|
|
7
|
+
/**
|
|
8
|
+
* Like lodash _.get
|
|
9
|
+
*/
|
|
10
|
+
export declare const _get: (baseObject: any, key: string, fallback?: any) => any;
|
|
11
|
+
export declare const _isEmpty: (obj: any) => boolean;
|
|
12
|
+
export declare const _pick: (baseObject: any, keys: string[]) => {};
|
|
13
|
+
export declare const randomKey: () => string;
|
|
14
|
+
/**
|
|
15
|
+
* Capitalize string
|
|
16
|
+
*/
|
|
17
|
+
export declare const capitalize: (text: string) => string;
|
|
18
|
+
export declare function getSortByType(globalSettings: any, type: ChartType): any;
|
|
19
|
+
/**
|
|
20
|
+
* Returns True or false when column type property is a date column.
|
|
21
|
+
* In cases when column type is a Formula, validate if formulaType property is a date one.
|
|
22
|
+
* @param column Webforms or Dataset Column object
|
|
23
|
+
* @return True if the column is a date column otherwise is not.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isColumnDate: (column: any) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Column Key Indetifier Generator
|
|
28
|
+
* @param id QuestionId
|
|
29
|
+
* @param type Question Type
|
|
30
|
+
* @param prop Extra property for compound or complex data type
|
|
31
|
+
* @param index column index in table (to support the same column multiple times)
|
|
32
|
+
*/
|
|
33
|
+
export declare const columnKey: (id: any, type: any, prop?: any, index?: any) => string;
|
|
34
|
+
export declare const timePeriod: {
|
|
35
|
+
text: string;
|
|
36
|
+
label: TIME_PERIOD;
|
|
37
|
+
key: string;
|
|
38
|
+
}[];
|
|
39
|
+
export declare const timePeriodCustomRange: {
|
|
40
|
+
text: string;
|
|
41
|
+
label: TP_CUSTOM_RANGE;
|
|
42
|
+
key: string;
|
|
43
|
+
}[];
|
|
44
|
+
export declare const isTimeColumn: (column?: any) => boolean;
|
|
45
|
+
export declare function allowTableCalculation(chartType: ChartType): boolean;
|
|
46
|
+
export declare function hasReferenceLayer(references: any): boolean;
|
|
47
|
+
export declare function hasSmallMultiple(list: any[]): boolean;
|
|
48
|
+
export declare function hasTrendLayer(trend: any): boolean;
|
|
49
|
+
export declare function isChartBasic(type: ChartType): boolean;
|
|
50
|
+
export declare function isChartMap(type: any): boolean;
|
|
51
|
+
export declare function isChartMetric(type: any): boolean;
|
|
52
|
+
export declare function isChartMultiserie(type: any): boolean;
|
|
53
|
+
export declare function isChartMinMax(type: any): boolean;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* simple deepclone
|
|
3
|
+
*/
|
|
4
|
+
export const jsonCopy = (obj = "") => {
|
|
5
|
+
return JSON.parse(JSON.stringify(obj));
|
|
6
|
+
};
|
|
7
|
+
export const _cloneDeep = jsonCopy; //
|
|
8
|
+
/**
|
|
9
|
+
* Like lodash _.get
|
|
10
|
+
*/
|
|
11
|
+
export const _get = (baseObject, key, fallback) => {
|
|
12
|
+
function fn() {
|
|
13
|
+
try {
|
|
14
|
+
// tslint:disable-next-line:no-eval
|
|
15
|
+
const value = eval(`this.${key}`.replace(".[", "["));
|
|
16
|
+
return typeof value !== "undefined" ? value : fallback;
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
return fallback;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return fn.apply(baseObject, null);
|
|
23
|
+
};
|
|
24
|
+
export const _isEmpty = (obj) => Object.keys(obj || "").length === 0;
|
|
25
|
+
export const _pick = (baseObject, keys) => {
|
|
26
|
+
return keys.reduce((newObj, attr) => {
|
|
27
|
+
if (attr in baseObject)
|
|
28
|
+
newObj[attr] = baseObject[attr];
|
|
29
|
+
return newObj;
|
|
30
|
+
}, {});
|
|
31
|
+
};
|
|
32
|
+
export const randomKey = () => {
|
|
33
|
+
return (Date.now() + Math.random() * 1e17).toString(36);
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Capitalize string
|
|
37
|
+
*/
|
|
38
|
+
export const capitalize = (text) => text.toLowerCase().replace(/^\w/, (c) => c.toUpperCase());
|
|
39
|
+
function getSortBy(type) {
|
|
40
|
+
return [
|
|
41
|
+
"BAR_CHART" /* CHART_TYPE.BAR_CHART */,
|
|
42
|
+
"LINE_CHART" /* CHART_TYPE.LINE_CHART */,
|
|
43
|
+
"SYMBOL_CHART" /* CHART_TYPE.SYMBOL_CHART */,
|
|
44
|
+
"MINMAX_CHART" /* CHART_TYPE.MINMAX_CHART */,
|
|
45
|
+
"COMBO_CHART" /* CHART_TYPE.COMBO_CHART */,
|
|
46
|
+
"BAR_CHART_MS" /* CHART_TYPE.BAR_CHART_MS */,
|
|
47
|
+
"LINE_CHART_MS" /* CHART_TYPE.LINE_CHART_MS */,
|
|
48
|
+
"SYMBOL_CHART_MS" /* CHART_TYPE.SYMBOL_CHART_MS */,
|
|
49
|
+
"FUNNEL_CHART" /* CHART_TYPE.FUNNEL_CHART */,
|
|
50
|
+
"HEATMAP_CHART" /* CHART_TYPE.HEATMAP_CHART */,
|
|
51
|
+
"COMBINED_CHART" /* CHART_TYPE.COMBINED_CHART */,
|
|
52
|
+
].includes(type)
|
|
53
|
+
? "sort_by_column"
|
|
54
|
+
: "sort_by";
|
|
55
|
+
}
|
|
56
|
+
export function getSortByType(globalSettings, type) {
|
|
57
|
+
return (_get(globalSettings, getSortBy(type)) ||
|
|
58
|
+
_get(globalSettings, "sort_by") || {
|
|
59
|
+
type: "Value" /* ACTION_SORT.VALUE */,
|
|
60
|
+
order: "Desc" /* ACTION_SORT_DIR.DESC */,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns True or false when column type property is a date column.
|
|
65
|
+
* In cases when column type is a Formula, validate if formulaType property is a date one.
|
|
66
|
+
* @param column Webforms or Dataset Column object
|
|
67
|
+
* @return True if the column is a date column otherwise is not.
|
|
68
|
+
*/
|
|
69
|
+
export const isColumnDate = (column) => {
|
|
70
|
+
if (column == null)
|
|
71
|
+
return;
|
|
72
|
+
return (column.type === "DATE" ||
|
|
73
|
+
(column.type === "FORMULA" && column.formulaType === "date"));
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Column Key Indetifier Generator
|
|
77
|
+
* @param id QuestionId
|
|
78
|
+
* @param type Question Type
|
|
79
|
+
* @param prop Extra property for compound or complex data type
|
|
80
|
+
* @param index column index in table (to support the same column multiple times)
|
|
81
|
+
*/
|
|
82
|
+
export const columnKey = (id, type, prop = "", index) => {
|
|
83
|
+
const _prop = prop !== null ? (prop === null || prop === void 0 ? void 0 : prop.value) || prop || "" : "";
|
|
84
|
+
const idx = index === undefined ? "" : `|${index || ""}`;
|
|
85
|
+
return `${id}|${type}|${_prop}${idx}`;
|
|
86
|
+
};
|
|
87
|
+
export const timePeriod = [
|
|
88
|
+
{ text: "This second", label: "THIS_SECOND" /* TIME_PERIOD.THIS_SECOND */, key: "this_second" },
|
|
89
|
+
{ text: "Last second", label: "LAST_SECOND" /* TIME_PERIOD.LAST_SECOND */, key: "last_second" },
|
|
90
|
+
{ text: "This minute", label: "THIS_MINUTE" /* TIME_PERIOD.THIS_MINUTE */, key: "this_minute" },
|
|
91
|
+
{ text: "Last minute", label: "LAST_MINUTE" /* TIME_PERIOD.LAST_MINUTE */, key: "last_minute" },
|
|
92
|
+
{ text: "This hour", label: "THIS_HOUR" /* TIME_PERIOD.THIS_HOUR */, key: "this_hour" },
|
|
93
|
+
{ text: "Last hour", label: "LAST_HOUR" /* TIME_PERIOD.LAST_HOUR */, key: "last_hour" },
|
|
94
|
+
{ text: "Today", label: "TODAY" /* TIME_PERIOD.TODAY */, key: "today" },
|
|
95
|
+
{ text: "Yesterday", label: "YESTERDAY" /* TIME_PERIOD.YESTERDAY */, key: "yesterday" },
|
|
96
|
+
{ text: "This week", label: "THIS_WEEK" /* TIME_PERIOD.THIS_WEEK */, key: "this_week" },
|
|
97
|
+
{ text: "Last week", label: "LAST_WEEK" /* TIME_PERIOD.LAST_WEEK */, key: "last_week" },
|
|
98
|
+
{ text: "This month", label: "THIS_MONTH" /* TIME_PERIOD.THIS_MONTH */, key: "this_month" },
|
|
99
|
+
{ text: "Last month", label: "LAST_MONTH" /* TIME_PERIOD.LAST_MONTH */, key: "last_month" },
|
|
100
|
+
{
|
|
101
|
+
text: "This quarter",
|
|
102
|
+
label: "THIS_QUARTER" /* TIME_PERIOD.THIS_QUARTER */,
|
|
103
|
+
key: "this_quarter",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
text: "Last quarter",
|
|
107
|
+
label: "LAST_QUARTER" /* TIME_PERIOD.LAST_QUARTER */,
|
|
108
|
+
key: "last_quarter",
|
|
109
|
+
},
|
|
110
|
+
{ text: "This year", label: "THIS_YEAR" /* TIME_PERIOD.THIS_YEAR */, key: "this_year" },
|
|
111
|
+
{ text: "Last year", label: "LAST_YEAR" /* TIME_PERIOD.LAST_YEAR */, key: "last_year" },
|
|
112
|
+
{ text: "All history", label: "ALL_HISTORY" /* TIME_PERIOD.ALL_HISTORY */, key: "all_history" },
|
|
113
|
+
{
|
|
114
|
+
text: "Custom Range",
|
|
115
|
+
label: "CUSTOM_RANGE" /* TIME_PERIOD.CUSTOM_RANGE */,
|
|
116
|
+
key: "custom_range",
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
export const timePeriodCustomRange = [
|
|
120
|
+
{ text: "Before", label: "BEFORE" /* TP_CUSTOM_RANGE.BEFORE */, key: "before" },
|
|
121
|
+
{ text: "After", label: "AFTER" /* TP_CUSTOM_RANGE.AFTER */, key: "after" },
|
|
122
|
+
{ text: "Between", label: "BETWEEN" /* TP_CUSTOM_RANGE.BETWEEN */, key: "between" },
|
|
123
|
+
];
|
|
124
|
+
export const isTimeColumn = (column = {}) => column.type === "TIME";
|
|
125
|
+
export function allowTableCalculation(chartType) {
|
|
126
|
+
const supportedCharts = getChartsSupportingTableCalculation();
|
|
127
|
+
return supportedCharts.includes(chartType);
|
|
128
|
+
}
|
|
129
|
+
function getChartsSupportingTableCalculation() {
|
|
130
|
+
return [
|
|
131
|
+
"TABLE_CHART" /* CHART_TYPE.TABLE_CHART */,
|
|
132
|
+
"BAR_CHART" /* CHART_TYPE.BAR_CHART */,
|
|
133
|
+
"LINE_CHART" /* CHART_TYPE.LINE_CHART */,
|
|
134
|
+
"HEATMAP_CHART" /* CHART_TYPE.HEATMAP_CHART */,
|
|
135
|
+
"COMBO_CHART" /* CHART_TYPE.COMBO_CHART */,
|
|
136
|
+
"BAR_CHART_MS" /* CHART_TYPE.BAR_CHART_MS */,
|
|
137
|
+
"LINE_CHART_MS" /* CHART_TYPE.LINE_CHART_MS */,
|
|
138
|
+
"SYMBOL_CHART_MS" /* CHART_TYPE.SYMBOL_CHART_MS */,
|
|
139
|
+
"FUNNEL_CHART" /* CHART_TYPE.FUNNEL_CHART */,
|
|
140
|
+
"COMBINED_CHART" /* CHART_TYPE.COMBINED_CHART */,
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
export function hasReferenceLayer(references) {
|
|
144
|
+
return (references === null || references === void 0 ? void 0 : references.filter((ref) => !_isEmpty(ref.axis)).length) > 0;
|
|
145
|
+
}
|
|
146
|
+
export function hasSmallMultiple(list) {
|
|
147
|
+
return (list === null || list === void 0 ? void 0 : list.length) > 0;
|
|
148
|
+
}
|
|
149
|
+
export function hasTrendLayer(trend) {
|
|
150
|
+
return trend && trend[0] ? trend[0].type !== "NONE" /* TREND_LINE_TYPE.NONE */ : false;
|
|
151
|
+
}
|
|
152
|
+
const CHART_BASE = [
|
|
153
|
+
"BAR_CHART" /* CHART_TYPE.BAR_CHART */,
|
|
154
|
+
"LINE_CHART" /* CHART_TYPE.LINE_CHART */,
|
|
155
|
+
"SYMBOL_CHART" /* CHART_TYPE.SYMBOL_CHART */,
|
|
156
|
+
"MINMAX_CHART" /* CHART_TYPE.MINMAX_CHART */,
|
|
157
|
+
];
|
|
158
|
+
const CHART_MS = [
|
|
159
|
+
"BAR_CHART_MS" /* CHART_TYPE.BAR_CHART_MS */,
|
|
160
|
+
"LINE_CHART_MS" /* CHART_TYPE.LINE_CHART_MS */,
|
|
161
|
+
"SYMBOL_CHART_MS" /* CHART_TYPE.SYMBOL_CHART_MS */,
|
|
162
|
+
"COMBINED_CHART" /* CHART_TYPE.COMBINED_CHART */,
|
|
163
|
+
];
|
|
164
|
+
const CHART_MAPS = [
|
|
165
|
+
"GEO_CHART_BUBBLE" /* CHART_TYPE.GEO_CHART_BUBBLE */,
|
|
166
|
+
"GEO_CHART_DOT" /* CHART_TYPE.GEO_CHART_DOT */,
|
|
167
|
+
"GEO_CHART_CHOROPLETH" /* CHART_TYPE.GEO_CHART_CHOROPLETH */,
|
|
168
|
+
"GEO_CHART" /* CHART_TYPE.GEO_CHART */,
|
|
169
|
+
];
|
|
170
|
+
const CHART_METRIC = [
|
|
171
|
+
"INDICATOR" /* CHART_TYPE.INDICATOR_METRIC */,
|
|
172
|
+
"DIAL" /* CHART_TYPE.DIAL_METRIC */,
|
|
173
|
+
"BULLET" /* CHART_TYPE.BULLET_METRIC */,
|
|
174
|
+
];
|
|
175
|
+
const CHART_MINMAX = ["MINMAX_CHART" /* CHART_TYPE.MINMAX_CHART */];
|
|
176
|
+
export function isChartBasic(type) {
|
|
177
|
+
return CHART_BASE.includes(type);
|
|
178
|
+
}
|
|
179
|
+
export function isChartMap(type) {
|
|
180
|
+
return CHART_MAPS.includes(type);
|
|
181
|
+
}
|
|
182
|
+
export function isChartMetric(type) {
|
|
183
|
+
return CHART_METRIC.includes(type);
|
|
184
|
+
}
|
|
185
|
+
export function isChartMultiserie(type) {
|
|
186
|
+
return CHART_MS.includes(type);
|
|
187
|
+
}
|
|
188
|
+
export function isChartMinMax(type) {
|
|
189
|
+
return CHART_MINMAX.includes(type);
|
|
190
|
+
}
|