您的位置 首页 > 数码极客

echarts统计图如何实现打印

1.折线图

import * as echarts from 'echarts';

var chartDom = document.getElementById('main');

var myChart = ec(chartDom);

var option;

option = {

xAxis: {

type: 'category',

data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

},

yAxis: {

type: 'value'

},

series: [{

data: [150, 230, 224, 218, 135, 147, 260],

type: 'line'

}]

};

option && myC(option);


2.柱状图

import * as echarts from 'echarts';

var chartDom = document.getElementById('main');

var myChart = ec(chartDom);

var option;

option = {

xAxis: {

type: 'category',

data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

},

yAxis: {

type: 'value'

},

series: [{

data: [120, 200, 150, 80, 70, 110, 130],

type: 'bar',

showBackground: true,

backgroundStyle: {

color: 'rgba(180, 180, 180, 0.2)'

}

}]

};

option && myC(option);


3.饼图

import * as echarts from 'echarts';

var chartDom = document.getElementById('main');

var myChart = ec(chartDom);

var option;

option = {

tooltip: {

trigger: 'item'

},

legend: {

top: '5%',

left: 'center'

},

series: [

{

name: '访问来源',

type: 'pie',

radius: ['40%', '70%'],

avoidLabelOverlap: false,

itemStyle: {

borderRadius: 10,

borderColor: '#fff',

borderWidth: 2

},

label: {

show: false,

position: 'center'

},

emphasis: {

label: {

show: true,

fontSize: '40',

fontWeight: 'bold'

}

},

labelLine: {

show: false

},

data: [

{value: 1048, name: '搜索引擎'},

{value: 735, name: '直接访问'},

{value: 580, name: '邮件营销'},

{value: 484, name: '联盟广告'},

{value: 300, name: '视频广告'}

]

}

]

};

option && myC(option);


责任编辑: 鲁达

1.内容基于多重复合算法人工智能语言模型创作,旨在以深度学习研究为目的传播信息知识,内容观点与本网站无关,反馈举报请
2.仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证;
3.本站属于非营利性站点无毒无广告,请读者放心使用!

“echarts统计图如何实现打印”边界阅读