dtable-statistic 4.0.4 → 4.0.6

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.
Files changed (74) hide show
  1. package/es/assets/icons/switch-icon.svg +17 -0
  2. package/es/calculator/workers/basic-chart-calculator-worker.js +1 -1
  3. package/es/components/dialog/chart-addition-edit-dialog.js +1 -0
  4. package/es/components/dialog/chart-addition-widgets/chart-selector.js +2 -1
  5. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +9 -0
  6. package/es/components/dialog/statistic-types-dialog/index.css +14 -0
  7. package/es/components/dialog/statistic-types-dialog/index.js +63 -0
  8. package/es/components/icon.js +12 -0
  9. package/es/constants/index.js +17 -6
  10. package/es/constants/model.js +20 -0
  11. package/es/dashboard.js +47 -9
  12. package/es/desktop-dashboard.js +3 -2
  13. package/es/locale/lang/de.js +3 -1
  14. package/es/locale/lang/en.js +3 -1
  15. package/es/locale/lang/fr.js +3 -1
  16. package/es/locale/lang/zh_CN.js +3 -1
  17. package/es/model/bar-group.js +60 -0
  18. package/es/model/bar.js +49 -0
  19. package/es/model/base-model.js +12 -0
  20. package/es/model/basic-number-card.js +27 -0
  21. package/es/model/combination.js +50 -0
  22. package/es/model/compare-bar.js +58 -0
  23. package/es/model/completeness-group.js +33 -0
  24. package/es/model/completeness.js +27 -0
  25. package/es/model/custom-bar.js +27 -0
  26. package/es/model/dashboard.js +22 -0
  27. package/es/model/generic-model.js +219 -0
  28. package/es/model/heat-map.js +35 -0
  29. package/es/model/horizontal-bar-group.js +55 -0
  30. package/es/model/horizontal-bar.js +49 -0
  31. package/es/model/index.js +26 -0
  32. package/es/model/map.js +37 -0
  33. package/es/model/mirror.js +35 -0
  34. package/es/model/pie.js +40 -0
  35. package/es/model/ring.js +41 -0
  36. package/es/model/scatter.js +24 -0
  37. package/es/model/table.js +34 -0
  38. package/es/model/trend.js +34 -0
  39. package/es/model/world-map.js +36 -0
  40. package/es/service/chart-service.js +47 -169
  41. package/es/service/dashboard-service.js +6 -5
  42. package/es/stat-editor/index.js +2 -0
  43. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +1 -0
  44. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +1 -0
  45. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +1 -0
  46. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +4 -3
  47. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +9 -10
  48. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +7 -31
  49. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +4 -3
  50. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +4 -3
  51. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +5 -29
  52. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +1 -0
  53. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +1 -0
  54. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +1 -0
  55. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +1 -0
  56. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +1 -0
  57. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +1 -0
  58. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +10 -0
  59. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +1 -0
  60. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +1 -0
  61. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +1 -0
  62. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +1 -0
  63. package/es/stat-editor/stat-settings/public-setting/base-settings.js +22 -1
  64. package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +29 -0
  65. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +58 -0
  66. package/es/stat-view/pie-chart.js +2 -2
  67. package/es/stat-view/ring-chart.js +2 -2
  68. package/es/utils/column-utils.js +69 -2
  69. package/es/utils/common-utils.js +3 -0
  70. package/es/utils/model.js +13 -0
  71. package/es/utils/row-utils.js +1 -0
  72. package/es/utils/stat-utils.js +4 -0
  73. package/package.json +1 -1
  74. package/es/model/stat-item.js +0 -340
@@ -1,4 +1,5 @@
1
- import { CellType } from 'dtable-store';
1
+ import { CellType, isDateColumn, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES } from 'dtable-store';
2
+ import { MIRROR_COLUMN_LIST } from '../constants';
2
3
  export function getColorFromSingleSelectColumn(column, target) {
3
4
  var columnType = column.type,
4
5
  columnData = column.data;
@@ -15,4 +16,70 @@ export function getColorFromSingleSelectColumn(column, target) {
15
16
  });
