123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import * as echarts from '../ec-canvas/echarts'
- import { mergeOptions } from '../ec-canvas/defaultOption'
- function initChart(canvas, width, height, dpr) {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- canvas.setChart(chart);
- var option = {
- series: [
- {
- data: [[0, 1000], [3, 500], [6, 750], [9, 1400], [12, 1250], [15, 1600], [18, 1800]],
- type: 'line',
- smooth: true,
- name: '主页访问量',
- areaStyle: {
- opacity: 0.1
- },
- symbolSize: 0
- },
- {
- data: [[0, 1250], [3, 600], [6, 800], [9, 1500], [12, 1400], [15, 1750], [18, 2000]],
- type: 'line',
- smooth: true,
- name: '场景浏览量',
- areaStyle: {
- opacity: 0.1
- },
- symbolSize: 0
- },
- ]
- };
- 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],
- }
- },
- {
- 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;
- }
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- ec: {
- onInit: initChart
- },
- barEc: {
- onInit: initBarChart
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- }
- })
|