品牌对比

dev
Esdese 3 years ago
parent a8aeabf4aa
commit ed6fe64981

@ -4,6 +4,12 @@ export default function negaposiOption(dName=[], dPositive=[], dNegative = []) {
// dValue.forEach(ele => {
// newValue.push(ele*1-100);
// })
console.log(
dNegative
);
console.log(
dPositive
);
return {
tooltip: {
trigger: 'axis',
@ -30,7 +36,10 @@ export default function negaposiOption(dName=[], dPositive=[], dNegative = []) {
type: 'category',
inverse: true,
axisTick: {
show: false
show: false
},
axisLine: {
show: false
},
axisLabel: {
margin: 10,
@ -54,7 +63,7 @@ export default function negaposiOption(dName=[], dPositive=[], dNegative = []) {
},
itemStyle:{
normal:{
barBorderRadius:12,
barBorderRadius:[12,0,0,12],
color: '#0084FF'
},
},
@ -77,7 +86,7 @@ export default function negaposiOption(dName=[], dPositive=[], dNegative = []) {
},
itemStyle:{
normal:{
barBorderRadius:12,
barBorderRadius:[0,12,12,0],
color: '#FFBF00',
},
},

@ -0,0 +1,158 @@
// 调性分布
export default function negaposiOption(dName = [], data = {}) {
// let newValue = [];
// dValue.forEach(ele => {
// newValue.push(ele*1-100);
// })
const totalData = []
const msg = []
for (let [index, i] of Object.keys(data).entries()) {
msg.push(i)
let obj = {
name: i,
type: 'bar',
barWidth: 12,
stack: 'Total',
label: {
show: false,
position: 'right',
formatter: function (params) {
return (params.data) + '%';
},
},
itemStyle: {
normal: {
barBorderRadius: '',
color: '#20cd61'
},
},
emphasis: {
focus: 'series'
},
data: data[i]
}
if (index == 0) {
obj.itemStyle.normal.barBorderRadius = [12, 0, 0, 12]
obj.itemStyle.normal.color = '#0283ff'
} else if (index == Object.keys(data).length - 1) {
obj.itemStyle.normal.barBorderRadius = [0, 12, 12, 0]
obj.itemStyle.normal.color = '#fec000'
}
totalData.push(obj)
}
return {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: msg,
left: 10,
// data:[{name:'正面'},{name:'中性'},{name:'负面'},]
textStyle: { //图例文字的样式
color: 'black',
fontSize: 8
},
itemWidth: 12,
itemHeight: 12,
borderRadius: 1,
},
grid: {
top: 20,
left: 12,
containLabel: true
},
xAxis: [{
type: 'value',
show: false
}],
yAxis: [{
type: 'category',
inverse: true,
axisTick: {
show: false
},
axisLine: {
show: false
},
axisLabel: {
margin: 10,
fontSize: 12
},
data: dName
}],
series: totalData
// [
// {
// name: '男',
// type: 'bar',
// barWidth:12,
// stack: 'Total',
// label: {
// show: false,
// position: 'right',
// formatter: function (params) {
// return (params.data)+'%';
// },
// },
// itemStyle:{
// normal:{
// barBorderRadius:[12,0,0,12],
// color: '#0084FF'
// },
// },
// emphasis: {
// focus: 'series'
// },
// data: dMan
// },
// {
// name: '女',
// type: 'bar',
// barWidth:12,
// stack: 'Total',
// label: {
// show: false,
// position: 'right',
// formatter: function (params) {
// return (params.data)+'%';
// },
// },
// itemStyle:{
// normal:{
// color: '#20cb65'
// },
// },
// emphasis: {
// focus: 'series'
// },
// data: dLady
// },
// {
// name: '未设置性别',
// type: 'bar',
// barWidth:12,
// stack: 'Total',
// label: {
// show: false,
// position: 'left',
// formatter: function (params) {
// return (params.data) +'%';
// },
// },
// itemStyle:{
// normal:{
// barBorderRadius:[0,12,12,0],
// color: '#FFBF00',
// },
// },
// emphasis: {
// focus: 'series'
// },
// data: noGender
// }
// ]
};
}

@ -0,0 +1,74 @@
// 象形
export default function pictographicOption(dRegion = [], dValue = [], dSum = 0) {
return {
textStyle: {
},
tooltip: {
trigger: "item",
backgroundColor: "#08182F",
color: "#fff",
borderColor: "#3373CC",
textStyle: {
color: "#fff", //设置文字颜色
fontSize: 9
},
},
xAxis: {
show: false,
type: 'value'
},
yAxis: {
data: dRegion,
inverse: true,
axisTick: {
show: false
},
axisLine: {
show: false
},
axisLabel: {
margin: 10,
color: '#333333',
fontSize: 12
}
},
grid: {
height: 186,
width: '50%',
left: 'center',
},
series: [{
itemStyle: {
normal: {
color: '#0084FF',
barBorderRadius: 12
},
},
// current data
type: 'bar',
barWidth: 15,
data: dValue,
label: {
show: true,
formatter: function (params) {
return ((params.value / dSum) * 100).toFixed(2) + ' %';
},
// position: 'right',
position:[180,0],
// offset: [20, 0],
color: '#333333',
fontSize: 12,
},
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)',
borderRadius:[12,12,12,12]
},
markLine: {
symbol: 'none',
},
}, ]
}
}

@ -0,0 +1,191 @@
import stack from "../../../../../components/option/stackedBarChart"
import pictographicOption from '../../../../../components/option/pictographicOption2'
import brokenLines from "../../../../../components/option/stackingLineOption"
const app = getApp()
const dColor = ['#FF4852', '#FF6E25', '#FFBF00', '#20CC62', '#00D6D6', '#00AAFF', '#7257FF']
Component({
data: {
imageUrl: getApp().globalData.imageUrl,
showChart: true,
stackOption: stack([], [], ['#00aaff', '#20cc62', '#ff4852']),
transformOption2:brokenLines([], [], [], []),
boxArr: new Array(6),
bbsInfoData:[],
bbsInfo:[],
bbsInfoAction:0,
positiveData:[],
positive:[],
positiveActive:0,
negativeData:[],
negative:[],
negativeActive:0,
},
lifetimes: {
attached() {
let brandRatioTime = wx.getStorageSync('brandRatioTime')
this.setData({
boxArr: wx.getStorageSync('brandData')
})
let sBrand = []
this.data.boxArr.forEach((ele) => {
if (ele) sBrand.push(ele.brandname)
})
//论坛信息
app.globalData.request({
action: 'getCount0528C',
sType: 'BbsBrand',
iContrastType: '1',
iBBsType: '1',
sBrand: sBrand.join(','),
token: wx.getStorageSync('token'),
...brandRatioTime,
}).then(res => {
this.setData({
bbsInfoData:res,
bbsInfo:[res[0],res[1]]
})
})
//论坛发帖趋势对比
app.globalData.request({
action: 'getCountTime0528C',
token: wx.getStorageSync('token'),
sType: 'BbsBrand',
iContrastType: '1',
iBBsType:'1',
...brandRatioTime,
sBrand: sBrand.join(',')
}).then(res => {
console.log(res);
let dDate = []
let dVal = new Array(res[0].value.length).fill([])
dVal = dVal.map(ele => {
ele = JSON.stringify(ele)
ele = JSON.parse(ele)
return ele
})
for (let i of res) {
dDate.push(i.key)
for (let [index, j] of i.value.entries()) {
dVal[index].push(j)
}
}
this.setData({
transformOption2: brokenLines(sBrand, dVal, dColor, dDate),
})
})
//论坛调性对比
app.globalData.request({
action: 'getAffectionsC',
token: wx.getStorageSync('token'),
sType: 'BbsBrand',
...brandRatioTime,
iContrastType: '1',
iBBsType:'1',
sBrand: sBrand.join(',')
}).then(res => {
let yMsg = []
let data = [
[],
[],
[]
]
for (let i of res) {
yMsg.push(i.Name)
data[0].push(i.Data['正面'])
data[1].push(i.Data['中性'])
data[2].push(i.Data['负面'])
}
this.setData({
stackOption: stack(yMsg, data, ['#00aaff', '#20cc62', '#ff4852'])
})
})
//论坛正面话题对比
app.globalData.request({
action: 'getTopicPosAndTopicNeg0528C',
token: wx.getStorageSync('token'),
sType: 'BbsBrand',
...brandRatioTime,
iContrastType: '1',
iBBsType:'1',
sBrand: sBrand.join(',')
}).then(res=>{
let newRes =[]
let positive = []
let negative = []
console.log(res);
for(let i of res){
for(let [index,j] of i.value.entries()){
let obj ={name:i.key,region:[],value:[],sum:0}
j.value.forEach(ele=>{
obj.region.push(ele.key)
obj.value.push(ele.value)
obj.sum+=ele.value
})
index == 0?positive.push(obj):negative.push(obj)
}
}
positive = positive.map(ele=>{
ele.func=pictographicOption(ele.region.slice(0,5),ele.value.slice(0,5),ele.sum)
return ele
})
negative = negative.map(ele=>{
ele.func=pictographicOption(ele.region.slice(0,5),ele.value.slice(0,5),ele.sum)
return ele
})
this.setData({
positiveData:positive,
positive:[positive[0],positive[1]],
negativeData:negative,
negative:[negative[0],negative[1]],
})
})
},
},
methods: {
//负面
negativeChange(event) {
let obj = {
0: [this.data.negativeData[0] || {}, this.data.negativeData[1] || {}],
1: [this.data.negativeData[2] || {}, this.data.negativeData[3] || {}],
2: [this.data.negativeData[4] || {}, this.data.negativeData[5] || {}]
}
let index = event.detail.index
this.setData({
negativeActive: index,
negative: obj[index]
})
},
//正面
positiveChange(event) {
let obj = {
0: [this.data.positiveData[0] || {}, this.data.positiveData[1] || {}],
1: [this.data.positiveData[2] || {}, this.data.positiveData[3] || {}],
2: [this.data.positiveData[4] || {}, this.data.positiveData[5] || {}]
}
let index = event.detail.index
console.log(obj[index]);
this.setData({
positiveActive: index,
positive: obj[index]
})
},
//论坛信息
bbsChange(event) {
let obj = {
0: [this.data.bbsInfoData[0] || {}, this.data.bbsInfoData[1] || {}],
1: [this.data.bbsInfoData[2] || {}, this.data.bbsInfoData[3] || {}],
2: [this.data.bbsInfoData[4] || {}, this.data.bbsInfoData[5] || {}]
}
let index = event.detail.index
console.log(obj[index]);
this.setData({
bbsInfoAction: index,
bbsInfo: obj[index]
})
},
}
})

@ -0,0 +1,7 @@
{
"usingComponents": {
"c-echars": "../../../../../../components/c-echars/index",
"word-cloud": "../../../../../components/word-cloud/index"
},
"component": true
}

@ -0,0 +1,88 @@
<view class="top_box">
<view class="top-title">
<view style="width: 45%;">论坛信息</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ bbsInfoAction }}" color="#BBBBBB" bind:change="bbsChange">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{bbsInfoData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{bbsInfoData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view class="info_box" wx:for="{{bbsInfo}}" wx:key="s">
<view class="info_left">
<view style="font-size:32rpx">{{item.key || '无'}}</view>
<view style="font-size:24rpx;color: rgba(153, 153, 153, 1);">品牌名称</view>
</view>
<view class="info_right">
<view class="list_box">
<view style="font-size:24rpx;color: rgba(153, 153, 153, 1);">论坛信息量</view>
<view style="font-size:28rpx;color: rgba(51, 51, 51, 1);">{{item.Count|| '0'}}</view>
</view>
<view class="list_box" style="text-align: right;">
<view style="font-size:24rpx;color: rgba(153, 153, 153, 1);">互动人数</view>
<view style="font-size:28rpx;color: rgba(51, 51, 51, 1);">{{item.interactCount || '0'}}</view>
</view>
<view class="list_box">
<view style="font-size:24rpx;color: rgba(153, 153, 153, 1);">论坛主贴量</view>
<view style="font-size:28rpx;color: rgba(51, 51, 51, 1);">{{item.zhutieCount || '0'}}</view>
</view>
<view class="list_box" style="text-align: right;">
<view style="font-size:24rpx;color: rgba(153, 153, 153, 1);">论坛品论量</view>
<view style="font-size:28rpx;color: rgba(51, 51, 51, 1);">{{item.commentsSum || '0'}}</view>
</view>
</view>
</view>
</view>
<view class="chart_box">
<view class="chart_title">论坛发帖趋势对比</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{transformOption2}}" height="100%"></c-echars>
</view>
</view>
<view class="chart_box">
<view class="chart_title">论坛调性对比</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{stackOption}}" height="100%"></c-echars>
</view>
</view>
<view class="area_box">
<view class="top-title">
<view style="width: 45%;">论坛正面话题对比</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ positiveActive }}" color="#BBBBBB" bind:change="positiveChange">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{bbsInfoData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{bbsInfoData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view wx:for="{{positive}}" wx:key="{{item.name}}">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="width:686rpx;height:486rpx;margin-top: -50px;">
<c-echars showChart="{{showChart}}" canvasId="region-canvas1" chartId="regionbar1" chartOption="{{item.func}}" height="100%"></c-echars>
</view>
</view>
</view>
<view class="area_box">
<view class="top-title">
<view style="width: 45%;">论坛负面话题对比</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ negativeActive }}" color="#BBBBBB" bind:change="negativeChange">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{bbsInfoData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{bbsInfoData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view wx:for="{{negative}}" wx:key="{{item.name}}">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="width:686rpx;height:486rpx;margin-top: -50px;">
<c-echars showChart="{{showChart}}" canvasId="region-canvas1" chartId="regionbar1" chartOption="{{item.func}}" height="100%"></c-echars>
</view>
</view>
</view>

