dtable-statistic 4.0.6 → 4.0.8

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 (67) hide show
  1. package/es/assets/css/dashboard.css +22 -0
  2. package/es/calculator/basic-chart-calculator.js +27 -18
  3. package/es/calculator/combination-calculator.js +34 -9
  4. package/es/calculator/compare-bar-calculator.js +37 -30
  5. package/es/calculator/heat-map-calculator.js +25 -14
  6. package/es/calculator/map-calculator.js +25 -14
  7. package/es/calculator/mirror-calculator.js +29 -14
  8. package/es/calculator/pivot-table-calculator.js +132 -76
  9. package/es/calculator/workers/basic-chart-calculator-worker.js +21 -6
  10. package/es/calculator/workers/combination-calculator-worker.js +20 -5
  11. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +12 -6
  12. package/es/calculator/workers/mirror-calculator-worker.js +15 -6
  13. package/es/calculator/workers/pivot-table-calculator-worker.js +97 -44
  14. package/es/calculator/world-map-calculator.js +25 -14
  15. package/es/components/dialog/enlarged-chart-dialog.js +2 -2
  16. package/es/components/dialog/statistic-record-dialog/index.css +2 -0
  17. package/es/components/dialog/statistic-record-dialog/index.js +80 -52
  18. package/es/constants/index.js +30 -29
  19. package/es/dashboard.js +57 -43
  20. package/es/desktop-dashboard.js +21 -56
  21. package/es/index.js +34 -2
  22. package/es/locale/lang/de.js +7 -3
  23. package/es/locale/lang/en.js +5 -1
  24. package/es/locale/lang/fr.js +7 -3
  25. package/es/locale/lang/zh_CN.js +5 -1
  26. package/es/mobile-dashboard.js +5 -5
  27. package/es/model/horizontal-bar-group.js +2 -0
  28. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +1 -2
  29. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +1 -1
  30. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +20 -3
  31. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +2 -8
  32. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +23 -2
  33. package/es/stat-list/chart-preview.js +3 -4
  34. package/es/stat-list/index.js +10 -4
  35. package/es/stat-view/area-chart.js +177 -162
  36. package/es/stat-view/bar-chart.js +221 -222
  37. package/es/stat-view/base-chart.js +79 -7
  38. package/es/stat-view/basic-number-card.js +11 -19
  39. package/es/stat-view/combination-chart.js +100 -83
  40. package/es/stat-view/compare-chart.js +133 -144
  41. package/es/stat-view/completeness-chart.js +108 -102
  42. package/es/stat-view/custom-bar.js +79 -99
  43. package/es/stat-view/dashboard-chart.js +57 -57
  44. package/es/stat-view/heat-map.js +13 -32
  45. package/es/stat-view/horizontal-bar-chart.js +200 -230
  46. package/es/stat-view/index.js +2 -2
  47. package/es/stat-view/line-chart.js +162 -158
  48. package/es/stat-view/map.js +26 -40
  49. package/es/stat-view/mirror.js +88 -94
  50. package/es/stat-view/pie-chart.js +11 -39
  51. package/es/stat-view/pivot-table/index.js +4 -16
  52. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +36 -23
  53. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +11 -5
  54. package/es/stat-view/pivot-table/pivot-table-display-name.js +206 -0
  55. package/es/stat-view/pivot-table/two-dimension-table.js +104 -60
  56. package/es/stat-view/ring-chart.js +24 -42
  57. package/es/stat-view/scatter-chart.js +4 -21
  58. package/es/stat-view/treemap-chart.js +3 -12
  59. package/es/stat-view/trend-chart.js +6 -17
  60. package/es/stat-view/world-map.js +39 -50
  61. package/es/tabs/tab.js +2 -1
  62. package/es/utils/collaborator.js +9 -0
  63. package/es/utils/common-utils.js +24 -6
  64. package/es/utils/index.js +1 -1
  65. package/es/utils/sql-utils.js +10 -9
  66. package/es/utils/stat-utils.js +8 -5
  67. package/package.json +1 -1
@@ -5,18 +5,15 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import intl from 'react-intl-universal';
8
- import { TableUtils, getNumberDisplayString } from 'dtable-store';
8
+ import { TableUtils } from 'dtable-store';
9
9
  import BaseChart from './base-chart';
10
10
  import { Chart } from '../custom-g2';
