zoukankan      html  css  js  c++  java
  • node后台生成echarts图表

     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        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     })
  • 相关阅读:
    SQL执行效率1
    php经典算法(转载)
    linux自用命令
    vim基本命令
    xampp安装
    BUU-rsa
    z3约束器学习笔记
    面试前夕oi挣扎式复习
    bss上的格式化字符串漏洞
    一、汇编
  • 原文地址:https://www.cnblogs.com/vichang/p/10386714.html
Copyright © 2011-2022 走看看