123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- import * as echarts from '../ec-canvas/echarts'
- import { mergeOptions } from '../ec-canvas/defaultOption'
- import CensusApi from '../../../apis/census'
- Component({
- /**
- * 组件的初始数据
- */
- data: {
- activeType: 0,
- ec: {
- onInit: initChart
- },
- ec2: {
- onInit: init2Chart
- },
- barEc: {
- onInit: initBarChart
- },
- dataNumList: [
- {
- value: 20,
- label: '展位浏览量',
- key: 'goods_num',
- bgColor: 'rgba(115,142,254,0.1)',
- color: '#738EFE'
- },
- {
- value: 20,
- label: '客户访问量',
- key: 'video_num',
- bgColor: 'rgba(77,174,255,0.1)',
- color: '#4DAEFF'
- },
- {
- value: 20,
- label: '商务询盘量',
- bgColor: 'rgba(23,210,210,0.1)',
- color: '#17D2D2'
- },
- {
- value: 20,
- label: '展位商品数',
- bgColor: 'rgba(246,151,88,0.1)',
- color: '#F69758'
-
- }
- ],
- chartTypes: [
- {
- icon: 'data_booth',
- name: '展位数据',
- value: 0
- },
- {
- icon: 'data_visitor',
- name: '访客数据',
- value: 1
- },
- {
- icon: 'data_wares',
- name: '商品数据',
- value: 2
- },
- ]
- },
- lifetimes: {
-
- },
- ready () {
- },
- methods: {
- changeActiveType (e) {
- const { value } = e.currentTarget.dataset
- this.setData({
- activeType: value
- })
- }
- }
- })
- function initChart(canvas, width, height, dpr) {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- canvas.setChart(chart);
-
- var option = {
- title: {
- text: ''
- },
- tooltip: {
- formatter: `{a}: {c} \n ${new Date().getFullYear()}-{b}`
- },
- series: [
- {
- data: [500,500,500,500,500],
- type: 'line',
- smooth: true,
- symbolSize: 0,
- name: '浏览量'
- },
- ]
- };
- chart.setOption(mergeOptions(option));
- return chart;
- }
- function initBarChart(canvas, width, height, dpr) {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- canvas.setChart(chart);
- var option = {
- title: {
- text: ''
- },
- xAxis: {
- type: 'category',
- data: ['aaa', 'aaa', 'aaa', 'asdsad'],
- axisLabel: {
- align: 'center'
- }
- },
- series: [
- {
- name: '浏览量',
- type: 'bar',
- data: [2.0, 4.9, 7.0, 11],
- barGap: 0,
- barWidth: 10,
- itemStyle: {
- barBorderRadius:[10, 10, 0, 0],
- }
- }
- ]
- };
- chart.setOption(mergeOptions(option));
- return chart;
- }
- function init2Chart(canvas, width, height, dpr) {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- canvas.setChart(chart);
- var option = {
- series: [
- {
- data: [1000,1000,1000,1000],
- type: 'line',
- smooth: true,
- name: '客户访问量',
- areaStyle: {
- opacity: 0.1
- },
- symbolSize: 0
- },
- {
- data: [1201, 1201, 1201, 1201, 1201, 1201],
- type: 'line',
- smooth: true,
- name: '商务询盘量',
- areaStyle: {
- opacity: 0.1
- },
- symbolSize: 0
- },
- ]
- };
- chart.setOption(mergeOptions(option));
- return chart;
- }
|