|
@@ -975,7 +975,6 @@ Page({
|
|
|
height: height,
|
|
|
devicePixelRatio: dpr
|
|
|
});
|
|
|
- barChart.setOption(this.getGoodOrBadOption());
|
|
|
request({
|
|
|
url: '/goodOrbad/getGoodOrBadByYearAndArea?area=1',
|
|
|
method: 'GET'
|
|
@@ -987,6 +986,11 @@ Page({
|
|
|
temp.push(res.data.basicSatisfied);
|
|
|
temp.push(res.data.satisfied);
|
|
|
temp.push(res.data.great);
|
|
|
+ // 计算最大值,以及分割值
|
|
|
+ var maxValue = Math.max(...temp)
|
|
|
+ maxValue = parseInt(maxValue/10000 + 1) * 10000
|
|
|
+ var interval = maxValue / 4
|
|
|
+ barChart.setOption(this.getGoodOrBadOption(maxValue, interval));
|
|
|
this.setData({
|
|
|
evalutionNum: res.data.goodOrBad,
|
|
|
evalutionRate: (res.data.good / res.data.goodOrBad * 100).toFixed(2)
|
|
@@ -1081,11 +1085,13 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
// 获取好差评图表
|
|
|
- getGoodOrBadOption() {
|
|
|
+ getGoodOrBadOption(maxValue, interval) {
|
|
|
//请求数据
|
|
|
let xAxis = {
|
|
|
type: 'value',
|
|
|
splitNumber: 4,
|
|
|
+ max: maxValue,
|
|
|
+ interval: interval,
|
|
|
axisLine: {
|
|
|
show: true
|
|
|
},
|