深圳全飞鸿

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 456|回复: 0
打印 上一主题 下一主题

echart 之bar的一种案例

[复制链接]

800

主题

1379

帖子

7704

积分

版主

Rank: 7Rank: 7Rank: 7

积分
7704
跳转到指定楼层
楼主
发表于 2021-12-18 17:57:33 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式


  1. function echarts_2() {
  2.     // 基于准备好的dom,初始化echarts实例
  3.     var myChart = echarts.init(document.getElementById('echart2'));
  4.     option = {
  5.                         //  backgroundColor: '#00265f',
  6.                         tooltip: {
  7.                                 trigger: 'axis',
  8.                                 axisPointer: { type: 'shadow'}
  9.                         },
  10.                         grid: {
  11.                                 left: '0%',
  12.                         top:'10px',
  13.                                 right: '0%',
  14.                                 bottom: '4%',
  15.                                 containLabel: true
  16.                         },
  17.                         xAxis: [{
  18.         type: 'category',
  19.               data: ['08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18'],
  20.         axisLine: {
  21.           show: true,
  22.                                         lineStyle: {
  23.             color: "rgba(255,255,255,.1)",
  24.             width: 1,
  25.             type: "solid"
  26.           },
  27.         },
  28.                
  29.         axisTick: {
  30.             show: false,
  31.         },
  32.                                 axisLabel:  {
  33.                                         interval: 0,
  34.                                         // rotate:50,
  35.                                         show: true,
  36.                                         splitNumber: 15,
  37.                                         textStyle: {
  38.                                                 color: "rgba(255,255,255,.6)",
  39.                                                 fontSize: '12',
  40.                                         },
  41.                                 },
  42.                         }],
  43.                         yAxis: [{
  44.                                         type: 'value',
  45.                                         axisLabel: {
  46.                                                  //formatter: '{value} %'
  47.                                 show:true,
  48.                                  textStyle: {
  49.                                                 color: "rgba(255,255,255,.6)",
  50.                                                                                         fontSize: '12',
  51.                                                                         },
  52.                                         },
  53.                                         axisTick: {
  54.                                                         show: false,
  55.                                         },
  56.                                         axisLine: {
  57.                                                         show: true,
  58.                                                         lineStyle: {
  59.                                                                         color: "rgba(255,255,255,.1        )",
  60.                                                                         width: 1,
  61.                                                                         type: "solid"
  62.                                                         },
  63.                                         },
  64.                                         splitLine: {
  65.                                                         lineStyle: {
  66.                                                                  color: "rgba(255,255,255,.1)",
  67.                                                         }
  68.                                         }
  69.                         }],
  70.                         series: [
  71.                         {
  72.                                 type: 'bar',
  73.                                 data: [1500, 1200, 600, -200, 300, 300, 900, 1200, 600, 200, 300],
  74.                                 barWidth:'35%', //柱子宽度
  75.                                 // barGap: 1, //柱子之间间距
  76.                                 itemStyle: {
  77.                                         normal: {
  78.                                                 color:'#27d08a',
  79.                                                 opacity: 1,
  80.                                                 barBorderRadius: 5,
  81.                                         }
  82.                                 }
  83.                         }
  84.                        
  85.                 ]
  86.         };
  87.       
  88.         // 使用刚指定的配置项和数据显示图表。
  89.         myChart.setOption(option);
  90.         window.addEventListener("resize",function(){
  91.             myChart.resize();
  92.         });
  93.     }
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|nagomes  

GMT+8, 2025-5-4 21:39 , Processed in 0.036821 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表