11
- import { Loading } from '../components';
12
- import { getCurrentTheme, getLabelFontSize } from '../utils/common-utils';
13
- import { getChartDisplayLabels, getChartGroups } from '../utils/basic-chart-utils';
14
- import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_CONFIG_CHANGED, NO_STATISTIC_RESULTS, STATISTICS_COUNT_SHOW, STAT_ITEM_THEME_COLORS, SUMMARY_TYPE, TITLE_AMOUNT, TYPE_COLOR_USING } from '../constants';
11
+ import { getCurrentTheme } from '../utils/common-utils';
12
+ import { getChartGroups } from '../utils/basic-chart-utils';
13
+ import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_CONFIG_CHANGED, STATISTICS_COUNT_SHOW, SUMMARY_TYPE, TITLE_AMOUNT, TYPE_COLOR_USING } from '../constants';
15
14
  var propTypes = {
16
15
  isPreview: PropTypes.bool,
17
- isEnlarge: PropTypes.bool,
18
16
  isEdit: PropTypes.bool,
19
- theme: PropTypes.string,
20
17
  colorThemeName: PropTypes.string,
21
18
  statItem: PropTypes.object,
22
19
  chartCalculator: PropTypes.object,
@@ -31,34 +28,12 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
31
28
  var _this;
32
29
  _classCallCheck(this, AreaChart);
33
30
  _this = _super.call(this, props);
34
- _this.getLabelFontSize = function () {
35
- var statItem = _this.props.statItem;
36
- var label_font_size = statItem.label_font_size;
37
- return getLabelFontSize(label_font_size);
38
- };
39
31
  _this.drawChart = function (data) {
40
32
  var _this$props = _this.props,
41
33
  getTableById = _this$props.getTableById,
42
- isPreview = _this$props.isPreview,
43
34
  statItem = _this$props.statItem,
44
- isEnlarge = _this$props.isEnlarge,
45
- theme = _this$props.theme,
46
35
  colorThemeName = _this$props.colorThemeName;
47
- var currentTheme = getCurrentTheme(colorThemeName);
48
- if (isPreview) {
49
- _this.chart = new Chart({
50
- container: _this.container,
51
- autoFit: true,
52
- appendPadding: [3, 0, 0, 0]
53
- });
54
- } else {
55
- _this.chart = new Chart({
56
- container: _this.container,
57
- height: 400,
58
- width: 700,
59
- appendPadding: [3, 0, 0, 0]
60
- });
61
- }
36
+ _this.initChartHandler();
62
37
  _this.chart.on('element:click', function (e) {
63
38
  var areaElement = e.target.get('element');
64
39
  var data = areaElement.data;
@@ -66,26 +41,23 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
66
41
  _this.props.toggleStatisticRecordsDialog(data, statItem);
67
42
  }
68
43
  });
44
+ var currentTheme = getCurrentTheme(colorThemeName);
69
45
  var table_id = statItem.table_id,
70
- summary_type = statItem.y_axis_summary_type,
46
+ y_axis_summary_type = statItem.y_axis_summary_type,
71
47
  y_axis_column_key = statItem.y_axis_column_key,
72
- summary_method = statItem.y_axis_summary_method,
73
48
  column_groupby_column_key = statItem.column_groupby_column_key,
74
- display_data = statItem.display_data,
75
- y_axis_auto_range = statItem.y_axis_auto_range,
76
- y_axis_min = statItem.y_axis_min,
77
- y_axis_max = statItem.y_axis_max,
78
49
  column_groupby_multiple_numeric_column = statItem.column_groupby_multiple_numeric_column,
79
50
  color_option = statItem.color_option;
80
- var chartBarColor,
81
- columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
82
- if (summary_type === SUMMARY_TYPE.ADVANCED) {
51
+ var isGroup = column_groupby_column_key || column_groupby_multiple_numeric_column;
52
+ var summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
53
+ if (y_axis_summary_type === SUMMARY_TYPE.ADVANCED) {
83
54
  var table = getTableById(table_id);
84
55
  var summaryColumn = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
85
- columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
56
+ summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
86
57
  }
87
58
  var groupColorMapping = null;
88
- if (column_groupby_column_key || column_groupby_multiple_numeric_column) {
59
+ var chartBarColor = '#2a67d1';
60
+ if (isGroup) {
89
61
  chartBarColor = currentTheme && currentTheme.colors;
90
62
  if (color_option === TYPE_COLOR_USING.USE_COLUMN_COLORS) {
91
63
  // when the 'Group by' column is a 'single-select' column,
@@ -105,8 +77,6 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
105
77
  });
106
78
  } else if (currentTheme && currentTheme.colors) {
107
79
  chartBarColor = currentTheme.colors[0];
108
- } else {
109
- chartBarColor = '#2a67d1';
110
80
  }
111
81
  _this.chart.data(data, {
112
82
  'name': {
@@ -114,131 +84,194 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
114
84
  nice: false
115
85
  }
116
86
  });
87
+ var chartData = isGroup ? getChartGroups(data) : data;
117
88
  var width = _this.chart.coordinateBBox.width;
118
- var chartData;
119
- if (column_groupby_column_key || column_groupby_multiple_numeric_column) {
120
- chartData = getChartGroups(data);
121
- } else {
122
- chartData = data;
123
- }
124
- var labelCount = chartData.length;
125
- if (Math.floor(width / labelCount) <= 20) {
126
- var displayLabels = getChartDisplayLabels(width, 20, chartData);
127
- labelCount = displayLabels.length;
89
+ var ticks = _this.getTicks(chartData, width);
90
+ var labelCount = _this.getLabelCount(ticks, chartData);
91
+ if (ticks.length > 0) {
128
92
  _this.chart.scale('name', {
129
93
  type: 'cat',
130
- ticks: displayLabels
94
+ ticks: ticks
131
95
  });
132
96
  }
133
- var themeColors = STAT_ITEM_THEME_COLORS.light;
134
- if (theme === 'dark' && !isEnlarge && isPreview) {
135
- themeColors = STAT_ITEM_THEME_COLORS.dark;
136
- }
97
+ var themeColors = _this.getThemeColors();
137
98
 
138
99
  // set Coord type
139
100
  _this.chart.coordinate('rect');
101
+ _this.handleAutoRange(data, summaryColumnData);
102
+
103
+ // draw line
104
+ if (isGroup) {
105
+ _this.drawLineGroup({
106
+ chartBarColor: chartBarColor,
107
+ themeColors: themeColors
108
+ });
109
+ } else {
110
+ _this.drawLine({
111
+ chartBarColor: chartBarColor,
112
+ themeColors: themeColors
113
+ });
114
+ }
115
+
116
+ // draw area
117
+ if (isGroup) {
118
+ _this.drawAreaGroup({
119
+ chartBarColor: chartBarColor
120
+ });
121
+ } else {
122
+ _this.drawArea({
123
+ chartBarColor: chartBarColor
124
+ });
125
+ }
126
+ _this.setTooltip();
127
+ _this.setAxis(themeColors, labelCount);
128
+ _this.setTheme();
129
+ _this.setLegend(themeColors);
130
+ _this.chart.render();
131
+ _this.renderAxisLabel();
132
+ };
133
+ _this.initChartHandler = function () {
134
+ var isPreview = _this.props.isPreview;
135
+ var config = {
136
+ container: _this.container,
137
+ autoFit: true,
138
+ appendPadding: [3, 0, 0, 0]
139
+ };
140
+ if (!isPreview) {
141
+ config.height = 400;
142
+ config.width = 700;
143
+ }
144
+ _this.chart = new Chart(config);
145
+ };
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) {
154
+ return {
155
+ value: value,
156
+ name: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
157
+ };
158
+ });
159
+ _this.chart.point().label(display_data ? 'formatted_value' : false, {
160
+ style: {
161
+ fontSize: _this.getLabelFontSize(),
162
+ fill: themeColors.textColor
163
+ }
164
+ }).position('name*value').color(chartBarColor).shape('circle').size(3).style({
165
+ lineWidth: 1,
166
+ stroke: '#fff'
167
+ }).tooltip('name*formatted_value', function (name, value) {
168
+ return {
169
+ value: value,
170
+ name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
171
+ title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
172
+ };
173
+ });
174
+ };
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({
180
+ group_name: {
181
+ type: 'cat'
182
+ }
183
+ });
184
+ _this.chart.line().position('name*value').color('group_name', chartBarColor);
185
+ _this.chart.point().label(display_data ? 'formatted_value' : false, {
186
+ style: {
187
+ fontSize: _this.getLabelFontSize(),
188
+ fill: themeColors.textColor
189
+ }
190
+ }).position('name*value').size(3).color('group_name', chartBarColor).tooltip('name*formatted_value*group_name', function (name, value, group_name) {
191
+ return {
192
+ value: value,
193
+ title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
194
+ name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
195
+ };
196
+ }).shape('circle').style({
197
+ lineWidth: 1,
198
+ stroke: '#fff'
199
+ });
200
+ };
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
+ return {
208
+ value: value,
209
+ name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
210
+ title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
211
+ };
212
+ });
213
+ };
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) {
220
+ return {
221
+ value: value,
222
+ name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
223
+ title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
224
+ };
225
+ });
226
+ };
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;
140
233
  var valueScaleOptions = {
141
234
  formatter: function formatter(value) {
142
- return getNumberDisplayString(value, columnData);
235
+ return _this.getNumberDisplayString(value, summaryColumnData, y_axis_summary_method);
143
236
  }
144
237
  };
