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/tooltip/index.jsx
|
|
30
|
+
var tooltip_exports = {};
|
|
31
|
+
__export(tooltip_exports, {
|
|
32
|
+
default: () => tooltip_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(tooltip_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 tooltip_default = LineChart;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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/index.js
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
line: () => import_line.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var import_line = __toESM(require("./components/line"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
line
|
|
39
|
+
});
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/chartUtils.js
|
|
20
|
+
var chartUtils_exports = {};
|
|
21
|
+
__export(chartUtils_exports, {
|
|
22
|
+
calculateSeriesTotal: () => calculateSeriesTotal,
|
|
23
|
+
changeDataTypeEn: () => changeDataTypeEn,
|
|
24
|
+
computeFloatNull: () => computeFloatNull,
|
|
25
|
+
computePos: () => computePos,
|
|
26
|
+
convertSeriesData: () => convertSeriesData,
|
|
27
|
+
dealPath: () => dealPath,
|
|
28
|
+
numberFormatMust: () => numberFormatMust,
|
|
29
|
+
numberFormatNull: () => numberFormatNull,
|
|
30
|
+
toggleAxisPointer: () => toggleAxisPointer
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(chartUtils_exports);
|
|
33
|
+
function isZH() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
function isFloat(n) {
|
|
37
|
+
return /^-?\d*\.\d+$/.test(n);
|
|
38
|
+
}
|
|
39
|
+
function changeDataTypeEn(s, number = 2) {
|
|
40
|
+
let n = number;
|
|
41
|
+
if (s === null) {
|
|
42
|
+
return "-";
|
|
43
|
+
}
|
|
44
|
+
if (!s && s !== 0 && s !== "0") {
|
|
45
|
+
return "0";
|
|
46
|
+
}
|
|
47
|
+
var f = "";
|
|
48
|
+
if (Number(s) < 0) {
|
|
49
|
+
f = "-";
|
|
50
|
+
}
|
|
51
|
+
n = n >= 0 && n <= 20 ? n : 2;
|
|
52
|
+
s = parseFloat((s + "").replace(/[^\d\.]/g, ""));
|
|
53
|
+
let bese = Math.pow(10, n);
|
|
54
|
+
s = s * bese;
|
|
55
|
+
s = s.toFixed() / bese + "";
|
|
56
|
+
if (isFloat(s)) {
|
|
57
|
+
let rs = s.indexOf(".");
|
|
58
|
+
if (rs < 0) {
|
|
59
|
+
rs = s.length;
|
|
60
|
+
s += ".";
|
|
61
|
+
}
|
|
62
|
+
while (s.length <= rs + n) {
|
|
63
|
+
s += "0";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var l = s.split(".")[0].split("").reverse();
|
|
67
|
+
var r = s.split(".")[1];
|
|
68
|
+
var t = "";
|
|
69
|
+
for (var i = 0; i < l.length; i++) {
|
|
70
|
+
t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? "," : "");
|
|
71
|
+
}
|
|
72
|
+
var sendStr = "";
|
|
73
|
+
if (n !== 0 && r) {
|
|
74
|
+
sendStr = t.split("").reverse().join("") + "." + r;
|
|
75
|
+
} else {
|
|
76
|
+
sendStr = t.split("").reverse().join("");
|
|
77
|
+
}
|
|
78
|
+
return f + sendStr;
|
|
79
|
+
}
|
|
80
|
+
function numberFormatMust(num, fixed) {
|
|
81
|
+
let value = num;
|
|
82
|
+
let fixedNum = isZH() ? 2 : 1;
|
|
83
|
+
let originNum = num;
|
|
84
|
+
if (num < 0) {
|
|
85
|
+
num = Math.abs(num);
|
|
86
|
+
}
|
|
87
|
+
isZH() ? num >= 1e8 ? value = changeDataTypeEn(num / 1e8, fixedNum) + "亿" : num >= 1e4 ? value = changeDataTypeEn(num / 1e4, fixedNum) + "万" : value = changeDataTypeEn(num, fixedNum) : num >= 1e9 ? value = changeDataTypeEn(num / 1e9, fixedNum) + "B" : num >= 1e6 ? value = changeDataTypeEn(num / 1e6, fixedNum) + "M" : num >= 1e3 ? value = changeDataTypeEn(num / 1e3, fixedNum) + "K" : value = changeDataTypeEn(num, fixedNum);
|
|
88
|
+
if (originNum < 0) {
|
|
89
|
+
return `-${value}`;
|
|
90
|
+
}
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
function isNumNull(num) {
|
|
94
|
+
return num === null || num === void 0 || isNaN(num);
|
|
95
|
+
}
|
|
96
|
+
function computeFloatNull(num, per = 100, unit = "%") {
|
|
97
|
+
if (isNumNull(num)) {
|
|
98
|
+
return "-";
|
|
99
|
+
} else if (num === 0) {
|
|
100
|
+
return "0" + unit;
|
|
101
|
+
} else {
|
|
102
|
+
return (num >= 4e-5 ? changeDataTypeEn(num * per, 2) : "<0.01") + unit;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function numberFormatNull(num, fixed) {
|
|
106
|
+
return isNumNull(num) ? "-" : numberFormatMust(num, fixed);
|
|
107
|
+
}
|
|
108
|
+
function dealPath(elementId, sawtooth = false) {
|
|
109
|
+
const paths = document.querySelectorAll("#" + elementId + " path");
|
|
110
|
+
paths.forEach(function(path) {
|
|
111
|
+
const transform = path.getAttribute("transform");
|
|
112
|
+
if (transform && transform.includes("translate")) {
|
|
113
|
+
const matches = transform.match(/translate\(([^)]+)\)/);
|
|
114
|
+
if (matches && matches[1]) {
|
|
115
|
+
const values = matches[1].split(" ").map(function(value) {
|
|
116
|
+
return Math.round(parseFloat(value));
|
|
117
|
+
});
|
|
118
|
+
const newTransform = "translate(" + values.join(" ") + ")";
|
|
119
|
+
path.setAttribute("transform", newTransform);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
if (sawtooth) {
|
|
123
|
+
path.style.shapeRendering = "crispEdges";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function modifyStyle(leftValue, currentWidth) {
|
|
129
|
+
const style = document.createElement("style");
|
|
130
|
+
style.innerHTML = `
|
|
131
|
+
.onesight-line-tooltip .triangle-down {
|
|
132
|
+
width: ${currentWidth}px !important;
|
|
133
|
+
}
|
|
134
|
+
.onesight-line-tooltip .triangle-down::after {
|
|
135
|
+
left: ${leftValue} !important;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
document.head.appendChild(style);
|
|
139
|
+
}
|
|
140
|
+
function computePos(xPoint, currentWidth) {
|
|
141
|
+
if (currentWidth) {
|
|
142
|
+
let res = xPoint - currentWidth / 2;
|
|
143
|
+
let leftValue = 0;
|
|
144
|
+
if (currentWidth === 340) {
|
|
145
|
+
leftValue = 50;
|
|
146
|
+
} else {
|
|
147
|
+
leftValue = 30;
|
|
148
|
+
}
|
|
149
|
+
if (res < 35) {
|
|
150
|
+
res = xPoint - leftValue;
|
|
151
|
+
modifyStyle(`${leftValue}px`, currentWidth);
|
|
152
|
+
} else if (res > 730) {
|
|
153
|
+
const val = currentWidth - leftValue;
|
|
154
|
+
res = xPoint - val;
|
|
155
|
+
modifyStyle(`${val}px`, currentWidth);
|
|
156
|
+
} else {
|
|
157
|
+
modifyStyle("50%", currentWidth);
|
|
158
|
+
}
|
|
159
|
+
return res;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
var calculateSeriesTotal = (data) => {
|
|
163
|
+
return Object.entries(data).reduce((acc, [key, values]) => {
|
|
164
|
+
acc[key] = values.reduce((sum, value) => sum + value, 0);
|
|
165
|
+
return acc;
|
|
166
|
+
}, {});
|
|
167
|
+
};
|
|
168
|
+
var convertSeriesData = (seriesData) => {
|
|
169
|
+
return Object.entries(seriesData).map(([name, data]) => {
|
|
170
|
+
return {
|
|
171
|
+
type: "line",
|
|
172
|
+
symbol: "emptyCircle",
|
|
173
|
+
symbolSize: 8,
|
|
174
|
+
showSymbol: false,
|
|
175
|
+
connectNulls: true,
|
|
176
|
+
lineStyle: {
|
|
177
|
+
width: 3
|
|
178
|
+
},
|
|
179
|
+
smooth: true,
|
|
180
|
+
triggerLineEvent: false,
|
|
181
|
+
emphasis: {
|
|
182
|
+
focus: "series",
|
|
183
|
+
itemStyle: {
|
|
184
|
+
borderWidth: 2,
|
|
185
|
+
color: "#fff"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
z: 2,
|
|
189
|
+
name,
|
|
190
|
+
data: data.map((value) => ({
|
|
191
|
+
value,
|
|
192
|
+
itemStyle: {
|
|
193
|
+
opacity: 1
|
|
194
|
+
},
|
|
195
|
+
select: {
|
|
196
|
+
itemStyle: {
|
|
197
|
+
opacity: 1
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}))
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
function toggleAxisPointer(myChart, show) {
|
|
205
|
+
myChart.setOption({
|
|
206
|
+
tooltip: {
|
|
207
|
+
axisPointer: {
|
|
208
|
+
lineStyle: {
|
|
209
|
+
color: show ? "rgba(0, 0, 0, 0.24)" : "rgba(0, 0, 0, 0)"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
216
|
+
0 && (module.exports = {
|
|
217
|
+
calculateSeriesTotal,
|
|
218
|
+
changeDataTypeEn,
|
|
219
|
+
computeFloatNull,
|
|
220
|
+
computePos,
|
|
221
|
+
convertSeriesData,
|
|
222
|
+
dealPath,
|
|
223
|
+
numberFormatMust,
|
|
224
|
+
numberFormatNull,
|
|
225
|
+
toggleAxisPointer
|
|
226
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/colors.js
|
|
20
|
+
var colors_exports = {};
|
|
21
|
+
__export(colors_exports, {
|
|
22
|
+
darkThemeColors: () => darkThemeColors,
|
|
23
|
+
defaultChartColors: () => defaultChartColors,
|
|
24
|
+
getChartColors: () => getChartColors,
|
|
25
|
+
lightThemeColors: () => lightThemeColors,
|
|
26
|
+
pieChartColors: () => pieChartColors
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(colors_exports);
|
|
29
|
+
var defaultChartColors = [
|
|
30
|
+
"#1DA9A0",
|
|
31
|
+
"#5274E8",
|
|
32
|
+
"#F8AF1D",
|
|
33
|
+
"#D54CB6",
|
|
34
|
+
"#51A6E6",
|
|
35
|
+
"#CB3432",
|
|
36
|
+
"#EE6666",
|
|
37
|
+
"#6C5CCE",
|
|
38
|
+
"#57C464",
|
|
39
|
+
"#FFED49",
|
|
40
|
+
"#8FE6D1",
|
|
41
|
+
"#71B3D2",
|
|
42
|
+
"#814F9E",
|
|
43
|
+
"#E85D9F",
|
|
44
|
+
"#78FA3C",
|
|
45
|
+
"#F8C6A4",
|
|
46
|
+
"#166364",
|
|
47
|
+
"#E1A1FE",
|
|
48
|
+
"#D0F52B",
|
|
49
|
+
"#9ECCF6"
|
|
50
|
+
];
|
|
51
|
+
var lightThemeColors = [];
|
|
52
|
+
var darkThemeColors = [];
|
|
53
|
+
var pieChartColors = [];
|
|
54
|
+
function getChartColors(chartType, theme = "light") {
|
|
55
|
+
switch (chartType) {
|
|
56
|
+
case "pie":
|
|
57
|
+
return pieChartColors;
|
|
58
|
+
case "line":
|
|
59
|
+
case "bar":
|
|
60
|
+
default:
|
|
61
|
+
return theme === "light" ? lightThemeColors : darkThemeColors;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
darkThemeColors,
|
|
67
|
+
defaultChartColors,
|
|
68
|
+
getChartColors,
|
|
69
|
+
lightThemeColors,
|
|
70
|
+
pieChartColors
|
|
71
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "onesight-charts",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "OneSight前端图表公共组件库",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "lib/index.js",
|
|
8
|
+
"module": "es/index.js",
|
|
9
|
+
"types": "lib/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "father build",
|
|
16
|
+
"build:watch": "father dev",
|
|
17
|
+
"dev": "dumi dev",
|
|
18
|
+
"docs:build": "dumi build",
|
|
19
|
+
"doctor": "father doctor",
|
|
20
|
+
"lint": "npm run lint:es && npm run lint:css",
|
|
21
|
+
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
22
|
+
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
23
|
+
"prepare": "husky install && dumi setup",
|
|
24
|
+
"prepublishOnly": "father doctor && npm run build",
|
|
25
|
+
"start": "npm run dev"
|
|
26
|
+
},
|
|
27
|
+
"commitlint": {
|
|
28
|
+
"extends": [
|
|
29
|
+
"@commitlint/config-conventional"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"lint-staged": {
|
|
33
|
+
"*.{md,json}": [
|
|
34
|
+
"prettier --write --no-error-on-unmatched-pattern"
|
|
35
|
+
],
|
|
36
|
+
"*.{css,less}": [
|
|
37
|
+
"stylelint --fix",
|
|
38
|
+
"prettier --write"
|
|
39
|
+
],
|
|
40
|
+
"*.{js,jsx}": [
|
|
41
|
+
"eslint --fix",
|
|
42
|
+
"prettier --write"
|
|
43
|
+
],
|
|
44
|
+
"*.{ts,tsx}": [
|
|
45
|
+
"eslint --fix",
|
|
46
|
+
"prettier --parser=typescript --write"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"echarts": "^5.4.3",
|
|
51
|
+
"echarts-for-react": "^3.0.2"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@commitlint/cli": "^17.1.2",
|
|
55
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
56
|
+
"@types/react": "^18.0.0",
|
|
57
|
+
"@types/react-dom": "^18.0.0",
|
|
58
|
+
"@umijs/lint": "^4.0.0",
|
|
59
|
+
"dumi": "^2.2.13",
|
|
60
|
+
"dumi-theme-antd": "^0.3.12",
|
|
61
|
+
"eslint": "^8.23.0",
|
|
62
|
+
"father": "^4.1.0",
|
|
63
|
+
"husky": "^8.0.1",
|
|
64
|
+
"lint-staged": "^13.0.3",
|
|
65
|
+
"prettier": "^2.7.1",
|
|
66
|
+
"prettier-plugin-organize-imports": "^3.0.0",
|
|
67
|
+
"prettier-plugin-packagejson": "^2.2.18",
|
|
68
|
+
"react": "^18.0.0",
|
|
69
|
+
"react-dom": "^18.0.0",
|
|
70
|
+
"stylelint": "^14.9.1"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"react": ">=16.9.0",
|
|
74
|
+
"react-dom": ">=16.9.0"
|
|
75
|
+
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public"
|
|
78
|
+
},
|
|
79
|
+
"authors": [
|
|
80
|
+
"wudong"
|
|
81
|
+
]
|
|
82
|
+
}
|