67 lines
1.5 KiB
JavaScript
67 lines
1.5 KiB
JavaScript
// 改变页面图表样式
|
|
let bgColor = "#fff";
|
|
let color = ["#0090FF", "#ffc300", "#f64662", "#ec610a", "#00c9b1", "#6730ec"];
|
|
|
|
function hexToRgba(hex, opacity) {
|
|
return (
|
|
"rgba(" +
|
|
parseInt("0x" + hex.slice(1, 3)) +
|
|
"," +
|
|
parseInt("0x" + hex.slice(3, 5)) +
|
|
"," +
|
|
parseInt("0x" + hex.slice(5, 7)) +
|
|
"," +
|
|
opacity +
|
|
")"
|
|
);
|
|
}
|
|
// 修改折线图样式
|
|
Forguncy.Helper.preSetEchartOption = (op, page, chart) => {
|
|
console.log(op);
|
|
op.series = op.series.map((element, index) => {
|
|
if (element.type == "line") {
|
|
var s1 = {};
|
|
s1.smooth = true;
|
|
element.symbol = "emptyCircle";
|
|
element.symbolSize = 8;
|
|
s1.zlevel = 3;
|
|
s1.showSymbol = false;
|
|
s1.lineStyle = {
|
|
normal: {
|
|
color: color[index],
|
|
shadowBlur: 5,
|
|
shadowColor: hexToRgba(color[index], 0.1),
|
|
shadowOffsetY: 6
|
|
}
|
|
};
|
|
s1.areaStyle = {
|
|
normal: {
|
|
color: new echarts.graphic.LinearGradient(
|
|
0,
|
|
0,
|
|
0,
|
|
1,
|
|
[
|
|
{
|
|
offset: 0,
|
|
color: hexToRgba(color[index], 0.3)
|
|
},
|
|
{
|
|
offset: 1,
|
|
color: hexToRgba(color[index], 0.1)
|
|
}
|
|
],
|
|
false
|
|
),
|
|
shadowColor: hexToRgba(color[index], 0.1),
|
|
shadowBlur: 10
|
|
}
|
|
};
|
|
|
|
element = { ...element, ...s1 };
|
|
}
|
|
return element;
|
|
});
|
|
|
|
return op;
|
|
}; |