码迷,mamicode.com
首页 > 其他好文 > 详细

node后台生成echarts图表

时间:2019-02-16 09:27:48      阅读:696      评论:0      收藏:0      [点我收藏+]

标签:offsetx   buffer   class   file   name   har   ima   var   dir   

 

 

 1 //2,生成图片数据
 2     var option = {
 3       tooltip: {
 4         trigger: ‘item‘,
 5         formatter: "{a} <br/>{b} : {c} ({d}%)"
 6       },
 7 
 8       series: [{
 9         name: ‘访问来源‘,
10         type: ‘pie‘,
11         radius: ‘55%‘,
12         center: [‘50%‘, ‘60%‘],
13         data: [
14           { value: 335, name: ‘直接访问‘ },
15           { value: 310, name: ‘邮件营销‘ },
16           { value: 234, name: ‘联盟广告‘ },
17           { value: 135, name: ‘视频广告‘ },
18           { value: 1548, name: ‘搜索引擎‘ }
19         ],
20         itemStyle: {
21           emphasis: {
22             shadowBlur: 10,
23             shadowOffsetX: 0,
24             shadowColor: ‘rgba(0, 0, 0, 0.5)‘
25           }
26         }
27       }]
28     };
29   //模块引入
30     var node_echarts = require(‘node-echarts‘);
31     var path = require(‘path‘);
32 
33     node_echarts({
34       width: 500, // Image width, type is number. 
35       height: 500, // Image height, type is number. 
36       option: option, // Echarts configuration, type is Object.
37       //If the path  is not set, return the Buffer of image. 
38       path: path.join(__dirname, ‘../data/image1.png‘), // Path is filepath of the image which will be created.
39       enableAutoDispose: true //Enable auto-dispose echarts after the image is created.
40     })

 

node后台生成echarts图表

标签:offsetx   buffer   class   file   name   har   ima   var   dir   

原文地址:https://www.cnblogs.com/vichang/p/10386714.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!