Browse Source

柱形图更新

master
luyisha 3 years ago
parent
commit
fe9725841f
  1. 34
      pages/home/home.vue

34
pages/home/home.vue

@ -235,6 +235,9 @@
}, },
renderChart(){ renderChart(){
let yMax = ([...this.UpDownSta.data].sort())[this.UpDownSta.data.length-1]; let yMax = ([...this.UpDownSta.data].sort())[this.UpDownSta.data.length-1];
if(!yMax){
yMax = 200;
}
let interval = yMax / 5; let interval = yMax / 5;
// yMax = interval*6; // yMax = interval*6;
let option = { let option = {
@ -249,7 +252,9 @@
// }, // },
grid: { grid: {
top: '12%', top: '12%',
bottom: '12%' bottom: '12%',
left: '10%',
right: '5%'
}, },
tooltip: {}, tooltip: {},
xAxis: { xAxis: {
@ -261,11 +266,12 @@
max: yMax, max: yMax,
interval: interval interval: interval
}, },
{ // {
min: 0, // min: 0,
max: yMax, // max: yMax,
interval: interval // interval: interval
}], // },
],
series: [ series: [
{ {
name: '', name: '',
@ -273,13 +279,13 @@
barMaxWidth: 30, barMaxWidth: 30,
data: this.UpDownSta.data data: this.UpDownSta.data
}, },
{ // {
name: '', // name: '',
type: 'line', // type: 'line',
// data: [175, 180, 410, 208, 195, 330], // // data: [175, 180, 410, 208, 195, 330],
data: this.UpDownSta.data, // data: this.UpDownSta.data,
yAxisIndex: 1 // yAxisIndex: 1
} // }
] ]
}; };
@ -376,7 +382,7 @@
API.request('/adminStatistics/upAndDownStatistics', {type: type}, res=>{ API.request('/adminStatistics/upAndDownStatistics', {type: type}, res=>{
this.UpDownSta = res.data; this.UpDownSta = res.data;
this.UpDownSta.xData = this.UpDownSta.histogram.map(item=>{ this.UpDownSta.xData = this.UpDownSta.histogram.map(item=>{
return item.date; return +item.date+'月';
}) })
this.UpDownSta.data = this.UpDownSta.histogram.map(item=>{ this.UpDownSta.data = this.UpDownSta.histogram.map(item=>{
return item.value; return item.value;

Loading…
Cancel
Save