showCharts() {const myChart = echarts.init(this.$refs.box)var optionoption = {color: '#2a78f7',tooltip: {trigger: 'axis'},grid: {// left: '3%',// right: '4%',top: '10%',containLabel: true},xAxis: {type: 'category',data: this.dates,axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 1,rotate: -20}},yAxis: {type: 'value',splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},series: [{name: '点击量',data: this.echarts.clickNums,type: 'line',smooth: true,areaStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1,[{ offset: 0, color: '#E8F2FF' }, // 柱图渐变色// { offset: 0.5, color: '#44C0C1' }, // 柱图渐变色{ offset: 1, color: '#ffffff' } // 柱图渐变色])}}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts3() {const myChart = echarts.init(this.$refs.box3)var optionoption = {tooltip: {trigger: 'axis'},color: '#2a78f7',grid: {// left: '3%',// right: '4%',top: '10%',containLabel: true},xAxis: {type: 'category',data: this.dates3,axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 1,rotate: -20}},yAxis: {type: 'value',splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},series: [{name: '价格',data: this.echarts3.prices,type: 'line',// smooth: true,step: 'start',areaStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1,[{ offset: 0, color: '#E8F2FF' }, // 柱图渐变色// { offset: 0.5, color: '#44C0C1' }, // 柱图渐变色{ offset: 1, color: '#ffffff' } // 柱图渐变色])}}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts2() {const myChart = echarts.init(this.$refs.box2)var optionoption = {tooltip: {trigger: 'item'},legend: {// top: -20,orient: 'vertical',// left: 'center',right: 'right',data: ['市场同款', '相似商品', '当前商品']},color: ['#ff7700', '#FFD700', '#2a78f7'],radar: {// shape: 'circle',splitNumber: 3, // 雷达图圈数设置indicator: [{ name: '流量', color: '#222222', max: 100 },{ name: '库存', color: '#222222', max: 100 },{ name: '毛利', color: '#222222', max: 100 },{ name: '销售', color: '#222222', max: 100 },{ name: '价格', color: '#222222', max: 100 }],splitArea: {show: false,areaStyle: {color: 'rgba(255,0,0,0)' // 图表背景的颜色}}},series: [{// name: '预算 vs 开销(Budget vs spending)',type: 'radar',data: [{value: this.echarts2.marketDimension,name: '市场同款'},{value: this.echarts2.similarCommodityDimension,name: '相似商品'},{value: this.echarts2.businessDimension,name: '当前商品'}]}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts4() {const myChart = echarts.init(this.$refs.box4)var optionoption = {tooltip: {trigger: 'axis'},legend: {selectedMode: false,left: '8%',data: ['销售金额'],icon: 'pie'},color: ['#2a78f7', '#2a78f7'],grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},xAxis: {type: 'category',boundaryGap: false,data: this.dates4,axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 1// rotate: -20}},yAxis: {type: 'value',splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},visualMap: {show: false,dimension: 0,pieces: [{lte: this.index,color: 'rgba(42,120,247, 1)'}, {gt: this.index,lte: 22,color: 'rgba(42,120,247, 0.5)'}]},series: [{name: '销售金额',type: 'line',// stack: '总量',smooth: true,data: this.echarts4.amounts,markArea: {itemStyle: {color: 'rgba(42,120,247, 0.1)'},data: [[{name: '预测趋势',xAxis: this.currentdate}, {xAxis: this.dates4[this.dates4.length]}]]}}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts(obj) {const myChart = echarts.init(this.$refs.box)var optionconst _this = thisoption = {// tooltip: {// trigger: 'axis',// axisPointer: {// type: 'shadow'// }// },tooltip: {trigger: 'axis',axisPointer: {type: 'shadow'},formatter: function(item) {var relVal = item[0].axisValue + '<br/>' + '总量库存:' + obj.totalStock[item[0].dataIndex]for (var i = 0, l = item.length; i < l; i++) {relVal += '<br/>' + item[i].seriesName + ':' + item[i].value}return relVal}},legend: {// selectedMode: false,// x: 'right',y: 'top',right: '2%',// top: -10,data: ['可卖库存', '占用库存']},color: ['#4A80FF', '#FF9F28'],grid: {left: '3%',right: '2%',bottom: '22%',top: '8%',containLabel: true},dataZoom: obj.availableStock.length > 15 ? {left: '6%',right: '2%',bottom: '33%',// top: '8%',show: obj.availableStock.length > 15, // 为true 滚动条出现realtime: true,type: 'slider', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。height: 12, // 表示滚动条的高度,也就是粗细// start: 0, // 表示默认展示20%~80%这一段。// end: 80,startValue: 0, // 数据窗口范围的起始数值endValue: 14 // 数据窗口范围的结束数值。} : { show: obj.availableStock.length > 15 },xAxis: [{type: 'category',data: obj.warehouseName,axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 0, // 强制所有标签显示margin: 20,rotate: 10,clickable: true},silent: false,triggerEvent: true}],yAxis: [{type: 'value',splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}}],series: [{name: '可卖库存',barMaxWidth: 50,type: 'bar',stack: 'Ad',emphasis: {focus: 'series'},data: obj.availableStock},{name: '占用库存',barMaxWidth: 50,type: 'bar',stack: 'Ad',emphasis: {focus: 'series'},data: obj.occupyStock}]}myChart.setOption(option, true)// myChart.on('click', 'xAxis.category', function(params) {// _this.succeedVisible = true// _this.title = params.name + '近15天数据情况'// _this.selectInDetails(obj.warehouseCode[params.dataIndex])// })myChart.on('click', function(params) {console.log(params)// console.log(params.dataIndex)// console.log(_this.succeedVisible)_this.succeedVisible = trueif (params.componentType === 'series') {_this.title = params.name + '近15天数据情况'_this.selectInDetails(obj.warehouseCode[params.dataIndex])} else {_this.title = params.value + '近15天数据情况'console.log(obj.warehouseCode)var iobj.warehouseName.map((item, index) => {if (item === params.value) {i = index}})// console.log(i)_this.selectInDetails(obj.warehouseCode[i])}// console.log(obj.warehouseCode[params.dataIndex])})window.addEventListener('resize', () => {myChart.resize()})},
showCharts2(obj) {const myChart = echarts.init(this.$refs.box2)var optionoption = {tooltip: {trigger: 'axis',axisPointer: {type: 'shadow'}},color: ['#4A80FF', '#FF9F28'],grid: {left: '3%',right: '2%',bottom: '20%',top: '8%',containLabel: true},legend: {y: 'top',right: '2%',data: ['可卖库存', '变动库存']},xAxis: [{type: 'category',data: obj.clickDate,// axisPointer: {// type: 'shadow'// }axisLine: {show: false, // 不显示坐标轴轴线onZero: true},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {// interval: 0,// margin: -180,rotate: 40},margin: -200}],yAxis: [{type: 'value',splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}}],series: [{name: '可卖库存',barMaxWidth: 15,type: 'bar',data: obj.availableStock},{name: '变动库存',type: 'line',data: obj.changeStock}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts1(obj) {const myChart = echarts.init(this.$refs.box1)var optionoption = {title: {text: '*超期指数:指根据商品库存、销量、变动情况进行模型计算,指数越高,超期越严重。',textStyle: {color: '#666666',fontSize: 12,lineHeight: 14},top: '78%',left: 'center'},tooltip: {trigger: 'axis',textStyle: {width: 160,overflow: 'break'},extraCssText: 'width:300px; white-space:normal;word-break: normal;'},color: ['#4A80FF', '#35CA67', '#FF9F28'],grid: {left: '3%',right: '2%',bottom: '22%',top: '8%',containLabel: true},legend: {y: 'top',right: '2%',data: ['可卖库存', '变动库存', '超期指数']},xAxis: [{type: 'category',data: obj.itemName,// axisPointer: {// type: 'shadow'// }axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {show: true,interval: 0, // 强制所有标签显示margin: 10, // 标签向右移动 如果yAxis 跟 xAxis换了,这个margin应该调为0才能看见标签显示formatter: function(params) { // 标签输出形式 ---请开始你的表演var index = 5var newstr = ''for (var i = 0; i < params.length; i += index) {var tmp = params.substring(i, i + index)newstr += tmp + '\n'}if (newstr.length > 10) {return newstr.substring(0, 10) + '...'} else {return newstr}}},triggerEvent: true}],yAxis: [{type: 'value',splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},{type: 'value',// min: 0,// max: 100,scale: true,splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}}],series: [{name: '可卖库存',barMaxWidth: 50,type: 'bar',data: obj.availableStock},{name: '变动库存',barMaxWidth: 50,type: 'bar',data: obj.changeStock},{name: '超期指数',type: 'line',yAxisIndex: 1,data: obj.exceedTimeExponent}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts() {const myChart = echarts.init(this.$refs.box)var optionoption = {grid: {left: '50px',// right: '4%',// bottom: '12%',top: '20px'},xAxis: {type: 'category',data: ['本店', '市场'],axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},yAxis: {type: 'value',max: 100,axisLabel: {formatter: '{value}%'},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},splitLine: {show: false}},series: [{data: [this.echarts.shopProportion, this.echarts.marketProportion],type: 'bar',barWidth: 30,itemStyle: {normal: {label: {// axisLabel: {// formatter: '{value}%'// },show: true, // 开启显示position: 'top', // 在上方显示textStyle: { // 数值样式color: 'black',fontSize: 14},formatter: '{c}%'},color: new echarts.graphic.LinearGradient(0, 0, 0, 1,[{ offset: 0, color: '#477eff' }, // 柱图渐变色// { offset: 0.5, color: '#44C0C1' }, // 柱图渐变色{ offset: 1, color: '#dfefff' } // 柱图渐变色])},emphasis: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1,[{ offset: 0, color: '#dfefff' }, // 柱图高亮渐变色// { offset: 0.7, color: '#44C0C1' }, // 柱图高亮渐变色{ offset: 1, color: '#477eff' } // 柱图高亮渐变色])}}}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts2() {const myChart = echarts.init(this.$refs.box2)var optionoption = {tooltip: {trigger: 'axis',formatter: function(item) {var arrgen = ['市场销售', '市场流量']function isCon(arr, val) {for (var i = 0; i < arr.length; i++) {if (arr[i] === val) { return true }}return false}if (item.length === 1) {if (isCon(arrgen, item[0].seriesName)) {return ``} else {return `<div><div style="color:#ffffff;">${item[0].axisValue}</div><div style="margin: 0 8px;"><div style="color:#ffffff;margin-left:10px;">${item[0].seriesName}:${item[0].value}</div></div></div>`}} else if (item.length === 2) {if (item.every((a, index, array) => isCon(arrgen, a.seriesName))) {return ``} else {return `<div><div style="color:#ffffff;">${item[0].axisValue}</div><div style="margin: 0 8px;">${isCon(arrgen, item[0].seriesName) ? `` : `<div style="color:#ffffff;margin-left:10px;">${item[0].seriesName}:${item[0].value}</div>`}${isCon(arrgen, item[1].seriesName) ? `` : `<div style="color:#ffffff;margin-left:10px;">${item[1].seriesName}:${item[1].value}</div>`}</div></div>`}} else if (item.length === 3) {return `<div><div style="color:#ffffff;">${item[0].axisValue}</div><div style="margin: 0 8px;">${isCon(arrgen, item[0].seriesName) ? `` : `<div style="color:#ffffff;margin-left:10px;">${item[0].seriesName}:${item[0].value}</div>`}${isCon(arrgen, item[1].seriesName) ? `` : `<div style="color:#ffffff;margin-left:10px;">${item[1].seriesName}:${item[1].value}</div>`}${isCon(arrgen, item[2].seriesName) ? `` : `<div style="color:#ffffff;margin-left:10px;">${item[2].seriesName}:${item[2].value}</div>`}</div></div>`} else if (item.length === 4) {return `<div><div style="color:#ffffff;">${item[1].axisValue}</div><div style="margin: 0 8px;"><div style="color:#ffffff;margin-left:10px;">本店销售:${item[1].value}</div><div style="color:#ffffff;margin-left:10px;">本店流量:${item[3].value}</div></div></div>`}}},color: ['#ff7700', '#2a78f7'],legend: {// selectedMode: false,right: '8%',data: ['市场销售', '本店销售', '市场流量', '本店流量']},grid: {left: '50px',right: '4%',// bottom: '12%',top: '25px'},xAxis: {type: 'category',data: this.dates,axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 0,rotate: -20}},yAxis: [{show: false,splitLine: {show: false},type: 'value',axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},{type: 'value',show: false,splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}}],series: [{name: '市场销售',data: this.echarts2.marketSales,type: 'bar',barWidth: 10},{name: '本店销售',data: this.echarts2.storeSales,type: 'bar',barWidth: 10},{name: '市场流量',type: 'line',yAxisIndex: 1,smooth: true,data: this.echarts2.marketClicks},{name: '本店流量',type: 'line',yAxisIndex: 1,smooth: true,data: this.echarts2.storeClicks}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts() {const myChart = echarts.init(this.$refs.box)var optionoption = {// title: {// text: '(万元)',// y: 'center',// rotate: -90,// textStyle: { fontWeight: 'normal' }// },// return `<div>// <div>${item[0].axisValue}</div>// <div style="margin: 0 8px;">// ${item[1] ? `<div style="color:#ffffff;"><i style="background-color:#ff7700;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>市场:${item[0].value}(万元)</div>// <div style="color:#ffffff;"><i style="background-color:#2a78f7;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>本店:${item[1].value}(万元)</div> ` : !item[0]// ? '' : item[0].seriesName === '本店' ? `<div style="color:#ffffff;"><i style="background-color:#2a78f7;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>本店:${item[0].value}(万元)</div>` : `<div style="color:#ffffff;"><i style="background-color:#ff7700;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>市场:${item[0].value}(万元)</div>`}// </div>// </div>`tooltip: {trigger: 'axis',formatter: function(item) {// console.log(item)return item[0].seriesName === '本店' ? `<div><div>${item[0].axisValue}</div><div style="margin: 0 8px;"><div style="color:#ffffff;"><i style="background-color:#2a78f7;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>本店:${item[0].value}(万元)</div></div></div>` : ``}},legend: {// selectedMode: false,left: '8%',data: ['市场', '本店'],icon: 'pie'},// color: ['#ff7700', '#2a78f7'],grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},xAxis: {type: 'category',boundaryGap: false,data: this.chartsa.value,// data: ['2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03'],axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 0,rotate: -10}},yAxis: [{name: '单位:(万元)', // Y轴标题type: 'value',splitNumber: 4,// y: 'center',// axisLabel: { formatter: '{value} %' },splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},{type: 'value',show: false,splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}}],series: [{name: '本店',type: 'line',stack: '总量',smooth: true,color: '#2a78f7',data: this.chartsa.value3},{name: '市场',type: 'line',stack: '总量',yAxisIndex: 1,smooth: true,color: '#ff7700',data: this.chartsa.value2}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts3() {const myChart = echarts.init(this.$refs.box)var optionoption = {// title: {// text: '(万元)',// y: 'center',// rotate: -90,// textStyle: { fontWeight: 'normal' }// },tooltip: {trigger: 'axis',formatter: function(item) {return `<div><div>${item[0].axisValue}</div><div style="margin: 0 8px;">${item[1] ? `<div style="color:#ffffff;"><i style="background-color:#ff7700;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>市场:${item[1].value}%</div><div style="color:#ffffff;"><i style="background-color:#2a78f7;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>本店:${item[0].value}%</div> ` : !item[0]? '' : item[0].seriesName === '本店' ? `<div style="color:#ffffff;"><i style="background-color:#2a78f7;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>本店:${item[0].value}%</div>` : `<div style="color:#ffffff;"><i style="background-color:#ff7700;display: inline-block;height:10px;width:10px;margin-right:8px;border-radius:5px"></i>市场:${item[0].value}%</div>`}</div></div>`}},legend: {left: '8%',data: ['市场', '本店'],icon: 'pie'},// color: ['#ff7700', '#2a78f7'],grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},xAxis: {type: 'category',boundaryGap: false,data: this.chartsa.value,// data: ['2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03', '2012-03'],axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度},axisLabel: {interval: 0,rotate: -10}},yAxis: {// name: '(万元)', // Y轴标题type: 'value',splitNumber: 4,// y: 'center',axisLabel: { formatter: '{value} %' },splitLine: {show: false},axisLine: {show: false // 不显示坐标轴轴线},axisTick: {show: false // 不显示坐标轴刻度}},series: [{name: '本店',type: 'line',stack: '总量',smooth: true,color: '#2a78f7',data: this.chartsa.value3}, {name: '市场',type: 'line',stack: '总量',smooth: true,color: '#ff7700',data: this.chartsa.value2}]}myChart.setOption(option, true)window.addEventListener('resize', () => {myChart.resize()})},
showCharts2() {const myChart = echarts.init(this.$refs.box2)var optionoption = {tooltip: {trigger: 'item',formatter: '{b}:{d}%'},color: ['#ffc474', '#fdd569', '#fd866a', '#da4745', '#9f87ff', '#8abb78', '#35e1b1', '#73ddff', '#73acff', '#788fbb'],series: [{type: 'pie',radius: ['40%', '70%'],avoidLabelOverlap: true,label: {// show: false,// position: 'center'normal: {// 各分区的提示内容// params: 即下面传入的data数组,通过自定义函数,展示你想要的内容和格式formatter: function(params) {return params.name + ' ' + params.percent + '%'},textStyle: { // 提示文字的样式fontSize: 13}}},emphasis: {label: {show: true}},data: this.chartsb}]}myChart.setOption(option, true)// myChart.on('click', function(params) {// console.log(params)// this.$router.push({ path: '/specialist',// query: {// merchant: this.queryParams.merchant,// loginId: this.getQueryVariable('loginId'),// // category: row.category,// token: this.getQueryVariable('token')// }})// })window.addEventListener('resize', () => {myChart.resize()})}
