105 lines
1.8 KiB
JavaScript
105 lines
1.8 KiB
JavaScript
const fontScale = 1;
|
|
|
|
const backgroundColor = "#181a1b";
|
|
const tooltipBgColor = "#00557f";
|
|
|
|
const toolboxParams = {
|
|
itemSize: 8 * fontScale,
|
|
showTitle: true,
|
|
top: "-1%",
|
|
right: "20%",
|
|
iconStyle: {
|
|
borderColor: "#eff1d6",
|
|
borderWidth: 2,
|
|
},
|
|
feature: {
|
|
dataZoom: {
|
|
yAxisIndex: "none",
|
|
},
|
|
restore: {},
|
|
saveAsImage: {
|
|
pixelRatio: 2,
|
|
},
|
|
},
|
|
};
|
|
|
|
const textStyleMain = {
|
|
fontFamily: "sans-serif",
|
|
fontSize: 12 * fontScale,
|
|
color: "#eff1d6",
|
|
};
|
|
|
|
const axisLabel = {
|
|
fontSize: 12 * fontScale,
|
|
color: "#eff1d6",
|
|
margin: 10,
|
|
};
|
|
|
|
const axisLine = {
|
|
show: true,
|
|
lineStyle: {
|
|
color: "#eff1d6",
|
|
width: 2,
|
|
},
|
|
};
|
|
|
|
const axisTick = { show: true };
|
|
|
|
const grid = {
|
|
bottom: 30,
|
|
top: 10,
|
|
left: 15,
|
|
containLabel: true,
|
|
};
|
|
|
|
const yaxisTextStyle = {
|
|
fontSize: 12 * fontScale,
|
|
padding: [0, 0, 10, 0],
|
|
color: "#eff1d6",
|
|
};
|
|
|
|
const yaxisTextStyle2 = {
|
|
fontSize: 12 * fontScale,
|
|
padding: [50, 0, 0, 0],
|
|
color: "#eff1d6",
|
|
};
|
|
|
|
function dataZoom(start = 90, end = 100, bottom = 15, height = 15) {
|
|
const dataZoom = [
|
|
{
|
|
start: start,
|
|
end: end,
|
|
bottom: bottom,
|
|
height: height,
|
|
},
|
|
];
|
|
|
|
return dataZoom;
|
|
}
|
|
|
|
function nFormatter(value, digits) {
|
|
const lookup = [
|
|
{ value: 1, symbol: "" },
|
|
{ value: 1e3, symbol: "k" },
|
|
{ value: 1e6, symbol: "M" },
|
|
{ value: 1e9, symbol: "G" },
|
|
{ value: 1e12, symbol: "T" },
|
|
{ value: 1e15, symbol: "P" },
|
|
{ value: 1e18, symbol: "E" },
|
|
];
|
|
const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
|
const item = lookup
|
|
.slice()
|
|
.reverse()
|
|
.find((item) => value >= item.value);
|
|
return item
|
|
? (value / item.value).toFixed(digits).replace(rx, "$1") + item.symbol
|
|
: "0";
|
|
}
|
|
|
|
window.addEventListener("resize", function () {
|
|
if (myChart != null && myChart != undefined) {
|
|
myChart.resize();
|
|
}
|
|
});
|