zoukankan      html  css  js  c++  java
  • ECharts柱状图线形图

    <div id="main" style=" 100%;height:510px;"></div>
    
    
    var myChart = echarts.init(document.getElementById('main'));
    //创建拿到外面,里面判断没有值可以清空

    var
    len = msg.row_data.record;
            if(len.length > 0){
    var total = msg.row_data.total_records; var ary = []; var option = {} var seriesType = '' if(Form == '1'){ //柱状 seriesType = 'bar'; }else if(Form == '2'){ //线型 seriesType = 'line'; } option = { legend: {}, tooltip: {}, dataset: { // 用 dimensions 指定了维度的顺序。直角坐标系中,如果 X 轴 type 为 category, // 默认把第一个维度映射到 X 轴上,后面维度映射到 Y 轴上。 // 如果不指定 dimensions,也可以通过指定 series.encode // 完成映射,参见后文。 dimensions: ['product', '员工总数', '参训人数', '完成人数'], source: [] }, // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。 xAxis: { type: 'category' }, // 声明一个 Y 轴,数值轴。 yAxis: {}, // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。 series: [{ type: seriesType }, { type: seriesType }, { type: seriesType }] }; $(len).each(function(index,item){ var obj = { product: item.CurrYear + '年' + item.CurrMonth + '月', '员工总数': item.StaffCount_Total, '参训人数': item.StaffCount_Actual, '完成人数': item.StaffCount_Finish } ary.push(obj); }) option.dataset.source = ary; myChart.setOption(option);
            }else{
              myChart.clear();
            }
     
    Scripts/echarts.min.js
    https://echarts.apache.org/handbook/zh/get-started
  • 相关阅读:
    FileUpload1上传控件
    docker如何push镜像到docker hub个人的仓库
    docker的ubuntu镜像无ifconfig和ping命令
    keystone同步数据库的时候提示error
    openstack安装dashboard后访问horizon出错 500 or 504
    装了ubuntu之后,只能进入ubuntu系统,不能进入windows系统
    Kernal Panic
    无法获得锁 /var/lib/dpkg/lock -open
    用户 'NT AUTHORITYIUSR' 登录失败
    配置错误:不能在此路径中使用此配置节。
  • 原文地址:https://www.cnblogs.com/liufeiran/p/15420945.html
Copyright © 2011-2022 走看看