Echarts.js简介

JavaScript012

Echarts.js简介,第1张

在平时开发项目时,免不了需要对数据进行图表显示的需求,比如:趋势图、饼状图、柱形图等。

Echarts.js是来自百度团队研发的图表js插件,利用HTML+js实现折线图、饼状图、热点图、3d图形等等,可在PC和移动端显示,加载速度快,功能丰富。

https://echarts.apache.org/zh/index.html

官网首页有着很多实例以及相关介绍,获取echart.js可以从本人百度网盘获取,包含所有图表组件,可直接引用。

链接: https://pan.baidu.com/s/1IEm8NGwqq4ExgYWp8mz9CA

提取码:aihy

为Echarts放置一个具备宽高的DOM容器

Echarts加载数据

环境 Vue2.x

之前使用的报表开发插件       vue-easy-print @0.0.8     

能打印pdf报表,但是存在 不能打印多页 的问题,使用人数较少,文档较少,版本较低,放弃.

改用新的插件      print-js

能在原来的基础上解决打印多页pdf的问题

npm install print-js --save

    import printJS from 'print-js'

<visa-template  id="aaa" ></visa-template>

<el-button type="primary" onclick="printJS( {printable:'aaa', type:'html',scanStyles:false,css:['https://qiniu.smartpilot.cn/myreport.css'],style:''})" >

  生成报表

</el-button>

例如:

    style:'{div:{color:#008855}}'

    字体缩小  .reportTable{font-size:0.8em !important }

#能分页靠的是这个css

```

.reportBox {

  text-align: center

  width: 100%

  margin: auto

  page-break-after: always

  margin-top: 20px

  font-family: "微软雅黑"

}

```