@ -0,0 +1,98 @@
.chart_box{
margin-top: 24rpx;
width: 686rpx;
height: 486rpx;
padding-top:32rpx ;
background: white;
}
.chart_title{
font-size: 36rpx;
font-weight: bold;
margin-left:32rpx ;
}
.table{
height: 380rpx;
width: 95%;
margin-left:16rpx ;
margin-top: 32rpx;
}
.top_box{
margin-top: 24rpx;
width: 686rpx;
height: 510rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
.info_box{
height: 200rpx;
margin-top: 22rpx;
display: flex;
justify-content: center;
align-items: center;
}
.info_left{
width: 30%;
}
.info_right{
height: 100%;
display:flex;
width: 60%;
justify-content:space-evenly;
flex-wrap: wrap;
}
.list_box{
height: 50%;
width: 50%;
}
.top-title {
width: 100%;
font-size: 18px;
padding-left: 32rpx;
font-weight: 600;
color: #333333;
display: flex;
justify-content: flex-start;
}
.rank_list{
margin-left: 32rpx;
margin-top: 16rpx;
}
.ranking{
font-size: 12px;
font-weight: 400;
color: #999999;
}
.ranking_cell{
height: 104rpx;
display: flex ; align-items: center;
}
.henxian{
height: 2rpx;
background:linear-gradient(to right,white, #f2f1f1,white);
}
.cloud_box{
margin-top: 24rpx;
width: 686rpx;
height: 884rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
.cloud_title {
width: 100%;
font-size: 18px;
padding-left: 32rpx;
font-weight: 600;
color: #333333;
display: flex;
justify-content: flex-start;
}
.area_box{
margin-top: 24rpx;
width: 686rpx;
height: 970rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}

@ -17,7 +17,7 @@ Page({
this.setData({
boxArr:wx.getStorageSync('brandData')
})
wx.setStorageSync('brandRatioTime', {sTimeType:'1'})
wx.setStorageSync('brandRatioTime', {sTimeType:'34'})
},
changeTab(val) {
let n = val.detail.index;

@ -3,7 +3,9 @@
"time-component":"/components/timecomponent/index",
"time-custom": "../../../../components/timeCustom/index",
"survey":"./survey/index",
"weibo":"./weibo/index"
"weibo":"./weibo/index",
"bbs":"./BBS/index",
"thetail":"./thetail/index"
},
"navigationBarTitleText": "品牌对比"
}

@ -32,6 +32,8 @@
<view class="content_box" wx:if="{{sonCom}}">
<survey wx:if="{{tabActive==0}}"></survey>
<weibo wx:if="{{tabActive==1}}"></weibo>
<bbs wx:if="{{tabActive==2}}"></bbs>
<thetail wx:if="{{tabActive==3}}"></thetail>
</view>
</view>

@ -0,0 +1,102 @@
import brokenLines from "../../../../../components/option/stackingLineOption"
import histogram from "../../../../../components/option/singleColumnarOption"
import stack from "../../../../../components/option/stackedBarChart"
import multipleColumn from "../../../../../components/option/multipleColumn"
import sHistogram from "../../../../../components/option/sColumnarOption"
const app = getApp()
const dColor = ['#FF4852', '#FF6E25', '#FFBF00', '#20CC62', '#00D6D6', '#00AAFF', '#7257FF']
Component({
data: {
imageUrl: getApp().globalData.imageUrl,
showChart: true,
transformOption: brokenLines([], [], [], []),
transformOption2: brokenLines([], [], [], []),
brandOption: histogram([], [], [], '#0084FF'),
brandOption2: histogram([], [], [], '#20cc62'),
brandOption3: multipleColumn([], [], []),
brandOption4: sHistogram(),
brandOption5: multipleColumn([], [], []),
stackOption: stack([], [], ['#00aaff', '#20cc62', '#ff4852']),
boxArr: new Array(6),
topActive: 0, //品牌传播
brandTop: [],
brandTopData: [],
cloudActive: 0, //词云
positiveWord: [],
negativeWord: [], //负面
},
lifetimes: {
attached() {
let brandRatioTime = wx.getStorageSync('brandRatioTime')
this.setData({
boxArr: wx.getStorageSync('brandData')
})
let sBrand = []
this.data.boxArr.forEach((ele) => {
if (ele) sBrand.push(ele.brandname)
})
//品牌传播TOP媒体
app.globalData.request({
action: 'getSourceTopCount0528C',
token: wx.getStorageSync('token'),
sType: 'BrandWeiYi',
...brandRatioTime,
iContrastType: '1',
iSize:'10',
sBrand: sBrand.join(',')
}).then(res => {
this.setData({
brandTop: [res[0], res[1]],
brandTopData: res
})
})
//尾翼趋势
app.globalData.request({
action: 'getCountTime0528C',
token: wx.getStorageSync('token'),
sType: 'BrandWeiYi',
iContrastType: '1',
...brandRatioTime,
sBrand: sBrand.join(',')
}).then(res => {
console.log(res);
let dDate = []
let dVal = new Array(res[0].value.length).fill([])
dVal = dVal.map(ele => {
ele = JSON.stringify(ele)
ele = JSON.parse(ele)
return ele
})
for (let i of res) {
dDate.push(i.key)
for (let [index, j] of i.value.entries()) {
dVal[index].push(j)
}
}
this.setData({
salesDate: res.Time,
transformOption2: brokenLines(sBrand, dVal, dColor, dDate),
})
})
},
},
methods: {
//品牌传播top媒体
changeModalHot(event) {
let obj = {
0: [this.data.brandTopData[0] || {}, this.data.brandTopData[1] || {}],
1: [this.data.brandTopData[2] || {}, this.data.brandTopData[3] || {}],
2: [this.data.brandTopData[4] || {}, this.data.brandTopData[5] || {}]
}
let index = event.detail.index
this.setData({
topActive: index,
brandTop: obj[index]
})
},
changeModalHot2(event) {
},
}
})

@ -0,0 +1,7 @@
{
"usingComponents": {
"c-echars": "../../../../../../components/c-echars/index",
"word-cloud": "../../../../../components/word-cloud/index"
},
"component": true
}

@ -0,0 +1,65 @@
<view class="chart_box">
<view class="chart_title">尾翼趋势对比</view>
<view class="table">
<c-echars height="100%" showChart="{{showChart}}" canvasId="eventbar-canvas" chartId="eventbar" chartOption="{{transformOption2}}"></c-echars>
</view>
</view>
<view class="top_box">
<view class="top-title">
<view style="width: 45%;">尾翼TOP媒体</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ topActive }}" color="#BBBBBB" bind:change="changeModalHot">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{brandTopData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{brandTopData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view style="font-size:32rpx;margin-left:30rpx;">{{brandTop[0].key}}</view>
<view class="rank_list">
<view class="ranking">
<view style=" display: inline-block;">排名</view>
<view style=" display: inline-block;margin-left: 172rpx;">车型</view>
<view style=" display: inline-block;margin-left: 272rpx;">传播量</view>
</view>
<view class="ranking_cell" wx:for="{{brandTop[0].value}}" wx:for-item="item" wx:if="{{index>=0 && index<=4}}" wx:key="V">
<view wx:if="{{index==0}}">
<image src="{{imageUrl}}/img_diyi.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==1}}">
<image src="{{imageUrl}}/img_dier.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==2}}">
<image src="{{imageUrl}}/img_disan.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:else style="font-size: 28rpx;color: #999999;font-weight: bolder;width: 52rpx;">{{"0"+(index+1)}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 112rpx;margin-left: 166rpx; font-weight: bolder;">{{item.key}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 94rpx;margin-left: 194rpx;color: #0084ff;font-weight: bolder;">{{item.value}}</view>
</view>
</view>
<view class="henxian"></view>
<view style="font-size:32rpx;margin-left:30rpx;">{{brandTop[1].key}}</view>
<view class="rank_list">
<view class="ranking" wx:if="{{brandTop[1].key}}">
<view style=" display: inline-block;">排名</view>
<view style=" display: inline-block;margin-left: 172rpx;">车型</view>
<view style=" display: inline-block;margin-left: 272rpx;">传播量</view>
</view>
<view class="ranking_cell" wx:for="{{brandTop[1].value}}" wx:for-item="item" wx:if="{{index>=0 && index<=4}}" wx:key="S">
<view wx:if="{{index==0}}">
<image src="{{imageUrl}}/img_diyi.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==1}}">
<image src="{{imageUrl}}/img_dier.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==2}}">
<image src="{{imageUrl}}/img_disan.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:else style="font-size: 28rpx;color: #999999;font-weight: bolder;width: 52rpx;">{{"0"+(index+1)}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 112rpx;margin-left: 166rpx; font-weight: bolder;">{{item.key}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 94rpx;margin-left: 194rpx;color: #0084ff;font-weight: bolder;">{{item.value}}</view>
</view>
</view>
</view>

@ -0,0 +1,69 @@
.chart_box{
margin-top: 24rpx;
width: 686rpx;
height: 486rpx;
padding-top:32rpx ;
background: white;
}
.chart_title{
font-size: 36rpx;
font-weight: bold;
margin-left:32rpx ;
}
.table{
height: 380rpx;
width: 95%;
margin-left:16rpx ;
margin-top: 32rpx;
}
.top_box{
margin-top: 24rpx;
width: 686rpx;
height: 1312rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
.top-title {
width: 100%;
font-size: 18px;
padding-left: 32rpx;
font-weight: 600;
color: #333333;
display: flex;
justify-content: flex-start;
}
.rank_list{
margin-left: 32rpx;
margin-top: 16rpx;
}
.ranking{
font-size: 12px;
font-weight: 400;
color: #999999;
}
.ranking_cell{
height: 104rpx;
display: flex ; align-items: center;
}
.henxian{
height: 2rpx;
background:linear-gradient(to right,white, #f2f1f1,white);
}
.cloud_box{
margin-top: 24rpx;
width: 686rpx;
height: 884rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
.cloud_title {
width: 100%;
font-size: 18px;
padding-left: 32rpx;
font-weight: 600;
color: #333333;
display: flex;
justify-content: flex-start;
}

@ -2,6 +2,8 @@ import histogram from "../../../../../components/option/singleColumnarOption"
import stack from "../../../../../components/option/stackedBarChart"
import sHistogram from "../../../../../components/option/sColumnarOption"
import pictographicOption from '../../../../../components/option/pictographicOption'
import negaposiOption from '../../../../../components/option/negaposiOption2'
const app = getApp()
const dColor = ['#FF4852', '#FF6E25', '#FFBF00', '#20CC62', '#00D6D6', '#00AAFF', '#7257FF']
Component({
@ -12,12 +14,16 @@ Component({
brandOption2: histogram([], [], [], '#20cc62'),
brandOption4: sHistogram(),
stackOption: stack([], [], ['#00aaff', '#20cc62', '#ff4852']),
genderOption:negaposiOption([],{}),
genderOptio2:negaposiOption([],{}),
boxArr: new Array(6),
topActive: 0, //品牌传播
userActive:0,//活跃用户信息
brandTop: [],
brandTopData: [],
areaActive:0,
areaData:[],
area:[]
},
lifetimes: {
attached() {
@ -166,15 +172,57 @@ Component({
newRes.push(obj)
}
newRes = newRes.map(ele=>{
ele.func=pictographicOption(ele.region,ele.value,ele.sum)
ele.func=[pictographicOption(ele.region.slice(0,5),ele.value.slice(0,5),ele.sum),
pictographicOption(ele.region.slice(5,10),ele.value.slice(5,10),ele.sum)]
return ele
})
console.log(newRes);
this.setData({
areaData:newRes
areaData:newRes,
area:[newRes[0],newRes[1]]
})
})
//男女-认证用户
app.globalData.request({
action: 'getSexMergeWeiBoC',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res=>{
Array.prototype.sum = function(){
let x = 0
this.forEach(ele=>{
x+=ele
})
return x
}
let sex = {
'男':[],
'未设性别':[],
'女':[],
}
let attestation = {
'普通认证':[],
'机构认证':[],
'非认证':[],
}
for(let i of res){
Object.keys(i.Data.sex).forEach(ele=>{
sex[ele].push(i.Data.sex[ele])
})
Object.keys(i.Data.attestation).forEach(ele=>{
attestation[ele].push(i.Data.attestation[ele])
})
}
this.setData({
genderOption:negaposiOption(sBrand,sex),
genderOption2:negaposiOption(sBrand,attestation)
})
})
},
},
@ -192,8 +240,17 @@ Component({
brandTop: obj[index]
})
},
changeModalHot2(event) {
changeActiveUser(event) {
let obj = {
0: [this.data.areaData[0] || {}, this.data.areaData[1] || {}],
1: [this.data.areaData[2] || {}, this.data.areaData[3] || {}],
2: [this.data.areaData[4] || {}, this.data.areaData[5] || {}]
}
let index = event.detail.index
this.setData({
areaActive: index,
area: obj[index]
})
},
}
})

@ -1,9 +1,3 @@
<!-- <view class="chart_box">
<view class="chart_title">信息量趋势</view>
<view class="table">
<c-echars height="100%" showChart="{{showChart}}" canvasId="eventbar-canvas" chartId="eventbar" chartOption="{{transformOption}}"></c-echars>
</view>
</view> -->
<view class="chart_box">
<view class="chart_title">微博信息量对比</view>
@ -31,15 +25,6 @@
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{stackOption}}" height="100%"></c-echars>
</view>
</view>
<!--
<view class="chart_box">
<view class="chart_title">渠道分布</view>
<view class="table" style="height: 100%;">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{brandOption3}}" height="100%"></c-echars>
</view>
</view> -->
<view class="top_box">
<view class="top-title">
<view style="width: 45%;">微博内容方向对比</view>
@ -102,15 +87,35 @@
<view class="top-title">
<view style="width: 45%;">活跃用户信息</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ topActive }}" color="#BBBBBB" bind:change="changeModalHot">
<van-tabs type="card" active="{{ userActive }}" color="#BBBBBB" bind:change="changeActiveUser">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{brandTopData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{brandTopData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view wx:for="{{area}}">
<view style="margin-left:32rpx ;">{{item.name}}</view>
<view class="chart_box" style="margin-top: -100rpx;">
<view style="float:left;width:342rpx;height:486rpx;">
<c-echars showChart="{{showChart}}" canvasId="region-canvas1" chartId="regionbar1" chartOption="{{item.func[0]}}" height="100%"></c-echars>
</view>
<view style="float:right;width:342rpx;height:486rpx;">
<c-echars showChart="{{showChart}}" canvasId="region-canvas1" chartId="regionbar1" chartOption="{{item.func[1]}}" height="100%"></c-echars>
</view>
</view>
</view>
</view>
<view class="chart_box">
<view class="chart_title">微博用户性别对比</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{genderOption}}" height="100%"></c-echars>
</view>
<view class="chart_box">
<c-echars showChart="{{showChart}}" canvasId="region-canvas1" chartId="regionbar1" chartOption="{{areaData[0].func}}" height="100%"></c-echars>
</view>
<view class="chart_box">
<view class="chart_title">微博认证用户对比</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{genderOption2}}" height="100%"></c-echars>
</view>
</view>
</view>

Loading…
Cancel
Save