dtable-statistic 4.0.2-test-2

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 (210) hide show
  1. package/README.md +3 -0
  2. package/es/api/dtable-db-api.js +43 -0
  3. package/es/assets/css/color-picker.css +53 -0
  4. package/es/assets/css/color-rules-popover.css +144 -0
  5. package/es/assets/css/color-theme-dialog.css +40 -0
  6. package/es/assets/css/dashboard.css +562 -0
  7. package/es/assets/css/dialog.css +415 -0
  8. package/es/assets/css/mobile-dashboard.module.css +91 -0
  9. package/es/assets/css/slider.css +77 -0
  10. package/es/assets/css/statistic-chart.module.css +11 -0
  11. package/es/assets/css/statistic-custom-title.module.css +3 -0
  12. package/es/assets/css/statistic-custom.module.css +4 -0
  13. package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
  14. package/es/assets/css/statistic-time-picker.module.css +21 -0
  15. package/es/assets/css/theme.css +61 -0
  16. package/es/assets/images/icon.png +0 -0
  17. package/es/calculator/base-calculator.js +111 -0
  18. package/es/calculator/basic-chart-calculator.js +571 -0
  19. package/es/calculator/combination-calculator.js +296 -0
  20. package/es/calculator/compare-bar-calculator.js +291 -0
  21. package/es/calculator/completeness-calculator.js +307 -0
  22. package/es/calculator/copy-value.js +47 -0
  23. package/es/calculator/dashboard-calculator.js +146 -0
  24. package/es/calculator/heat-map-calculator.js +225 -0
  25. package/es/calculator/horizontal-bar-calculator.js +100 -0
  26. package/es/calculator/index.js +88 -0
  27. package/es/calculator/map-calculator.js +169 -0
  28. package/es/calculator/mirror-calculator.js +217 -0
  29. package/es/calculator/number-card-calculator.js +135 -0
  30. package/es/calculator/pivot-table-calculator.js +810 -0
  31. package/es/calculator/scatter-calculator.js +150 -0
  32. package/es/calculator/thread-manager.js +70 -0
  33. package/es/calculator/trend-calculator.js +204 -0
  34. package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
  35. package/es/calculator/workers/calculator.worker.js +22 -0
  36. package/es/calculator/workers/card-calculator-worker.js +28 -0
  37. package/es/calculator/workers/combination-calculator-worker.js +257 -0
  38. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
  39. package/es/calculator/workers/completeness-calculator-worker.js +153 -0
  40. package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
  41. package/es/calculator/workers/mirror-calculator-worker.js +132 -0
  42. package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
  43. package/es/calculator/workers/scatter-calculator-worker.js +67 -0
  44. package/es/calculator/workers/trend-calculator-worker.js +93 -0
  45. package/es/calculator/world-map-calculator.js +193 -0
  46. package/es/components/common-add-tool.js +19 -0
  47. package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
  48. package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
  49. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
  50. package/es/components/dialog/color-theme-dialog.js +71 -0
  51. package/es/components/dialog/enlarged-chart-dialog.js +73 -0
  52. package/es/components/dialog/new-table-dialog.js +113 -0
  53. package/es/components/dialog/new-view-dialog.js +87 -0
  54. package/es/components/dialog/rename-view-dialog.js +87 -0
  55. package/es/components/dialog/statistic-record-dialog/index.css +114 -0
  56. package/es/components/dialog/statistic-record-dialog/index.js +174 -0
  57. package/es/components/dialog/table-select-dialog.js +93 -0
  58. package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
  59. package/es/components/dtable-popover.js +109 -0
  60. package/es/components/dtable-search-input.js +137 -0
  61. package/es/components/dtable-select.js +104 -0
  62. package/es/components/index.js +11 -0
  63. package/es/components/loading.js +8 -0
  64. package/es/components/modal-portal.js +36 -0
  65. package/es/components/popover/color-rules/color-rule.js +179 -0
  66. package/es/components/popover/color-rules/index.js +87 -0
  67. package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
  68. package/es/components/popover/color-rules/rule-filters/index.css +214 -0
  69. package/es/components/popover/color-rules/rule-filters/index.js +97 -0
  70. package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
  71. package/es/components/popover/color-rules-popover.js +213 -0
  72. package/es/components/popover/color-selector-popover.js +85 -0
  73. package/es/components/seatable-radio/index.css +51 -0
  74. package/es/components/seatable-radio/index.js +28 -0
  75. package/es/components/select/index.js +2 -0
  76. package/es/components/select/option-group.css +104 -0
  77. package/es/components/select/option-group.js +225 -0
  78. package/es/components/select/option.js +51 -0
  79. package/es/components/select/select.css +211 -0
  80. package/es/components/select/select.js +157 -0
  81. package/es/components/toast/alert.js +130 -0
  82. package/es/components/toast/index.js +3 -0
  83. package/es/components/toast/toast.js +164 -0
  84. package/es/components/toast/toastManager.js +150 -0
  85. package/es/components/toast/toaster.js +64 -0
  86. package/es/constants/color-rules.js +8 -0
  87. package/es/constants/dtable-select-style.js +61 -0
  88. package/es/constants/event-types.js +1 -0
  89. package/es/constants/index.js +501 -0
  90. package/es/constants/key-codes.js +102 -0
  91. package/es/constants/zIndexes.js +1 -0
  92. package/es/custom-g2.js +614 -0
  93. package/es/dashboard.js +408 -0
  94. package/es/desktop-dashboard.js +299 -0
  95. package/es/index.js +33 -0
  96. package/es/locale/index.js +17 -0
  97. package/es/locale/lang/de.js +237 -0
  98. package/es/locale/lang/en.js +237 -0
  99. package/es/locale/lang/fr.js +237 -0
  100. package/es/locale/lang/zh_CN.js +237 -0
  101. package/es/mobile-dashboard.js +103 -0
  102. package/es/model/collaborators.js +11 -0
  103. package/es/model/stat-item.js +340 -0
  104. package/es/model/statistic-dashboard.js +8 -0
  105. package/es/service/chart-service.js +192 -0
  106. package/es/service/dashboard-service.js +415 -0
  107. package/es/stat-editor/chart-name-editor.js +75 -0
  108. package/es/stat-editor/index.js +74 -0
  109. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
  110. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
  111. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
  112. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
  113. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
  114. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
  115. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
  116. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
  117. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
  118. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
  119. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
  120. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
  121. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
  122. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
  123. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
  124. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
  125. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
  126. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
  127. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
  128. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
  129. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
  130. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
  131. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
  132. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
  133. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
  134. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
  135. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
  136. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
  137. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
  138. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
  139. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
  140. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
  141. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
  143. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
  144. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
  145. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
  146. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
  147. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
  148. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
  149. package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
  150. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
  151. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
  152. package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
  153. package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
  154. package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
  155. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
  156. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
  157. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
  158. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
  159. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
  160. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
  161. package/es/stat-list/chart-preview.js +139 -0
  162. package/es/stat-list/index.js +275 -0
  163. package/es/stat-view/area-chart.js +521 -0
  164. package/es/stat-view/bar-chart.js +568 -0
  165. package/es/stat-view/base-chart.js +44 -0
  166. package/es/stat-view/basic-number-card.js +255 -0
  167. package/es/stat-view/combination-chart.js +558 -0
  168. package/es/stat-view/compare-chart.js +485 -0
  169. package/es/stat-view/completeness-chart.js +389 -0
  170. package/es/stat-view/custom-bar.js +433 -0
  171. package/es/stat-view/dashboard-chart.js +317 -0
  172. package/es/stat-view/heat-map.js +501 -0
  173. package/es/stat-view/horizontal-bar-chart.js +569 -0
  174. package/es/stat-view/index.js +183 -0
  175. package/es/stat-view/line-chart.js +505 -0
  176. package/es/stat-view/map.js +428 -0
  177. package/es/stat-view/mirror.js +285 -0
  178. package/es/stat-view/pie-chart.js +326 -0
  179. package/es/stat-view/pivot-table/index.js +206 -0
  180. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
  181. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
  182. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
  183. package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
  184. package/es/stat-view/ring-chart.js +416 -0
  185. package/es/stat-view/scatter-chart.js +367 -0
  186. package/es/stat-view/treemap-chart.js +318 -0
  187. package/es/stat-view/trend-chart.js +299 -0
  188. package/es/stat-view/world-map.js +443 -0
  189. package/es/tabs/index.js +252 -0
  190. package/es/tabs/statistic-tabs.module.css +154 -0
  191. package/es/tabs/tab.js +167 -0
  192. package/es/utils/basic-chart-utils.js +24 -0
  193. package/es/utils/cell-format.js +110 -0
  194. package/es/utils/cell-value.js +27 -0
  195. package/es/utils/collaborator.js +31 -0
  196. package/es/utils/color-utils.js +112 -0
  197. package/es/utils/column-utils.js +18 -0
  198. package/es/utils/column.js +13 -0
  199. package/es/utils/common-utils.js +303 -0
  200. package/es/utils/date-format.js +65 -0
  201. package/es/utils/export-table-utils.js +632 -0
  202. package/es/utils/index.js +26 -0
  203. package/es/utils/object.js +26 -0
  204. package/es/utils/row-utils.js +115 -0
  205. package/es/utils/search.js +67 -0
  206. package/es/utils/sql-utils.js +293 -0
  207. package/es/utils/stat-utils.js +353 -0
  208. package/es/utils/trend-utils.js +136 -0
  209. package/index.js +1 -0
  210. package/package.json +188 -0
