dev
liuyongli 3 years ago
parent b6c2538b24
commit b5f669d21b

@ -9,6 +9,11 @@ Component({
lifetimes: {
attached() {
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
})
app.globalData.request({action: 'getEventsListH', sType: 'Home', sTimeType: 3}).then(res => {
const arr = []
res.forEach(ele => {
@ -24,7 +29,10 @@ Component({
})
this.setData({
questes: arr,
})
})
setTimeout(() =>{
wx.hideToast();
},500)
})
},
},

@ -47,7 +47,7 @@ Component({
arr1.push(ele.value)
})
this.setData({
brandOption: histogram(arr,arr1,"#20CC62")
brandOption: histogram(arr,arr1,"#0084FF")
})
setTimeout(() =>{
wx.hideToast();

@ -11,8 +11,8 @@ const ds=[]
// [3123, 2313, 313, 4355, 1490, 2900, 2310],
// [1400, 5434, 1544, 533, 1454, 1900, 3310],
// [1400, 5434, 1544, 533, 1454, 1900, 3310],]
const data=['微博','其他','短视频','微信','APP','论坛','新闻']
// const data = []
// const data=['微博','其他','短视频','微信','APP','论坛','新闻']
const data = []
const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF']
Component({
@ -30,23 +30,33 @@ Component({
attached() {
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: 34, sQueryType: 2}).then(res => {
const arr = []
const arr1=[]
const arr2=[]
const arr3=[]
const arr4=[]
res.forEach(ele => {
let ol = {
dx:ele.key
}
// let ol = {
// dx:ele.key
// }
arr.push(ele.key)
ele.value.forEach(val =>{
let obj = {
ds:val.value,
data:val.key
}
arr.push(obj)
arr1.push(val.value)
arr2.push(val.key)
})
arr.push(ol)
// arr.push(ol)
})
// for (let index = 0; index < 7; index++) {
// arr3.push(arr2[index])
// }
for (let index = 0; index < 7; index++) {
arr3.push(arr2[index])
}
this.setData({
brandOption: arr,
brandOption:sHistogram(arr,arr1,arr3,color2),
})
console.log('111',arr)
console.log('111',arr1)
console.log('111',arr3)
})
},
},

@ -47,7 +47,7 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
axisLabel: {
color: '#999999',//x轴文本颜色
textStyle: {
fontSize : 9
fontSize : 8
}
}
@ -64,15 +64,15 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
axisLabel: {
color: '#999999',//y轴文本颜色
textStyle: {
fontSize : 9
}
fontSize : 8
},
},
splitLine: { //分割线
// lineStyle:{
// // color:"#2d3436"
// }
show: true,
lineStyle: {
lineStyle: {
type: 'dashed',
color: '#E8E8E8',
}
@ -92,7 +92,13 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
color: '#999999',//y轴文本颜色
textStyle: {
fontSize : 9
}
},
formatter:(value) => {
if(value >= 10000){
value = (value / 10000) + '万';
}
return value;
}
},
splitLine: { //分割线
// lineStyle:{
@ -127,10 +133,11 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
series:{
type: 'bar',
data: ds,
barWidth : 24,
stack:"Search Engine",
emphasis: {//折线图的高亮状态。
focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。
},
emphasis: {//折线图的高亮状态。
focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。
},
itemStyle: {
normal:{
color: color1,

@ -83,7 +83,7 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) {
function columar(data=[],ds=[],color2=[]){
// MS判断多条数据还是单条数据 true为单条false为多条
let list=[]
for (let i = 0; i < color2.length; i++) {
for (let i = 0; i < data.length; i++) {
// MS?
// list.push({
// type: 'bar',
@ -102,7 +102,7 @@ function columar(data=[],ds=[],color2=[]){
// }
// }) :
list.push({
name: data[i].name,
name: data[i],
type: 'bar',
barWidth : 24,
data: ds[i],

Loading…
Cancel
Save