This commit is contained in:
lll 2023-12-06 15:25:32 +08:00
parent 6a952c9c15
commit c8932a0721
2 changed files with 186 additions and 181 deletions

View File

@ -23,7 +23,6 @@
配电室 配电室
</div> </div>
</div> </div>
<div class="imgRight"> <div class="imgRight">
<div <div
@click="goTwo('破碎系统')" @click="goTwo('破碎系统')"

View File

@ -486,12 +486,8 @@ export default {
let yaxisData = [90, 80, 100, 70, 65]; let yaxisData = [90, 80, 100, 70, 65];
let yaxisData2 = [60, 56, 34, 69, 79]; let yaxisData2 = [60, 56, 34, 69, 79];
// const offsetX = 20;
const maxValue = Math.max(...yaxisData); const offsetY = 10;
const maxValue2 = Math.max(...yaxisData2);
const offsetX = 15;
const offsetY = 5;
// //
const CubeLeft = echarts.graphic.extendShape({ const CubeLeft = echarts.graphic.extendShape({
shape: { shape: {
@ -501,6 +497,7 @@ export default {
buildPath: function (ctx, shape) { buildPath: function (ctx, shape) {
// canvasshapecustom // canvasshapecustom
const xAxisPoint = shape.xAxisPoint; const xAxisPoint = shape.xAxisPoint;
// console.log(shape);
const c0 = [shape.x, shape.y]; const c0 = [shape.x, shape.y];
const c1 = [shape.x - offsetX, shape.y - offsetY]; const c1 = [shape.x - offsetX, shape.y - offsetY];
const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY]; const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY];
@ -513,7 +510,6 @@ export default {
.closePath(); .closePath();
}, },
}); });
// //
const CubeRight = echarts.graphic.extendShape({ const CubeRight = echarts.graphic.extendShape({
shape: { shape: {
@ -534,7 +530,6 @@ export default {
.closePath(); .closePath();
}, },
}); });
// //
const CubeTop = echarts.graphic.extendShape({ const CubeTop = echarts.graphic.extendShape({
shape: { shape: {
@ -554,127 +549,220 @@ export default {
.closePath(); .closePath();
}, },
}); });
// //
echarts.graphic.registerShape("CubeLeft", CubeLeft); echarts.graphic.registerShape("CubeLeft", CubeLeft);
echarts.graphic.registerShape("CubeRight", CubeRight); echarts.graphic.registerShape("CubeRight", CubeRight);
echarts.graphic.registerShape("CubeTop", CubeTop); echarts.graphic.registerShape("CubeTop", CubeTop);
let option = { const option = {
legend: { legend: {
data: [ data: [
{ icon: "rect", name: "昨日" }, {
{ icon: "rect", name: "今日" }, name: "昨日",
],
textStyle: { textStyle: {
color: "#fff", color: "white",
fontSize: "20px",
}, },
}, },
{
name: "今日",
textStyle: {
color: "white",
},
},
],
},
// tooltip: { // tooltip: {
// trigger: "axis", // trigger: "axis",
// axisPointer: { // axisPointer: {
// type: "shadow", // type: "shadow",
// }, // },
// backgroundColor: "rgba(255,255,255,0.75)", // // formatter: function (params) {
// extraCssText: "box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.3);", // // const item = params[1]
// textStyle: { // // return item.name + ' : ' + item.value
// fontSize: 20, // // }
// color: "#000",
// },
// formatter: (params, ticket, callback) => {
// const item = params[1];
// return item.name + " : " + item.value + " ";
// },
// }, // },
grid: { grid: {
left: "1%", left: "3%",
right: "0%", right: "4%",
top: "16%", bottom: "3%",
bottom: "5%",
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
type: "category", type: "category",
data: xaxisData, data: xaxisData,
axisLine: { axisLabel: {
show: true, show: true,
// lineStyle: { textStyle: {
// width: 1, color: "#fff",
// }, fontSize: 20,
},
interval: 0, //x
}, },
axisTick: { axisTick: {
show: true, show: true,
}, },
axisLabel: {
fontSize: 20,
color: "#FFFFFF",
},
}, },
yAxis: { yAxis: {
type: "value", type: "value",
splitArea: false,
name: "单位:kWh", name: "单位:kWh",
nameTextStyle: { nameTextStyle: {
color: "#fff", color: "#fff",
fontSize: 20, fontSize: 20,
padding: 10,
},
axisLine: {
show: false,
lineStyle: {
width: 2,
color: "#CEDDF2",
},
}, },
splitLine: { splitLine: {
show: true, show: true,
lineStyle: {
color: "#2A353F",
type: "dashed",
},
},
axisTick: {
show: false,
}, },
axisLabel: { axisLabel: {
show: true,
textStyle: {
color: "#fff",
fontSize: 20, fontSize: 20,
color: "#FFFFFF", },
interval: 0, //x
}, },
}, },
series: [ series: [
{ {
type: "bar", type: "custom",
name: "昨日",
markPoint: {
data: [
{
type: "max",
name: "Max",
symbolOffset: [-20, 0],
itemStyle: { itemStyle: {
color: "transparent", color: "transparent", //
}, },
data: yaxisData, // label
label: { label: {
normal: { color: "#0BE73B", //
show: true, fontSize: 25,
position: "top",
formatter: (e) => {
return e.value === maxValue ? e.value : "";
}, },
fontSize: 20,
color: "#02C262",
offset: [0, -15],
}, },
],
},
renderItem: (params, api) => {
const location = api.coord([api.value(0), api.value(1)]);
return {
type: "group",
x: -20,
children: [
{
type: "CubeLeft",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#09E63A",
},
{
offset: 1,
color: "#39E7C7",
},
]),
}, },
}, },
{ {
type: "bar", type: "CubeRight",
itemStyle: { shape: {
color: "transparent", api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
}, },
data: yaxisData2, style: {
label: { fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
normal: { {
show: true, offset: 0,
position: "top", color: "#00C35A",
formatter: (e) => {
return e.value === maxValue2 ? e.value : "";
}, },
fontSize: 20, {
color: "#3286FF", offset: 1,
offset: [0, -15], color: "#09C379",
},
]),
}, },
}, },
{
type: "CubeTop",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#05E6A5",
},
{
offset: 1,
color: "#12DE63",
},
]),
},
},
],
};
},
data: yaxisData,
}, },
{ {
type: "custom", type: "custom",
name: "今日", name: "今日",
markPoint: {
data: [
{
type: "max",
name: "Max",
symbolOffset: [25, 0],
itemStyle: {
color: "transparent", //
},
// label
label: {
color: "#24BDF2", //
fontSize: 25,
},
},
],
},
renderItem: (params, api) => { renderItem: (params, api) => {
const location = api.coord([api.value(0), api.value(1)]); const location = api.coord([api.value(0), api.value(1)]);
const xAxisPoint = api.coord([api.value(0), 0]);
const distance = 50;
return { return {
type: "group", type: "group",
x: 30,
children: [ children: [
{ {
type: "CubeLeft", type: "CubeLeft",
@ -682,23 +770,19 @@ export default {
api, api,
xValue: api.value(0), xValue: api.value(0),
yValue: api.value(1), yValue: api.value(1),
x: location[0] - distance, x: location[0],
y: location[1], y: location[1],
xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]], xAxisPoint: api.coord([api.value(0), 0]),
}, },
style: { style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ {
offset: 0, offset: 0,
color: "#10C6FF", color: "#4567FF",
},
{
offset: 0.35,
color: "#377DFF",
}, },
{ {
offset: 1, offset: 1,
color: "#4464FF", color: "#0CC7FA",
}, },
]), ]),
}, },
@ -709,23 +793,19 @@ export default {
api, api,
xValue: api.value(0), xValue: api.value(0),
yValue: api.value(1), yValue: api.value(1),
x: location[0] - distance, x: location[0],
y: location[1], y: location[1],
xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]], xAxisPoint: api.coord([api.value(0), 0]),
}, },
style: { style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ {
offset: 0, offset: 0,
color: "#0673D5", color: "#115DD5",
},
{
offset: 0.35,
color: "#0B68D5",
}, },
{ {
offset: 1, offset: 1,
color: "#115DD5", color: "#0574D0",
}, },
]), ]),
}, },
@ -736,12 +816,21 @@ export default {
api, api,
xValue: api.value(0), xValue: api.value(0),
yValue: api.value(1), yValue: api.value(1),
x: location[0] - distance, x: location[0],
y: location[1], y: location[1],
xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]], xAxisPoint: api.coord([api.value(0), 0]),
}, },
style: { style: {
fill: "#0964FF", fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#0D7FFB",
},
{
offset: 1,
color: "#0440EB",
},
]),
}, },
}, },
], ],
@ -749,91 +838,8 @@ export default {
}, },
data: yaxisData2, data: yaxisData2,
}, },
{
type: "custom",
name: "昨日",
barCategoryGap: "20%",
renderItem: (params, api) => {
const location = api.coord([api.value(0), api.value(1)]);
return {
type: "group",
children: [
{
type: "CubeLeft",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#08E83C",
},
{
offset: 0.35,
color: "#1FE77D",
},
{
offset: 1,
color: "#38E7C5",
},
]),
},
},
{
type: "CubeRight",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#00C25D",
},
{
offset: 0.35,
color: "#05C269",
},
{
offset: 1,
color: "#0BC27B",
},
]),
},
},
{
type: "CubeTop",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: "#05E861",
},
},
], ],
}; };
},
data: yaxisData,
},
],
};
this.defineEcharts("pdsydl", option); this.defineEcharts("pdsydl", option);
}, },
// //