16
17
  var color = selectedOption && selectedOption.color;
17
18
  return color || null;
18
- }
19
+ }
20
+ export var isStatisticDateColumn = function isStatisticDateColumn(column) {
21
+ if (!column) return false;
22
+ return isDateColumn(column);
23
+ };
24
+ export var isMapColumn = function isMapColumn(column) {
25
+ if (!column) return false;
26
+ var type = column.type,
27
+ data = column.data;
28
+ if (type === CellType.GEOLOCATION) {
29
+ var _ref = data || {},
30
+ geo_format = _ref.geo_format;
31
+ if (geo_format === 'lng_lat' || geo_format === 'country_region') {
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ if (FORMULA_COLUMN_TYPES.includes(type)) {
37
+ var _ref2 = data || {},
38
+ result_type = _ref2.result_type,
39
+ array_type = _ref2.array_type,
40
+ array_data = _ref2.array_data;
41
+ if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
42
+ return false;
43
+ }
44
+ var _ref3 = array_data || {},
45
+ _geo_format = _ref3.geo_format;
46
+ if (_geo_format === 'lng_lat' || _geo_format === 'country_region') {
47
+ return false;
48
+ }
49
+ return true;
50
+ }
51
+ return false;
52
+ };
53
+ export var isMirrorColumn = function isMirrorColumn(column) {
54
+ if (!column) return false;
55
+ return MIRROR_COLUMN_LIST.includes(column.type);
56
+ };
57
+ export var isWorldMapColumn = function isWorldMapColumn(column) {
58
+ if (!column) return false;
59
+ var type = column.type,
60
+ data = column.data;
61
+ if (type === CellType.TEXT) return true;
62
+ if (type === CellType.GEOLOCATION) {
63
+ var _ref4 = data || {},
64
+ geo_format = _ref4.geo_format;
65
+ if (geo_format === 'country_region') {
66
+ return true;
67
+ }
68
+ }
69
+ if (FORMULA_COLUMN_TYPES.includes(type)) {
70
+ var _data = column.data;
71
+ var _ref5 = _data || {},
72
+ result_type = _ref5.result_type,
73
+ array_type = _ref5.array_type,
74
+ array_data = _ref5.array_data;
75
+ if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
76
+ return false;
77
+ }
78
+ var _ref6 = array_data || {},
79
+ _geo_format2 = _ref6.geo_format;
80
+ if (_geo_format2 === 'country_region') {
81
+ return true;
82
+ }
83
+ }
84
+ return false;
85
+ };
@@ -300,4 +300,7 @@ export var sortDataByGroupSum = function sortDataByGroupSum(data, sortType) {
300
300
  return nameSumMap.sort(sortSum).reduce(function (accumulator, currentItem) {
301
301
  return accumulator.concat(currentItem.items);
302
302
  }, []);
303
+ };
304
+ export var isBoolean = function isBoolean(val) {
305
+ return typeof val === 'boolean';
303
306
  };
@@ -0,0 +1,13 @@
1
+ import { hasOwnProperty } from './object';
2
+ export var getChartConfigValueFromKey = function getChartConfigValueFromKey(key, object) {
3
+ if (!hasOwnProperty(object, key)) {
4
+ return null;
5
+ }
6
+ return object[key];
7
+ };
8
+ export var getChartConfigValueFromKeys = function getChartConfigValueFromKeys(keys, object) {
9
+ var existKey = keys.find(function (key) {
10
+ return hasOwnProperty(object, key);
11
+ });
12
+ return existKey ? object[existKey] : null;
13
+ };
@@ -102,6 +102,7 @@ export var getFormattedLabel = function getFormattedLabel(column, name, collabor
102
102
  return name;
103
103
  };
