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

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

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