238
+
239
+ // eslint-disable-next-line
145
240
  if (y_axis_auto_range == undefined || y_axis_auto_range) {
146
- valueScaleOptions = Object.assign({}, valueScaleOptions, {
241
+ valueScaleOptions = Object.assign(valueScaleOptions, {
147
242
  nice: true
148
243
  });
149
244
  } else {
150
- valueScaleOptions = Object.assign({}, valueScaleOptions, {
245
+ valueScaleOptions = Object.assign(valueScaleOptions, {
151
246
  min: y_axis_min,
152
247
  max: y_axis_max
153
248
  });
249
+
154
250
  // set the filter rule
155
251
  _this.chart.filter('value', function (value) {
156
252
  return value >= y_axis_min;
157
253
  });
254
+
158
255
  // filter the data
159
256
  _this.chart.filterData(data);
160
257
  }
161
258
  _this.chart.scale({
162
259
  value: valueScaleOptions
163
260
  });
164
- if (column_groupby_column_key || column_groupby_multiple_numeric_column) {
165
- _this.chart.scale({
166
- group_name: {
167
- type: 'cat'
168
- }
169
- });
170
- _this.chart.line().position('name*value').color('group_name', chartBarColor);
171
- _this.chart.point().label(display_data ? 'value' : false, {
172
- style: {
173
- fontSize: _this.getLabelFontSize(),
174
- fill: themeColors.textColor
175
- }
176
- }).position('name*value').size(3).color('group_name', chartBarColor).tooltip('name*value*group_name', function (name, value, group_name) {
177
- return {
178
- title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
179
- value: getNumberDisplayString(value, columnData),
180
- name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
181
- };
182
- }).shape('circle').style({
183
- lineWidth: 1,
184
- stroke: '#fff'
185
- });
186
- } else {
187
- _this.chart.line().position('name*value').color(chartBarColor).tooltip('name*value', function (name, value) {
188
- return {
189
- name: summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[summary_method]),
190
- value: getNumberDisplayString(value, columnData)
191
- };
192
- });
193
- _this.chart.point().label(display_data ? 'value' : false, {
194
- style: {
195
- fontSize: _this.getLabelFontSize(),
196
- fill: themeColors.textColor
197
- }
198
- }).position('name*value').color(chartBarColor).shape('circle').size(3).style({
199
- lineWidth: 1,
200
- stroke: '#fff'
201
- }).tooltip('name*value', function (name, value) {
202
- return {
203
- name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
204
- value: getNumberDisplayString(value, columnData),
205
- title: summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[summary_method])
206
- };
207
- });
208
- }
209
- if (column_groupby_column_key || column_groupby_multiple_numeric_column) {
210
- _this.chart.area().position('name*value').color('group_name', chartBarColor).tooltip('name*value', function (name, value) {
211
- return {
212
- name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
213
- value: getNumberDisplayString(value, columnData),
214
- title: summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[summary_method])
215
- };
216
- });
217
- } else {
218
- _this.chart.area().position('name*value').color(chartBarColor).tooltip('name*value', function (name, value) {
219
- return {
220
- name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
221
- value: getNumberDisplayString(value, columnData),
222
- title: summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[summary_method])
223
- };
224
- });
225
- }
261
+ };
262
+ _this.setTooltip = function () {
226
263
  _this.chart.tooltip({
227
264
  showCrosshairs: true,
228
265
  showTitle: true,
229
266
  containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
230
267
  itemTpl: '<div class="g2-tooltip-content"><div class="tooltip-name">{title}<div><div class="tooltip-item">{name}: {value}<div></div>',
231
268
  domStyles: {
232
- 'g2-tooltip': {
233
- borderRadius: '2px',
234
- backgroundColor: '#fff',
235
- padding: '10px'
236
- },
237
- 'tooltip-item': {
238
- marginTop: '5px'
239
- }
269
+ 'g2-tooltip': _this.getDefaultChartStyleByKey('g2-tooltip'),
270
+ 'tooltip-item': _this.getDefaultChartStyleByKey('tooltip-item')
240
271
  }
241
272
  });
273
+ };
274
+ _this.setAxis = function (themeColors, labelCount) {
242
275
  _this.chart.axis('name', {
243
276
  line: {
244
277
  style: themeColors.gridColor
@@ -250,16 +283,7 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
250
283
  offset: 20,
251
284
  autoRotate: true,
252
285
  rotate: labelCount > 11 ? 0.3 : 0,
253
- formatter: function formatter(name) {
254
- var label = name;
255
- if (name.length > 10) {
256
- label = "".concat(name.slice(0, 10), "...");
257
- }
258
- if (name === '' || name === 'undefined') {
259
- label = intl.get(EMPTY_NAME);
260
- }
261
- return label;
262
- }
286
+ formatter: _this.labelFormatter
263
287
  }
264
288
  });
265
289
  _this.chart.axis('value', {
@@ -276,6 +300,8 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
276
300
  }
277
301
  }
278
302
  });
