@zgfe/business-lib 1.0.0-beta.6 → 1.0.3
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 +38 -48
- package/es/analysisLayout/index.less +1 -1
- 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 +168 -0
- package/es/attrConditions/components/valuesList.d.ts +10 -0
- package/es/attrConditions/components/valuesList.js +188 -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 +183 -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/attributeSelector/demo/index.d.ts +3 -0
- package/es/attributeSelector/demo/{singleForm.js → index.js} +42 -44
- package/es/attributeSelector/index.d.ts +4 -111
- package/es/attributeSelector/index.js +88 -543
- package/es/attributeSelector/listPanel.d.ts +4 -0
- package/es/attributeSelector/listPanel.js +208 -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/pie.js +1 -0
- package/es/chart/index.d.ts +2 -96
- package/es/chart/index.js +28 -35
- 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} +45 -111
- 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 +116 -112
- package/es/commonStyle/select.less +1 -1
- package/es/commonStyle/theme.less +520 -473
- package/es/components/iconFont.js +4 -2
- 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 +10 -0
- package/es/dialog/components/itemNode.js +109 -0
- package/es/dialog/components/list.d.ts +3 -13
- package/es/dialog/components/list.js +15 -12
- package/es/dialog/components/selectToInput.d.ts +4 -48
- package/es/dialog/components/selectToInput.js +74 -80
- 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 +34 -3
- package/es/dialog/demo/index2.js +14 -2
- package/es/dialog/index.d.ts +4 -97
- package/es/dialog/index.js +54 -109
- 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 -30
- package/es/eventSelector/index.js +90 -416
- package/es/eventSelector/listPanel.d.ts +4 -0
- package/es/eventSelector/listPanel.js +197 -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 +14 -11
- package/es/index.js +9 -11
- 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/{multipleSelector → searchInput}/demo/index.d.ts +0 -0
- package/es/searchInput/demo/index.js +5 -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 -49
- package/es/select/index.js +168 -122
- 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/index3.js +9 -18
- package/es/table/index.d.ts +4 -30
- package/es/table/index.js +30 -26
- 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 +1 -0
- package/es/targetConditionGroup/demo/group.js +108 -23
- package/es/targetConditionGroup/demo/index.js +34 -34
- package/es/targetConditionGroup/demo/styles/index.less +29 -0
- package/es/targetConditionGroup/index.d.ts +4 -57
- package/es/targetConditionGroup/index.js +177 -274
- 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 -55
- package/es/targetSelector/index.js +103 -214
- 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/userCondition/conditionTypeList.d.ts +10 -0
- package/es/userCondition/conditionTypeList.js +43 -0
- package/es/userCondition/conditionWrap.d.ts +7 -0
- package/es/userCondition/conditionWrap.js +18 -0
- package/es/userCondition/conditions/eventCondition.d.ts +8 -0
- package/es/userCondition/conditions/eventCondition.js +104 -0
- package/es/userCondition/conditions/periodCondition.d.ts +11 -0
- package/es/userCondition/conditions/periodCondition.js +156 -0
- package/es/userCondition/conditions/propCondition.d.ts +11 -0
- package/es/userCondition/conditions/propCondition.js +147 -0
- package/es/userCondition/conditions/runTimesCondition.d.ts +9 -0
- package/es/userCondition/conditions/runTimesCondition.js +78 -0
- package/es/userCondition/conditions/styles/eventCondition.less +49 -0
- package/es/userCondition/conditions/styles/periodCondition.less +14 -0
- package/es/userCondition/conditions/styles/propCondition.less +36 -0
- package/es/userCondition/conditions/styles/runTimesCondition.less +16 -0
- package/es/{attributeSelector/demo/singleForm.d.ts → userCondition/demo/index.d.ts} +0 -0
- package/es/userCondition/demo/index.js +97 -0
- package/es/userCondition/index.d.ts +7 -0
- package/es/userCondition/index.js +146 -0
- package/es/userCondition/orConditions.d.ts +5 -0
- package/es/userCondition/orConditions.js +202 -0
- package/es/userCondition/relationLabel.d.ts +6 -0
- package/es/userCondition/relationLabel.js +12 -0
- package/es/userCondition/styles/conditionTypeList.less +31 -0
- package/es/userCondition/styles/conditionWrap.less +14 -0
- package/es/userCondition/styles/index.less +13 -0
- package/es/userCondition/styles/orConditions.less +16 -0
- package/es/userCondition/styles/relationLabel.less +18 -0
- package/es/userCondition/types.d.ts +79 -0
- package/es/userCondition/types.js +1 -0
- package/es/userCondition/util.d.ts +2 -0
- package/es/userCondition/util.js +54 -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 +60 -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 -86
- 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 -47
- package/es/globalAttributes/index.js +0 -112
- package/es/multipleSelector/index.d.ts +0 -36
- package/es/multipleSelector/index.js +0 -131
- 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 -112
- package/es/targetConditionGroup/components/conditionItem.d.ts +0 -47
- package/es/targetConditionGroup/components/conditionItem.js +0 -232
- 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/group.d.ts +0 -56
- package/es/targetConditionGroup/group.js +0 -204
- package/es/targetConditionGroup/index.less +0 -76
- package/es/targetConditionGroup/type.d.ts +0 -95
- 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,14 +16,13 @@ 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,
|
|
@@ -31,22 +30,17 @@ var BizChart = function BizChart(props) {
|
|
|
31
30
|
showList = props.showList,
|
|
32
31
|
option = props.option,
|
|
33
32
|
userGroup = props.userGroup,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
reverseXAxis = _props$reverseXAxis === void 0 ? false : _props$reverseXAxis,
|
|
40
|
-
_props$isCity = props.isCity,
|
|
41
|
-
isCity = _props$isCity === void 0 ? true : _props$isCity,
|
|
42
|
-
_props$xRotate = props.xRotate,
|
|
43
|
-
xRotate = _props$xRotate === void 0 ? 0 : _props$xRotate,
|
|
44
|
-
_props$yRotate = props.yRotate,
|
|
45
|
-
yRotate = _props$yRotate === void 0 ? 0 : _props$yRotate,
|
|
33
|
+
showAll = props.showAll,
|
|
34
|
+
reverseXAxis = props.reverseXAxis,
|
|
35
|
+
isCity = props.isCity,
|
|
36
|
+
xRotate = props.xRotate,
|
|
37
|
+
yRotate = props.yRotate,
|
|
46
38
|
seriesName = props.seriesName,
|
|
39
|
+
colors = props.colors,
|
|
47
40
|
tooltipFormatter = props.tooltipFormatter,
|
|
48
41
|
xAxisFormatter = props.xAxisFormatter,
|
|
49
42
|
yAxisFormatter = props.yAxisFormatter,
|
|
43
|
+
legendFormatter = props.legendFormatter,
|
|
50
44
|
valueUnit = props.valueUnit,
|
|
51
45
|
legendPosition = props.legendPosition,
|
|
52
46
|
legendOrient = props.legendOrient;
|
|
@@ -56,21 +50,6 @@ var BizChart = function BizChart(props) {
|
|
|
56
50
|
chartOption = _useState2[0],
|
|
57
51
|
setChartOption = _useState2[1];
|
|
58
52
|
|
|
59
|
-
var showMap = useMemo(function () {
|
|
60
|
-
var data = {};
|
|
61
|
-
|
|
62
|
-
if (showList) {
|
|
63
|
-
showList.forEach(function (item) {
|
|
64
|
-
if (util.isArray(item)) {
|
|
65
|
-
data[item.join('-')] = true;
|
|
66
|
-
} else if (util.isString(item)) {
|
|
67
|
-
data[item] = true;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return data;
|
|
73
|
-
}, [showList]);
|
|
74
53
|
useEffect(function () {
|
|
75
54
|
if (option) {
|
|
76
55
|
setChartOption(function () {
|
|
@@ -82,12 +61,12 @@ var BizChart = function BizChart(props) {
|
|
|
82
61
|
var eOption = {};
|
|
83
62
|
|
|
84
63
|
if (type === 'pie') {
|
|
85
|
-
var rData = formatPieData(data, showAll,
|
|
64
|
+
var rData = formatPieData(data, showAll, showList);
|
|
86
65
|
eOption = getPieOption(rData, legendPosition, legendOrient, tooltipFormatter);
|
|
87
66
|
} else if (type === 'line' || type === 'bar') {
|
|
88
|
-
var _rData = formatChartData(data,
|
|
67
|
+
var _rData = formatChartData(data, showAll, showList, reverseXAxis, colors);
|
|
89
68
|
|
|
90
|
-
eOption = getChartOption(type,
|
|
69
|
+
eOption = getChartOption(type, _rData, legendPosition, legendOrient, valueUnit, xRotate, yRotate, tooltipFormatter, xAxisFormatter, yAxisFormatter, legendFormatter, reverseXAxis, seriesName);
|
|
91
70
|
} else if (type === 'map') {
|
|
92
71
|
var series = isCity ? citySeries(data, !!userGroup) : provinceSeries(data, !!userGroup);
|
|
93
72
|
var maxMin = maxMinValue(series[0]);
|
|
@@ -95,17 +74,31 @@ var BizChart = function BizChart(props) {
|
|
|
95
74
|
eOption = getMapOption(series, maxMin, showVisualMap, tooltipFormatter);
|
|
96
75
|
}
|
|
97
76
|
|
|
77
|
+
if (colors) {
|
|
78
|
+
eOption.color = colors;
|
|
79
|
+
}
|
|
80
|
+
|
|
98
81
|
setChartOption(function () {
|
|
99
82
|
return _objectSpread({}, eOption);
|
|
100
83
|
});
|
|
101
|
-
}, [
|
|
84
|
+
}, [data, showAll, showList, reverseXAxis]);
|
|
102
85
|
return /*#__PURE__*/React.createElement(ReactEChartsCore, {
|
|
103
86
|
echarts: echarts,
|
|
104
87
|
option: chartOption,
|
|
105
88
|
notMerge: true,
|
|
106
89
|
lazyUpdate: true,
|
|
107
|
-
theme: 'theme_name'
|
|
90
|
+
theme: 'theme_name',
|
|
91
|
+
style: {
|
|
92
|
+
width: '100%'
|
|
93
|
+
}
|
|
108
94
|
});
|
|
109
95
|
};
|
|
110
96
|
|
|
97
|
+
BizChart.defaultProps = {
|
|
98
|
+
showAll: false,
|
|
99
|
+
reverseXAxis: false,
|
|
100
|
+
isCity: true,
|
|
101
|
+
xRotate: 0,
|
|
102
|
+
yRotate: 0
|
|
103
|
+
};
|
|
111
104
|
export default BizChart;
|
|
@@ -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, xRotate?: number, yRotate?: number, 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,47 +101,28 @@ export var tooltipConfig = {
|
|
|
109
101
|
}
|
|
110
102
|
}
|
|
111
103
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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;
|
|
135
|
-
var xRotate = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
|
|
136
|
-
var yRotate = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
|
|
137
|
-
var tooltipFormatter = arguments.length > 9 ? arguments[9] : undefined;
|
|
138
|
-
var xAxisFormatter = arguments.length > 10 ? arguments[10] : undefined;
|
|
139
|
-
var yAxisFormatter = arguments.length > 11 ? arguments[11] : undefined;
|
|
140
|
-
var reverseXAxis = arguments.length > 12 ? arguments[12] : undefined;
|
|
141
|
-
var seriesName = arguments.length > 13 ? arguments[13] : 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;
|
|
110
|
+
var tooltipFormatter = arguments.length > 7 ? arguments[7] : undefined;
|
|
111
|
+
var xAxisFormatter = arguments.length > 8 ? arguments[8] : undefined;
|
|
112
|
+
var yAxisFormatter = arguments.length > 9 ? arguments[9] : undefined;
|
|
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;
|
|
142
116
|
|
|
143
117
|
var xAxis = JSON.parse(JSON.stringify(xAxisConfig)),
|
|
144
118
|
tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
|
|
145
119
|
yAxis = _objectSpread({}, yAxisConfig),
|
|
146
120
|
legend = _objectSpread({}, legendConfig),
|
|
147
121
|
grid = _objectSpread({}, gridConfig),
|
|
148
|
-
seriesItem = _objectSpread({}, seriesConfig);
|
|
149
|
-
|
|
122
|
+
seriesItem = _objectSpread({}, seriesConfig);
|
|
150
123
|
|
|
151
|
-
if (
|
|
152
|
-
xAxis.data =
|
|
124
|
+
if (data.x_axis) {
|
|
125
|
+
xAxis.data = data.x_axis;
|
|
153
126
|
}
|
|
154
127
|
|
|
155
128
|
xAxis.boundaryGap = chartType === 'bar';
|
|
@@ -162,8 +135,7 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
162
135
|
xAxis.axisLabel.formatter = xAxisFormatter;
|
|
163
136
|
} else {
|
|
164
137
|
xAxis.axisLabel.formatter = xAxisFormatterDefault;
|
|
165
|
-
}
|
|
166
|
-
|
|
138
|
+
}
|
|
167
139
|
|
|
168
140
|
yAxis.axisLabel = yAxis.axisLabel || {};
|
|
169
141
|
yAxis.axisLabel.rotate = yRotate;
|
|
@@ -176,14 +148,8 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
176
148
|
|
|
177
149
|
if (unit) {
|
|
178
150
|
yAxis.name = unit;
|
|
179
|
-
}
|
|
180
|
-
|
|
151
|
+
}
|
|
181
152
|
|
|
182
|
-
var itemStyle = {
|
|
183
|
-
color: sameColor ? 'auto' : function (param) {
|
|
184
|
-
return chartColors[param.dataIndex % 20];
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
153
|
var series = [];
|
|
188
154
|
|
|
189
155
|
if (chartType === 'bar') {
|
|
@@ -191,48 +157,29 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
191
157
|
}
|
|
192
158
|
|
|
193
159
|
if (!reverseXAxis) {
|
|
194
|
-
series =
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (item.names) {
|
|
198
|
-
data = {
|
|
199
|
-
name: item.names.join('-'),
|
|
200
|
-
data: item.values
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return _objectSpread(_objectSpread(_objectSpread({}, data), seriesItem), {}, {
|
|
205
|
-
itemStyle: itemStyle,
|
|
160
|
+
series = data.series.map(function (item) {
|
|
161
|
+
return _objectSpread(_objectSpread(_objectSpread({}, item), seriesItem), {}, {
|
|
206
162
|
type: chartType
|
|
207
163
|
});
|
|
208
164
|
});
|
|
209
165
|
} else {
|
|
210
166
|
series = [_objectSpread(_objectSpread({
|
|
211
167
|
name: seriesName || '',
|
|
212
|
-
data:
|
|
168
|
+
data: data.series
|
|
213
169
|
}, seriesItem), {}, {
|
|
214
|
-
itemStyle: itemStyle,
|
|
215
170
|
type: chartType
|
|
216
171
|
})];
|
|
217
|
-
}
|
|
218
|
-
|
|
172
|
+
}
|
|
219
173
|
|
|
220
174
|
tooltip.axisPointer = tooltip.axisPointer || {};
|
|
221
175
|
tooltip.axisPointer.type = chartType === 'bar' ? 'shadow' : 'line';
|
|
222
|
-
|
|
223
|
-
if (tooltipFormatter) {
|
|
224
|
-
tooltip.formatter = tooltipFormatter;
|
|
225
|
-
} else {
|
|
226
|
-
tooltip.formatter = tooltipFormatterDefault;
|
|
227
|
-
} // grid config
|
|
228
|
-
|
|
176
|
+
tooltip.formatter = tooltipFormatter ? tooltipFormatter : tooltipFormatterDefault;
|
|
229
177
|
|
|
230
178
|
if (legendPosition === 'top') {
|
|
231
179
|
grid.top = series.length > 1 || series.length > 0 && series[0].name ? 45 : 10;
|
|
232
180
|
} else if (legendPosition === 'bottom') {
|
|
233
181
|
grid.bottom = series.length > 1 || series.length > 0 && series[0].name ? 45 : 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
182
|
+
}
|
|
236
183
|
|
|
237
184
|
legend.top = legendPosition;
|
|
238
185
|
legend.orient = legendOrient;
|
|
@@ -244,6 +191,11 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
244
191
|
grid.left = 80;
|
|
245
192
|
}
|
|
246
193
|
|
|
194
|
+
if (chartType === 'line') {
|
|
195
|
+
legend.icon = 'circle';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
legend.formatter = legendFormatter ? legendFormatter : legendFormatterDefault;
|
|
247
199
|
return _objectSpread(_objectSpread({}, baseConfig), {}, {
|
|
248
200
|
legend: legend,
|
|
249
201
|
xAxis: xAxis,
|
|
@@ -253,15 +205,6 @@ export var getChartOption = function getChartOption(chartType, xData) {
|
|
|
253
205
|
series: series
|
|
254
206
|
});
|
|
255
207
|
};
|
|
256
|
-
/**
|
|
257
|
-
* 饼图配置
|
|
258
|
-
* @param seriesData 数据 [{name:'',value:''}]
|
|
259
|
-
* @param legendPosition 图例位置
|
|
260
|
-
* @param legendOrient 图例方向
|
|
261
|
-
* @param tooltipFormatter tooltip 自定义显示
|
|
262
|
-
* @returns
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
208
|
export var getPieOption = function getPieOption() {
|
|
266
209
|
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
267
210
|
var legendPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
|
@@ -281,6 +224,7 @@ export var getPieOption = function getPieOption() {
|
|
|
281
224
|
|
|
282
225
|
legend.top = legendPosition;
|
|
283
226
|
legend.orient = legendOrient;
|
|
227
|
+
legend.icon = 'circle';
|
|
284
228
|
|
|
285
229
|
if (legendOrient === 'vertical') {
|
|
286
230
|
legend.left = 'left';
|
|
@@ -297,8 +241,8 @@ export var getPieOption = function getPieOption() {
|
|
|
297
241
|
tooltip.formatter = function (params) {
|
|
298
242
|
var name = params.name,
|
|
299
243
|
value = params.value,
|
|
300
|
-
|
|
301
|
-
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>");
|
|
302
246
|
};
|
|
303
247
|
}
|
|
304
248
|
|
|
@@ -309,15 +253,6 @@ export var getPieOption = function getPieOption() {
|
|
|
309
253
|
series: series
|
|
310
254
|
});
|
|
311
255
|
};
|
|
312
|
-
/**
|
|
313
|
-
* 地图
|
|
314
|
-
* @param seriesData 数据
|
|
315
|
-
* @param maxMinValue 最大最小值
|
|
316
|
-
* @param showVisualMap 是否显示
|
|
317
|
-
* @param tooltipFormat 提示formatter
|
|
318
|
-
* @returns option
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
256
|
export var getMapOption = function getMapOption() {
|
|
322
257
|
var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
323
258
|
var maxMinValue = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -361,8 +296,7 @@ export var getMapOption = function getMapOption() {
|
|
|
361
296
|
inRange: {
|
|
362
297
|
color: ['lightskyblue', 'yellow', 'orangered']
|
|
363
298
|
},
|
|
364
|
-
show: showVisualMap
|
|
365
|
-
|
|
299
|
+
show: showVisualMap
|
|
366
300
|
},
|
|
367
301
|
toolbox: {
|
|
368
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
|
};
|