@@ -0,0 +1,340 @@
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 };
@@ -0,0 +1,8 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ var StatisticDashBoard = function StatisticDashBoard(object) {
3
+ _classCallCheck(this, StatisticDashBoard);
4
+ this._id = object._id || null;
5
+ this.name = object.name || null;
6
+ this.stat_items = object.stat_items || null;
7
+ };
8
+ export { StatisticDashBoard as default };
@@ -0,0 +1,192 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import StatItem from '../model/stat-item';
5
+ import { STAT_TYPE, GEOLOCATION_GRANULARITY, SUMMARY_TYPE, LABEL_COLORS, STATISTICS_COUNT_TYPE } from '../constants';
6
+ import { generatorUniqueId } from '../utils/common-utils';
7
+ var ChartService = /*#__PURE__*/function () {
8
+ function ChartService(_ref) {
9
+ var defaultChartTitle = _ref.defaultChartTitle;
10
+ _classCallCheck(this, ChartService);
11
+ this.defaultChartTitle = defaultChartTitle;
12
+ }
13
+ _createClass(ChartService, [{
14
+ key: "generateChart",
15
+ value: function generateChart(_ref2) {
16
+ var type = _ref2.type,
17
+ dashboard = _ref2.dashboard,
18
+ activeTable = _ref2.activeTable,
19
+ activeView = _ref2.activeView;
20
+ var stat_items = dashboard.stat_items;
21
+ var charId = generatorUniqueId(stat_items);
22
+ var commonConfigs = {
23
+ type: type,
24
+ _id: charId,
25
+ name: this.defaultChartTitle,
26
+ table_id: activeTable._id,
27
+ view_id: activeView._id
28
+ };
29
+ switch (type) {
30
+ case STAT_TYPE.MAP:
31
+ case STAT_TYPE.MAP_BUBBLE:
32
+ {
33
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
34
+ geo_column: null,
35
+ geolocation_granularity: GEOLOCATION_GRANULARITY.PROVINCE,
36
+ summary_type: SUMMARY_TYPE.COUNT
37
+ }));
38
+ }
39
+ case STAT_TYPE.WORLD_MAP:
40
+ case STAT_TYPE.WORLD_MAP_BUBBLE:
41
+ {
42
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
43
+ column: null,
44
+ summary_type: SUMMARY_TYPE.COUNT
45
+ }));
46
+ }
47
+ case STAT_TYPE.HEAT_MAP:
48
+ {
49
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
50
+ time_column: null,
51
+ summary_type: SUMMARY_TYPE.COUNT
52
+ }));
53
+ }
54
+ case STAT_TYPE.MIRROR:
55
+ {
56
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
57
+ column: null,
58
+ group_column: null,
59
+ is_transpose: false,
60
+ summary_type: SUMMARY_TYPE.COUNT
61
+ }));
62
+ }
63
+ case STAT_TYPE.BAR:
64
+ case STAT_TYPE.LINE:
65
+ case STAT_TYPE.AREA_CHART:
66
+ case STAT_TYPE.AREA_GROUP_CHART:
67
+ case STAT_TYPE.COMPARE_BAR:
68
+ {
69
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
70
+ x_axis_column_key: null,
71
+ y_axis_summary_type: SUMMARY_TYPE.COUNT,
72
+ show_x_axis_label: false,
73
+ show_y_axis_label: false
74
+ }));
75
+ }
76
+ case STAT_TYPE.CUSTOM_BAR:
77
+ {
78
+ return new StatItem(commonConfigs);
79
+ }
80
+ case STAT_TYPE.BAR_GROUP:
81
+ case STAT_TYPE.BAR_STACK:
82
+ case STAT_TYPE.GROUP_LINE:
83
+ {
84
+ var configs = _objectSpread(_objectSpread({}, commonConfigs), {}, {
85
+ x_axis_column_key: null,
86
+ column_groupby_column_key: null,
87
+ y_axis_summary_type: SUMMARY_TYPE.COUNT,
88
+ show_x_axis_label: false,
89
+ show_y_axis_label: false
90
+ });
91
+ if (type === STAT_TYPE.BAR_STACK) {
92
+ configs.y_axis_use_stack = true;
93
+ }
94
+ return new StatItem(configs);
95
+ }
96
+ case STAT_TYPE.HORIZONTAL_BAR:
97
+ {
98
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
99
+ vertical_axis_column_key: null,
100
+ horizontal_axis_summary_type: SUMMARY_TYPE.COUNT,
101
+ show_vertical_axis_label: false,
102
+ show_horizontal_axis_label: false
103
+ }));
104
+ }
105
+ case STAT_TYPE.HORIZONTAL_GROUP_BAR:
106
+ case STAT_TYPE.STACKED_HORIZONTAL_BAR:
107
+ {
108
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
109
+ vertical_axis_column_key: null,
110
+ horizontal_axis_summary_type: SUMMARY_TYPE.COUNT,
111
+ show_vertical_axis_label: false,
112
+ show_horizontal_axis_label: false,
113
+ column_groupby_column_key: null
114
+ }));
115
+ }
116
+ case STAT_TYPE.PIE:
117
+ case STAT_TYPE.RING:
118
+ case STAT_TYPE.TREEMAP:
119
+ {
120
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
121
+ groupby_column_key: null,
122
+ summary_type: SUMMARY_TYPE.COUNT
123
+ }));
124
+ }
125
+ case STAT_TYPE.SCATTER:
126
+ {
127
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
128
+ x_axis_column: null,
129
+ y_axis_column: null,
130
+ group_column: null,
131
+ show_x_axis_label: false,
132
+ show_y_axis_label: false
133
+ }));
134
+ }
135
+ case STAT_TYPE.BASIC_NUMBER_CARD:
136
+ {
137
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
138
+ numeric_column: null,
139
+ summary_method: 'Row_count'
140
+ }));
141
+ }
142
+ case STAT_TYPE.COMBINATION_CHART:
143
+ {
144
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
145
+ x_axis_column_key: null,
146
+ x_axis_include_empty: false,
147
+ y_axis_left_summary_type: STATISTICS_COUNT_TYPE.COUNT,
148
+ y_axis_right_summary_type: STATISTICS_COUNT_TYPE.COUNT,
149
+ y_axis_left_color: LABEL_COLORS[0],
150
+ y_axis_right_color: LABEL_COLORS[1],
151
+ show_y_axis_left_label: false,
152
+ show_y_axis_right_label: false
153
+ }));
154
+ }
155
+ case STAT_TYPE.TREND_CHART:
156
+ {
157
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
158
+ date_column: null,
159
+ summary_type: STATISTICS_COUNT_TYPE.COUNT,
160
+ date_granularity: STATISTICS_COUNT_TYPE.MONTH
161
+ }));
162
+ }
163
+ case STAT_TYPE.COMPLETENESS_CHART:
164
+ case STAT_TYPE.GROUP_COMPLETENESS_CHART:
165
+ {
166
+ return new StatItem(commonConfigs);
167
+ }
168
+ case STAT_TYPE.DASHBOARD:
169
+ {
170
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
171
+ target_value_column: null,
172
+ target_value_column_summary_method: 'Row_count',
173
+ total_value_column: null,
174
+ total_value_column_summary_method: 'Row_count'
175
+ }));
176
+ }
177
+ case STAT_TYPE.PIVOT_TABLE:
178
+ {
179
+ return new StatItem(_objectSpread(_objectSpread({}, commonConfigs), {}, {
180
+ summary_type: SUMMARY_TYPE.COUNT
181
+ }));
182
+ }
183
+ default:
184
+ {
185
+ return null;
186
+ }
187
+ }
188
+ }
189
+ }]);
190
+ return ChartService;
191
+ }();
192
+ export default ChartService;