This commit is contained in:
parent
6a952c9c15
commit
c8932a0721
|
|
@ -23,7 +23,6 @@
|
||||||
配电室
|
配电室
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="imgRight">
|
<div class="imgRight">
|
||||||
<div
|
<div
|
||||||
@click="goTwo('破碎系统')"
|
@click="goTwo('破碎系统')"
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
// 会canvas的应该都能看得懂,shape是从custom传入的
|
// 会canvas的应该都能看得懂,shape是从custom传入的
|
||||||
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: {
|
||||||
|
|
@ -543,7 +538,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
|
||||||
|
|
@ -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: {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "今日",
|
||||||
|
textStyle: {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
textStyle: {
|
|
||||||
color: "#fff",
|
|
||||||
fontSize: "20px",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
// 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: {
|
||||||
fontSize: 20,
|
show: true,
|
||||||
color: "#FFFFFF",
|
textStyle: {
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
interval: 0, //代表显示所有x轴标签显示
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
type: "bar",
|
type: "custom",
|
||||||
itemStyle: {
|
name: "昨日",
|
||||||
color: "transparent",
|
markPoint: {
|
||||||
|
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",
|
||||||
|
|
@ -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);
|
||||||
},
|
},
|
||||||
// 监听鼠标事件,实现饼图选中效果(单选),近似实现高亮(放大)效果。
|
// 监听鼠标事件,实现饼图选中效果(单选),近似实现高亮(放大)效果。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue