sea-chart 0.0.80 → 0.0.81

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.
@@ -81,33 +81,22 @@ async function calculator(chart, value, _ref) {
81
81
  } else {
82
82
  completedRate = (currentValue / targetValue * 100).toFixed(0);
83
83
  }
84
- if (currentValue < targetValue) {
85
- result.unshift({
86
- name: label,
87
- value: currentValue,
88
- group_name: 'completed',
89
- current_value: currentValue,
90
- target_value: targetValue,
91
- rows
92
- }, {
93
- name: label,
94
- value: targetValue - currentValue,
95
- group_name: 'rest',
96
- current_value: currentValue,
97
- target_value: targetValue,
98
- rows,
99
- completedRate
100
- });
101
- } else {
102
- result.unshift({
103
- name: label,
104
- value: currentValue,
105
- group_name: 'completed',
106
- current_value: currentValue,
107
- target_value: targetValue,
108
- rows
109
- });
110
- }
84
+ result.push({
85
+ name: label,
86
+ value: currentValue,
87
+ group_name: 'completed',
88
+ current_value: currentValue,
89
+ target_value: targetValue,
90
+ rows
91
+ }, {
92
+ name: label,
93
+ value: Math.max(targetValue - currentValue, 0),
94
+ group_name: 'rest',
95
+ current_value: currentValue,
96
+ target_value: targetValue,
97
+ rows,
98
+ completedRate
99
+ });
111
100
  }
112
101
  });
113
102
  } else {
@@ -189,39 +178,26 @@ async function calculator(chart, value, _ref) {
189
178
  } else {
190
179
  completedRate = (currentValue / targetValue * 100).toFixed(0);
191
180
  }
192
- if (currentValue < targetValue) {
193
- result.unshift({
194
- name: label,
195
- groupby: groupLabel,
196
- value: currentValue,
197
- color,
198
- group_name: 'completed',
199
- current_value: currentValue,
200
- target_value: targetValue,
201
- rows
202
- }, {
203
- name: label,
204
- groupby: groupLabel,
205
- value: targetValue - currentValue,
206
- color,
207
- group_name: 'rest',
208
- current_value: currentValue,
209
- target_value: targetValue,
210
- rows,
211
- completedRate
212
- });
213
- } else {
214
- result.unshift({
215
- name: label,
216
- groupby: groupLabel,
217
- value: currentValue,
218
- color,
219
- group_name: 'completed',
220
- current_value: currentValue,
221
- target_value: targetValue,
222
- rows
223
- });
224
- }
181
+ result.push({
182
+ name: label,
183
+ groupby: groupLabel,
184
+ value: currentValue,
185
+ color,
186
+ group_name: 'completed',
187
+ current_value: currentValue,
188
+ target_value: targetValue,
189
+ rows
190
+ }, {
191
+ name: label,
192
+ groupby: groupLabel,
193
+ value: Math.max(targetValue - currentValue, 0),
194
+ color,
195
+ group_name: 'rest',
196
+ current_value: currentValue,
197
+ target_value: targetValue,
198
+ rows,
199
+ completedRate
200
+ });
225
201
  }
226
202
  });
227
203
  result.colorMap = colorMap;
@@ -3,7 +3,7 @@ import React, { useEffect, useRef } from 'react';
3
3
  import { maxBy } from 'lodash-es';
4
4
  import { BaseUtils, isBoolean } from '../../utils';
5
5
  import intl from '../../intl';
6
- import { CHART_STYLE_COLORS, CHART_TYPE, CHART_THEME_COLOR } from '../../constants';
6
+ import { CHART_TYPE, CHART_THEME_COLOR } from '../../constants';
7
7
  import ChartComponent from './chart-component';
8
8
  export default function Completeness(props) {
9
9
  var _chartRef$current, _chartRef$current2;
@@ -21,11 +21,13 @@ export default function Completeness(props) {
21
21
  var _style_config$title;
22
22
  let {
23
23
  chart: {
24
- style_config
24
+ style_config,
25
+ config
25
26
  }
26
27
  } = props;
27
28
  chartPaddingTop = ((_style_config$title = style_config.title) === null || _style_config$title === void 0 ? void 0 : _style_config$title.text) ? 17 : 0;
28
- const appendPadding = [chartPaddingTop, 30, 0, 0];
29
+ const chartPaddingRight = (config === null || config === void 0 ? void 0 : config.show_percentage) ? 45 : 0;
30
+ const appendPadding = [chartPaddingTop, chartPaddingRight, 0, 0];
29
31
  currentChart.initChart(chartContainerRef.current, {
30
32
  appendPadding
31
33
  });
@@ -43,7 +43,6 @@ class Treemap extends ChartComponent {
43
43
  this.chart.clear(true);
44
44
  };
45
45
  this.drawChart = () => {
46
- debugger;
47
46
  let {
48
47
  result: data,
49
48
  chart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.80",
3
+ "version": "0.0.81",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",