104
104
  export function getCellValue(row, formulaRow, column) {
105
+ if (!column) return null;
105
106
  var type = column.type,
106
107
  key = column.key;
107
108
  if (FORMULA_COLUMN_TYPES_MAP[type]) {
@@ -55,6 +55,10 @@ var StatUtils = /*#__PURE__*/function () {
55
55
  if (!dateGranularity) {
56
56
  return getDateDisplayString(cellValue);
57
57
  }
58
+ if (dateGranularity.toUpperCase() === 'QUARTER') {
59
+ // TODO: fix the unknown word 'QUARTAR'
60
+ return DateUtils.getDateByGranularity(cellValue, 'QUARTAR');
61
+ }
58
62
  return DateUtils.getDateByGranularity(cellValue, dateGranularity);
59
63
  }
60
64
  case CellType.MULTIPLE_SELECT:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-statistic",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",
@@ -1,340 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import { isNumber } from 'dtable-store';
4
- import { STAT_TYPE, SUPPORT_LABEL_FONT_SIZE_CHARTS, DEFAULT_LABEL_FONT_SIZE, LEGEND_DIRECTION_MAP } from '../constants';
5
- var StatItem = /*#__PURE__*/function () {
6
- function StatItem(object) {
7
- _classCallCheck(this, StatItem);
8
- this.initStatConfigs(object);
9
- }
10
- _createClass(StatItem, [{
11
- key: "initStatConfigs",
12
- value: function initStatConfigs(object) {
13
- var type = object.type;
14
- this._id = object._id || null;
15
- this.name = object.name || null;
16
- this.type = type || null;
17
- this.table_id = object.table_id || null;
18
- this.view_id = object.view_id || null;
19
- this.chart_color_theme = object.chart_color_theme || 'theme0';
20
- switch (type) {
21
- case STAT_TYPE.MAP:
22
- case STAT_TYPE.MAP_BUBBLE:
23
- {
24
- this.geo_column = object.geo_column || null;
25
- this.geolocation_granularity = object.geolocation_granularity || null;
26
- this.summary_type = object.summary_type || null;
27
- this.summary_method = object.summary_method || null;
28
- this.summary_column = object.summary_column || null;
29
- this.legend_direction = object.legend_direction || LEGEND_DIRECTION_MAP.VERTICAL;
30
- this.legend_size = object.legend_size || 1;
31
- break;
32
- }
33
- case STAT_TYPE.WORLD_MAP:
34
- case STAT_TYPE.WORLD_MAP_BUBBLE:
35
- {
36
- this.column = object.column || null;
37
- this.summary_type = object.summary_type || null;
38
- this.summary_method = object.summary_method || null;
39
- this.summary_column = object.summary_column || null;
40
- this.legend_direction = object.legend_direction || LEGEND_DIRECTION_MAP.VERTICAL;
41
- this.legend_size = object.legend_size || 1;
42
- break;
43
- }
44
- case STAT_TYPE.HEAT_MAP:
45
- {
46
- this.time_column = object.time_column || null;
47
- this.summary_type = object.summary_type || null;
48
- this.summary_method = object.summary_method || null;
49
- this.summary_column = object.summary_column || null;
50
- break;
51
- }
52
- case STAT_TYPE.MIRROR:
53
- {
54
- this.column = object.column || null;
55
- this.is_transpose = object.is_transpose || false;
56
- this.group_column = object.group_column || null;
57
- this.summary_method = object.summary_method || null;
58
- this.summary_column = object.summary_column || null;
59
- this.summary_type = object.summary_type;
60
- break;
61
- }
62
- case STAT_TYPE.BAR:
63
- case STAT_TYPE.LINE:
64
- case STAT_TYPE.AREA_CHART:
65
- {
66
- this.x_axis_column_key = object.x_axis_column_key || null;
67
- this.x_axis_date_granularity = object.x_axis_date_granularity || null;
68
- this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity || null;
69
- this.x_axis_include_empty = object.x_axis_include_empty || null;
70
- this.y_axis_summary_type = object.y_axis_summary_type || null;
71
- this.y_axis_column_key = object.y_axis_column_key || null;
72
- this.y_axis_summary_method = object.y_axis_summary_method || null;
73
- this.y_axis_label_color = object.y_axis_label_color || null;
74
- this.y_axis_label_color_rules = object.y_axis_label_color_rules || null;
75
- this.show_x_axis_label = object.show_x_axis_label || false;
76
- this.show_y_axis_label = object.show_y_axis_label || false;
77
- this.x_axis_label_position = object.x_axis_label_position || 'center';
78
- this.y_axis_label_position = object.y_axis_label_position || 'center';
79
- this.sort_type = object.sort_type || '';
80
- break;
81
- }
82
- case STAT_TYPE.CUSTOM_BAR:
83
- {
84
- this.x_axis_column_key = object.x_axis_column_key || null;
85
- this.x_axis_date_granularity = object.x_axis_date_granularity || null;
86
- this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity || null;
87
- this.x_axis_include_empty = object.x_axis_include_empty || null;
88
- this.show_x_axis_label = object.show_x_axis_label || false;
89
- this.show_y_axis_label = object.show_y_axis_label || false;
90
- this.x_axis_label_position = object.x_axis_label_position || 'center';
91
- this.y_axis_label_position = object.y_axis_label_position || 'center';
92
- this.title_name = object.title_name || null;
93
- this.y_axises = object.y_axises || null;
94
- break;
95
- }
96
- case STAT_TYPE.BAR_GROUP:
97
- case STAT_TYPE.BAR_STACK:
98
- case STAT_TYPE.GROUP_LINE:
99
- case STAT_TYPE.AREA_GROUP_CHART:
100
- {
101
- this.x_axis_column_key = object.x_axis_column_key || null;
102
- this.x_axis_date_granularity = object.x_axis_date_granularity || null;
103
- this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity || null;
104
- this.x_axis_include_empty = object.x_axis_include_empty || null;
105
- this.y_axis_summary_type = object.y_axis_summary_type || null;
106
- this.show_x_axis_label = object.show_x_axis_label || false;
107
- this.show_y_axis_label = object.show_y_axis_label || false;
108
- this.x_axis_label_position = object.x_axis_label_position || 'center';
109
- this.y_axis_label_position = object.y_axis_label_position || 'center';
110
- this.y_axis_column_key = object.y_axis_column_key || null;
111
- this.y_axis_summary_method = object.y_axis_summary_method || null;
112
- this.y_axis_label_color = object.y_axis_label_color || null;
113
-
114
- // group
115
- this.column_groupby_column_key = object.column_groupby_column_key || null;
116
- this.column_groupby_date_granularity = object.column_groupby_date_granularity || null;
117
- this.column_groupby_geolocation_granularity = object.column_groupby_geolocation_granularity || null;
118
- this.column_groupby_multiple_numeric_column = object.column_groupby_multiple_numeric_column || null;
119
- this.column_groupby_numeric_columns = object.column_groupby_numeric_columns || null;
120
- this.y_axis_use_stack = object.y_axis_use_stack || null;
121
- this.title_name = object.title_name || null;
122
- break;
123
- }
124
- case STAT_TYPE.PIE:
125
- case STAT_TYPE.RING:
126
- case STAT_TYPE.TREEMAP:
127
- {
128
- this.groupby_column_key = object.groupby_column_key || null;
129
- this.groupby_date_granularity = object.groupby_date_granularity || null;
130
- this.groupby_geolocation_granularity = object.groupby_geolocation_granularity || null;
131
- this.summary_type = object.summary_type || null;
132
- this.summary_column_key = object.summary_column_key || null;
133
- this.summary_method = object.summary_method || null;
134
- this.show_legend = object.show_legend || true;
135
- this.display_label = object.display_label || true;
136
- this.groupby_include_empty_cells = object.groupby_include_empty_cells || null;
137
- this.show_percent = object.show_percent || null;
138
- this.column_groupby_column_key = object.column_groupby_column_key || null;
139
- this.column_groupby_date_granularity = object.column_groupby_date_granularity || null;
140
- this.column_groupby_geolocation_granularity = object.column_groupby_geolocation_granularity || null;
141
- this.sort_type = object.sort_type || '';
142
- this.minimum_slice_percent = 1.5;
143
- if (type === STAT_TYPE.RING) {
144
- this.display_annotation = object.display_annotation || true;
145
- }
146
- break;
147
- }
148
- case STAT_TYPE.SCATTER:
149
- {
150
- this.x_axis_column = object.x_axis_column || null;
151
- this.y_axis_column = object.y_axis_column || null;
152
- this.group_column = object.group_column || null;
153
- this.show_x_axis_label = object.show_x_axis_label || false;
154
- this.show_y_axis_label = object.show_y_axis_label || false;
155
- this.x_axis_label_position = object.x_axis_label_position || 'center';
156
- this.y_axis_label_position = object.y_axis_label_position || 'center';
157
- break;
158
- }
159
- case STAT_TYPE.BASIC_NUMBER_CARD:
160
- {
161
- this.name = null;
162
- this.summary_method = object.summary_method || null;
163
- this.numeric_column = object.numeric_column || null;
164
- break;
165
- }
166
- case STAT_TYPE.HORIZONTAL_BAR:
167
- {
168
- this.vertical_axis_column_key = object.vertical_axis_column_key || null;
169
- this.vertical_axis_date_granularity = object.vertical_axis_date_granularity || null;
170
- this.vertical_axis_geolocation_granularity = object.vertical_axis_geolocation_granularity || null;
171
- this.vertical_axis_include_empty = object.vertical_axis_include_empty || null;
172
- this.horizontal_axis_summary_type = object.horizontal_axis_summary_type || null;
173
- this.horizontal_axis_column_key = object.horizontal_axis_column_key || null;
174
- this.horizontal_axis_summary_method = object.horizontal_axis_summary_method || null;
175
- this.horizontal_axis_label_color = object.horizontal_axis_label_color || null;
176
- this.horizontal_axis_label_color_rules = object.horizontal_axis_label_color_rules || null;
177
- this.show_vertical_axis_label = object.show_vertical_axis_label || false;
178
- this.show_horizontal_axis_label = object.show_horizontal_axis_label || false;
179
- this.vertical_axis_label_position = object.vertical_axis_label_position || 'center';
180
- this.horizontal_axis_label_position = object.horizontal_axis_label_position || 'center';
181
- this.sort_type = object.sort_type || '';
182
- break;
183
- }
184
- case STAT_TYPE.HORIZONTAL_GROUP_BAR:
185
- case STAT_TYPE.STACKED_HORIZONTAL_BAR:
186
- {
187
- this.vertical_axis_column_key = object.vertical_axis_column_key || null;
188
- this.vertical_axis_date_granularity = object.vertical_axis_date_granularity || null;
189
- this.vertical_axis_geolocation_granularity = object.vertical_axis_geolocation_granularity || null;
190
- this.vertical_axis_include_empty = object.vertical_axis_include_empty || null;
191
- this.horizontal_axis_summary_type = object.horizontal_axis_summary_type || null;
192
- this.show_vertical_axis_label = object.show_vertical_axis_label || false;
193
- this.show_horizontal_axis_label = object.show_horizontal_axis_label || false;
194
- this.vertical_axis_label_position = object.vertical_axis_label_position || 'center';
195
- this.horizontal_axis_label_position = object.horizontal_axis_label_position || 'center';
196
- this.horizontal_axis_column_key = object.horizontal_axis_column_key || null;
197
- this.horizontal_axis_summary_method = object.horizontal_axis_summary_method || null;
198
- this.horizontal_axis_label_color = object.horizontal_axis_label_color || null;
199
-
200
- // group
201
- this.column_groupby_column_key = object.column_groupby_column_key || null;
202
- this.column_groupby_date_granularity = object.column_groupby_date_granularity || null;
203
- this.column_groupby_geolocation_granularity = object.column_groupby_geolocation_granularity || null;
204
- this.column_groupby_multiple_numeric_column = object.column_groupby_multiple_numeric_column || null;
205
- this.column_groupby_numeric_columns = object.column_groupby_numeric_columns || null;
206
- this.title_name = object.title_name || null;
207
- break;
208
- }
209
- case STAT_TYPE.COMBINATION_CHART:
210
- {
211
- this.x_axis_column_key = object.x_axis_column_key || null;
212
- this.x_axis_geolocation_granularity = object.x_axis_geolocation_granularity || null;
213
- this.x_axis_date_granularity = object.x_axis_date_granularity || null;
214
- this.x_axis_include_empty = object.x_axis_include_empty || null;
215
- this.y_axis_left_summary_type = object.y_axis_left_summary_type || null;
216
- this.y_axis_right_summary_type = object.y_axis_right_summary_type || null;
217
- this.y_axis_left_summary_method = object.y_axis_left_summary_method || null;
218
- this.y_axis_right_summary_method = object.y_axis_right_summary_method || null;
219
- this.y_axis_left_summary_column = object.y_axis_left__summary_column || null;
220
- this.y_axis_right_summary_column = object.y_axis_right_summary_column || null;
221
- this.y_axis_left_group_by_multiple_numeric_column = object.y_axis_left_group_by_multiple_numeric_column || false;
222
- this.y_axis_left_group_by_numeric_columns = object.y_axis_left_group_by_numeric_columns || null;
223
- this.y_axis_left_color = object.y_axis_left_color || null;
224
- this.y_axis_right_color = object.y_axis_right_color || null;
225
- this.show_x_axis_label = object.show_x_axis_label || null;
226
- this.x_axis_label_position = object.x_axis_label_position || 'center';
227
- this.show_y_axis_left_label = object.show_y_axis_left_label || null;
228
- this.show_y_axis_right_label = object.show_y_axis_right_label || null;
229
- this.y_axis_left_label_position = object.y_axis_left_label_position || null;
230
- this.y_axis_right_label_position = object.y_axis_right_label_position || null;
231
- this.y_axis_auto_range_left = object.y_axis_auto_range_left || null;
232
- this.y_axis_min_left = object.y_axis_min_left || null;
233
- this.y_axis_max_left = object.y_axis_max_left || null;
234
- this.y_axis_auto_range_right = object.y_axis_auto_range_right || null;
235
- this.y_axis_min_right = object.y_axis_min_right || null;
236
- this.y_axis_max_right = object.y_axis_max_right || null;
237
- this.display_data = object.display_data || null;
238
- break;
239
- }
240
- case STAT_TYPE.COMPARE_BAR:
241
- {
242
- this.x_axis_column_key = object.x_axis_column_key || null;
243
- this.x_axis_date_granularity = object.x_axis_date_granularity || 'month';
244
- this.x_axis_date_range_start = object.x_axis_date_range_start || null;
245
- this.x_axis_date_range_end = object.x_axis_date_range_end || null;
246
- this.x_axis_compared_date_range_start = object.x_axis_compared_date_range_start || null;
247
- this.x_axis_compared_date_range_end = object.x_axis_compared_date_range_end || null;
248
- this.show_x_axis_label = object.show_x_axis_label || false;
249
- this.show_y_axis_label = object.show_y_axis_label || false;
250
- this.x_axis_label_position = object.x_axis_label_position || 'center';
251
- this.y_axis_label_position = object.y_axis_label_position || 'center';
252
- this.y_axis_summary_type = object.y_axis_summary_type || null;
253
- this.y_axis_compare_label_color = object.y_axis_compare_label_color || null;
254
- this.y_axis_compared_label_color = object.y_axis_compared_label_color || null;
255
- this.y_axis_column_key = object.y_axis_column_key || null;
256
- this.y_axis_summary_method = object.y_axis_summary_method || null;
257
- this.display_increase = object.display_increase || false;
258
- this.display_increase_percentage = object.display_increase_percentage || false;
259
- this.increase_display_color = object.increase_display_color || null;
260
- this.increase_line_color = object.increase_line_color || '#fbd44a';
261
- break;
262
- }
263
- case STAT_TYPE.TREND_CHART:
264
- {
265
- this.date_column = object.date_column || null;
266
- this.date_granularity = object.date_granularity || null;
267
- this.summary_type = object.summary_type;
268
- this.summary_column = object.summary_column;
269
- this.summary_method = object.summary_method;
270
- break;
271
- }
272
- case STAT_TYPE.COMPLETENESS_CHART:
273
- {
274
- this.name_column = object.name_column || null;
275
- this.completed_column = object.completed_column || null;
276
- this.target_column = object.target_column || null;
277
- this.completed_color = object.completed_color || '#2a67d1';
278
- this.display_percentage = object.display_percentage || true;
279
- this.y_axis_auto_range = object.y_axis_auto_range || null;
280
- this.y_axis_min = object.y_axis_min || null;
281
- this.y_axis_max = object.y_axis_max || null;
282
- break;
283
- }
284
- case STAT_TYPE.DASHBOARD:
285
- {
286
- this.name = null;
287
- this.target_value_column = object.target_value_column || null;
288
- this.target_value_column_summary_method = object.target_value_column_summary_method || 'Row_count';
289
- this.total_value_column = object.total_value_column || null;
290
- this.total_value_column_summary_method = object.total_value_column_summary_method || 'Row_count';
291
- break;
292
- }
293
- case STAT_TYPE.GROUP_COMPLETENESS_CHART:
294
- {
295
- this.target_value_column = object.target_value_column || null;
296
- this.target_value_column_summary_method = object.target_value_column_summary_method || 'Row_count';
297
- this.total_value_column = object.total_value_column || null;
298
- this.total_value_column_summary_method = object.total_value_column_summary_method || 'Row_count';
299
- this.name_column = object.name_column || null;
300
- this.completed_column = object.completed_column || null;
301
- this.target_column = object.target_column || null;
302
- this.display_percentage = object.display_percentage || true;
303
- this.group_column = object.group_column || null;
304
- this.date_granularity = object.date_granularity || null;
305
- this.geolocation_granularity = object.geolocation_granularity || null;
306
- break;
307
- }
308
- case STAT_TYPE.PIVOT_TABLE:
309
- {
310
- this.groupby_column_key = object.groupby_column_key || null;
311
- this.groupby_date_granularity = object.groupby_date_granularity || null;
312
- this.groupby_geolocation_granularity = object.groupby_geolocation_granularity || null;
313
- this.groupby_include_empty_cells = object.groupby_include_empty_cells || false;
314
- this.summary_column_key = object.summary_column_key || null;
315
- this.summary_method = object.summary_method || null;
316
- this.summary_type = object.summary_type || null;
317
- this.column_groupby_multiple_numeric_column = object.column_groupby_multiple_numeric_column || false;
318
- this.column_groupby_column_key = object.column_groupby_column_key || null;
319
- this.column_groupby_date_granularity = object.column_groupby_date_granularity || null;
320
- this.column_groupby_geolocation_granularity = object.column_groupby_geolocation_granularity || null;
321
- this.display_total = object.display_total || true;
322
- this.summary_columns_option = object.summary_columns_option || [];
323
- break;
324
- }
325
- default:
326
- {
327
- break;
328
- }
329
- }
330
- if (object.display_data) {
331
- this.display_data = true;
332
- }
333
- if (SUPPORT_LABEL_FONT_SIZE_CHARTS.includes(type)) {
334
- this.label_font_size = isNumber(object.label_font_size) ? object.label_font_size : DEFAULT_LABEL_FONT_SIZE;
335
- }
336
- }
337
- }]);
338
- return StatItem;
339
- }();
340
- export { StatItem as default };