sea-chart 0.0.74 → 0.0.76

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.
@@ -150,7 +150,7 @@ const DataSettings = _ref => {
150
150
  onChange: onChange
151
151
  }), /*#__PURE__*/React.createElement(FormGroup, {
152
152
  className: "sea-chart-parameter-item"
153
- }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(_DTableSelect, {
153
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_type')), /*#__PURE__*/React.createElement(_DTableSelect, {
154
154
  menuPortalTarget: "#sea-chart-settings-content",
155
155
  classNamePrefix: "chart-summary-types",
156
156
  value: selectedSummaryTypeOption,
@@ -98,7 +98,7 @@ const DataSettings = _ref => {
98
98
  className: "mt-4"
99
99
  }), /*#__PURE__*/React.createElement(BasicSummary, {
100
100
  className: "selected-y-axis",
101
- label: intl.get('Summary_method'),
101
+ label: intl.get('Summary_type'),
102
102
  summaryTypeKey: 'summary_type',
103
103
  summaryMethodKey: 'summary_method',
104
104
  summaryColumnKey: 'summary_column_key',
@@ -73,27 +73,36 @@ async function calculator(chart, value, _ref) {
73
73
  targetValue,
74
74
  rows
75
75
  } = labelCountMap[label];
76
+ let completedRate;
77
+ if (!targetValue && currentValue) {
78
+ completedRate = 100;
79
+ } else if (!targetValue && !currentValue) {
80
+ completedRate = 'empty';
81
+ } else {
82
+ completedRate = (currentValue / targetValue * 100).toFixed(0);
83
+ }
76
84
  if (currentValue < targetValue) {
77
85
  result.unshift({
78
86
  name: label,
79
87
  value: currentValue,
80
- type: 'completed',
88
+ group_name: 'completed',
81
89
  current_value: currentValue,
82
90
  target_value: targetValue,
83
91
  rows
84
92
  }, {
85
93
  name: label,
86
94
  value: targetValue - currentValue,
87
- type: 'uncompleted',
95
+ group_name: 'rest',
88
96
  current_value: currentValue,
89
97
  target_value: targetValue,
90
- rows
98
+ rows,
99
+ completedRate
91
100
  });
92
101
  } else {
93
102
  result.unshift({
94
103
  name: label,
95
104
  value: currentValue,
96
- type: 'completed',
105
+ group_name: 'completed',
97
106
  current_value: currentValue,
98
107
  target_value: targetValue,
99
108
  rows
@@ -172,13 +181,21 @@ async function calculator(chart, value, _ref) {
172
181
  targetValue,
173
182
  rows
174
183
  } = labelCountMap[key];
184
+ let completedRate;
185
+ if (!targetValue && currentValue) {
186
+ completedRate = 100;
187
+ } else if (!targetValue && !currentValue) {
188
+ completedRate = 'empty';
189
+ } else {
190
+ completedRate = (currentValue / targetValue * 100).toFixed(0);
191
+ }
175
192
  if (currentValue < targetValue) {
176
193
  result.unshift({
177
194
  name: label,
178
195
  groupby: groupLabel,
179
196
  value: currentValue,
180
197
  color,
181
- type: 'completed',
198
+ group_name: 'completed',
182
199
  current_value: currentValue,
183
200
  target_value: targetValue,
184
201
  rows
@@ -187,10 +204,11 @@ async function calculator(chart, value, _ref) {
187
204
  groupby: groupLabel,
188
205
  value: targetValue - currentValue,
189
206
  color,
190
- type: 'uncompleted',
207
+ group_name: 'rest',
191
208
  current_value: currentValue,
192
209
  target_value: targetValue,
193
- rows
210
+ rows,
211
+ completedRate
194
212
  });
195
213
  } else {
196
214
  result.unshift({
@@ -198,7 +216,7 @@ async function calculator(chart, value, _ref) {
198
216
  groupby: groupLabel,
199
217
  value: currentValue,
200
218
  color,
201
- type: 'completed',
219
+ group_name: 'completed',
202
220
  current_value: currentValue,
203
221
  target_value: targetValue,
204
222
  rows
@@ -69,7 +69,7 @@ class Area extends ChartComponent {
69
69
  line_type,
70
70
  y_axis_show_value,
71
71
  label_font_size,
72
- summary_columns
72
+ summary_columns = []
73
73
  } = chart.config;
74
74
  const newData = this.getChartGroupData(data);
75
75
  const isSmooth = line_type === CHART_LINE_TYPES[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",