Commit bad53ff7f2e7eee8e0e1768a92733cfa438e437e

Authored by 梁保满
1 parent 5e11badb

echart y轴最小间隔

src/components/charts/barChart.vue
... ... @@ -28,7 +28,7 @@ export default {
28 28 // this.initData();
29 29 },
30 30 methods: {
31   - setOption(xAxis,params) {
  31 + setOption(xAxis, params) {
32 32 const that = this;
33 33 const options = {
34 34 color: this.colors || ["#4472c4", "#ed7d32", "#a5a5a5"],
... ... @@ -64,6 +64,7 @@ export default {
64 64 },
65 65 yAxis: {
66 66 type: "value",
  67 + minInterval: 1,
67 68 axisLine: { show: true, lineStyle: { color: "#e2e2e2" } },
68 69 splitLine: {
69 70 show: true,
... ... @@ -105,13 +106,13 @@ export default {
105 106 };
106 107 return options;
107 108 },
108   - initData(xAxis,params) {
  109 + initData(xAxis, params) {
109 110 if (!xAxis.length) return;
110 111 if (!this.chart) {
111 112 const div = document.getElementById(this.id);
112 113 this.chart = this.$echarts.init(div);
113 114 }
114   - const options = this.setOption(xAxis,params);
  115 + const options = this.setOption(xAxis, params);
115 116 this.chart?.clear();
116 117 this.chart.setOption(options, true);
117 118 },
... ...