onesight-charts 0.0.1
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/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/components/line/demo.js +13 -0
- package/dist/components/line/index.js +294 -0
- package/dist/components/line/style.scss +110 -0
- package/dist/components/line/tooltipConfig.js +93 -0
- package/dist/components/one-table/demo/line-chart.js +908 -0
- package/dist/components/one-table/index.js +128 -0
- package/dist/components/one-table/index.scss +5 -0
- package/dist/components/pie/index.js +94 -0
- package/dist/components/pie/index.scss +5 -0
- package/dist/components/tooltip/demo/line-chart.js +908 -0
- package/dist/components/tooltip/index.js +128 -0
- package/dist/components/tooltip/index.scss +5 -0
- package/dist/index.js +1 -0
- package/dist/umd/onesight-charts.min.css +1 -0
- package/dist/umd/onesight-charts.min.js +1 -0
- package/dist/utils/chartUtils.js +215 -0
- package/dist/utils/colors.js +26 -0
- package/lib/components/line/demo.js +42 -0
- package/lib/components/line/index.js +307 -0
- package/lib/components/line/style.scss +110 -0
- package/lib/components/line/tooltipConfig.js +144 -0
- package/lib/components/one-table/demo/line-chart.js +1020 -0
- package/lib/components/one-table/index.js +156 -0
- package/lib/components/one-table/index.scss +5 -0
- package/lib/components/pie/index.js +131 -0
- package/lib/components/pie/index.scss +5 -0
- package/lib/components/tooltip/demo/line-chart.js +1020 -0
- package/lib/components/tooltip/index.js +156 -0
- package/lib/components/tooltip/index.scss +5 -0
- package/lib/index.js +39 -0
- package/lib/utils/chartUtils.js +226 -0
- package/lib/utils/colors.js +71 -0
- package/package.json +82 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import ReactECharts from 'echarts-for-react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var LineChart = function LineChart(_ref) {
|
|
4
|
+
var data = _ref.data;
|
|
5
|
+
var getOption = function getOption() {
|
|
6
|
+
return {
|
|
7
|
+
legend: {
|
|
8
|
+
// data: legendData,
|
|
9
|
+
x: 'center',
|
|
10
|
+
type: 'plain',
|
|
11
|
+
bottom: 0,
|
|
12
|
+
padding: 0,
|
|
13
|
+
left: 'center',
|
|
14
|
+
icon: 'rect',
|
|
15
|
+
itemWidth: 16,
|
|
16
|
+
itemHeight: 4,
|
|
17
|
+
itemGap: 8,
|
|
18
|
+
// formatter: function (name) {
|
|
19
|
+
// let value = legendCustom
|
|
20
|
+
// ? handleCompareSeries(name, series)
|
|
21
|
+
// : handleSeries(name, series);
|
|
22
|
+
// let showName = name;
|
|
23
|
+
// if (series.length >= 4) {
|
|
24
|
+
// const strLen = 15;
|
|
25
|
+
// if (name.length > strLen) {
|
|
26
|
+
// showName = name.substring(0, strLen) + '...';
|
|
27
|
+
// }
|
|
28
|
+
// }
|
|
29
|
+
// return isTranslation
|
|
30
|
+
// ? `{labelName|${formatMessage({
|
|
31
|
+
// id: `listening_${name}`,
|
|
32
|
+
// })} }\n{labelMark|${value}}`
|
|
33
|
+
// : legendCustom
|
|
34
|
+
// ? `{labelName|${showName}}\n{labelMark|${value}}`
|
|
35
|
+
// : `${name}`;
|
|
36
|
+
// },
|
|
37
|
+
textStyle: {
|
|
38
|
+
fontWeight: 500,
|
|
39
|
+
fontSize: 12,
|
|
40
|
+
color: '#364141',
|
|
41
|
+
lineHeight: 6,
|
|
42
|
+
rich: {
|
|
43
|
+
// 给labelName添加样式
|
|
44
|
+
labelName: {
|
|
45
|
+
fontWeight: 500,
|
|
46
|
+
fontSize: 12,
|
|
47
|
+
padding: [6, 6, 0, 0]
|
|
48
|
+
},
|
|
49
|
+
// 给labelMark添加样式
|
|
50
|
+
labelMark: {
|
|
51
|
+
color: '#7A8283',
|
|
52
|
+
fontSize: 12,
|
|
53
|
+
padding: [30, 0, 0, 0]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
tooltip: {
|
|
59
|
+
trigger: 'axis'
|
|
60
|
+
},
|
|
61
|
+
xAxis: {
|
|
62
|
+
type: 'category',
|
|
63
|
+
axisLine: {
|
|
64
|
+
lineStyle: {
|
|
65
|
+
color: '#e5e5e5'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
axisTick: {
|
|
69
|
+
show: true,
|
|
70
|
+
alignWithLabel: true,
|
|
71
|
+
length: 5
|
|
72
|
+
},
|
|
73
|
+
axisLabel: {
|
|
74
|
+
// formatter: function (value, index) {
|
|
75
|
+
// return xAxisType === 'date'
|
|
76
|
+
// ? formatDateXaxis(value)
|
|
77
|
+
// : formatMessage({ id: `listening_${value}` });
|
|
78
|
+
// },
|
|
79
|
+
interval: 'auto',
|
|
80
|
+
margin: 12,
|
|
81
|
+
color: '#515E5F',
|
|
82
|
+
fontWeight: 500,
|
|
83
|
+
fontSize: 12,
|
|
84
|
+
lineHeight: 20
|
|
85
|
+
},
|
|
86
|
+
splitLine: {
|
|
87
|
+
show: false,
|
|
88
|
+
interval: 0
|
|
89
|
+
},
|
|
90
|
+
boundaryGap: false
|
|
91
|
+
// data: xAxisData,
|
|
92
|
+
},
|
|
93
|
+
yAxis: {
|
|
94
|
+
type: 'value',
|
|
95
|
+
minInterval: 1,
|
|
96
|
+
axisLabel: {
|
|
97
|
+
// formatter: function (value) {
|
|
98
|
+
// let formatted = customize.numberFormatNull(value);
|
|
99
|
+
// if (formatted.length < 4) {
|
|
100
|
+
// // 假设最大长度为4
|
|
101
|
+
// formatted = ' ' + formatted; // 在前面添加空格
|
|
102
|
+
// }
|
|
103
|
+
// return formatted;
|
|
104
|
+
// },
|
|
105
|
+
margin: 14,
|
|
106
|
+
color: '#515E5F',
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
lineHeight: 20
|
|
109
|
+
},
|
|
110
|
+
splitLine: {
|
|
111
|
+
lineStyle: {
|
|
112
|
+
type: 'dashed',
|
|
113
|
+
color: '#E5E5E5'
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
series: data,
|
|
118
|
+
animation: true
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
return /*#__PURE__*/React.createElement(ReactECharts, {
|
|
122
|
+
option: getOption(),
|
|
123
|
+
style: {
|
|
124
|
+
height: 400
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
export default LineChart;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as line } from "./components/line";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.onesight-line-tooltip{border-color:#ddd;border-radius:8px;box-shadow:0 6px 20px 0 rgba(0,0,0,.13);min-width:280px;padding:0}.onesight-line-tooltip .tooltip-wrap{position:relative}.onesight-line-tooltip .tooltip-head{border-bottom:1px solid #eee;color:#364141;font-size:15px;font-weight:700;line-height:22px;overflow:hidden;padding:10px 16px;text-overflow:ellipsis;white-space:nowrap}.onesight-line-tooltip .tooltip-body{max-height:213.64px;overflow-y:auto;padding:0 0 0 8px}.onesight-line-tooltip .tooltip-body .total{color:#364141;font-weight:600;padding:14px 8px 2px}.onesight-line-tooltip .tooltip-body .item,.onesight-line-tooltip .tooltip-body .total{align-items:center;display:flex;font-size:14px;justify-content:space-between;line-height:20px}.onesight-line-tooltip .tooltip-body .item{border-radius:6px;color:#515e5f;cursor:pointer;font-weight:400;height:32px;margin-right:1px;margin-top:8px;padding:0 8px}.onesight-line-tooltip .tooltip-body .item .l{flex-basis:auto;flex-grow:1;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.onesight-line-tooltip .tooltip-body .item .l-color{display:inline-block;height:4px;margin-bottom:3px;margin-left:2px;margin-right:6px;vertical-align:middle;width:16px}.onesight-line-tooltip .tooltip-body .item .r{flex-grow:0;flex-shrink:0;padding-left:6px;white-space:nowrap}.onesight-line-tooltip .tooltip-body .item .r .num{font-weight:700;vertical-align:baseline}.onesight-line-tooltip .tooltip-body .item:last-child{border-bottom:none;margin-bottom:8px}.onesight-line-tooltip .tooltip-body .item:only-child{line-height:32px}.onesight-line-tooltip .tooltip-body .item:hover{background:#f3f4f4}.onesight-line-tooltip .triangle-down{background:transparent;bottom:-12px;height:12px;left:50%;position:absolute;transform:translateX(-50%);width:280px}.onesight-line-tooltip .triangle-down:after{border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fff;content:"";filter:drop-shadow(0 1px 0 #dddddd);height:0;left:50%;position:absolute;transform:translateX(-50%);width:0}
|