Commit 88ee1399 authored by 徐一鸣's avatar 徐一鸣

运行管控调试

parent 47dfc3d7
...@@ -7,73 +7,72 @@ import { graphic } from "echarts/lib/export"; ...@@ -7,73 +7,72 @@ import { graphic } from "echarts/lib/export";
export default { export default {
props: { props: {
data: { data: {
type: Array, type: Object,
default: () => { default: () => {
return []; return null;
} },
}, },
bar_width: { bar_width: {
type: Number, type: Number,
default: 12 default: 12,
}, },
colors: { colors: {
type: Array, type: Array,
default: () => { default: () => {
return ["#515fe7", "#e56600"]; return ["#515fe7", "#e56600"];
} },
}, },
bar_border_radius: { bar_border_radius: {
type: Array, type: Array,
default: () => { default: () => {
return [10, 10, 10, 10]; return [10, 10, 10, 10];
} },
}, },
show_split: { show_split: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
x_router: { x_router: {
type: Number, type: Number,
default: 0 default: 0,
} },
}, },
data: () => ({}),
mounted() {},
methods: { methods: {
bar() { bar() {
let self = this; let _self = this;
let xAxis = (_self.data && _self.data.xAxis) || [];
let series = (_self.data && _self.data.series) || [{}, {}];
return { return {
grid: { grid: {
left: 10, left: 10,
right: 10, right: 10,
bottom: 25, bottom: 25,
top: 25, top: 25,
containLabel: true containLabel: true,
}, },
legend: { legend: {
left: "right", left: "right",
itemWidth: 10, itemWidth: 10,
itemHeight: 10, itemHeight: 10,
orient: "horizontal", orient: "horizontal",
backgroundColor: "#f4f7fc" backgroundColor: "#f4f7fc",
data: series.map((item) => item.name),
}, },
color: this.colors, tooltip: {
tooltip: {}, trigger: "axis",
dataset: {
source: self.data
}, },
xAxis: { xAxis: {
type: "category", type: "category",
// data: self.data.legendData,
axisLabel: { axisLabel: {
margin: 20, margin: 20,
color: "#0d1847", color: "#0d1847",
textStyle: { textStyle: {
fontSize: 12 fontSize: 12,
}, },
interval: 0, interval: 0,
rotate: self.x_router, rotate: _self.x_router,
formatter: function(value) { /* formatter: function(value) {
let valueTxt = ""; let valueTxt = "";
if (value.length > 6) { if (value.length > 6) {
valueTxt = value.substring(0, 5) + "..."; valueTxt = value.substring(0, 5) + "...";
...@@ -81,57 +80,59 @@ export default { ...@@ -81,57 +80,59 @@ export default {
valueTxt = value; valueTxt = value;
} }
return valueTxt; return valueTxt;
} }, */
}, },
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#f2f2f2" color: "#f2f2f2",
} },
}, },
axisTick: { axisTick: {
show: false show: false,
}, },
splitArea: { splitArea: {
show: true, show: true,
areaStyle: { areaStyle: {
color: ["#fff", "#f8f9fd"], color: ["#fff", "#f8f9fd"],
opacity: 0.5 opacity: 0.5,
}, },
interval: 0 interval: 0,
} },
axisPointer: {
type: "shadow",
},
data: xAxis,
}, },
yAxis: [ yAxis: [
{ {
axisLabel: { axisLabel: {
color: "#a9aec0", color: "#a9aec0",
textStyle: { textStyle: {
fontSize: 12 fontSize: 12,
} },
}, },
minInterval: 1, minInterval: 1,
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "rgba(0, 0, 0, 0)" color: "rgba(0, 0, 0, 0)",
} },
}, },
axisTick: { axisTick: {
show: false show: false,
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: "#f2f2f2", color: "#f2f2f2",
type: "solid" type: "solid",
} },
} },
} },
], ],
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [ series: [
{ {
type: "bar", type: "bar",
type: "bar", type: "bar",
barWidth: self.bar_width, barWidth: _self.bar_width,
itemStyle: { itemStyle: {
normal: { normal: {
color: function(params) { color: function(params) {
...@@ -143,24 +144,26 @@ export default { ...@@ -143,24 +144,26 @@ export default {
[ [
{ {
offset: 0, offset: 0,
color: self.colors[0] // 0% 处的颜色 color: _self.colors[0], // 0% 处的颜色
}, },
{ {
offset: 1, offset: 1,
color: self.colors[0] // 100% 处的颜色 color: _self.colors[0], // 100% 处的颜色
} },
], ],
false false
); );
}, },
barBorderRadius: self.bar_border_radius barBorderRadius: _self.bar_border_radius,
} },
} },
name: series[0].name,
data: series[0].data,
}, },
{ {
type: "bar", type: "bar",
type: "bar", type: "bar",
barWidth: self.bar_width, barWidth: _self.bar_width,
itemStyle: { itemStyle: {
normal: { normal: {
color: function(params) { color: function(params) {
...@@ -172,24 +175,26 @@ export default { ...@@ -172,24 +175,26 @@ export default {
[ [
{ {
offset: 0, offset: 0,
color: self.colors[1] // 0% 处的颜色 color: _self.colors[1], // 0% 处的颜色
}, },
{ {
offset: 1, offset: 1,
color: self.colors[1] // 100% 处的颜色 color: _self.colors[1], // 100% 处的颜色
} },
], ],
false false
); );
}, },
barBorderRadius: self.bar_border_radius barBorderRadius: _self.bar_border_radius,
} },
} },
} name: series[1].name,
] data: series[1].data,
},
],
}; };
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>
......
...@@ -46,6 +46,17 @@ export default { ...@@ -46,6 +46,17 @@ export default {
bar() { bar() {
let self = this; let self = this;
return { return {
tooltip: {
trigger: "axis",
formatter: function(params) {
var htmlStr = "";
for (var i = 0; i < params.length; i++) {
htmlStr += params[i].name + " : ";
htmlStr += params[i].value;
}
return htmlStr;
}
},
grid: { grid: {
left: 10, left: 10,
right: 10, right: 10,
...@@ -65,7 +76,7 @@ export default { ...@@ -65,7 +76,7 @@ export default {
}, },
interval: 0, interval: 0,
rotate: self.x_router, rotate: self.x_router,
formatter: function(value) { /* formatter: function(value) {
let valueTxt = ""; let valueTxt = "";
if (value.length > 6) { if (value.length > 6) {
valueTxt = value.substring(0, 5) + "..."; valueTxt = value.substring(0, 5) + "...";
...@@ -73,7 +84,7 @@ export default { ...@@ -73,7 +84,7 @@ export default {
valueTxt = value; valueTxt = value;
} }
return valueTxt; return valueTxt;
} } */
}, },
axisLine: { axisLine: {
lineStyle: { lineStyle: {
...@@ -91,6 +102,9 @@ export default { ...@@ -91,6 +102,9 @@ export default {
}, },
interval: 0 interval: 0
}, },
axisPointer: {
type: "shadow",
},
} }
], ],
yAxis: [ yAxis: [
......
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
this.$el.scrollTop = 0; this.$el.scrollTop = 0;
this.timer = setInterval(() => { this.timer = setInterval(() => {
let itemHeight = 50; let itemHeight = 60;
let curScrollTop = this.$el.scrollTop + itemHeight; let curScrollTop = this.$el.scrollTop + itemHeight;
if ( if (
curScrollTop >= curScrollTop >=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment