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,156 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/one-table/index.jsx
|
|
30
|
+
var one_table_exports = {};
|
|
31
|
+
__export(one_table_exports, {
|
|
32
|
+
default: () => one_table_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(one_table_exports);
|
|
35
|
+
var import_echarts_for_react = __toESM(require("echarts-for-react"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var LineChart = ({ data }) => {
|
|
38
|
+
const getOption = () => {
|
|
39
|
+
return {
|
|
40
|
+
legend: {
|
|
41
|
+
// data: legendData,
|
|
42
|
+
x: "center",
|
|
43
|
+
type: "plain",
|
|
44
|
+
bottom: 0,
|
|
45
|
+
padding: 0,
|
|
46
|
+
left: "center",
|
|
47
|
+
icon: "rect",
|
|
48
|
+
itemWidth: 16,
|
|
49
|
+
itemHeight: 4,
|
|
50
|
+
itemGap: 8,
|
|
51
|
+
// formatter: function (name) {
|
|
52
|
+
// let value = legendCustom
|
|
53
|
+
// ? handleCompareSeries(name, series)
|
|
54
|
+
// : handleSeries(name, series);
|
|
55
|
+
// let showName = name;
|
|
56
|
+
// if (series.length >= 4) {
|
|
57
|
+
// const strLen = 15;
|
|
58
|
+
// if (name.length > strLen) {
|
|
59
|
+
// showName = name.substring(0, strLen) + '...';
|
|
60
|
+
// }
|
|
61
|
+
// }
|
|
62
|
+
// return isTranslation
|
|
63
|
+
// ? `{labelName|${formatMessage({
|
|
64
|
+
// id: `listening_${name}`,
|
|
65
|
+
// })} }\n{labelMark|${value}}`
|
|
66
|
+
// : legendCustom
|
|
67
|
+
// ? `{labelName|${showName}}\n{labelMark|${value}}`
|
|
68
|
+
// : `${name}`;
|
|
69
|
+
// },
|
|
70
|
+
textStyle: {
|
|
71
|
+
fontWeight: 500,
|
|
72
|
+
fontSize: 12,
|
|
73
|
+
color: "#364141",
|
|
74
|
+
lineHeight: 6,
|
|
75
|
+
rich: {
|
|
76
|
+
// 给labelName添加样式
|
|
77
|
+
labelName: {
|
|
78
|
+
fontWeight: 500,
|
|
79
|
+
fontSize: 12,
|
|
80
|
+
padding: [6, 6, 0, 0]
|
|
81
|
+
},
|
|
82
|
+
// 给labelMark添加样式
|
|
83
|
+
labelMark: {
|
|
84
|
+
color: "#7A8283",
|
|
85
|
+
fontSize: 12,
|
|
86
|
+
padding: [30, 0, 0, 0]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
tooltip: {
|
|
92
|
+
trigger: "axis"
|
|
93
|
+
},
|
|
94
|
+
xAxis: {
|
|
95
|
+
type: "category",
|
|
96
|
+
axisLine: {
|
|
97
|
+
lineStyle: {
|
|
98
|
+
color: "#e5e5e5"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
axisTick: {
|
|
102
|
+
show: true,
|
|
103
|
+
alignWithLabel: true,
|
|
104
|
+
length: 5
|
|
105
|
+
},
|
|
106
|
+
axisLabel: {
|
|
107
|
+
// formatter: function (value, index) {
|
|
108
|
+
// return xAxisType === 'date'
|
|
109
|
+
// ? formatDateXaxis(value)
|
|
110
|
+
// : formatMessage({ id: `listening_${value}` });
|
|
111
|
+
// },
|
|
112
|
+
interval: "auto",
|
|
113
|
+
margin: 12,
|
|
114
|
+
color: "#515E5F",
|
|
115
|
+
fontWeight: 500,
|
|
116
|
+
fontSize: 12,
|
|
117
|
+
lineHeight: 20
|
|
118
|
+
},
|
|
119
|
+
splitLine: {
|
|
120
|
+
show: false,
|
|
121
|
+
interval: 0
|
|
122
|
+
},
|
|
123
|
+
boundaryGap: false
|
|
124
|
+
// data: xAxisData,
|
|
125
|
+
},
|
|
126
|
+
yAxis: {
|
|
127
|
+
type: "value",
|
|
128
|
+
minInterval: 1,
|
|
129
|
+
axisLabel: {
|
|
130
|
+
// formatter: function (value) {
|
|
131
|
+
// let formatted = customize.numberFormatNull(value);
|
|
132
|
+
// if (formatted.length < 4) {
|
|
133
|
+
// // 假设最大长度为4
|
|
134
|
+
// formatted = ' ' + formatted; // 在前面添加空格
|
|
135
|
+
// }
|
|
136
|
+
// return formatted;
|
|
137
|
+
// },
|
|
138
|
+
margin: 14,
|
|
139
|
+
color: "#515E5F",
|
|
140
|
+
fontSize: 12,
|
|
141
|
+
lineHeight: 20
|
|
142
|
+
},
|
|
143
|
+
splitLine: {
|
|
144
|
+
lineStyle: {
|
|
145
|
+
type: "dashed",
|
|
146
|
+
color: "#E5E5E5"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
series: data,
|
|
151
|
+
animation: true
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
return /* @__PURE__ */ import_react.default.createElement(import_echarts_for_react.default, { option: getOption(), style: { height: 400 } });
|
|
155
|
+
};
|
|
156
|
+
var one_table_default = LineChart;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pie/index.jsx
|
|
30
|
+
var pie_exports = {};
|
|
31
|
+
__export(pie_exports, {
|
|
32
|
+
default: () => Pie
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(pie_exports);
|
|
35
|
+
var echarts = __toESM(require("echarts"));
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_index = require("./index.scss");
|
|
38
|
+
function Pie() {
|
|
39
|
+
const chartID = "chart-pie";
|
|
40
|
+
(0, import_react.useEffect)(() => {
|
|
41
|
+
ceartChart();
|
|
42
|
+
}, []);
|
|
43
|
+
const ceartChart = () => {
|
|
44
|
+
let myChart = echarts.init(document.getElementById(chartID), null, {
|
|
45
|
+
renderer: "svg"
|
|
46
|
+
});
|
|
47
|
+
let option = {
|
|
48
|
+
tooltip: {
|
|
49
|
+
show: false,
|
|
50
|
+
className: "pie-tooltip",
|
|
51
|
+
trigger: "item",
|
|
52
|
+
padding: 0
|
|
53
|
+
},
|
|
54
|
+
series: [
|
|
55
|
+
{
|
|
56
|
+
type: "pie",
|
|
57
|
+
radius: [70, 95],
|
|
58
|
+
itemStyle: {
|
|
59
|
+
borderColor: "#fff",
|
|
60
|
+
borderWidth: 2
|
|
61
|
+
},
|
|
62
|
+
label: {
|
|
63
|
+
show: false,
|
|
64
|
+
position: "center"
|
|
65
|
+
},
|
|
66
|
+
emphasis: {
|
|
67
|
+
label: {
|
|
68
|
+
show: true,
|
|
69
|
+
formatter: () => {
|
|
70
|
+
return "";
|
|
71
|
+
},
|
|
72
|
+
rich: {
|
|
73
|
+
n: {
|
|
74
|
+
height: 40,
|
|
75
|
+
padding: [0, 0, 12, 0],
|
|
76
|
+
lineHeight: 16,
|
|
77
|
+
fontWeight: 500,
|
|
78
|
+
fontSize: 16,
|
|
79
|
+
color: "#515e5f",
|
|
80
|
+
align: "center"
|
|
81
|
+
},
|
|
82
|
+
v: {
|
|
83
|
+
lineHeight: 36,
|
|
84
|
+
fontWeight: 800,
|
|
85
|
+
fontSize: 30,
|
|
86
|
+
color: "#273333",
|
|
87
|
+
align: "center",
|
|
88
|
+
padding: [0, 0, 15, 0]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
data: [
|
|
94
|
+
{
|
|
95
|
+
value: 5325,
|
|
96
|
+
name: "positive",
|
|
97
|
+
proportion: 0.0595,
|
|
98
|
+
type: 1,
|
|
99
|
+
itemStyle: {
|
|
100
|
+
color: "#1DA9A0"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
value: 1879,
|
|
105
|
+
name: "negative",
|
|
106
|
+
proportion: 0.021,
|
|
107
|
+
type: 2,
|
|
108
|
+
itemStyle: {
|
|
109
|
+
color: "#EE6666"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 82344,
|
|
114
|
+
name: "neutral",
|
|
115
|
+
proportion: 0.9195,
|
|
116
|
+
type: 3,
|
|
117
|
+
itemStyle: {
|
|
118
|
+
color: "#bbbbbb"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
selectedMode: true,
|
|
123
|
+
selectedOffset: 0,
|
|
124
|
+
minAngle: 3
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
};
|
|
128
|
+
myChart.setOption(option);
|
|
129
|
+
};
|
|
130
|
+
return /* @__PURE__ */ React.createElement("div", { id: chartID, className: "onesight-chart-pie" });
|
|
131
|
+
}
|