sea-chart 0.0.74 → 0.0.76-alpha.0
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.
- package/dist/settings/basic-number-card/data-settings.js +1 -1
- package/dist/settings/trend-settings/data-settings.js +1 -1
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +48 -54
- package/dist/view/wrapper/area.js +1 -1
- package/dist/view/wrapper/completeness.js +5 -3
- package/package.json +1 -1
|
@@ -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('
|
|
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('
|
|
101
|
+
label: intl.get('Summary_type'),
|
|
102
102
|
summaryTypeKey: 'summary_type',
|
|
103
103
|
summaryMethodKey: 'summary_method',
|
|
104
104
|
summaryColumnKey: 'summary_column_key',
|
|
@@ -73,32 +73,30 @@ async function calculator(chart, value, _ref) {
|
|
|
73
73
|
targetValue,
|
|
74
74
|
rows
|
|
75
75
|
} = labelCountMap[label];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
current_value: currentValue,
|
|
82
|
-
target_value: targetValue,
|
|
83
|
-
rows
|
|
84
|
-
}, {
|
|
85
|
-
name: label,
|
|
86
|
-
value: targetValue - currentValue,
|
|
87
|
-
type: 'uncompleted',
|
|
88
|
-
current_value: currentValue,
|
|
89
|
-
target_value: targetValue,
|
|
90
|
-
rows
|
|
91
|
-
});
|
|
76
|
+
let completedRate;
|
|
77
|
+
if (!targetValue && currentValue) {
|
|
78
|
+
completedRate = 100;
|
|
79
|
+
} else if (!targetValue && !currentValue) {
|
|
80
|
+
completedRate = 'empty';
|
|
92
81
|
} else {
|
|
93
|
-
|
|
94
|
-
name: label,
|
|
95
|
-
value: currentValue,
|
|
96
|
-
type: 'completed',
|
|
97
|
-
current_value: currentValue,
|
|
98
|
-
target_value: targetValue,
|
|
99
|
-
rows
|
|
100
|
-
});
|
|
82
|
+
completedRate = (currentValue / targetValue * 100).toFixed(0);
|
|
101
83
|
}
|
|
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
|
+
});
|
|
102
100
|
}
|
|
103
101
|
});
|
|
104
102
|
} else {
|
|
@@ -172,38 +170,34 @@ async function calculator(chart, value, _ref) {
|
|
|
172
170
|
targetValue,
|
|
173
171
|
rows
|
|
174
172
|
} = labelCountMap[key];
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
color,
|
|
181
|
-
type: 'completed',
|
|
182
|
-
current_value: currentValue,
|
|
183
|
-
target_value: targetValue,
|
|
184
|
-
rows
|
|
185
|
-
}, {
|
|
186
|
-
name: label,
|
|
187
|
-
groupby: groupLabel,
|
|
188
|
-
value: targetValue - currentValue,
|
|
189
|
-
color,
|
|
190
|
-
type: 'uncompleted',
|
|
191
|
-
current_value: currentValue,
|
|
192
|
-
target_value: targetValue,
|
|
193
|
-
rows
|
|
194
|
-
});
|
|
173
|
+
let completedRate;
|
|
174
|
+
if (!targetValue && currentValue) {
|
|
175
|
+
completedRate = 100;
|
|
176
|
+
} else if (!targetValue && !currentValue) {
|
|
177
|
+
completedRate = 'empty';
|
|
195
178
|
} else {
|
|
196
|
-
|
|
197
|
-
name: label,
|
|
198
|
-
groupby: groupLabel,
|
|
199
|
-
value: currentValue,
|
|
200
|
-
color,
|
|
201
|
-
type: 'completed',
|
|
202
|
-
current_value: currentValue,
|
|
203
|
-
target_value: targetValue,
|
|
204
|
-
rows
|
|
205
|
-
});
|
|
179
|
+
completedRate = (currentValue / targetValue * 100).toFixed(0);
|
|
206
180
|
}
|
|
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
|
+
});
|
|
207
201
|
}
|
|
208
202
|
});
|
|
209
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 {
|
|
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
|
|
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
|
});
|