zoukankan      html  css  js  c++  java
  • 认识Echarts(网址:http://echarts.baidu.com/tutorial.html#ECharts%20%E7%89%B9%E6%80%A7%E4%BB%8B%E7%BB%8D)

    first.html:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>First ECharts</title>
    <script type="text/javascript" src="../js/echarts.min.js"></script>
    </head>
    <body>
    <div id="charts" style=" 600px;height: 400px"></div>
    </body>
    <script type="text/javascript">
    var charts = echarts.init(document.getElementById("charts"));

    var config = {
    title: {
    text:'销量信息',
    show:true,
    textStyle:{
    color:'red'
    },
    left:"center"
    },
    tooltip: {
    triggerOn:'mousemove',
    formatter:'{b}的销量为:{c}'
    },
    legend: {
    left:'left',
    orient:'vertical',
    data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
    },
    series: [{
    name: '销量',
    type: 'pie',
    radius:['30%','60%'],
    data:[
    {value:0,name:'衬衫'},
    {value:10,name:'羊毛衫'},
    {value:50,name:'雪纺衫'},
    {value:5,name:'裤子'},
    {value:30,name:'高跟鞋'},
    {value:12,name:'袜子'}
    ]
    }]
    };
    charts.setOption(config);


    charts.on('click',function(data){
    console.log(data.name);
    console.log(data.value);
    });

    </script>
    </html>

    pie.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>First ECharts</title>
    <script type="text/javascript" src="../js/echarts.min.js"></script>
    </head>
    <body>
    <div id="charts" style=" 400px;height: 300px"></div>
    <input type="button" onclick="test()" value="Click">
    </body>
    <script type="text/javascript">
    var charts = echarts.init(document.getElementById("charts"));

    var config = {
    title: {
    text:'销量信息',
    show:true,
    textStyle:{
    color:'red'
    },
    left:"50px"
    },
    tooltip: {},
    legend: {
    data:['销量']
    },
    xAxis: {
    data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
    },
    yAxis: {},
    series: [{
    name: '销量',
    type: 'bar',
    data: [0, 0, 0, 0, 0, 0]
    }]
    };
    charts.showLoading();
    charts.setOption(config);

    function test(){
    charts.hideLoading();
    charts.setOption({
    series:[{
    data : [5, 20, 36, 10, 10, 20]
    }]
    })
    }
    </script>
    </html>

  • 相关阅读:
    chrony软件使用说明
    使用cobbler批量安装操作系统(基于Centos7.x )
    kickstart模式实现批量安装centos7.x系统
    uCGUI字符串显示过程分析和uCGUI字库的组建
    Network boot from AMD Am79C970A
    关于TFTLCD硬件接口和驱动的问题
    (转)关于模拟地和数字地分开的问题解释!
    获取单片机代码运行时间的方法
    stm32类型cl、vl、xl、ld、md、hd的含义
    RS232转RS485电路图分析
  • 原文地址:https://www.cnblogs.com/hwgok/p/5879715.html
Copyright © 2011-2022 走看看