• 624 Echarts常用图表 直角坐标系常见配置: 网格 grid, 坐标轴 axis, 区域缩放 dataZoom


    直角坐标系的常见配置


    13.直角坐标系的常用配置_grid.html

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <script src="lib/echarts.min.js"></script>
    </head>
    
    <body>
      <div style=" 800px;height:600px"></div>
      <script>
        var mCharts = echarts.init(document.querySelector("div"))
        var xDataArr = ['张三', '李四', '王五', '闰土', '小明', '茅台', '二妞', '大强']
        var yDataArr = [88, 92, 63, 77, 94, 80, 72, 86]
    
        var option = {
          // 坐标轴容器
          grid: {
            show: true, // 是否可见
            borderWidth: 10, // 边框的宽度
            borderColor: 'yellowgreen', // 边框的颜色
            left: 60, // 边框的位置
            top: 30,
             600, // 边框的大小
            height: 350,
            backgroundColor: 'skyblue'
          },
          xAxis: {
            type: 'category',
            data: xDataArr
          },
          yAxis: {
            type: 'value'
          },
          series: [
            {
              name: '语文',
              type: 'bar',
              markPoint: {
                data: [
                  {
                    type: 'max', name: '最大值'
                  }, {
                    type: 'min', name: '最小值'
                  }
                ]
              },
              markLine: {
                data: [
                  {
                    type: 'average', name: '平均值'
                  }
                ]
              },
              label: {
                show: true,
                rotate: 60,
                position: 'top',
                // color: '#fff' 
              },
              barWidth: '50%',
              data: yDataArr
            }
          ]
        }
        mCharts.setOption(option)
      </script>
    </body>
    
    </html>
    


    • 配置2: 坐标轴 axis

    14.直角坐标系的常用配置_axis.html

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <script src="lib/echarts.min.js"></script>
    </head>
    
    <body>
      <div style=" 600px;height:400px"></div>
      <script>
        var mCharts = echarts.init(document.querySelector("div"))
        var xDataArr = ['张三', '李四', '王五', '闰土', '小明', '茅台', '二妞', '大强']
        var yDataArr = [88, 92, 63, 77, 94, 80, 72, 86]
    
        var option = {
          grid: {
            show: true,
            borderColor: '#399',
            borderWidth: 8
          },
          xAxis: {
            type: 'category',
            data: xDataArr,
            position: 'top' // 控制坐标轴的位置
          },
          yAxis: {
            type: 'value',
            position: 'right' // 控制坐标轴的位置
          },
          series: [
            {
              name: '语文',
              type: 'bar',
              markPoint: {
                data: [
                  {
                    type: 'max', name: '最大值'
                  }, {
                    type: 'min', name: '最小值'
                  }
                ]
              },
              markLine: {
                data: [
                  {
                    type: 'average', name: '平均值'
                  }
                ]
              },
              label: {
                show: true,
                rotate: 60,
                position: 'top'
              },
              barWidth: '30%',
              data: yDataArr
            }
          ]
        }
        mCharts.setOption(option)
      </script>
    </body>
    
    </html>
    


    • 配置3: 区域缩放 dataZoom


    15.直角坐标系的常用配置dataZoom.html

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <script src="lib/echarts.min.js"></script>
    </head>
    
    <body>
      <div style=" 600px;height:400px"></div>
      <script>
        var mCharts = echarts.init(document.querySelector("div"))
        var xDataArr = ['张三', '李四', '王五', '闰土', '小明', '茅台', '二妞', '大强']
        var yDataArr = [88, 92, 63, 77, 94, 80, 72, 86]
    
        var option = {
          // 控制区域缩放效果的实现
          dataZoom: [
            {
              // 缩放的类型: slide代表滑块, inside代表依靠鼠标滚轮
              type: 'slider',
              // type: 'inside'
              xAxisIndex: 0
            },
            {
              type: 'slider',
              yAxisIndex: 0,
              start: 0, // 渲染完成后, 数据筛选的初始值, 百分比
              end: 80 // 渲染完成后, 数据筛选的结束值, 百分比
            }
          ],
          toolbox: {
            feature: {
              dataZoom: {}
            }
          },
          grid: {
            show: true,
            borderColor: 'red',
          },
          xAxis: {
            type: 'category',
            data: xDataArr
          },
          yAxis: {
            type: 'value'
          },
          series: [
            {
              name: '语文',
              type: 'bar',
              markPoint: {
                data: [
                  {
                    type: 'max', name: '最大值'
                  }, {
                    type: 'min', name: '最小值'
                  }
                ]
              },
              markLine: {
                data: [
                  {
                    type: 'average', name: '平均值'
                  }
                ]
              },
              label: {
                show: true,
                rotate: 60,
                position: 'top'
              },
              barWidth: '30%',
              data: yDataArr
            }
          ]
        }
        mCharts.setOption(option)
      </script>
    </body>
    
    </html>
    



















  • 相关阅读:
    汇编代码中db,dw,dd的区别
    利用汇编详解栈结构
    80X86指令总结
    【原创】自己动手写的一个查看函数API地址的小工具
    【初学破解】暴力破解绕过程序认证
    OD基本汇编指令
    排序算法
    数据聚类算法-K-means算法
    数据预测算法-ARIMA预测
    数据预测算法-指数平滑法-1
  • 原文地址:https://www.cnblogs.com/jianjie/p/14429525.html
Copyright © 2020-2023  润新知