303
+ };
304
+ _this.setTheme = function () {
279
305
  _this.chart.theme({
280
306
  geometries: {
281
307
  point: {
@@ -290,6 +316,8 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
290
316
  }
291
317
  }
292
318
  });
319
+ };
320
+ _this.setLegend = function (themeColors) {
293
321
  _this.chart.legend('group_name', {
294
322
  position: 'bottom',
295
323
  itemName: {
@@ -315,16 +343,11 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
315
343
  }
316
344
  }
317
345
  });
318
- _this.chart.render();
319
- _this.renderAxisLabel();
320
346
  };
321
347
  _this.renderAxisLabel = function (newStatItem) {
322
348
  var _this$props2 = _this.props,
323
349
  getTableById = _this$props2.getTableById,
324
- statItem = _this$props2.statItem,
325
- isEnlarge = _this$props2.isEnlarge,
326
- isPreview = _this$props2.isPreview,
327
- theme = _this$props2.theme;
350
+ statItem = _this$props2.statItem;
328
351
  if (newStatItem && newStatItem._id !== statItem._id) {
329
352
  return;
330
353
  }
@@ -341,10 +364,7 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
341
364
  y_axis_summary_type = _statItem.y_axis_summary_type;
342
365
  var table = getTableById(table_id);
343
366
  var autoPadding = _this.chart.autoPadding;
344
- var textColor = '#999999';
345
- if (theme === 'dark' && !isEnlarge && isPreview) {
346
- textColor = '#ffffff';
347
- }
367
+ var textColor = _this.getAxisLabelColor();
348
368
  var xAxisID = "chart-x-axis-label_".concat(statItem._id);
349
369
  var chartContainer = _this.chart.getCanvas().get('container');
350
370
  var xLabel = chartContainer.querySelector("#".concat(xAxisID));
@@ -499,18 +519,13 @@ var AreaChart = /*#__PURE__*/function (_BaseChart) {
499
519
  showResultDescription = _this$state.showResultDescription;
500
520
  var show_y_axis_label = statItem.show_y_axis_label,
501
521
  show_x_axis_label = statItem.show_x_axis_label;
502
- var style = {
503
- padding: show_y_axis_label || show_x_axis_label ? 30 : 20
504
- };
505
- return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && /*#__PURE__*/React.createElement("div", {
506
- className: 'statistic-chart-loading-container'
507
- }, /*#__PURE__*/React.createElement(Loading, null)), showResultDescription && /*#__PURE__*/React.createElement("div", {
508
- className: 'statistic-chart-text'
509
- }, intl.get(NO_STATISTIC_RESULTS)), /*#__PURE__*/React.createElement("div", {
510
- ref: function ref(_ref) {
511
- return _this4.container = _ref;
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
512
528
  },
513
- style: style,
514
529
  className: "statistic-chart-container"
515
530
  }));
516
531
  }