@zgfe/business-lib 1.0.0-beta.4 → 1.0.1-beta.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/es/analysisLayout/demo/index.js +4 -1
- package/es/analysisLayout/index.d.ts +1 -28
- package/es/analysisLayout/index.js +32 -42
- package/es/analysisLayout/index.less +7 -5
- package/es/assets/styles/chunks.less +143 -0
- package/es/assets/styles/inner.less +3 -0
- package/es/assets/styles/resetAntd.less +398 -0
- package/es/assets/styles/variable.less +21 -0
- package/es/assets/theme.d.ts +5 -0
- package/es/assets/theme.js +4 -0
- package/es/attrConditions/components/operateList.d.ts +8 -0
- package/es/attrConditions/components/operateList.js +83 -0
- package/es/attrConditions/components/stringList.d.ts +9 -0
- package/es/attrConditions/components/stringList.js +167 -0
- package/es/attrConditions/components/valuesList.d.ts +10 -0
- package/es/attrConditions/components/valuesList.js +186 -0
- package/es/{attributeSelector/demo/multi.d.ts → attrConditions/demo/group.d.ts} +0 -0
- package/es/attrConditions/demo/group.js +82 -0
- package/es/{globalAttributes → attrConditions}/demo/index.d.ts +0 -0
- package/es/{datePicker/demo/form.js → attrConditions/demo/index.js} +43 -23
- package/es/attrConditions/group.d.ts +5 -0
- package/es/attrConditions/group.js +184 -0
- package/es/attrConditions/index.d.ts +6 -0
- package/es/attrConditions/index.js +160 -0
- package/es/attrConditions/styles/group.less +49 -0
- package/es/attrConditions/styles/index.less +94 -0
- package/es/attrConditions/types.d.ts +63 -0
- package/es/attrConditions/types.js +19 -0
- package/es/attrConditions/utils/operates.d.ts +16 -0
- package/es/attrConditions/utils/operates.js +67 -0
- package/es/{multipleSelector → attributeSelector}/demo/index.d.ts +1 -0
- package/es/attributeSelector/demo/{singleForm.js → index.js} +42 -44
- package/es/attributeSelector/index.d.ts +4 -109
- package/es/attributeSelector/index.js +85 -527
- package/es/attributeSelector/listPanel.d.ts +4 -0
- package/es/attributeSelector/listPanel.js +206 -0
- package/es/attributeSelector/option.d.ts +15 -0
- package/es/attributeSelector/option.js +53 -0
- package/es/attributeSelector/styles/index.less +100 -0
- package/es/attributeSelector/types.d.ts +79 -0
- package/es/attributeSelector/types.js +15 -0
- package/es/attributeSelector/util.d.ts +7 -0
- package/es/attributeSelector/util.js +69 -0
- package/es/chart/demo/bar.js +2 -1
- package/es/chart/demo/pie.js +1 -0
- package/es/chart/index.d.ts +2 -80
- package/es/chart/index.js +27 -24
- package/es/chart/styles/index.less +50 -0
- package/es/chart/types.d.ts +46 -0
- package/es/chart/{type.js → types.js} +0 -0
- package/es/chart/util/{chartConfig.d.ts → chartOptionConfig.d.ts} +4 -35
- package/es/chart/util/{chartConfig.js → chartOptionConfig.js} +46 -109
- package/es/chart/util/formatData.d.ts +3 -7
- package/es/chart/util/formatData.js +47 -26
- package/es/chart/util/formatOption.d.ts +2 -1
- package/es/chart/util/formatOption.js +22 -9
- package/es/chart/util/mapUtil.d.ts +3 -3
- package/es/chart/util/mapUtil.js +9 -19
- package/es/commonStyle/icon.less +130 -110
- package/es/commonStyle/select.less +1 -1
- package/es/commonStyle/theme.less +520 -470
- package/es/context/index.d.ts +16 -0
- package/es/context/index.js +3 -0
- package/es/datePicker/datePicker.d.ts +10 -0
- package/es/datePicker/datePicker.js +115 -0
- package/es/datePicker/demo/index.d.ts +1 -0
- package/es/datePicker/demo/index.js +9 -2
- package/es/datePicker/index.d.ts +4 -27
- package/es/datePicker/index.js +72 -148
- package/es/datePicker/styles/index.less +48 -0
- package/es/datePicker/types.d.ts +24 -0
- package/es/{eventSelector/type.js → datePicker/types.js} +0 -0
- package/es/datePicker/utils.d.ts +6 -0
- package/es/datePicker/utils.js +70 -0
- package/es/dialog/components/itemNode.d.ts +9 -0
- package/es/dialog/components/itemNode.js +107 -0
- package/es/dialog/components/list.d.ts +3 -13
- package/es/dialog/components/list.js +8 -7
- package/es/dialog/components/selectToInput.d.ts +4 -41
- package/es/dialog/components/selectToInput.js +109 -54
- package/es/dialog/components/styles/handle.less +39 -0
- package/es/dialog/components/styles/list.less +60 -0
- package/es/dialog/components/styles/tab.less +55 -0
- package/es/dialog/components/tab.d.ts +3 -7
- package/es/dialog/components/tab.js +57 -19
- package/es/dialog/data/{chart.d.ts → data.d.ts} +9 -0
- package/es/dialog/data/{chart.js → data.js} +11 -0
- package/es/dialog/demo/index.d.ts +23 -0
- package/es/dialog/demo/index.js +60 -22
- package/es/dialog/demo/index2.js +14 -2
- package/es/dialog/index.d.ts +4 -65
- package/es/dialog/index.js +124 -108
- package/es/dialog/styles/index.less +11 -0
- package/es/dialog/types.d.ts +77 -0
- package/es/{targetConditionGroup/type.js → dialog/types.js} +0 -0
- package/es/eventSelector/demo/index.js +26 -44
- package/es/eventSelector/index.d.ts +4 -25
- package/es/eventSelector/index.js +91 -338
- package/es/eventSelector/listPanel.d.ts +4 -0
- package/es/eventSelector/listPanel.js +195 -0
- package/es/eventSelector/option.d.ts +17 -0
- package/es/eventSelector/option.js +54 -0
- package/es/eventSelector/styles/index.less +77 -0
- package/es/eventSelector/types.d.ts +31 -0
- package/es/eventSelector/types.js +1 -0
- package/es/index.d.ts +12 -10
- package/es/index.js +7 -10
- package/es/{attributeSelector/data → mock}/env.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/env.js +0 -0
- package/es/{attributeSelector/data → mock}/event.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/event.js +0 -0
- package/es/{attributeSelector/data → mock}/user.d.ts +0 -0
- package/es/{attributeSelector/data → mock}/user.js +0 -0
- package/es/searchInput/index.d.ts +8 -0
- package/es/searchInput/index.js +31 -0
- package/es/{attributeSelector/demo/multiForm.d.ts → select/demo/group.d.ts} +0 -0
- package/es/{globalAttributes/demo/index.js → select/demo/group.js} +49 -31
- package/es/select/demo/index.js +49 -21
- package/es/{attributeSelector/demo/single.d.ts → select/demo/multiple.d.ts} +0 -0
- package/es/{multipleSelector/demo/index.js → select/demo/multiple.js} +55 -12
- package/es/select/handle.d.ts +5 -0
- package/es/select/handle.js +119 -0
- package/es/select/index.d.ts +4 -41
- package/es/select/index.js +166 -121
- package/es/select/option.d.ts +4 -0
- package/es/select/option.js +59 -0
- package/es/select/overlay.d.ts +4 -0
- package/es/select/overlay.js +154 -0
- package/es/select/styles/handle.less +111 -0
- package/es/select/styles/index.less +99 -0
- package/es/select/types.d.ts +65 -0
- package/es/select/types.js +1 -0
- package/es/table/demo/data/table.js +1 -1
- package/es/table/demo/index.d.ts +1 -1
- package/es/table/demo/index.js +9 -8
- package/es/table/demo/index2.js +45 -3
- package/es/{attributeSelector/demo/singleForm.d.ts → table/demo/index3.d.ts} +0 -0
- package/es/table/demo/index3.js +218 -0
- package/es/table/index.d.ts +4 -30
- package/es/table/index.js +19 -17
- package/es/table/styles/index.less +5 -0
- package/es/table/type.d.ts +10 -0
- package/es/table/type.js +1 -0
- package/es/targetConditionGroup/components/targetDimension.d.ts +8 -0
- package/es/targetConditionGroup/components/targetDimension.js +153 -0
- package/es/targetConditionGroup/data/operates.d.ts +8 -24
- package/es/targetConditionGroup/data/operates.js +26 -69
- package/es/targetConditionGroup/demo/group.d.ts +3 -0
- package/es/targetConditionGroup/demo/group.js +127 -0
- package/es/targetConditionGroup/demo/index.js +41 -51
- package/es/targetConditionGroup/demo/styles/index.less +29 -0
- package/es/targetConditionGroup/index.d.ts +4 -51
- package/es/targetConditionGroup/index.js +187 -222
- package/es/targetConditionGroup/styles/index.less +25 -0
- package/es/targetConditionGroup/types.d.ts +32 -0
- package/es/targetConditionGroup/types.js +1 -0
- package/es/targetSelector/demo/index.d.ts +1 -0
- package/es/targetSelector/demo/index.js +29 -71
- package/es/targetSelector/editBox.d.ts +8 -0
- package/es/targetSelector/{components/BizEventNameEditBox.js → editBox.js} +49 -24
- package/es/targetSelector/index.d.ts +5 -39
- package/es/targetSelector/index.js +102 -169
- package/es/targetSelector/optionIcon.d.ts +9 -0
- package/es/targetSelector/optionIcon.js +24 -0
- package/es/targetSelector/optionMenu.d.ts +7 -0
- package/es/targetSelector/optionMenu.js +38 -0
- package/es/targetSelector/styles/index.less +88 -0
- package/es/targetSelector/types.d.ts +18 -0
- package/es/targetSelector/types.js +1 -0
- package/es/{datePicker/demo/form.d.ts → userGroup/demo/group.d.ts} +0 -0
- package/es/{targetConditionGroup/demo/form.js → userGroup/demo/group.js} +68 -72
- package/es/userGroup/demo/index.d.ts +0 -1
- package/es/userGroup/demo/index.js +5 -62
- package/es/userGroup/index.d.ts +3 -77
- package/es/userGroup/index.js +58 -108
- package/es/userGroup/styles/index.less +20 -0
- package/es/userGroup/types.d.ts +15 -0
- package/es/userGroup/types.js +1 -0
- package/es/utils/ajax.js +5 -20
- package/es/utils/type.d.ts +42 -44
- package/es/utils/util.d.ts +1 -35
- package/es/utils/util.js +27 -57
- package/package.json +11 -4
- package/es/attributeSelector/demo/multi.js +0 -39
- package/es/attributeSelector/demo/multiForm.js +0 -64
- package/es/attributeSelector/demo/single.js +0 -43
- package/es/attributeSelector/group.d.ts +0 -31
- package/es/attributeSelector/group.js +0 -225
- package/es/attributeSelector/index.less +0 -172
- package/es/chart/index.less +0 -38
- package/es/chart/style/circle.svg +0 -4
- package/es/chart/type.d.ts +0 -22
- package/es/datePicker/data.d.ts +0 -9
- package/es/datePicker/data.js +0 -65
- package/es/datePicker/index.less +0 -364
- package/es/dialog/components/style/list.less +0 -59
- package/es/dialog/components/style/tab.less +0 -61
- package/es/dialog/style/index.less +0 -76
- package/es/eventSelector/demo/form.d.ts +0 -2
- package/es/eventSelector/demo/form.js +0 -89
- package/es/eventSelector/demo/nodata.d.ts +0 -2
- package/es/eventSelector/demo/nodata.js +0 -13
- package/es/eventSelector/index.less +0 -121
- package/es/eventSelector/type.d.ts +0 -41
- package/es/globalAttributes/demo/data/env.d.ts +0 -11
- package/es/globalAttributes/demo/data/env.js +0 -181
- package/es/globalAttributes/demo/data/event.d.ts +0 -237
- package/es/globalAttributes/demo/data/event.js +0 -3483
- package/es/globalAttributes/demo/data/user.d.ts +0 -22
- package/es/globalAttributes/demo/data/user.js +0 -218
- package/es/globalAttributes/index.d.ts +0 -46
- package/es/globalAttributes/index.js +0 -117
- package/es/multipleSelector/index.d.ts +0 -36
- package/es/multipleSelector/index.js +0 -103
- package/es/multipleSelector/index.less +0 -136
- package/es/table/demo/index.less +0 -8
- package/es/table/index.less +0 -139
- package/es/targetConditionGroup/components/conditionGroup.d.ts +0 -30
- package/es/targetConditionGroup/components/conditionGroup.js +0 -111
- package/es/targetConditionGroup/components/conditionItem.d.ts +0 -47
- package/es/targetConditionGroup/components/conditionItem.js +0 -259
- package/es/targetConditionGroup/components/style/group.less +0 -47
- package/es/targetConditionGroup/components/style/index.less +0 -16
- package/es/targetConditionGroup/demo/data/env.d.ts +0 -11
- package/es/targetConditionGroup/demo/data/env.js +0 -181
- package/es/targetConditionGroup/demo/data/event.d.ts +0 -237
- package/es/targetConditionGroup/demo/data/event.js +0 -3483
- package/es/targetConditionGroup/demo/data/user.d.ts +0 -22
- package/es/targetConditionGroup/demo/data/user.js +0 -218
- package/es/targetConditionGroup/demo/form.d.ts +0 -2
- package/es/targetConditionGroup/demo/item.d.ts +0 -2
- package/es/targetConditionGroup/demo/item.js +0 -5
- package/es/targetConditionGroup/index.less +0 -64
- package/es/targetConditionGroup/type.d.ts +0 -50
- package/es/targetSelector/components/BizCascadeBox.d.ts +0 -34
- package/es/targetSelector/components/BizCascadeBox.js +0 -213
- package/es/targetSelector/components/BizEventNameEditBox.d.ts +0 -20
- package/es/targetSelector/demo/form.d.ts +0 -2
- package/es/targetSelector/demo/form.js +0 -133
- package/es/targetSelector/demo/nodata.d.ts +0 -2
- package/es/targetSelector/demo/nodata.js +0 -13
- package/es/targetSelector/index.less +0 -28
- package/es/userGroup/demo/cluster.d.ts +0 -3
- package/es/userGroup/demo/cluster.js +0 -102
- package/es/userGroup/demo/index.less +0 -3
- package/es/userGroup/index.less +0 -2
- package/es/userGroup/userCluster.d.ts +0 -63
- package/es/userGroup/userCluster.js +0 -255
package/es/chart/index.js
CHANGED
|
@@ -16,32 +16,36 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
16
16
|
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
|
|
19
|
-
import React, { useEffect,
|
|
19
|
+
import React, { useEffect, useState } from 'react';
|
|
20
20
|
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
|
21
21
|
import * as echarts from 'echarts';
|
|
22
|
-
import { getChartOption, getPieOption, getMapOption } from './util/
|
|
22
|
+
import { getChartOption, getPieOption, getMapOption } from './util/chartOptionConfig';
|
|
23
23
|
import { provinceSeries, citySeries, maxMinValue } from './util/mapUtil';
|
|
24
24
|
import { formatPieData, formatChartData } from './util/formatData';
|
|
25
25
|
import './util/data/china.js';
|
|
26
|
-
import util from '../utils/util';
|
|
27
26
|
|
|
28
27
|
var BizChart = function BizChart(props) {
|
|
29
28
|
var type = props.type,
|
|
30
29
|
data = props.data,
|
|
31
30
|
showList = props.showList,
|
|
31
|
+
option = props.option,
|
|
32
32
|
userGroup = props.userGroup,
|
|
33
33
|
_props$showAll = props.showAll,
|
|
34
|
-
showAll = _props$showAll === void 0 ?
|
|
35
|
-
_props$sameColor = props.sameColor,
|
|
36
|
-
sameColor = _props$sameColor === void 0 ? true : _props$sameColor,
|
|
34
|
+
showAll = _props$showAll === void 0 ? false : _props$showAll,
|
|
37
35
|
_props$reverseXAxis = props.reverseXAxis,
|
|
38
36
|
reverseXAxis = _props$reverseXAxis === void 0 ? false : _props$reverseXAxis,
|
|
39
37
|
_props$isCity = props.isCity,
|
|
40
38
|
isCity = _props$isCity === void 0 ? true : _props$isCity,
|
|
39
|
+
_props$xRotate = props.xRotate,
|
|
40
|
+
xRotate = _props$xRotate === void 0 ? 0 : _props$xRotate,
|
|
41
|
+
_props$yRotate = props.yRotate,
|
|
42
|
+
yRotate = _props$yRotate === void 0 ? 0 : _props$yRotate,
|
|
41
43
|
seriesName = props.seriesName,
|
|
44
|
+
colors = props.colors,
|
|
42
45
|
tooltipFormatter = props.tooltipFormatter,
|
|
43
46
|
xAxisFormatter = props.xAxisFormatter,
|
|
44
47
|
yAxisFormatter = props.yAxisFormatter,
|
|
48
|
+
legendFormatter = props.legendFormatter,
|
|
45
49
|
valueUnit = props.valueUnit,
|
|
46
50
|
legendPosition = props.legendPosition,
|
|
47
51
|
legendOrient = props.legendOrient;
|
|
@@ -51,31 +55,23 @@ var BizChart = function BizChart(props) {
|
|
|
51
55
|
chartOption = _useState2[0],
|
|
52
56
|
setChartOption = _useState2[1];
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
showList.forEach(function (item) {
|
|
59
|
-
if (util.isArray(item)) {
|
|
60
|
-
data[item.join('-')] = true;
|
|
61
|
-
} else if (util.isString(item)) {
|
|
62
|
-
data[item] = true;
|
|
63
|
-
}
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
if (option) {
|
|
60
|
+
setChartOption(function () {
|
|
61
|
+
return _objectSpread({}, option);
|
|
64
62
|
});
|
|
63
|
+
return;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
return data;
|
|
68
|
-
}, [showList]);
|
|
69
|
-
useEffect(function () {
|
|
70
66
|
var eOption = {};
|
|
71
67
|
|
|
72
68
|
if (type === 'pie') {
|
|
73
|
-
var rData = formatPieData(data, showAll,
|
|
69
|
+
var rData = formatPieData(data, showAll, showList);
|
|
74
70
|
eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
|
|
75
71
|
} else if (type === 'line' || type === 'bar') {
|
|
76
|
-
var _rData = formatChartData(data,
|
|
72
|
+
var _rData = formatChartData(data, showAll, showList, reverseXAxis, colors);
|
|
77
73
|
|
|
78
|
-
eOption = getChartOption(type,
|
|
74
|
+
eOption = getChartOption(type, _rData, legendPosition, legendOrient, valueUnit, xRotate, yRotate, tooltipFormatter, xAxisFormatter, yAxisFormatter, legendFormatter, reverseXAxis, seriesName);
|
|
79
75
|
} else if (type === 'map') {
|
|
80
76
|
var series = isCity ? citySeries(data, !!userGroup) : provinceSeries(data, !!userGroup);
|
|
81
77
|
var maxMin = maxMinValue(series[0]);
|
|
@@ -83,16 +79,23 @@ var BizChart = function BizChart(props) {
|
|
|
83
79
|
eOption = getMapOption(series, maxMin, showVisualMap, tooltipFormatter);
|
|
84
80
|
}
|
|
85
81
|
|
|
82
|
+
if (colors) {
|
|
83
|
+
eOption.color = colors;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
86
|
setChartOption(function () {
|
|
87
87
|
return _objectSpread({}, eOption);
|
|
88
88
|
});
|
|
89
|
-
}, [data,
|
|
89
|
+
}, [data, showAll, showList, reverseXAxis]);
|
|
90
90
|
return /*#__PURE__*/React.createElement(ReactEChartsCore, {
|
|
91
91
|
echarts: echarts,
|
|
92
92
|
option: chartOption,
|
|
93
93
|
notMerge: true,
|
|
94
94
|
lazyUpdate: true,
|
|
95
|
-
theme: 'theme_name'
|
|
95
|
+
theme: 'theme_name',
|
|
96
|
+
style: {
|
|
97
|
+
width: '100%'
|
|
98
|
+
}
|
|
96
99
|
});
|
|
97
100
|
};
|
|
98
101
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@import '../../assets/styles/variable.less';
|
|
2
|
+
|
|
3
|
+
.biz-chart-tooltip {
|
|
4
|
+
padding: @padding-xs;
|
|
5
|
+
background-color: 'rgba(250, 251, 253, 0.8)';
|
|
6
|
+
border-color: 'transparent';
|
|
7
|
+
backdrop-filter: blur(4px);
|
|
8
|
+
|
|
9
|
+
.biz-chart-tooltip-title {
|
|
10
|
+
margin-bottom: @margin-xss;
|
|
11
|
+
color: @text-color;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
font-size: @font-size-sm;
|
|
14
|
+
line-height: 17px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.biz-chart-tooltip-item {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
height: @height-sm;
|
|
22
|
+
padding: 0px @padding-xs;
|
|
23
|
+
font-size: @font-size-sm;
|
|
24
|
+
background: @white;
|
|
25
|
+
border-radius: @border-radius-small;
|
|
26
|
+
box-shadow: @box-shadow-small;
|
|
27
|
+
|
|
28
|
+
&:not(:last-child) {
|
|
29
|
+
margin-bottom: @margin-xss;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.biz-chart-tooltip-content {
|
|
33
|
+
color: @text-color-secondary;
|
|
34
|
+
|
|
35
|
+
.biz-tooltip-marker {
|
|
36
|
+
display: inline-block;
|
|
37
|
+
width: 8px;
|
|
38
|
+
height: 8px;
|
|
39
|
+
margin-right: @margin-xs;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.biz-chart-tooltip-value {
|
|
45
|
+
margin-left: @margin-xs;
|
|
46
|
+
color: @text-color;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EChartsOption } from 'echarts';
|
|
2
|
+
export interface ChartItmProps {
|
|
3
|
+
names: Array<string>;
|
|
4
|
+
values: Array<number>;
|
|
5
|
+
userGroupCompareData?: object;
|
|
6
|
+
}
|
|
7
|
+
export interface ItemDataProps {
|
|
8
|
+
data: Array<object>;
|
|
9
|
+
[prop: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface ProvinceDataProps {
|
|
12
|
+
name: string;
|
|
13
|
+
value: number;
|
|
14
|
+
childrenOptions: Array<any>;
|
|
15
|
+
isProvince?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ProvinceMapDataProps {
|
|
18
|
+
[prop: string]: ProvinceDataProps;
|
|
19
|
+
}
|
|
20
|
+
export declare namespace ChartTypes {
|
|
21
|
+
interface Value {
|
|
22
|
+
x_axis: Array<string>;
|
|
23
|
+
series: Array<ChartItmProps>;
|
|
24
|
+
}
|
|
25
|
+
interface Props {
|
|
26
|
+
type: 'bar' | 'pie' | 'line' | 'map';
|
|
27
|
+
data: Value;
|
|
28
|
+
option?: EChartsOption;
|
|
29
|
+
isCity?: boolean;
|
|
30
|
+
userGroup?: string;
|
|
31
|
+
colors?: string[];
|
|
32
|
+
tooltipFormatter?: (param: any) => string;
|
|
33
|
+
xAxisFormatter?: (param: any) => string;
|
|
34
|
+
yAxisFormatter?: (param: any) => string;
|
|
35
|
+
legendFormatter?: (param: any) => string;
|
|
36
|
+
valueUnit?: string;
|
|
37
|
+
xRotate?: number;
|
|
38
|
+
yRotate?: number;
|
|
39
|
+
legendPosition?: 'top' | 'bottom' | 'middle';
|
|
40
|
+
legendOrient?: 'horizontal' | 'vertical';
|
|
41
|
+
showList?: Array<any>;
|
|
42
|
+
showAll?: boolean;
|
|
43
|
+
reverseXAxis?: boolean;
|
|
44
|
+
seriesName?: string;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
File without changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { GridComponentOption, TitleComponentOption, TooltipComponentOption } from 'echarts/types/dist/echarts';
|
|
2
2
|
import { BarSeriesOption, LegendComponentOption, LineSeriesOption, PieSeriesOption, ToolboxComponentOption, XAXisOption, YAXisOption } from 'echarts/types/dist/shared';
|
|
3
|
-
import '../index.less';
|
|
3
|
+
import '../styles/index.less';
|
|
4
|
+
import { ChartTypes } from '../types';
|
|
5
|
+
export declare type EChartsOption = echarts.ComposeOption<TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GridComponentOption | LegendComponentOption | LineSeriesOption | BarSeriesOption | PieSeriesOption>;
|
|
4
6
|
export declare const baseConfig: EChartsOption;
|
|
5
7
|
export declare const seriesConfig: any;
|
|
6
|
-
export declare type EChartsOption = echarts.ComposeOption<TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GridComponentOption | LegendComponentOption | LineSeriesOption | BarSeriesOption | PieSeriesOption>;
|
|
7
8
|
export declare const legendConfig: LegendComponentOption;
|
|
8
9
|
export declare const gridConfig: {
|
|
9
10
|
left: number;
|
|
@@ -15,40 +16,8 @@ export declare const gridConfig: {
|
|
|
15
16
|
export declare const xAxisConfig: XAXisOption;
|
|
16
17
|
export declare const yAxisConfig: YAXisOption;
|
|
17
18
|
export declare const tooltipConfig: TooltipComponentOption;
|
|
18
|
-
|
|
19
|
-
* 折现/柱图
|
|
20
|
-
* @param xData x轴数据 []
|
|
21
|
-
* @param seriesData 系列数据 [{name:'系列名称',data:[数据]}]
|
|
22
|
-
* @param chartType 图表类型
|
|
23
|
-
* @param seriesType 系列类型(单选列柱图是单个颜色还是一个柱一个颜色)
|
|
24
|
-
* @param legendPosition 图例位置
|
|
25
|
-
* @param legendOrient 图例方向
|
|
26
|
-
* @param unit y轴单位
|
|
27
|
-
* @param tooltipFormatter tooltip 自定义显示
|
|
28
|
-
* @param xAxisFormatter x轴 自定义显示
|
|
29
|
-
* @param yAxisFormatter y轴 自定义显示
|
|
30
|
-
* @param reverseXAxis 柱图单系列
|
|
31
|
-
* @param seriesName 系列名称
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
export declare const getChartOption: (chartType: string, xData?: string[] | undefined, seriesData?: object[], sameColor?: boolean, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string | undefined, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean | undefined, seriesName?: string | undefined) => EChartsOption;
|
|
35
|
-
/**
|
|
36
|
-
* 饼图配置
|
|
37
|
-
* @param seriesData 数据 [{name:'',value:''}]
|
|
38
|
-
* @param legendPosition 图例位置
|
|
39
|
-
* @param legendOrient 图例方向
|
|
40
|
-
* @param tooltipFormatter tooltip 自定义显示
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
19
|
+
export declare const getChartOption: (chartType: string, data: ChartTypes.Value, legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', unit?: string | undefined, xRotate?: number, yRotate?: number, tooltipFormatter?: ((value: any) => string) | undefined, xAxisFormatter?: ((value: any) => string) | undefined, yAxisFormatter?: ((value: any) => string) | undefined, legendFormatter?: ((value: any) => string) | undefined, reverseXAxis?: boolean | undefined, seriesName?: string | undefined) => EChartsOption;
|
|
43
20
|
export declare const getPieOption: (seriesData?: object[], legendPosition?: 'top' | 'bottom' | 'middle', legendOrient?: 'horizontal' | 'vertical', tooltipFormatter?: ((value: any) => string) | undefined) => EChartsOption;
|
|
44
|
-
/**
|
|
45
|
-
* 地图
|
|
46
|
-
* @param seriesData 数据
|
|
47
|
-
* @param maxMinValue 最大最小值
|
|
48
|
-
* @param showVisualMap 是否显示
|
|
49
|
-
* @param tooltipFormat 提示formatter
|
|
50
|
-
* @returns option
|
|
51
|
-
*/
|
|
52
21
|
export declare const getMapOption: (seriesData: object[] | undefined, maxMinValue: {
|
|
53
22
|
min: number;
|
|
54
23
|
max: number;
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
-
|
|
13
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
2
|
|
|
15
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
4
|
|
|
17
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
6
|
|
|
19
|
-
import { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter } from './formatOption';
|
|
7
|
+
import { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault, mapTooltipFormatter, legendFormatterDefault } from './formatOption';
|
|
20
8
|
import { chartColors } from './color';
|
|
21
|
-
import '../index.less';
|
|
9
|
+
import '../styles/index.less';
|
|
22
10
|
export var baseConfig = {
|
|
23
11
|
color: chartColors,
|
|
24
12
|
textStyle: {
|
|
@@ -34,20 +22,25 @@ export var seriesConfig = {
|
|
|
34
22
|
};
|
|
35
23
|
export var legendConfig = {
|
|
36
24
|
type: 'scroll',
|
|
37
|
-
height: 17,
|
|
38
|
-
padding: 0,
|
|
39
25
|
itemHeight: 10,
|
|
40
26
|
itemWidth: 10,
|
|
41
|
-
|
|
42
|
-
opacity: 0
|
|
43
|
-
},
|
|
27
|
+
itemGap: 21,
|
|
44
28
|
textStyle: {
|
|
45
29
|
color: '#5F6085',
|
|
46
|
-
|
|
30
|
+
height: 10,
|
|
31
|
+
rich: {
|
|
32
|
+
a: {
|
|
33
|
+
verticalAlign: 'bottom'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
47
36
|
},
|
|
37
|
+
formatter: ['{a|{name}}'].join('\n'),
|
|
48
38
|
pageIconSize: 10,
|
|
49
39
|
pageTextStyle: {
|
|
50
40
|
color: '#5F6085'
|
|
41
|
+
},
|
|
42
|
+
tooltip: {
|
|
43
|
+
show: true
|
|
51
44
|
}
|
|
52
45
|
};
|
|
53
46
|
export var gridConfig = {
|
|
@@ -72,7 +65,6 @@ export var xAxisConfig = {
|
|
|
72
65
|
nameTextStyle: {
|
|
73
66
|
lineHeight: 30
|
|
74
67
|
},
|
|
75
|
-
// boundaryGap: false,
|
|
76
68
|
axisLabel: {
|
|
77
69
|
formatter: function formatter(value) {
|
|
78
70
|
return value;
|
|
@@ -109,61 +101,44 @@ export var tooltipConfig = {
|
|
|
109
101
|
}
|
|
110
102
|
}
|
|
111
103
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
* @param legendPosition 图例位置
|
|
119
|
-
* @param legendOrient 图例方向
|
|
120
|
-
* @param unit y轴单位
|
|
121
|
-
* @param tooltipFormatter tooltip 自定义显示
|
|
122
|
-
* @param xAxisFormatter x轴 自定义显示
|
|
123
|
-
* @param yAxisFormatter y轴 自定义显示
|
|
124
|
-
* @param reverseXAxis 柱图单系列
|
|
125
|
-
* @param seriesName 系列名称
|
|
126
|
-
*
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
export var getChartOption = function getChartOption(chartType, xData) {
|
|
130
|
-
var seriesData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
131
|
-
var sameColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
132
|
-
var legendPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'top';
|
|
133
|
-
var legendOrient = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'horizontal';
|
|
134
|
-
var unit = arguments.length > 6 ? arguments[6] : undefined;
|
|
104
|
+
export var getChartOption = function getChartOption(chartType, data) {
|
|
105
|
+
var legendPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'top';
|
|
106
|
+
var legendOrient = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'horizontal';
|
|
107
|
+
var unit = arguments.length > 4 ? arguments[4] : undefined;
|
|
108
|
+
var xRotate = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
109
|
+
var yRotate = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
135
110
|
var tooltipFormatter = arguments.length > 7 ? arguments[7] : undefined;
|
|
136
111
|
var xAxisFormatter = arguments.length > 8 ? arguments[8] : undefined;
|
|
137
112
|
var yAxisFormatter = arguments.length > 9 ? arguments[9] : undefined;
|
|
138
|
-
var
|
|
139
|
-
var
|
|
113
|
+
var legendFormatter = arguments.length > 10 ? arguments[10] : undefined;
|
|
114
|
+
var reverseXAxis = arguments.length > 11 ? arguments[11] : undefined;
|
|
115
|
+
var seriesName = arguments.length > 12 ? arguments[12] : undefined;
|
|
140
116
|
|
|
141
117
|
var xAxis = JSON.parse(JSON.stringify(xAxisConfig)),
|
|
142
118
|
tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
|
|
143
119
|
yAxis = _objectSpread({}, yAxisConfig),
|
|
144
120
|
legend = _objectSpread({}, legendConfig),
|
|
145
121
|
grid = _objectSpread({}, gridConfig),
|
|
146
|
-
seriesItem = _objectSpread({}, seriesConfig);
|
|
147
|
-
|
|
122
|
+
seriesItem = _objectSpread({}, seriesConfig);
|
|
148
123
|
|
|
149
|
-
if (
|
|
150
|
-
xAxis.data =
|
|
124
|
+
if (data.x_axis) {
|
|
125
|
+
xAxis.data = data.x_axis;
|
|
151
126
|
}
|
|
152
127
|
|
|
153
128
|
xAxis.boundaryGap = chartType === 'bar';
|
|
154
129
|
xAxis.axisLabel = xAxis.axisLabel || {
|
|
155
130
|
rotate: 0
|
|
156
131
|
};
|
|
157
|
-
xAxis.axisLabel.rotate =
|
|
132
|
+
xAxis.axisLabel.rotate = xRotate;
|
|
158
133
|
|
|
159
134
|
if (xAxisFormatter) {
|
|
160
135
|
xAxis.axisLabel.formatter = xAxisFormatter;
|
|
161
136
|
} else {
|
|
162
137
|
xAxis.axisLabel.formatter = xAxisFormatterDefault;
|
|
163
|
-
}
|
|
164
|
-
|
|
138
|
+
}
|
|
165
139
|
|
|
166
140
|
yAxis.axisLabel = yAxis.axisLabel || {};
|
|
141
|
+
yAxis.axisLabel.rotate = yRotate;
|
|
167
142
|
|
|
168
143
|
if (yAxisFormatter) {
|
|
169
144
|
yAxis.axisLabel.formatter = yAxisFormatter;
|
|
@@ -173,14 +148,8 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
173
148
|
|
|
174
149
|
if (unit) {
|
|
175
150
|
yAxis.name = unit;
|
|
176
|
-
}
|
|
177
|
-
|
|
151
|
+
}
|
|
178
152
|
|
|
179
|
-
var itemStyle = {
|
|
180
|
-
color: sameColor ? 'auto' : function (param) {
|
|
181
|
-
return chartColors[param.dataIndex % 20];
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
153
|
var series = [];
|
|
185
154
|
|
|
186
155
|
if (chartType === 'bar') {
|
|
@@ -188,48 +157,29 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
188
157
|
}
|
|
189
158
|
|
|
190
159
|
if (!reverseXAxis) {
|
|
191
|
-
series =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (item.names) {
|
|
195
|
-
data = {
|
|
196
|
-
name: item.names.join('-'),
|
|
197
|
-
data: item.values
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return _objectSpread(_objectSpread(_objectSpread({}, data), seriesItem), {}, {
|
|
202
|
-
itemStyle: itemStyle,
|
|
160
|
+
series = data.series.map(function (item) {
|
|
161
|
+
return _objectSpread(_objectSpread(_objectSpread({}, item), seriesItem), {}, {
|
|
203
162
|
type: chartType
|
|
204
163
|
});
|
|
205
164
|
});
|
|
206
165
|
} else {
|
|
207
166
|
series = [_objectSpread(_objectSpread({
|
|
208
167
|
name: seriesName || '',
|
|
209
|
-
data:
|
|
168
|
+
data: data.series
|
|
210
169
|
}, seriesItem), {}, {
|
|
211
|
-
itemStyle: itemStyle,
|
|
212
170
|
type: chartType
|
|
213
171
|
})];
|
|
214
|
-
}
|
|
215
|
-
|
|
172
|
+
}
|
|
216
173
|
|
|
217
174
|
tooltip.axisPointer = tooltip.axisPointer || {};
|
|
218
175
|
tooltip.axisPointer.type = chartType === 'bar' ? 'shadow' : 'line';
|
|
219
|
-
|
|
220
|
-
if (tooltipFormatter) {
|
|
221
|
-
tooltip.formatter = tooltipFormatter;
|
|
222
|
-
} else {
|
|
223
|
-
tooltip.formatter = tooltipFormatterDefault;
|
|
224
|
-
} // grid config
|
|
225
|
-
|
|
176
|
+
tooltip.formatter = tooltipFormatter ? tooltipFormatter : tooltipFormatterDefault;
|
|
226
177
|
|
|
227
178
|
if (legendPosition === 'top') {
|
|
228
|
-
grid.top = series.length > 1 || series[0].name ? 45 : 10;
|
|
179
|
+
grid.top = series.length > 1 || series.length > 0 && series[0].name ? 45 : 10;
|
|
229
180
|
} else if (legendPosition === 'bottom') {
|
|
230
|
-
grid.bottom = series.length > 1 || series[0].name ? 45 : 0;
|
|
231
|
-
}
|
|
232
|
-
|
|
181
|
+
grid.bottom = series.length > 1 || series.length > 0 && series[0].name ? 45 : 0;
|
|
182
|
+
}
|
|
233
183
|
|
|
234
184
|
legend.top = legendPosition;
|
|
235
185
|
legend.orient = legendOrient;
|
|
@@ -241,6 +191,11 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
241
191
|
grid.left = 80;
|
|
242
192
|
}
|
|
243
193
|
|
|
194
|
+
if (chartType === 'line') {
|
|
195
|
+
legend.icon = 'circle';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
legend.formatter = legendFormatter ? legendFormatter : legendFormatterDefault;
|
|
244
199
|
return _objectSpread(_objectSpread({}, baseConfig), {}, {
|
|
245
200
|
legend: legend,
|
|
246
201
|
xAxis: xAxis,
|
|
@@ -250,15 +205,6 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
250
205
|
series: series
|
|
251
206
|
});
|
|
252
207
|
};
|
|
253
|
-
/**
|
|
254
|
-
* 饼图配置
|
|
255
|
-
* @param seriesData 数据 [{name:'',value:''}]
|
|
256
|
-
* @param legendPosition 图例位置
|
|
257
|
-
* @param legendOrient 图例方向
|
|
258
|
-
* @param tooltipFormatter tooltip 自定义显示
|
|
259
|
-
* @returns
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
208
|
export var getPieOption = function getPieOption() {
|
|
263
209
|
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
264
210
|
var legendPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
|
@@ -278,6 +224,7 @@ export var getPieOption = function getPieOption() {
|
|
|
278
224
|
|
|
279
225
|
legend.top = legendPosition;
|
|
280
226
|
legend.orient = legendOrient;
|
|
227
|
+
legend.icon = 'circle';
|
|
281
228
|
|
|
282
229
|
if (legendOrient === 'vertical') {
|
|
283
230
|
legend.left = 'left';
|
|
@@ -294,8 +241,8 @@ export var getPieOption = function getPieOption() {
|
|
|
294
241
|
tooltip.formatter = function (params) {
|
|
295
242
|
var name = params.name,
|
|
296
243
|
value = params.value,
|
|
297
|
-
|
|
298
|
-
return "<div class=\"biz-chart-tooltip-item\"
|
|
244
|
+
color = params.color;
|
|
245
|
+
return "<div class=\"biz-chart-tooltip-item\">\n <span class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(color, "\"></span>").concat(name, "\n </span> \n <span class=\"biz-chart-tooltip-value\">").concat(value, "</span>\n </div>");
|
|
299
246
|
};
|
|
300
247
|
}
|
|
301
248
|
|
|
@@ -306,15 +253,6 @@ export var getPieOption = function getPieOption() {
|
|
|
306
253
|
series: series
|
|
307
254
|
});
|
|
308
255
|
};
|
|
309
|
-
/**
|
|
310
|
-
* 地图
|
|
311
|
-
* @param seriesData 数据
|
|
312
|
-
* @param maxMinValue 最大最小值
|
|
313
|
-
* @param showVisualMap 是否显示
|
|
314
|
-
* @param tooltipFormat 提示formatter
|
|
315
|
-
* @returns option
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
256
|
export var getMapOption = function getMapOption() {
|
|
319
257
|
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
320
258
|
var maxMinValue = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -358,8 +296,7 @@ export var getMapOption = function getMapOption() {
|
|
|
358
296
|
inRange: {
|
|
359
297
|
color: ['lightskyblue', 'yellow', 'orangered']
|
|
360
298
|
},
|
|
361
|
-
show: showVisualMap
|
|
362
|
-
|
|
299
|
+
show: showVisualMap
|
|
363
300
|
},
|
|
364
301
|
toolbox: {
|
|
365
302
|
show: true,
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const formatPieData: (data:
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
}, showList?: any[] | undefined) => {
|
|
1
|
+
import { ChartTypes } from '../types';
|
|
2
|
+
export declare const formatPieData: (data: ChartTypes.Value, showAll?: boolean | undefined, showList?: any[] | undefined) => {
|
|
5
3
|
name: string;
|
|
6
4
|
value: number;
|
|
7
5
|
}[];
|
|
8
|
-
export declare const formatChartData: (data:
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
}, showList?: any[] | undefined) => {
|
|
6
|
+
export declare const formatChartData: (data: ChartTypes.Value, showAll?: boolean | undefined, showList?: any[] | undefined, reverseXAxis?: boolean | undefined, color?: string[] | undefined) => {
|
|
11
7
|
x_axis: string[];
|
|
12
8
|
series: any;
|
|
13
9
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import util from '../../utils/util';
|
|
1
2
|
import { chartColors } from './color';
|
|
2
|
-
export var formatPieData = function formatPieData(data, showAll,
|
|
3
|
+
export var formatPieData = function formatPieData(data, showAll, showList) {
|
|
4
|
+
var showMap = getShowMap(showList);
|
|
3
5
|
var list = [];
|
|
4
6
|
var other = {
|
|
5
7
|
name: '其它',
|
|
@@ -7,7 +9,7 @@ export var formatPieData = function formatPieData(data, showAll, showMap, showLi
|
|
|
7
9
|
};
|
|
8
10
|
data.series.forEach(function (item) {
|
|
9
11
|
var series = {
|
|
10
|
-
name: item.names.join('
|
|
12
|
+
name: item.names.join(','),
|
|
11
13
|
value: item.values[0]
|
|
12
14
|
};
|
|
13
15
|
|
|
@@ -15,7 +17,6 @@ export var formatPieData = function formatPieData(data, showAll, showMap, showLi
|
|
|
15
17
|
list.push(series);
|
|
16
18
|
} else {
|
|
17
19
|
if (showList && showMap[series.name] || !showList && list.length < 10) {
|
|
18
|
-
// 数据被showList命中,或者没定义showList,但位于前十的记录
|
|
19
20
|
list.push(series);
|
|
20
21
|
} else {
|
|
21
22
|
other.value += item.values[0];
|
|
@@ -25,32 +26,52 @@ export var formatPieData = function formatPieData(data, showAll, showMap, showLi
|
|
|
25
26
|
if (!showAll && other.value > 0) list.push(other);
|
|
26
27
|
return list;
|
|
27
28
|
};
|
|
28
|
-
export var formatChartData = function formatChartData(data,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
export var formatChartData = function formatChartData(data, showAll, showList, reverseXAxis, color) {
|
|
30
|
+
var showMap = getShowMap(showList);
|
|
31
|
+
var x_axis = reverseXAxis ? [] : data.x_axis;
|
|
32
|
+
var sData = [];
|
|
33
|
+
var colorData = color || chartColors;
|
|
34
|
+
data.series.forEach(function (seriesItem) {
|
|
35
|
+
var name = seriesItem.names.join(',');
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
if (showAll || showList && showMap[name] || !showList && sData.length < 10) {
|
|
38
|
+
if (reverseXAxis) {
|
|
39
|
+
x_axis.push(name);
|
|
40
|
+
sData.push({
|
|
41
|
+
name: name,
|
|
42
|
+
value: seriesItem.values[0],
|
|
43
|
+
itemStyle: {
|
|
44
|
+
normal: {
|
|
45
|
+
color: colorData[sData.length]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
sData.push({
|
|
51
|
+
name: name,
|
|
52
|
+
data: seriesItem.values
|
|
53
|
+
});
|
|
37
54
|
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
x_axis: x_axis,
|
|
59
|
+
series: sData
|
|
60
|
+
};
|
|
61
|
+
};
|
|
38
62
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
var getShowMap = function getShowMap(showList) {
|
|
64
|
+
var data = {};
|
|
65
|
+
|
|
66
|
+
if (showList) {
|
|
67
|
+
showList.forEach(function (item) {
|
|
68
|
+
if (util.isArray(item)) {
|
|
69
|
+
data[item.join(',')] = true;
|
|
70
|
+
} else if (util.isString(item)) {
|
|
71
|
+
data[item] = true;
|
|
72
|
+
}
|
|
48
73
|
});
|
|
49
|
-
return {
|
|
50
|
-
x_axis: x_axis,
|
|
51
|
-
series: sData
|
|
52
|
-
};
|
|
53
|
-
} else {
|
|
54
|
-
return data;
|
|
55
74
|
}
|
|
75
|
+
|
|
76
|
+
return data;
|
|
56
77
|
};
|