Commit 9702c210 authored by 吕超's avatar 吕超

同步表格样式,格式化图例位数

parent db66523d
......@@ -23,34 +23,44 @@
<script>
export default {
data() {
return {}
return {};
},
props: {
title: {
type: String
type: String,
},
colors: {
type: Array
type: Array,
},
range: {
type: Array
}
type: Array,
},
},
computed: {
showLabel() {
return function (range, index) {
console.log(range, index)
console.log(range, index);
if (index == 0) {
return `< ${range[0]}`
return `< ${this.forMat(range[0])}`;
} else if (index === range.length) {
return `> ${range[index - 1]} `
return `> ${this.forMat(range[index - 1])} `;
} else {
return `${range[index - 1]} - ${range[index]}`
return `${this.forMat(range[index - 1])} - ${this.forMat(
range[index]
)}`;
}
};
},
},
methods: {
forMat(num) {
if (!Number.isInteger(num)) {
return num.toFixed(4);
}
}
}
}
return num;
},
},
};
</script>
<style lang="less" scoped>
......
......@@ -77,7 +77,7 @@ export default {
color: ["#d65108"],
tooltip: {
show: true,
trigger: 'axis'
trigger: "axis",
},
grid: {
left: "3%",
......@@ -127,9 +127,10 @@ export default {
position: "right",
},
itemStyle: {
emphasis: {
color: "rgba(201,59,60)",
},
color: "#d8ee2c",
// emphasis: {
// color: "rgba(201,59,60)",
// },
},
},
],
......
......@@ -170,6 +170,7 @@ export default {
position: 'top'
},
itemStyle: {
color: '#d8ee2c'
// emphasis: {
// color: "rgba(201,59,60)",
// },
......
......@@ -225,6 +225,7 @@ export default {
{
name: '2011年',
type: 'bar',
barWidth: `80%`,
itemStyle: {
color: '#d8ee2c'
}
......
......@@ -62,7 +62,7 @@ export default {
},
tooltip: {
show: true,
trigger: 'axis'
trigger: "axis",
},
xAxis: [
{
......@@ -105,6 +105,7 @@ export default {
position: "right",
},
itemStyle: {
color: "#d8ee2c",
emphasis: {
color: "rgba(201,59,60)",
},
......
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