sea-chart 0.0.76 → 0.0.78-alpha.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/components/statistic-record-dialog/index.js +4 -11
- package/dist/constants/index.js +45 -0
- package/dist/locale/lang/de.js +5 -3
- package/dist/locale/lang/en.js +2 -0
- package/dist/locale/lang/es.js +2 -0
- package/dist/locale/lang/fr.js +6 -4
- package/dist/locale/lang/pt.js +2 -0
- package/dist/locale/lang/ru.js +2 -0
- package/dist/locale/lang/zh_CN.js +4 -2
- package/dist/settings/advance-bar-settings/data-settings.js +2 -1
- package/dist/settings/bar-settings/data-settings.js +2 -1
- package/dist/settings/widgets/group-by.js +2 -1
- package/dist/utils/chart-utils/base-utils.js +26 -1
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +4 -4
- package/dist/utils/chart-utils/original-data-utils/index.js +2 -1
- package/dist/utils/chart-utils/sql-statistics-utils.js +130 -124
- package/dist/utils/column-utils.js +48 -137
- package/dist/utils/index.js +20 -1
- package/dist/utils/row-record-utils.js +60 -1
- package/dist/view/wrapper/table/index.css +0 -4
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +11 -4
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +11 -4
- package/dist/view/wrapper/table/pivot-table-display-name.js +10 -2
- package/dist/view/wrapper/table/two-dimension-table.js +18 -8
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import DtableSearchInput from '../dtable-search-input';
|
|
|
8
8
|
import Loading from '../loading';
|
|
9
9
|
import { searchRows } from '../../utils/search';
|
|
10
10
|
import ChartDataSQL from '../../utils/sql/chart-data-sql';
|
|
11
|
+
import { getFilterConditions } from '../../utils/row-record-utils';
|
|
11
12
|
import RowCard from '../row-card/row-card';
|
|
12
13
|
import { CommonEventTypes } from '../../constants/common-constants';
|
|
13
14
|
import './index.css';
|
|
@@ -31,8 +32,7 @@ class StatisticRecordDialog extends React.Component {
|
|
|
31
32
|
} = statisticRecord || {};
|
|
32
33
|
const {
|
|
33
34
|
table_id,
|
|
34
|
-
view_id
|
|
35
|
-
filters
|
|
35
|
+
view_id
|
|
36
36
|
} = chart.config;
|
|
37
37
|
this.table = getTableById(tables, table_id);
|
|
38
38
|
if (view_id) {
|
|
@@ -44,15 +44,8 @@ class StatisticRecordDialog extends React.Component {
|
|
|
44
44
|
if (this.isArchiveView || !isCalculateByView || statisticRecord.isQueryBySql) {
|
|
45
45
|
var _context$api, _context$api2;
|
|
46
46
|
if ((_context$api = context.api) === null || _context$api === void 0 ? void 0 : _context$api.customQueryRows) {
|
|
47
|
-
const newFilters = (filters === null || filters === void 0 ? void 0 : filters.map(item => {
|
|
48
|
-
return {
|
|
49
|
-
...item,
|
|
50
|
-
column_key: (item === null || item === void 0 ? void 0 : item.column_key) || '',
|
|
51
|
-
value: (item === null || item === void 0 ? void 0 : item.filter_term) || ''
|
|
52
|
-
};
|
|
53
|
-
})) || [];
|
|
54
47
|
const detailFilterConditions = {
|
|
55
|
-
filters:
|
|
48
|
+
filters: getFilterConditions(statisticRecord, chart, this.table.columns)
|
|
56
49
|
};
|
|
57
50
|
context.api.customQueryRows(detailFilterConditions).then(res => {
|
|
58
51
|
const {
|
|
@@ -255,7 +248,7 @@ class StatisticRecordDialog extends React.Component {
|
|
|
255
248
|
window.app.cacheFormulaResults(table.rows, {
|
|
256
249
|
targetViewId: view._id,
|
|
257
250
|
table,
|
|
258
|
-
dtableStoreValue
|
|
251
|
+
value: dtableStoreValue
|
|
259
252
|
});
|
|
260
253
|
}
|
|
261
254
|
return {
|
package/dist/constants/index.js
CHANGED
|
@@ -160,6 +160,7 @@ export const THEME_NAME_MAP = {
|
|
|
160
160
|
};
|
|
161
161
|
export const CHART_THEME_COLOR = {
|
|
162
162
|
dark: {
|
|
163
|
+
pivotTextColor: '#ffffff',
|
|
163
164
|
textColor: '#ffffff',
|
|
164
165
|
fontSize: 13,
|
|
165
166
|
gridColor: '#4E4E56',
|
|
@@ -168,6 +169,7 @@ export const CHART_THEME_COLOR = {
|
|
|
168
169
|
cardColor: '#ffffff'
|
|
169
170
|
},
|
|
170
171
|
light: {
|
|
172
|
+
pivotTextColor: '#212529',
|
|
171
173
|
textColor: '#666666',
|
|
172
174
|
fontSize: 13,
|
|
173
175
|
gridColor: '#F3F3F3',
|
|
@@ -254,4 +256,47 @@ export const MONTH_MIRROR = {
|
|
|
254
256
|
'10': 'Nov',
|
|
255
257
|
'11': 'Dec'
|
|
256
258
|
};
|
|
259
|
+
export const xAxisMap = {
|
|
260
|
+
[CHART_TYPE.BAR_CUSTOM]: 'x_axis_column_key',
|
|
261
|
+
[CHART_TYPE.BAR_GROUP]: 'x_axis_column_key',
|
|
262
|
+
[CHART_TYPE.BAR_STACK]: 'x_axis_column_key',
|
|
263
|
+
[CHART_TYPE.BAR]: 'x_axis_column_key',
|
|
264
|
+
[CHART_TYPE.AREA_GROUP]: 'x_axis_column_key',
|
|
265
|
+
[CHART_TYPE.AREA]: 'x_axis_column_key',
|
|
266
|
+
[CHART_TYPE.BASIC_NUMBER_CARD]: 'numeric_column_key',
|
|
267
|
+
[CHART_TYPE.COMBINATION]: 'x_axis_column_key',
|
|
268
|
+
[CHART_TYPE.COMPARE_BAR]: 'x_axis_column_key',
|
|
269
|
+
[CHART_TYPE.COMPLETENESS_GROUP]: 'groupby_column_key',
|
|
270
|
+
[CHART_TYPE.COMPLETENESS]: 'groupby_column_key',
|
|
271
|
+
[CHART_TYPE.DASHBOARD]: 'target_value_column_key',
|
|
272
|
+
[CHART_TYPE.HEAT_MAP]: 'time_column_key',
|
|
273
|
+
[CHART_TYPE.HORIZONTAL_BAR]: 'vertical_axis_column_key',
|
|
274
|
+
[CHART_TYPE.HORIZONTAL_GROUP_BAR]: 'vertical_axis_column_key',
|
|
275
|
+
[CHART_TYPE.STACKED_HORIZONTAL_BAR]: 'vertical_axis_column_key',
|
|
276
|
+
[CHART_TYPE.LINE_GROUP]: 'x_axis_column_key',
|
|
277
|
+
[CHART_TYPE.LINE]: 'x_axis_column_key',
|
|
278
|
+
[CHART_TYPE.MAP_BUBBLE]: 'geo_column_key',
|
|
279
|
+
[CHART_TYPE.MAP]: 'geo_column_key',
|
|
280
|
+
[CHART_TYPE.WORLD_MAP_BUBBLE]: 'geo_column_key',
|
|
281
|
+
[CHART_TYPE.WORLD_MAP]: 'geo_column_key',
|
|
282
|
+
[CHART_TYPE.MIRROR]: 'column_key',
|
|
283
|
+
[CHART_TYPE.PIE]: 'groupby_column_key',
|
|
284
|
+
[CHART_TYPE.RING]: 'groupby_column_key',
|
|
285
|
+
[CHART_TYPE.SCATTER]: 'x_axis_column_key',
|
|
286
|
+
[CHART_TYPE.TABLE]: 'groupby_column_key',
|
|
287
|
+
[CHART_TYPE.TREE_MAP]: 'groupby_column_key',
|
|
288
|
+
[CHART_TYPE.TREND]: 'date_column_key'
|
|
289
|
+
};
|
|
290
|
+
export const groupAxisMap = {
|
|
291
|
+
[CHART_TYPE.BAR_GROUP]: 'column_groupby_column_key',
|
|
292
|
+
[CHART_TYPE.BAR_STACK]: 'column_groupby_column_key',
|
|
293
|
+
[CHART_TYPE.AREA_GROUP]: 'column_groupby_column_key',
|
|
294
|
+
[CHART_TYPE.COMPLETENESS_GROUP]: 'column_groupby_column_key',
|
|
295
|
+
[CHART_TYPE.HORIZONTAL_GROUP_BAR]: 'column_groupby_column_key',
|
|
296
|
+
[CHART_TYPE.STACKED_HORIZONTAL_BAR]: 'column_groupby_column_key',
|
|
297
|
+
[CHART_TYPE.LINE_GROUP]: 'column_groupby_column_key',
|
|
298
|
+
[CHART_TYPE.SCATTER]: 'column_groupby_column_key',
|
|
299
|
+
[CHART_TYPE.MIRROR]: 'group_column_key',
|
|
300
|
+
[CHART_TYPE.TABLE]: 'groupby_column_key'
|
|
301
|
+
};
|
|
257
302
|
export { GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, CHART_KEY, GENERIC_KEY, GENERIC_KEY_2_SIMILAR_KEYS, STYLE_COLORS, HORIZONTAL_ALIGN, HORIZONTAL_ALIGNS, HORIZONTAL_ALIGN_SHOW, CHART_TYPE, CHART_TYPE_SHOW, CHART_TYPES, CHART_TYPE_IMAGE, GEOLOCATION_GRANULARITY, GEOLOCATION_GRANULARITY_LIST, MAP_LEVEL, MUNICIPALITIES, regions, TABLE_DIMENSIONS };
|
package/dist/locale/lang/de.js
CHANGED
|
@@ -83,7 +83,7 @@ const de = {
|
|
|
83
83
|
"Calculate_the_number_of_records_in_two_time_periods": "Anzahl der Einträge in zwei Zeitperioden vergleichen",
|
|
84
84
|
"Use_a_field_to_calculate_the_sum_maximum_or_minimum_value_of_records_in_two_time_periods": "Ein Feld verwenden, um die Summe, das Maximum, das Minimum oder den Durchschnitt von Datensätzen in zwei Zeiträumen zu berechnen",
|
|
85
85
|
"No_options": "Keine Optionen",
|
|
86
|
-
"Alignment": "
|
|
86
|
+
"Alignment": "Ausrichtung",
|
|
87
87
|
"Text_horizontal_alignment": "Horizontale Ausrichtung des Textes",
|
|
88
88
|
"Please_input_date": "Datum eingeben",
|
|
89
89
|
"Filter": "Filtern",
|
|
@@ -140,8 +140,10 @@ const de = {
|
|
|
140
140
|
"Hour": "Stunde",
|
|
141
141
|
"Minute": "Minute",
|
|
142
142
|
"Done": "Erledigt",
|
|
143
|
+
"Error": "Fehler",
|
|
143
144
|
"Internal_server_error": "Interner Serverfehler",
|
|
144
145
|
"Network_error": "Netzwerkfehler",
|
|
146
|
+
"Permission_denied": "Zugriff verweigert",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "Die Filterbedingungen sind abnormal. Bitte setzen sie die Filterbedingungen in den Ansichtseinstellungen zurück.",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "Schließen Sie die Konfiguration des Diagramms ab.",
|
|
147
149
|
"Not_used": "Nicht verwendet",
|
|
@@ -179,7 +181,7 @@ const de = {
|
|
|
179
181
|
"Statistic_field": "Statisches Feld",
|
|
180
182
|
"target": "Ziel",
|
|
181
183
|
"completed": "vollständig",
|
|
182
|
-
"Completed_field": "
|
|
184
|
+
"Completed_field": "Abgeschlossenes Feld",
|
|
183
185
|
"Target_field": "Zielfeld",
|
|
184
186
|
"Show_percentage": "Prozent anzeigen",
|
|
185
187
|
"Name_field": "Name",
|
|
@@ -239,7 +241,7 @@ const de = {
|
|
|
239
241
|
"Previous_30_days": "Vorherige 30 Tage",
|
|
240
242
|
"The_day_before_yesterday": "Vorgestern",
|
|
241
243
|
"Can_not_compare_with_{var}": "Ein Vergleich mit {var} ist nicht möglich.",
|
|
242
|
-
"Number": "
|
|
244
|
+
"Number": "Zahl",
|
|
243
245
|
"polylines": "Polygonzug",
|
|
244
246
|
"curves": "Kurven",
|
|
245
247
|
"Line_type": "Linientyp",
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -140,8 +140,10 @@ const en = {
|
|
|
140
140
|
"Hour": "Hour",
|
|
141
141
|
"Minute": "Minute",
|
|
142
142
|
"Done": "Done",
|
|
143
|
+
"Error": "Error",
|
|
143
144
|
"Internal_server_error": "Internal server error",
|
|
144
145
|
"Network_error": "Network error",
|
|
146
|
+
"Permission_denied": "Permission denied",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "There are some problems with the filters.",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
|
|
147
149
|
"Not_used": "Not used",
|
package/dist/locale/lang/es.js
CHANGED
|
@@ -140,8 +140,10 @@ const es = {
|
|
|
140
140
|
"Hour": "Hour",
|
|
141
141
|
"Minute": "Minute",
|
|
142
142
|
"Done": "Done",
|
|
143
|
+
"Error": "Error",
|
|
143
144
|
"Internal_server_error": "Internal server error",
|
|
144
145
|
"Network_error": "Network error",
|
|
146
|
+
"Permission_denied": "Permission denied",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "There are some problems with the filters.",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
|
|
147
149
|
"Not_used": "Not used",
|
package/dist/locale/lang/fr.js
CHANGED
|
@@ -83,7 +83,7 @@ const fr = {
|
|
|
83
83
|
"Calculate_the_number_of_records_in_two_time_periods": "Calculer le nombre d'enregistrements pour deux périodes de temps",
|
|
84
84
|
"Use_a_field_to_calculate_the_sum_maximum_or_minimum_value_of_records_in_two_time_periods": "Utiliser une colonne pour calculer la somme, le maximum, le minimum ou la moyenne des enregistrements pour deux périodes de temps",
|
|
85
85
|
"No_options": "Il n'y a pas d'options.",
|
|
86
|
-
"Alignment": "
|
|
86
|
+
"Alignment": "Alignement",
|
|
87
87
|
"Text_horizontal_alignment": "Alignement de texte horizontal",
|
|
88
88
|
"Please_input_date": "Veuillez entrer la date",
|
|
89
89
|
"Filter": "Filtrer",
|
|
@@ -140,8 +140,10 @@ const fr = {
|
|
|
140
140
|
"Hour": "Heure",
|
|
141
141
|
"Minute": "Minute",
|
|
142
142
|
"Done": "Fait",
|
|
143
|
+
"Error": "Erreur",
|
|
143
144
|
"Internal_server_error": "Erreur interne du serveur",
|
|
144
145
|
"Network_error": "Erreur réseau",
|
|
146
|
+
"Permission_denied": "Permission refusée",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "Les conditions de filtrage sont anormales. Veuillez réinitialiser les conditions de filtrage dans les paramètres de vue.",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "Compléter la configuration du diagramme",
|
|
147
149
|
"Not_used": "Ne pas utilisé",
|
|
@@ -179,7 +181,7 @@ const fr = {
|
|
|
179
181
|
"Statistic_field": "Champ statistique",
|
|
180
182
|
"target": "cible",
|
|
181
183
|
"completed": "complété",
|
|
182
|
-
"Completed_field": "
|
|
184
|
+
"Completed_field": "Champ complété",
|
|
183
185
|
"Target_field": "Champ cible",
|
|
184
186
|
"Show_percentage": "Afficher le pourcentage",
|
|
185
187
|
"Name_field": "Nom",
|
|
@@ -199,7 +201,7 @@ const fr = {
|
|
|
199
201
|
"Y_axis_column_not_found": "La colonne pour l'axe des y n'a pas été trouvée.",
|
|
200
202
|
"Numeric_column_not_found": "La colonne numérique n'a pas été trouvée.",
|
|
201
203
|
"Target_column_not_found": "La colonne cible n'a pas été trouvée",
|
|
202
|
-
"Completed_column_not_found": "
|
|
204
|
+
"Completed_column_not_found": "Colonne complétée introuvable",
|
|
203
205
|
"Target_summary_method_is_not_valid": "La méthode de résumé cible n'est pas valide.",
|
|
204
206
|
"Grid_size": "Taille de la grille\n",
|
|
205
207
|
"Grid_distance": "Ecart entre les grilles",
|
|
@@ -239,7 +241,7 @@ const fr = {
|
|
|
239
241
|
"Previous_30_days": "30 jours précédents",
|
|
240
242
|
"The_day_before_yesterday": "Avant-hier",
|
|
241
243
|
"Can_not_compare_with_{var}": "Il est impossible de comparer avec {var}.",
|
|
242
|
-
"Number": "
|
|
244
|
+
"Number": "Nombre",
|
|
243
245
|
"polylines": "Ligne polygonale",
|
|
244
246
|
"curves": "Courbes",
|
|
245
247
|
"Line_type": "Type de ligne",
|
package/dist/locale/lang/pt.js
CHANGED
|
@@ -140,8 +140,10 @@ const pt = {
|
|
|
140
140
|
"Hour": "Hour",
|
|
141
141
|
"Minute": "Minute",
|
|
142
142
|
"Done": "Done",
|
|
143
|
+
"Error": "Error",
|
|
143
144
|
"Internal_server_error": "Internal server error",
|
|
144
145
|
"Network_error": "Network error",
|
|
146
|
+
"Permission_denied": "Permission denied",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "There are some problems with the filters.",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
|
|
147
149
|
"Not_used": "Not used",
|
package/dist/locale/lang/ru.js
CHANGED
|
@@ -140,8 +140,10 @@ const ru = {
|
|
|
140
140
|
"Hour": "Hour",
|
|
141
141
|
"Minute": "Minute",
|
|
142
142
|
"Done": "Done",
|
|
143
|
+
"Error": "Error",
|
|
143
144
|
"Internal_server_error": "Internal server error",
|
|
144
145
|
"Network_error": "Network error",
|
|
146
|
+
"Permission_denied": "Permission denied",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "There are some problems with the filters.",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
|
|
147
149
|
"Not_used": "Not used",
|
|
@@ -83,7 +83,7 @@ const zh_CN = {
|
|
|
83
83
|
"Calculate_the_number_of_records_in_two_time_periods": "计算两个时间段的记录数",
|
|
84
84
|
"Use_a_field_to_calculate_the_sum_maximum_or_minimum_value_of_records_in_two_time_periods": "使用字段计算两个时间段内记录的最大值或最小值之和",
|
|
85
85
|
"No_options": "没有选项",
|
|
86
|
-
"Alignment": "
|
|
86
|
+
"Alignment": "对齐方式",
|
|
87
87
|
"Text_horizontal_alignment": "文本水平对齐",
|
|
88
88
|
"Please_input_date": "请输入日期",
|
|
89
89
|
"Filter": "过滤",
|
|
@@ -140,8 +140,10 @@ const zh_CN = {
|
|
|
140
140
|
"Hour": "时",
|
|
141
141
|
"Minute": "分",
|
|
142
142
|
"Done": "完成",
|
|
143
|
+
"Error": "错误",
|
|
143
144
|
"Internal_server_error": "服务端错误",
|
|
144
145
|
"Network_error": "网络错误",
|
|
146
|
+
"Permission_denied": "权限错误",
|
|
145
147
|
"There_are_some_problems_with_the_filters": "过滤器有一些问题。",
|
|
146
148
|
"Please_complete_the_chart_configuration_first": "请先完成图表配置",
|
|
147
149
|
"Not_used": "不使用",
|
|
@@ -239,7 +241,7 @@ const zh_CN = {
|
|
|
239
241
|
"Previous_30_days": "之前 30 天",
|
|
240
242
|
"The_day_before_yesterday": "前天",
|
|
241
243
|
"Can_not_compare_with_{var}": "无法和 {var} 比较",
|
|
242
|
-
"Number": "
|
|
244
|
+
"Number": "数字",
|
|
243
245
|
"polylines": "折线",
|
|
244
246
|
"curves": "曲线",
|
|
245
247
|
"Line_type": "线型",
|
|
@@ -5,6 +5,7 @@ import CommonDataSettings from '../widgets/common-data-settings';
|
|
|
5
5
|
import Divider from '../widgets/divider';
|
|
6
6
|
import GroupBy from '../widgets/group-by';
|
|
7
7
|
import YAxisGroupSettings from '../widgets/y-axis-group-settings';
|
|
8
|
+
import { islinkDateFormula } from '../../utils/column-utils';
|
|
8
9
|
import { CHART_SUMMARY_TYPE, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP } from '../../constants';
|
|
9
10
|
import intl from '../../intl';
|
|
10
11
|
const DataSettings = _ref => {
|
|
@@ -36,7 +37,7 @@ const DataSettings = _ref => {
|
|
|
36
37
|
update['x_axis_date_granularity'] = null;
|
|
37
38
|
update['x_axis_geolocation_granularity'] = null;
|
|
38
39
|
} else {
|
|
39
|
-
if (DATE_COLUMN_OPTIONS.includes(type)) {
|
|
40
|
+
if (DATE_COLUMN_OPTIONS.includes(type) || islinkDateFormula(column)) {
|
|
40
41
|
update['x_axis_date_granularity'] = CHART_SUMMARY_TYPE.MONTH;
|
|
41
42
|
update['x_axis_geolocation_granularity'] = null;
|
|
42
43
|
} else if (type === CellType.GEOLOCATION) {
|
|
@@ -7,6 +7,7 @@ import Divider from '../widgets/divider';
|
|
|
7
7
|
import GroupBy from '../widgets/group-by';
|
|
8
8
|
import BasicSummary from '../widgets/basic-summary';
|
|
9
9
|
import DataSort from '../widgets/data-sort';
|
|
10
|
+
import { islinkDateFormula } from '../../utils/column-utils';
|
|
10
11
|
import { CHART_SUMMARY_TYPE, SUPPORT_DATA_SORT_CHART_TYPES, CHART_SUMMARY_TYPES, GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, CHART_TYPE } from '../../constants';
|
|
11
12
|
const DataSettings = _ref => {
|
|
12
13
|
let {
|
|
@@ -37,7 +38,7 @@ const DataSettings = _ref => {
|
|
|
37
38
|
update['x_axis_date_granularity'] = null;
|
|
38
39
|
update['x_axis_geolocation_granularity'] = null;
|
|
39
40
|
} else {
|
|
40
|
-
if (DATE_COLUMN_OPTIONS.includes(type)) {
|
|
41
|
+
if (DATE_COLUMN_OPTIONS.includes(type) || islinkDateFormula(column)) {
|
|
41
42
|
update['x_axis_date_granularity'] = CHART_SUMMARY_TYPE.MONTH;
|
|
42
43
|
update['x_axis_geolocation_granularity'] = null;
|
|
43
44
|
} else if (type === CellType.GEOLOCATION) {
|
|
@@ -4,6 +4,7 @@ import React, { Component } from 'react';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { Label, FormGroup } from 'reactstrap';
|
|
6
6
|
import { CellType, COLUMNS_ICON_CONFIG, DATE_COLUMN_OPTIONS, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
7
|
+
import { islinkDateFormula } from '../../utils/column-utils';
|
|
7
8
|
import { CHART_SUPPORT_COLUMNS, DATE_GRANULATES, GEOLOCATION_GRANULATES, CHART_SUMMARY_SHOW, GEOLOCATION_FORMAT_MAP, CHART_TYPE, TIME_COLUMN_LIST, COMPLETENESS_GROUPBY_SUPPORTED_COLUMN_TYPE, NUMBERIC_COLUMN_TYPE, MIRROR_COLUMN_LIST } from '../../constants';
|
|
8
9
|
import intl from '../../intl';
|
|
9
10
|
class GroupBy extends Component {
|
|
@@ -176,7 +177,7 @@ class GroupBy extends Component {
|
|
|
176
177
|
const {
|
|
177
178
|
type: groupbyColumnType
|
|
178
179
|
} = groupbyColumn;
|
|
179
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, DATE_COLUMN_OPTIONS.includes(groupbyColumnType) && this.renderGroupbyDateGranulates(), groupbyColumnType === CellType.GEOLOCATION && this.geolocationGranulatesOptions.length > 0 && this.renderGroupbyGeolocationGranulates());
|
|
180
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (DATE_COLUMN_OPTIONS.includes(groupbyColumnType) || islinkDateFormula(groupbyColumn)) && this.renderGroupbyDateGranulates(), groupbyColumnType === CellType.GEOLOCATION && this.geolocationGranulatesOptions.length > 0 && this.renderGroupbyGeolocationGranulates());
|
|
180
181
|
};
|
|
181
182
|
this.dateGranulatesOptions = this.generatorGranulatesOptions(DATE_GRANULATES);
|
|
182
183
|
this.initOptions(_props);
|
|
@@ -1052,9 +1052,16 @@ BaseUtils.getGroupLabel = (cellValue, formulaRow, column, dateGranularity, geoGr
|
|
|
1052
1052
|
if (!formulaRow) return '';
|
|
1053
1053
|
let formulaCellValue = formulaRow[key];
|
|
1054
1054
|
let {
|
|
1055
|
-
result_type
|
|
1055
|
+
result_type,
|
|
1056
|
+
array_type
|
|
1056
1057
|
} = data || {};
|
|
1057
1058
|
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
1059
|
+
if (array_type === 'date' && (formulaCellValue === null || formulaCellValue === void 0 ? void 0 : formulaCellValue.length) === 1) {
|
|
1060
|
+
const dateCellValue = formulaCellValue[0];
|
|
1061
|
+
if (!dateGranularity) return getDateDisplayString(dateCellValue);
|
|
1062
|
+
if (dateGranularity.toUpperCase() === 'QUARTER') return DateUtils.getDateByGranularity(dateCellValue, 'QUARTAR');
|
|
1063
|
+
return DateUtils.getDateByGranularity(dateCellValue, dateGranularity);
|
|
1064
|
+
}
|
|
1058
1065
|
return getFormulaDisplayString(formulaCellValue, data, {
|
|
1059
1066
|
tables: value.tables
|
|
1060
1067
|
}) || null;
|
|
@@ -1378,4 +1385,22 @@ BaseUtils.mergePivotTableSameCollaborator = pivot_rows => {
|
|
|
1378
1385
|
});
|
|
1379
1386
|
return new_pivot_rows;
|
|
1380
1387
|
};
|
|
1388
|
+
BaseUtils.getDateGranularityByType = chart => {
|
|
1389
|
+
const {
|
|
1390
|
+
type
|
|
1391
|
+
} = chart;
|
|
1392
|
+
if ([CHART_TYPE.AREA_GROUP, CHART_TYPE.AREA, CHART_TYPE.BAR, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_STACK, CHART_TYPE.COMPARE_BAR, CHART_TYPE.COMBINATION, CHART_TYPE.LINE_GROUP, CHART_TYPE.LINE].includes(type)) {
|
|
1393
|
+
return chart['x_axis_date_granularity'];
|
|
1394
|
+
}
|
|
1395
|
+
if ([CHART_TYPE.COMPLETENESS_GROUP, CHART_TYPE.SCATTER, CHART_TYPE.TREND].includes(type)) {
|
|
1396
|
+
return chart['date_granularity'];
|
|
1397
|
+
}
|
|
1398
|
+
if ([CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR].includes(type)) {
|
|
1399
|
+
return chart['vertical_axis_date_granularity'];
|
|
1400
|
+
}
|
|
1401
|
+
if ([CHART_TYPE.PIE, CHART_TYPE.RING, CHART_TYPE.TABLE, CHART_TYPE.TREE_MAP].includes(type)) {
|
|
1402
|
+
return chart['groupby_date_granularity'];
|
|
1403
|
+
}
|
|
1404
|
+
return null;
|
|
1405
|
+
};
|
|
1381
1406
|
export default BaseUtils;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { CellType, DATE_COLUMN_OPTIONS, FORMULA_COLUMN_TYPES_MAP, getTableById, getViewById, getTableColumnByKey } from 'dtable-utils';
|
|
3
3
|
import { CHART_SUMMARY_TYPE, CHART_TYPE, Y_AXIS_TYPE_PREFIX } from '../../../constants';
|
|
4
|
-
import { getColorFromSingleSelectColumn } from '../../column-utils';
|
|
4
|
+
import { getColorFromSingleSelectColumn, islinkDateFormula } from '../../column-utils';
|
|
5
5
|
import { isArrayCellValue } from '../../cell-value-utils';
|
|
6
6
|
import { getFormattedLabel, isValidRow } from '../../row-utils';
|
|
7
7
|
import { fixGeoGranularity } from '../../map';
|
|
@@ -67,7 +67,7 @@ async function calculateBasicChart(chart, value, _ref) {
|
|
|
67
67
|
const {
|
|
68
68
|
type: groupby_column_type
|
|
69
69
|
} = groupbyColumn;
|
|
70
|
-
if (DATE_COLUMN_OPTIONS.includes(groupby_column_type) && !groupby_date_granularity) {
|
|
70
|
+
if ((DATE_COLUMN_OPTIONS.includes(groupby_column_type) || islinkDateFormula(groupbyColumn)) && !groupby_date_granularity) {
|
|
71
71
|
groupby_date_granularity = CHART_SUMMARY_TYPE.MONTH;
|
|
72
72
|
if ([CHART_TYPE.HEAT_MAP].includes(chart.type)) {
|
|
73
73
|
groupby_date_granularity = CHART_SUMMARY_TYPE.DAY;
|
|
@@ -161,7 +161,7 @@ async function calculateGroupingChart(chart, value, _ref2) {
|
|
|
161
161
|
const {
|
|
162
162
|
type: groupby_column_type
|
|
163
163
|
} = groupbyColumn;
|
|
164
|
-
if (DATE_COLUMN_OPTIONS.includes(groupby_column_type) && !groupby_date_granularity) {
|
|
164
|
+
if ((DATE_COLUMN_OPTIONS.includes(groupby_column_type) || islinkDateFormula(groupbyColumn)) && !groupby_date_granularity) {
|
|
165
165
|
groupby_date_granularity = CHART_SUMMARY_TYPE.MONTH;
|
|
166
166
|
}
|
|
167
167
|
if (groupby_column_type === CellType.GEOLOCATION && !groupby_geolocation_granularity) {
|
|
@@ -461,7 +461,7 @@ async function calculateCustomBar(statItem, value, _ref4) {
|
|
|
461
461
|
} = groupbyColumn;
|
|
462
462
|
let groupbyDateGranularity = x_axis_date_granularity;
|
|
463
463
|
let groupbyGeolocationGranularity = x_axis_geolocation_granularity;
|
|
464
|
-
if (DATE_COLUMN_OPTIONS.includes(groupbyColumnType) && !groupbyDateGranularity) {
|
|
464
|
+
if ((DATE_COLUMN_OPTIONS.includes(groupbyColumnType) || islinkDateFormula(groupbyColumn)) && !groupbyDateGranularity) {
|
|
465
465
|
groupbyDateGranularity = CHART_SUMMARY_TYPE.MONTH;
|
|
466
466
|
}
|
|
467
467
|
if (groupbyColumnType === CellType.GEOLOCATION && !groupbyGeolocationGranularity) {
|
|
@@ -3,6 +3,7 @@ import { getTableById, getViewById } from 'dtable-utils';
|
|
|
3
3
|
import { CHART_TYPE, SUPPORT_DATA_SORT_CHART_TYPES } from '../../../constants';
|
|
4
4
|
import BaseUtils from '../base-utils';
|
|
5
5
|
import context from '../../../context';
|
|
6
|
+
import { getErrorMessage } from '../..';
|
|
6
7
|
import PivotTableCalculator from './pivot-table-calculator';
|
|
7
8
|
import BasicChartCalculator from './basic-chart-calculator';
|
|
8
9
|
import CompareBarCalculator from './compare-bar-chart-calculator';
|
|
@@ -83,7 +84,7 @@ OriginalDataUtils.calculateChart = async (chart, value, callback) => {
|
|
|
83
84
|
chartTableColumns
|
|
84
85
|
});
|
|
85
86
|
} catch (error) {
|
|
86
|
-
const error_message =
|
|
87
|
+
const error_message = getErrorMessage(error);
|
|
87
88
|
return callback && callback(error_message, '', null);
|
|
88
89
|
}
|
|
89
90
|
};
|