Compare commits

..

No commits in common. "24838b3ecc421f7018217399558d5406bcb72bb5" and "ad680cf19e2919014c0d8ec131a6534da0478a28" have entirely different histories.

2 changed files with 181 additions and 186 deletions

View File

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

View File

@ -486,8 +486,12 @@ 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 offsetY = 10; const maxValue = Math.max(...yaxisData);
const maxValue2 = Math.max(...yaxisData2);
const offsetX = 15;
const offsetY = 5;
// //
const CubeLeft = echarts.graphic.extendShape({ const CubeLeft = echarts.graphic.extendShape({
shape: { shape: {
@ -497,7 +501,6 @@ 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];
@ -510,6 +513,7 @@ export default {
.closePath(); .closePath();
}, },
}); });
// //
const CubeRight = echarts.graphic.extendShape({ const CubeRight = echarts.graphic.extendShape({
shape: { shape: {
@ -530,6 +534,7 @@ export default {
.closePath(); .closePath();
}, },
}); });
// //
const CubeTop = echarts.graphic.extendShape({ const CubeTop = echarts.graphic.extendShape({
shape: { shape: {
@ -538,7 +543,7 @@ export default {
}, },
buildPath: function (ctx, shape) { buildPath: function (ctx, shape) {
const c1 = [shape.x, shape.y]; const c1 = [shape.x, shape.y];
const c2 = [shape.x + offsetX, shape.y - offsetY]; // const c2 = [shape.x + offsetX, shape.y - offsetY]; //
const c3 = [shape.x, shape.y - offsetX]; const c3 = [shape.x, shape.y - offsetX];
const c4 = [shape.x - offsetX, shape.y - offsetY]; const c4 = [shape.x - offsetX, shape.y - offsetY];
ctx ctx
@ -549,220 +554,127 @@ 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);
const option = { let option = {
legend: { legend: {
data: [ data: [
{ { icon: "rect", name: "昨日" },
name: "昨日", { icon: "rect", name: "今日" },
textStyle: {
color: "white",
},
},
{
name: "今日",
textStyle: {
color: "white",
},
},
], ],
textStyle: {
color: "#fff",
fontSize: "20px",
},
}, },
// tooltip: { // tooltip: {
// trigger: "axis", // trigger: "axis",
// axisPointer: { // axisPointer: {
// type: "shadow", // type: "shadow",
// }, // },
// // formatter: function (params) { // backgroundColor: "rgba(255,255,255,0.75)",
// // const item = params[1] // extraCssText: "box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.3);",
// // return item.name + ' : ' + item.value // textStyle: {
// // } // fontSize: 20,
// color: "#000",
// },
// formatter: (params, ticket, callback) => {
// const item = params[1];
// return item.name + " : " + item.value + " ";
// },
// }, // },
grid: { grid: {
left: "3%", left: "1%",
right: "4%", right: "0%",
bottom: "3%", top: "16%",
bottom: "5%",
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
type: "category", type: "category",
data: xaxisData, data: xaxisData,
axisLabel: { axisLine: {
show: true, show: true,
textStyle: { // lineStyle: {
color: "#fff", // width: 1,
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, fontSize: 20,
textStyle: { color: "#FFFFFF",
color: "#fff",
fontSize: 20,
},
interval: 0, //x
}, },
}, },
series: [ series: [
{ {
type: "custom", type: "bar",
name: "昨日", itemStyle: {
markPoint: { color: "transparent",
data: [
{
type: "max",
name: "Max",
symbolOffset: [-20, 0],
itemStyle: {
color: "transparent", //
},
// label
label: {
color: "#0BE73B", //
fontSize: 25,
},
},
],
},
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: "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: "#00C35A",
},
{
offset: 1,
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, data: yaxisData,
label: {
normal: {
show: true,
position: "top",
formatter: (e) => {
return e.value === maxValue ? e.value : "";
},
fontSize: 20,
color: "#02C262",
offset: [0, -15],
},
},
}, },
{
type: "bar",
itemStyle: {
color: "transparent",
},
data: yaxisData2,
label: {
normal: {
show: true,
position: "top",
formatter: (e) => {
return e.value === maxValue2 ? e.value : "";
},
fontSize: 20,
color: "#3286FF",
offset: [0, -15],
},
},
},
{ {
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",
@ -770,19 +682,23 @@ export default {
api, api,
xValue: api.value(0), xValue: api.value(0),
yValue: api.value(1), yValue: api.value(1),
x: location[0], x: location[0] - distance,
y: location[1], y: location[1],
xAxisPoint: api.coord([api.value(0), 0]), xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]],
}, },
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: "#4567FF", color: "#10C6FF",
},
{
offset: 0.35,
color: "#377DFF",
}, },
{ {
offset: 1, offset: 1,
color: "#0CC7FA", color: "#4464FF",
}, },
]), ]),
}, },
@ -793,19 +709,23 @@ export default {
api, api,
xValue: api.value(0), xValue: api.value(0),
yValue: api.value(1), yValue: api.value(1),
x: location[0], x: location[0] - distance,
y: location[1], y: location[1],
xAxisPoint: api.coord([api.value(0), 0]), xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]],
}, },
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: "#115DD5", color: "#0673D5",
},
{
offset: 0.35,
color: "#0B68D5",
}, },
{ {
offset: 1, offset: 1,
color: "#0574D0", color: "#115DD5",
}, },
]), ]),
}, },
@ -816,21 +736,12 @@ export default {
api, api,
xValue: api.value(0), xValue: api.value(0),
yValue: api.value(1), yValue: api.value(1),
x: location[0], x: location[0] - distance,
y: location[1], y: location[1],
xAxisPoint: api.coord([api.value(0), 0]), xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]],
}, },
style: { style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ fill: "#0964FF",
{
offset: 0,
color: "#0D7FFB",
},
{
offset: 1,
color: "#0440EB",
},
]),
}, },
}, },
], ],
@ -838,8 +749,91 @@ 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);
}, },
// //