dtable-statistic 4.2.2 → 4.3.1

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 (219) hide show
  1. package/es/api/dtable-db-api.js +31 -37
  2. package/es/calculator/base-calculator.js +49 -99
  3. package/es/calculator/basic-chart-calculator.js +335 -559
  4. package/es/calculator/combination-calculator.js +231 -299
  5. package/es/calculator/compare-bar-calculator.js +184 -281
  6. package/es/calculator/completeness-calculator.js +203 -288
  7. package/es/calculator/copy-value.js +18 -18
  8. package/es/calculator/dashboard-calculator.js +68 -137
  9. package/es/calculator/heat-map-calculator.js +139 -220
  10. package/es/calculator/horizontal-bar-calculator.js +64 -93
  11. package/es/calculator/index.js +53 -69
  12. package/es/calculator/map-calculator.js +98 -174
  13. package/es/calculator/mirror-calculator.js +137 -216
  14. package/es/calculator/number-card-calculator.js +58 -126
  15. package/es/calculator/pivot-table-calculator.js +750 -792
  16. package/es/calculator/scatter-calculator.js +72 -140
  17. package/es/calculator/thread-manager.js +48 -67
  18. package/es/calculator/trend-calculator.js +107 -191
  19. package/es/calculator/workers/basic-chart-calculator-worker.js +194 -165
  20. package/es/calculator/workers/calculator.worker.js +22 -6
  21. package/es/calculator/workers/card-calculator-worker.js +16 -14
  22. package/es/calculator/workers/combination-calculator-worker.js +128 -135
  23. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +80 -96
  24. package/es/calculator/workers/completeness-calculator-worker.js +56 -49
  25. package/es/calculator/workers/dashboard-calculator-worker.js +24 -22
  26. package/es/calculator/workers/mirror-calculator-worker.js +52 -52
  27. package/es/calculator/workers/pivot-table-calculator-worker.js +247 -230
  28. package/es/calculator/workers/scatter-calculator-worker.js +34 -32
  29. package/es/calculator/workers/trend-calculator-worker.js +33 -29
  30. package/es/calculator/world-map-calculator.js +120 -197
  31. package/es/components/common-add-tool.js +7 -5
  32. package/es/components/dialog/chart-addition-edit-dialog.js +67 -77
  33. package/es/components/dialog/chart-addition-widgets/chart-selector.js +57 -67
  34. package/es/components/dialog/color-theme-dialog.js +34 -47
  35. package/es/components/dialog/delete-confirmation-dialog.js +7 -5
  36. package/es/components/dialog/enlarged-chart-dialog.js +68 -81
  37. package/es/components/dialog/new-table-dialog.js +62 -80
  38. package/es/components/dialog/new-view-dialog.js +50 -62
  39. package/es/components/dialog/rename-view-dialog.js +49 -58
  40. package/es/components/dialog/statistic-record-dialog/index.js +233 -231
  41. package/es/components/dialog/statistic-types-dialog/index.js +40 -49
  42. package/es/components/dialog/table-select-dialog.js +61 -70
  43. package/es/components/dropdown-menu/statistic-dropdown-menu.js +129 -142
  44. package/es/components/dtable-popover.js +62 -81
  45. package/es/components/dtable-search-input.js +89 -99
  46. package/es/components/dtable-select.js +55 -74
  47. package/es/components/icon.js +5 -3
  48. package/es/components/loading.js +1 -1
  49. package/es/components/modal-portal.js +15 -32
  50. package/es/components/popover/color-rules/color-rule.js +137 -141
  51. package/es/components/popover/color-rules/index.js +58 -66
  52. package/es/components/popover/color-rules/rule-filters/filter.js +124 -124
  53. package/es/components/popover/color-rules/rule-filters/index.js +50 -58
  54. package/es/components/popover/color-rules/rule-filters/number-input.js +42 -57
  55. package/es/components/popover/color-rules-popover.js +117 -121
  56. package/es/components/popover/color-selector-popover.js +60 -70
  57. package/es/components/seatable-radio/index.js +2 -2
  58. package/es/components/select/option-group.js +139 -157
  59. package/es/components/select/option.js +26 -40
  60. package/es/components/select/select.js +97 -112
  61. package/es/components/toast/alert.js +65 -80
  62. package/es/components/toast/index.js +1 -1
  63. package/es/components/toast/toast.js +76 -103
  64. package/es/components/toast/toastManager.js +57 -93
  65. package/es/components/toast/toaster.js +58 -56
  66. package/es/constants/color-rules.js +8 -5
  67. package/es/constants/dtable-select-style.js +44 -48
  68. package/es/constants/event-types.js +4 -4
  69. package/es/constants/index.js +328 -242
  70. package/es/constants/map.js +2 -2
  71. package/es/constants/model.js +20 -20
  72. package/es/constants/regions.js +1 -1
  73. package/es/constants/zIndexes.js +1 -1
  74. package/es/custom-g2.js +11 -11
  75. package/es/dashboard.js +343 -333
  76. package/es/desktop-dashboard.js +217 -224
  77. package/es/index.js +45 -58
  78. package/es/locale/index.js +3 -3
  79. package/es/locale/lang/de.js +1 -1
  80. package/es/locale/lang/en.js +7 -7
  81. package/es/locale/lang/fr.js +1 -1
  82. package/es/locale/lang/zh_CN.js +1 -1
  83. package/es/mobile-dashboard.js +76 -89
  84. package/es/model/bar-group.js +34 -44
  85. package/es/model/bar.js +26 -36
  86. package/es/model/base-model.js +11 -12
  87. package/es/model/basic-number-card.js +10 -20
  88. package/es/model/collaborators.js +10 -11
  89. package/es/model/combination.js +32 -42
  90. package/es/model/compare-bar.js +30 -40
  91. package/es/model/completeness-group.js +19 -29
  92. package/es/model/completeness.js +14 -24
  93. package/es/model/custom-bar.js +14 -24
  94. package/es/model/dashboard.js +9 -19
  95. package/es/model/generic-model.js +187 -197
  96. package/es/model/heat-map.js +16 -26
  97. package/es/model/horizontal-bar-group.js +32 -42
  98. package/es/model/horizontal-bar.js +26 -36
  99. package/es/model/index.js +31 -3
  100. package/es/model/map.js +20 -30
  101. package/es/model/mirror.js +15 -25
  102. package/es/model/pie.js +21 -31
  103. package/es/model/ring.js +23 -33
  104. package/es/model/scatter.js +11 -21
  105. package/es/model/statistic-dashboard.js +7 -8
  106. package/es/model/table.js +19 -29
  107. package/es/model/trend.js +15 -25
  108. package/es/model/world-map.js +17 -27
  109. package/es/service/chart-service.js +69 -65
  110. package/es/service/dashboard-service.js +421 -419
  111. package/es/service/map-json.js +112 -132
  112. package/es/stat-editor/chart-name-editor.js +44 -58
  113. package/es/stat-editor/index.js +59 -70
  114. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +93 -98
  115. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +246 -248
  116. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +127 -126
  117. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +5 -3
  118. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +78 -90
  119. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +146 -150
  120. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +88 -98
  121. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +100 -118
  122. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +161 -148
  123. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +58 -66
  124. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +58 -60
  125. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +152 -148
  126. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +101 -105
  127. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +81 -91
  128. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +110 -122
  129. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +101 -113
  130. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +130 -120
  131. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +88 -102
  132. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +88 -102
  133. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +200 -194
  134. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +98 -110
  135. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +106 -118
  136. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +212 -223
  137. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +109 -119
  138. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +329 -319
  139. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +82 -90
  140. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +58 -65
  141. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +126 -116
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +201 -182
  143. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +79 -79
  144. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +196 -175
  145. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +35 -50
  146. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +180 -147
  147. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +31 -40
  148. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +56 -67
  149. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +60 -69
  150. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +165 -158
  151. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +61 -74
  152. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +199 -193
  153. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +25 -38
  154. package/es/stat-editor/stat-settings/color-setting/color-picker.js +79 -86
  155. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +138 -120
  156. package/es/stat-editor/stat-settings/map/map-level.js +31 -43
  157. package/es/stat-editor/stat-settings/map/map-province-city.js +82 -83
  158. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +48 -50
  159. package/es/stat-editor/stat-settings/public-setting/base-settings.js +96 -96
  160. package/es/stat-editor/stat-settings/public-setting/calender.js +69 -75
  161. package/es/stat-editor/stat-settings/public-setting/column-settings.js +5 -3
  162. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +36 -41
  163. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +37 -41
  164. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +25 -38
  165. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +40 -52
  166. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +90 -93
  167. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +23 -36
  168. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +39 -44
  169. package/es/stat-list/chart-preview.js +85 -98
  170. package/es/stat-list/index.js +170 -178
  171. package/es/stat-view/area-chart.js +282 -274
  172. package/es/stat-view/bar-chart.js +300 -292
  173. package/es/stat-view/base-chart.js +58 -52
  174. package/es/stat-view/basic-number-card.js +115 -168
  175. package/es/stat-view/combination-chart.js +298 -334
  176. package/es/stat-view/compare-chart.js +256 -254
  177. package/es/stat-view/completeness-chart.js +194 -206
  178. package/es/stat-view/custom-bar.js +221 -223
  179. package/es/stat-view/dashboard-chart.js +122 -180
  180. package/es/stat-view/heat-map.js +268 -294
  181. package/es/stat-view/horizontal-bar-chart.js +291 -281
  182. package/es/stat-view/index.js +136 -152
  183. package/es/stat-view/line-chart.js +267 -265
  184. package/es/stat-view/map.js +246 -246
  185. package/es/stat-view/mirror.js +141 -152
  186. package/es/stat-view/pie-chart.js +143 -156
  187. package/es/stat-view/pivot-table/index.js +113 -118
  188. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +104 -102
  189. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +116 -118
  190. package/es/stat-view/pivot-table/pivot-table-display-name.js +96 -95
  191. package/es/stat-view/pivot-table/two-dimension-table.js +238 -229
  192. package/es/stat-view/ring-chart.js +189 -200
  193. package/es/stat-view/scatter-chart.js +162 -213
  194. package/es/stat-view/treemap-chart.js +136 -200
  195. package/es/stat-view/trend-chart.js +137 -183
  196. package/es/stat-view/world-map.js +233 -243
  197. package/es/tabs/index.js +164 -169
  198. package/es/tabs/tab.js +101 -116
  199. package/es/utils/basic-chart-utils.js +7 -9
  200. package/es/utils/cell-format.js +48 -51
  201. package/es/utils/cell-value.js +1 -1
  202. package/es/utils/collaborator.js +15 -14
  203. package/es/utils/color-utils.js +48 -37
  204. package/es/utils/column-utils.js +47 -33
  205. package/es/utils/column.js +1 -1
  206. package/es/utils/common-utils.js +111 -117
  207. package/es/utils/date-format.js +17 -17
  208. package/es/utils/export-table-utils.js +507 -396
  209. package/es/utils/index.js +6 -6
  210. package/es/utils/map.js +30 -34
  211. package/es/utils/model.js +3 -5
  212. package/es/utils/object.js +4 -4
  213. package/es/utils/pivot-table.js +20 -20
  214. package/es/utils/row-utils.js +41 -33
  215. package/es/utils/search.js +18 -20
  216. package/es/utils/sql-utils.js +132 -98
  217. package/es/utils/stat-utils.js +303 -320
  218. package/es/utils/trend-utils.js +57 -67
  219. package/package.json +2 -2
@@ -1,7 +1,3 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React from 'react';
6
2
  import PropTypes from 'prop-types';
7
3
  import intl from 'react-intl-universal';
@@ -11,7 +7,7 @@ import { Chart } from '../custom-g2';
11
7
  import { getCurrentTheme } from '../utils/common-utils';
12
8
  import { getChartGroups } from '../utils/basic-chart-utils';
13
9
  import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_CONFIG_CHANGED, STATISTICS_COUNT_SHOW, SUMMARY_TYPE, TITLE_AMOUNT, TYPE_COLOR_USING } from '../constants';
14
- var propTypes = {
10
+ const propTypes = {
15
11
  isPreview: PropTypes.bool,
16
12
  isEdit: PropTypes.bool,
17
13
  colorThemeName: PropTypes.string,
@@ -21,119 +17,122 @@ var propTypes = {
21
17
  getTableById: PropTypes.func,
22
18
  toggleStatisticRecordsDialog: PropTypes.func
23
19
  };
24
- var AreaChart = /*#__PURE__*/function (_BaseChart) {
25
- _inherits(AreaChart, _BaseChart);
26
- var _super = _createSuper(AreaChart);
27
- function AreaChart(props) {
28
- var _this;
29
- _classCallCheck(this, AreaChart);
30
- _this = _super.call(this, props);
31
- _this.drawChart = function (data) {
32
- var _this$props = _this.props,
33
- getTableById = _this$props.getTableById,
34
- statItem = _this$props.statItem,
35
- colorThemeName = _this$props.colorThemeName;
36
- _this.initChartHandler();
37
- _this.chart.on('element:click', function (e) {
38
- var areaElement = e.target.get('element');
39
- var data = areaElement.data;
20
+ class AreaChart extends BaseChart {
21
+ constructor(props) {
22
+ super(props);
23
+ this.drawChart = data => {
24
+ const {
25
+ getTableById,
26
+ statItem,
27
+ colorThemeName
28
+ } = this.props;
29
+ this.initChartHandler();
30
+ this.chart.on('element:click', e => {
31
+ const areaElement = e.target.get('element');
32
+ const data = areaElement.data;
40
33
  if (!Array.isArray(data)) {
41
- _this.props.toggleStatisticRecordsDialog(data, statItem);
34
+ this.props.toggleStatisticRecordsDialog(data, statItem);
42
35
  }
43
36
  });
44
- var currentTheme = getCurrentTheme(colorThemeName);
45
- var table_id = statItem.table_id,
46
- y_axis_summary_type = statItem.y_axis_summary_type,
47
- y_axis_column_key = statItem.y_axis_column_key,
48
- column_groupby_column_key = statItem.column_groupby_column_key,
49
- column_groupby_multiple_numeric_column = statItem.column_groupby_multiple_numeric_column,
50
- color_option = statItem.color_option;
51
- var isGroup = column_groupby_column_key || column_groupby_multiple_numeric_column;
52
- var summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
37
+ const currentTheme = getCurrentTheme(colorThemeName);
38
+ let {
39
+ table_id,
40
+ y_axis_summary_type,
41
+ y_axis_column_key,
42
+ column_groupby_column_key,
43
+ column_groupby_multiple_numeric_column,
44
+ color_option
45
+ } = statItem;
46
+ const isGroup = column_groupby_column_key || column_groupby_multiple_numeric_column;
47
+ let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
53
48
  if (y_axis_summary_type === SUMMARY_TYPE.ADVANCED) {
54
- var table = getTableById(table_id);
55
- var summaryColumn = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
49
+ const table = getTableById(table_id);
50
+ const summaryColumn = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
56
51
  summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
57
52
  }
58
- var groupColorMapping = null;
59
- var chartBarColor = '#2a67d1';
53
+ let groupColorMapping = null;
54
+ let chartBarColor = '#2a67d1';
60
55
  if (isGroup) {
61
56
  chartBarColor = currentTheme && currentTheme.colors;
62
57
  if (color_option === TYPE_COLOR_USING.USE_COLUMN_COLORS) {
63
58
  // when the 'Group by' column is a 'single-select' column,
64
59
  // and the user chooses to use the colors from the column.
65
60
  groupColorMapping = {};
66
- data.forEach(function (item) {
61
+ data.forEach(item => {
67
62
  if (!groupColorMapping[item.group_name]) {
68
63
  groupColorMapping[item.group_name] = item.color;
69
64
  }
70
65
  });
71
- chartBarColor = function chartBarColor(group_name) {
66
+ chartBarColor = group_name => {
72
67
  return groupColorMapping[group_name];
73
68
  };
74
69
  }
75
- _this.chart.scale('group_name', {
70
+ this.chart.scale('group_name', {
76
71
  type: 'cat'
77
72
  });
78
73
  } else if (currentTheme && currentTheme.colors) {
79
74
  chartBarColor = currentTheme.colors[0];
80
75
  }
81
- _this.chart.data(data, {
76
+ this.chart.data(data, {
82
77
  'name': {
83
78
  type: 'cat',
84
79
  nice: false
85
80
  }
86
81
  });
87
- var chartData = isGroup ? getChartGroups(data) : data;
88
- var width = _this.chart.coordinateBBox.width;
89
- var ticks = _this.getTicks(chartData, width);
90
- var labelCount = _this.getLabelCount(ticks, chartData);
82
+ const chartData = isGroup ? getChartGroups(data) : data;
83
+ const {
84
+ width
85
+ } = this.chart.coordinateBBox;
86
+ const ticks = this.getTicks(chartData, width);
87
+ const labelCount = this.getLabelCount(ticks, chartData);
91
88
  if (ticks.length > 0) {
92
- _this.chart.scale('name', {
89
+ this.chart.scale('name', {
93
90
  type: 'cat',
94
- ticks: ticks
91
+ ticks
95
92
  });
96
93
  }
97
- var themeColors = _this.getThemeColors();
94
+ const themeColors = this.getThemeColors();
98
95
 
99
96
  // set Coord type
100
- _this.chart.coordinate('rect');
101
- _this.handleAutoRange(data, summaryColumnData);
97
+ this.chart.coordinate('rect');
98
+ this.handleAutoRange(data, summaryColumnData);
102
99
 
103
100
  // draw line
104
101
  if (isGroup) {
105
- _this.drawLineGroup({
106
- chartBarColor: chartBarColor,
107
- themeColors: themeColors
102
+ this.drawLineGroup({
103
+ chartBarColor,
104
+ themeColors
108
105
  });
109
106
  } else {
110
- _this.drawLine({
111
- chartBarColor: chartBarColor,
112
- themeColors: themeColors
107
+ this.drawLine({
108
+ chartBarColor,
109
+ themeColors
113
110
  });
114
111
  }
115
112
 
116
113
  // draw area
117
114
  if (isGroup) {
118
- _this.drawAreaGroup({
119
- chartBarColor: chartBarColor
115
+ this.drawAreaGroup({
116
+ chartBarColor
120
117
  });
121
118
  } else {
122
- _this.drawArea({
123
- chartBarColor: chartBarColor
119
+ this.drawArea({
120
+ chartBarColor
124
121
  });
125
122
  }
126
- _this.setTooltip();
127
- _this.setAxis(themeColors, labelCount);
128
- _this.setTheme();
129
- _this.setLegend(themeColors);
130
- _this.chart.render();
131
- _this.renderAxisLabel();
123
+ this.setTooltip();
124
+ this.setAxis(themeColors, labelCount);
125
+ this.setTheme();
126
+ this.setLegend(themeColors);
127
+ this.chart.render();
128
+ this.renderAxisLabel();
132
129
  };
133
- _this.initChartHandler = function () {
134
- var isPreview = _this.props.isPreview;
135
- var config = {
136
- container: _this.container,
130
+ this.initChartHandler = () => {
131
+ const {
132
+ isPreview
133
+ } = this.props;
134
+ let config = {
135
+ container: this.container,
137
136
  autoFit: true,
138
137
  appendPadding: [3, 0, 0, 0]
139
138
  };
@@ -141,55 +140,62 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
141
140
  config.height = 400;
142
141
  config.width = 700;
143
142
  }
144
- _this.chart = new Chart(config);
143
+ this.chart = new Chart(config);
145
144
  };
146
- _this.drawLine = function (_ref) {
147
- var chartBarColor = _ref.chartBarColor,
148
- themeColors = _ref.themeColors;
149
- var _this$props$statItem = _this.props.statItem,
150
- y_axis_summary_type = _this$props$statItem.y_axis_summary_type,
151
- y_axis_summary_method = _this$props$statItem.y_axis_summary_method,
152
- display_data = _this$props$statItem.display_data;
153
- _this.chart.line().position('name*value').color(chartBarColor).tooltip('name*formatted_value', function (name, value) {
145
+ this.drawLine = _ref => {
146
+ let {
147
+ chartBarColor,
148
+ themeColors
149
+ } = _ref;
150
+ const {
151
+ y_axis_summary_type,
152
+ y_axis_summary_method,
153
+ display_data
154
+ } = this.props.statItem;
155
+ this.chart.line().position('name*value').color(chartBarColor).tooltip('name*formatted_value', (name, value) => {
154
156
  return {
155
- value: value,
157
+ value,
156
158
  name: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
157
159
  };
158
160
  });
159
- _this.chart.point().label(display_data ? 'formatted_value' : false, {
161
+ this.chart.point().label(display_data ? 'formatted_value' : false, {
160
162
  style: {
161
- fontSize: _this.getLabelFontSize(),
163
+ fontSize: this.getLabelFontSize(),
162
164
  fill: themeColors.textColor
163
165
  }
164
166
  }).position('name*value').color(chartBarColor).shape('circle').size(3).style({
165
167
  lineWidth: 1,
166
168
  stroke: '#fff'
167
- }).tooltip('name*formatted_value', function (name, value) {
169
+ }).tooltip('name*formatted_value', (name, value) => {
168
170
  return {
169
- value: value,
171
+ value,
170
172
  name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
171
173
  title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
172
174
  };
173
175
  });
174
176
  };
175
- _this.drawLineGroup = function (_ref2) {
176
- var chartBarColor = _ref2.chartBarColor,
177
- themeColors = _ref2.themeColors;
178
- var display_data = _this.props.statItem.display_data;
179
- _this.chart.scale({
177
+ this.drawLineGroup = _ref2 => {
178
+ let {
179
+ chartBarColor,
180
+ themeColors
181
+ } = _ref2;
182
+ const {
183
+ display_data
184
+ } = this.props.statItem;
185
+ this.chart.scale({
180
186
  group_name: {
181
187
  type: 'cat'
182
188
  }
183
189
  });
184
- _this.chart.line().position('name*value').color('group_name', chartBarColor);
185
- _this.chart.point().label(display_data ? 'formatted_value' : false, {
190
+ this.chart.line().position('name*value').color('group_name', chartBarColor);
191
+ this.chart.point().label(display_data ? 'formatted_value' : false, {
186
192
  style: {
187
- fontSize: _this.getLabelFontSize(),
193
+ fontSize: this.getLabelFontSize(),
188
194
  fill: themeColors.textColor
189
195
  }
190
- }).position('name*value').size(3).color('group_name', chartBarColor).tooltip('name*formatted_value*group_name', function (name, value, group_name) {
196
+ }).position('name*value').size(3).color('group_name', chartBarColor).tooltip('name*formatted_value*group_name', (name, value, group_name) => {
191
197
  return {
192
- value: value,
198
+ value,
193
199
  title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
194
200
  name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
195
201
  };
@@ -198,41 +204,48 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
198
204
  stroke: '#fff'
199
205
  });
200
206
  };
201
- _this.drawArea = function (_ref3) {
202
- var chartBarColor = _ref3.chartBarColor;
203
- var _this$props$statItem2 = _this.props.statItem,
204
- y_axis_summary_type = _this$props$statItem2.y_axis_summary_type,
205
- y_axis_summary_method = _this$props$statItem2.y_axis_summary_method;
206
- _this.chart.area().position('name*value').color(chartBarColor).tooltip('name*formatted_value', function (name, value) {
207
+ this.drawArea = _ref3 => {
208
+ let {
209
+ chartBarColor
210
+ } = _ref3;
211
+ const {
212
+ y_axis_summary_type,
213
+ y_axis_summary_method
214
+ } = this.props.statItem;
215
+ this.chart.area().position('name*value').color(chartBarColor).tooltip('name*formatted_value', (name, value) => {
207
216
  return {
208
- value: value,
217
+ value,
209
218
  name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
210
219
  title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
211
220
  };
212
221
  });
213
222
  };
214
- _this.drawAreaGroup = function (_ref4) {
215
- var chartBarColor = _ref4.chartBarColor;
216
- var _this$props$statItem3 = _this.props.statItem,
217
- y_axis_summary_type = _this$props$statItem3.y_axis_summary_type,
218
- y_axis_summary_method = _this$props$statItem3.y_axis_summary_method;
219
- _this.chart.area().position('name*value').color('group_name', chartBarColor).tooltip('name*formatted_value', function (name, value) {
223
+ this.drawAreaGroup = _ref4 => {
224
+ let {
225
+ chartBarColor
226
+ } = _ref4;
227
+ const {
228
+ y_axis_summary_type,
229
+ y_axis_summary_method
230
+ } = this.props.statItem;
231
+ this.chart.area().position('name*value').color('group_name', chartBarColor).tooltip('name*formatted_value', (name, value) => {
220
232
  return {
221
- value: value,
233
+ value,
222
234
  name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
223
235
  title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
224
236
  };
225
237
  });
226
238
  };
227
- _this.handleAutoRange = function (data, summaryColumnData) {
228
- var _this$props$statItem4 = _this.props.statItem,
229
- y_axis_auto_range = _this$props$statItem4.y_axis_auto_range,
230
- y_axis_min = _this$props$statItem4.y_axis_min,
231
- y_axis_max = _this$props$statItem4.y_axis_max,
232
- y_axis_summary_method = _this$props$statItem4.y_axis_summary_method;
233
- var valueScaleOptions = {
234
- formatter: function formatter(value) {
235
- return _this.getNumberDisplayString(value, summaryColumnData, y_axis_summary_method);
239
+ this.handleAutoRange = (data, summaryColumnData) => {
240
+ const {
241
+ y_axis_auto_range,
242
+ y_axis_min,
243
+ y_axis_max,
244
+ y_axis_summary_method
245
+ } = this.props.statItem;
246
+ let valueScaleOptions = {
247
+ formatter: value => {
248
+ return this.getNumberDisplayString(value, summaryColumnData, y_axis_summary_method);
236
249
  }
237
250
  };
238
251
 
@@ -248,31 +261,31 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
248
261
  });
249
262
 
250
263
  // set the filter rule
251
- _this.chart.filter('value', function (value) {
264
+ this.chart.filter('value', value => {
252
265
  return value >= y_axis_min;
253
266
  });
254
267
 
255
268
  // filter the data
256
- _this.chart.filterData(data);
269
+ this.chart.filterData(data);
257
270
  }
258
- _this.chart.scale({
271
+ this.chart.scale({
259
272
  value: valueScaleOptions
260
273
  });
261
274
  };
262
- _this.setTooltip = function () {
263
- _this.chart.tooltip({
275
+ this.setTooltip = () => {
276
+ this.chart.tooltip({
264
277
  showCrosshairs: true,
265
278
  showTitle: true,
266
279
  containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
267
280
  itemTpl: '<div class="g2-tooltip-content"><div class="tooltip-name">{title}<div><div class="tooltip-item">{name}: {value}<div></div>',
268
281
  domStyles: {
269
- 'g2-tooltip': _this.getDefaultChartStyleByKey('g2-tooltip'),
270
- 'tooltip-item': _this.getDefaultChartStyleByKey('tooltip-item')
282
+ 'g2-tooltip': this.getDefaultChartStyleByKey('g2-tooltip'),
283
+ 'tooltip-item': this.getDefaultChartStyleByKey('tooltip-item')
271
284
  }
272
285
  });
273
286
  };
274
- _this.setAxis = function (themeColors, labelCount) {
275
- _this.chart.axis('name', {
287
+ this.setAxis = (themeColors, labelCount) => {
288
+ this.chart.axis('name', {
276
289
  line: {
277
290
  style: themeColors.gridColor
278
291
  },
@@ -283,10 +296,10 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
283
296
  offset: 20,
284
297
  autoRotate: true,
285
298
  rotate: labelCount > 11 ? 0.3 : 0,
286
- formatter: _this.labelFormatter
299
+ formatter: this.labelFormatter
287
300
  }
288
301
  });
289
- _this.chart.axis('value', {
302
+ this.chart.axis('value', {
290
303
  label: {
291
304
  style: {
292
305
  fill: themeColors.textColor
@@ -301,8 +314,8 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
301
314
  }
302
315
  });
303
316
  };
304
- _this.setTheme = function () {
305
- _this.chart.theme({
317
+ this.setTheme = () => {
318
+ this.chart.theme({
306
319
  geometries: {
307
320
  point: {
308
321
  circle: {
@@ -317,14 +330,14 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
317
330
  }
318
331
  });
319
332
  };
320
- _this.setLegend = function (themeColors) {
321
- _this.chart.legend('group_name', {
333
+ this.setLegend = themeColors => {
334
+ this.chart.legend('group_name', {
322
335
  position: 'bottom',
323
336
  itemName: {
324
337
  style: {
325
338
  fill: themeColors.textColor
326
339
  },
327
- formatter: function formatter(name) {
340
+ formatter: name => {
328
341
  return !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name;
329
342
  }
330
343
  },
@@ -344,35 +357,37 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
344
357
  }
345
358
  });
346
359
  };
347
- _this.renderAxisLabel = function (newStatItem) {
348
- var _this$props2 = _this.props,
349
- getTableById = _this$props2.getTableById,
350
- statItem = _this$props2.statItem;
360
+ this.renderAxisLabel = newStatItem => {
361
+ let {
362
+ getTableById,
363
+ statItem
364
+ } = this.props;
351
365
  if (newStatItem && newStatItem._id !== statItem._id) {
352
366
  return;
353
367
  }
354
- if (!_this.chart) return;
368
+ if (!this.chart) return;
355
369
  statItem = newStatItem || statItem;
356
- var _statItem = statItem,
357
- table_id = _statItem.table_id,
358
- x_axis_column_key = _statItem.x_axis_column_key,
359
- y_axis_column_key = _statItem.y_axis_column_key,
360
- show_y_axis_label = _statItem.show_y_axis_label,
361
- show_x_axis_label = _statItem.show_x_axis_label,
362
- y_axis_label_position = _statItem.y_axis_label_position,
363
- x_axis_label_position = _statItem.x_axis_label_position,
364
- y_axis_summary_type = _statItem.y_axis_summary_type;
365
- var table = getTableById(table_id);
366
- var autoPadding = _this.chart.autoPadding;
367
- var textColor = _this.getAxisLabelColor();
368
- var xAxisID = "chart-x-axis-label_".concat(statItem._id);
369
- var chartContainer = _this.chart.getCanvas().get('container');
370
- var xLabel = chartContainer.querySelector("#".concat(xAxisID));
370
+ const {
371
+ table_id,
372
+ x_axis_column_key,
373
+ y_axis_column_key,
374
+ show_y_axis_label,
375
+ show_x_axis_label,
376
+ y_axis_label_position,
377
+ x_axis_label_position,
378
+ y_axis_summary_type
379
+ } = statItem;
380
+ const table = getTableById(table_id);
381
+ const autoPadding = this.chart.autoPadding;
382
+ const textColor = this.getAxisLabelColor();
383
+ const xAxisID = "chart-x-axis-label_".concat(statItem._id);
384
+ const chartContainer = this.chart.getCanvas().get('container');
385
+ const xLabel = chartContainer.querySelector("#".concat(xAxisID));
371
386
  if (!xLabel && show_x_axis_label) {
372
- var div = document.createElement('div');
387
+ const div = document.createElement('div');
373
388
  div.id = xAxisID;
374
389
  div.className = 'statistic-chart-axis-label';
375
- var column = TableUtils.getTableColumnByKey(table, x_axis_column_key);
390
+ const column = TableUtils.getTableColumnByKey(table, x_axis_column_key);
376
391
  div.innerHTML = "".concat(column ? column.name : '');
377
392
  div.setAttribute('style', "color:".concat(textColor, "; width: 100%; padding-left: ").concat(autoPadding.left, "px; text-align: ").concat(x_axis_label_position, "; bottom: -20px"));
378
393
  chartContainer.appendChild(div);
@@ -383,154 +398,147 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
383
398
  if (xLabel && !show_x_axis_label) {
384
399
  xLabel.parentNode.removeChild(xLabel);
385
400
  }
386
- var yAxisID = "chart-y-axis-label_".concat(statItem._id);
387
- var yLabel = chartContainer.querySelector("#".concat(yAxisID));
388
- var paddingLeft = autoPadding.bottom + (show_x_axis_label ? 10 : 0);
401
+ const yAxisID = "chart-y-axis-label_".concat(statItem._id);
402
+ const yLabel = chartContainer.querySelector("#".concat(yAxisID));
403
+ let paddingLeft = autoPadding.bottom + (show_x_axis_label ? 10 : 0);
389
404
  if (!yLabel && show_y_axis_label) {
390
- var _div = document.createElement('div');
391
- _div.id = yAxisID;
392
- _div.className = 'statistic-chart-axis-label';
405
+ const div = document.createElement('div');
406
+ div.id = yAxisID;
407
+ div.className = 'statistic-chart-axis-label';
393
408
  if (y_axis_summary_type === SUMMARY_TYPE.COUNT) {
394
- _div.innerHTML = intl.get(TITLE_AMOUNT);
409
+ div.innerHTML = intl.get(TITLE_AMOUNT);
395
410
  } else {
396
- var _column = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
397
- _div.innerHTML = _column.name || '';
411
+ const column = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
412
+ div.innerHTML = column.name || '';
398
413
  }
399
- var containerHeight = chartContainer.offsetHeight;
400
- var textAlign = 'center';
414
+ const containerHeight = chartContainer.offsetHeight;
415
+ let textAlign = 'center';
401
416
  if (y_axis_label_position === 'bottom') textAlign = 'left';
402
417
  if (y_axis_label_position === 'top') textAlign = 'right';
403
- _div.setAttribute('style', "color:".concat(textColor, "; padding-right: ").concat(autoPadding.top, "px; padding-left: ").concat(paddingLeft, "px; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0px; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2 + autoPadding.bottom / 4, "px) rotate(-90deg)"));
404
- chartContainer.appendChild(_div);
418
+ div.setAttribute('style', "color:".concat(textColor, "; padding-right: ").concat(autoPadding.top, "px; padding-left: ").concat(paddingLeft, "px; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0px; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2 + autoPadding.bottom / 4, "px) rotate(-90deg)"));
419
+ chartContainer.appendChild(div);
405
420
  }
406
421
  if (yLabel && show_y_axis_label) {
407
- var _containerHeight = chartContainer.offsetHeight;
408
- var _textAlign = 'center';
409
- if (y_axis_label_position === 'bottom') _textAlign = 'left';
410
- if (y_axis_label_position === 'top') _textAlign = 'right';
411
- yLabel.setAttribute('style', "color:".concat(textColor, "; padding-right: ").concat(autoPadding.top, "px; padding-left: ").concat(paddingLeft, "px; position: absolute; width: ").concat(_containerHeight, "px; text-align: ").concat(_textAlign, "; top: 0; left: 0px; transform: translate(-").concat(_containerHeight / 2 + 12, "px, ").concat((_containerHeight - autoPadding.bottom) / 2 + autoPadding.bottom / 4, "px) rotate(-90deg)"));
422
+ const containerHeight = chartContainer.offsetHeight;
423
+ let textAlign = 'center';
424
+ if (y_axis_label_position === 'bottom') textAlign = 'left';
425
+ if (y_axis_label_position === 'top') textAlign = 'right';
426
+ yLabel.setAttribute('style', "color:".concat(textColor, "; padding-right: ").concat(autoPadding.top, "px; padding-left: ").concat(paddingLeft, "px; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0px; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2 + autoPadding.bottom / 4, "px) rotate(-90deg)"));
412
427
  }
413
428
  if (yLabel && !show_y_axis_label) {
414
429
  yLabel.parentNode.removeChild(yLabel);
415
430
  }
416
431
  };
417
- _this.destroyChart = function () {
418
- _this.chart.destroy();
419
- _this.chart = null;
432
+ this.destroyChart = () => {
433
+ this.chart.destroy();
434
+ this.chart = null;
420
435
  };
421
- _this.state = {
436
+ this.state = {
422
437
  isCalculatingData: true,
423
438
  showResultDescription: true
424
439
  };
425
- _this.calculateData = null;
426
- return _this;
440
+ this.calculateData = null;
441
+ }
442
+ componentDidMount() {
443
+ const {
444
+ statItem,
445
+ chartCalculator,
446
+ eventBus
447
+ } = this.props;
448
+ this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, newStatItem => {
449
+ this.renderAxisLabel(newStatItem);
450
+ });
451
+ if (!this.container) return;
452
+ chartCalculator.calculate(statItem).then(data => {
453
+ const showResultDescription = data.length > 0 ? false : true;
454
+ this.setState({
455
+ isCalculatingData: false,
456
+ showResultDescription
457
+ }, () => {
458
+ if (!showResultDescription) {
459
+ this.drawChart(data);
460
+ this.calculateData = data;
461
+ }
462
+ });
463
+ });
464
+ }
465
+ shouldComponentUpdate(nextProps, nextState) {
466
+ const {
467
+ colorThemeName
468
+ } = this.props;
469
+ if (this.canUpdate(this.props, nextProps)) {
470
+ return true;
471
+ }
472
+ if (nextState.isCalculatingData !== this.state.isCalculatingData) {
473
+ return true;
474
+ }
475
+ if (nextProps.colorThemeName !== colorThemeName) {
476
+ return true;
477
+ }
478
+ return false;
427
479
  }
428
- _createClass(AreaChart, [{
429
- key: "componentDidMount",
430
- value: function componentDidMount() {
431
- var _this2 = this;
432
- var _this$props3 = this.props,
433
- statItem = _this$props3.statItem,
434
- chartCalculator = _this$props3.chartCalculator,
435
- eventBus = _this$props3.eventBus;
436
- this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, function (newStatItem) {
437
- _this2.renderAxisLabel(newStatItem);
480
+ componentDidUpdate(preProps, preState) {
481
+ const {
482
+ statItem,
483
+ chartCalculator
484
+ } = this.props;
485
+ const {
486
+ isCalculatingData
487
+ } = this.state;
488
+ if (isCalculatingData !== preState.isCalculatingData) return;
489
+ if (this.shouldCalculateStatItem(preProps, this.props)) {
490
+ this.setState({
491
+ isCalculatingData: true
438
492
  });
439
493
  if (!this.container) return;
440
- chartCalculator.calculate(statItem).then(function (data) {
441
- var showResultDescription = data.length > 0 ? false : true;
442
- _this2.setState({
494
+ chartCalculator.calculate(statItem).then(data => {
495
+ const showResultDescription = data.length > 0 ? false : true;
496
+ this.chart && this.destroyChart();
497
+ this.calculateData = data;
498
+ this.setState({
443
499
  isCalculatingData: false,
444
- showResultDescription: showResultDescription
445
- }, function () {
500
+ showResultDescription
501
+ }, () => {
446
502
  if (!showResultDescription) {
447
- _this2.drawChart(data);
448
- _this2.calculateData = data;
503
+ this.drawChart(data);
504
+ if (this.props.isPreview) this.chart.forceFit();
449
505
  }
450
506
  });
451
507
  });
452
- }
453
- }, {
454
- key: "shouldComponentUpdate",
455
- value: function shouldComponentUpdate(nextProps, nextState) {
456
- var colorThemeName = this.props.colorThemeName;
457
- if (this.canUpdate(this.props, nextProps)) {
458
- return true;
459
- }
460
- if (nextState.isCalculatingData !== this.state.isCalculatingData) {
461
- return true;
462
- }
463
- if (nextProps.colorThemeName !== colorThemeName) {
464
- return true;
465
- }
466
- return false;
467
- }
468
- }, {
469
- key: "componentDidUpdate",
470
- value: function componentDidUpdate(preProps, preState) {
471
- var _this3 = this;
472
- var _this$props4 = this.props,
473
- statItem = _this$props4.statItem,
474
- chartCalculator = _this$props4.chartCalculator;
475
- var isCalculatingData = this.state.isCalculatingData;
476
- if (isCalculatingData !== preState.isCalculatingData) return;
477
- if (this.shouldCalculateStatItem(preProps, this.props)) {
478
- this.setState({
479
- isCalculatingData: true
480
- });
481
- if (!this.container) return;
482
- chartCalculator.calculate(statItem).then(function (data) {
483
- var showResultDescription = data.length > 0 ? false : true;
484
- _this3.chart && _this3.destroyChart();
485
- _this3.calculateData = data;
486
- _this3.setState({
487
- isCalculatingData: false,
488
- showResultDescription: showResultDescription
489
- }, function () {
490
- if (!showResultDescription) {
491
- _this3.drawChart(data);
492
- if (_this3.props.isPreview) _this3.chart.forceFit();
493
- }
494
- });
495
- });
496
- } else {
497
- if (!this.state.showResultDescription) {
498
- this.chart && this.destroyChart();
499
- this.drawChart(this.calculateData);
500
- if (this.props.isPreview) {
501
- this.chart.forceFit();
502
- }
508
+ } else {
509
+ if (!this.state.showResultDescription) {
510
+ this.chart && this.destroyChart();
511
+ this.drawChart(this.calculateData);
512
+ if (this.props.isPreview) {
513
+ this.chart.forceFit();
503
514
  }
504
515
  }
505
516
  }
506
- }, {
507
- key: "componentWillUnmount",
508
- value: function componentWillUnmount() {
509
- this.container = null;
510
- this.unsubscribeStyleChange();
511
- }
512
- }, {
513
- key: "render",
514
- value: function render() {
515
- var _this4 = this;
516
- var statItem = this.props.statItem;
517
- var _this$state = this.state,
518
- isCalculatingData = _this$state.isCalculatingData,
519
- showResultDescription = _this$state.showResultDescription;
520
- var show_y_axis_label = statItem.show_y_axis_label,
521
- show_x_axis_label = statItem.show_x_axis_label;
522
- return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
523
- ref: function ref(_ref5) {
524
- return _this4.container = _ref5;
525
- },
526
- style: {
527
- padding: show_y_axis_label || show_x_axis_label ? 30 : 20
528
- },
529
- className: "statistic-chart-container"
530
- }));
531
- }
532
- }]);
533
- return AreaChart;
534
- }(BaseChart);
517
+ }
518
+ componentWillUnmount() {
519
+ this.container = null;
520
+ this.unsubscribeStyleChange();
521
+ }
522
+ render() {
523
+ const {
524
+ statItem
525
+ } = this.props;
526
+ const {
527
+ isCalculatingData,
528
+ showResultDescription
529
+ } = this.state;
530
+ const {
531
+ show_y_axis_label,
532
+ show_x_axis_label
533
+ } = statItem;
534
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
535
+ ref: ref => this.container = ref,
536
+ style: {
537
+ padding: show_y_axis_label || show_x_axis_label ? 30 : 20
538
+ },
539
+ className: "statistic-chart-container"
540
+ }));
541
+ }
542
+ }
535
543
  AreaChart.propTypes = propTypes;
536
544
  export default AreaChart;