移动端写一个图表引用echarts,highcharts插件,本次要找一个能够显示最新数据的折线图,最后只找到显示最大值;
找到echarts的实例;记一下个各功能。
 
<!DOCTYPE html>
<html style="height: 100%">
<head>
  <meta charset="utf-8">
  <script type="text/javascript" src="echarts/echarts.min.js"></script>
  <script type="text/javascript" src="echarts/echarts-gl.min.js"></script>
  <script type="text/javascript" src="echarts/ecStat.min.js"></script>
  <script type="text/javascript" src="echarts/dataTool.min.js"></script>
  <script type="text/javascript" src="echarts/china.js"></script>
  <script type="text/javascript" src="echarts/world.js"></script>
  <!-- <script type="text/javascript" src="echarts/api.js"></script> -->
  <script type="text/javascript" src="echarts/bmap.min.js"></script>
  <script type="text/javascript" src="echarts/simplex.js"></script>
 
</head>
<body style="height: 100%; margin: 0">
  <div id="container" style="height: 100%"></div>
  <script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {
          title: {
              text: 'echarts的示例',//标题
              subtext: '纯属虚构',//标题2
          },
          tooltip: {
              trigger: 'axis',
          },
          legend: {
              data: ['最高气温', '最低气温']
          },
          toolbox: {//控制上的小按钮
              show: true,
              feature: {
                    dataZoom: {
                          yAxisIndex: 'none'
                    },
                    dataView: { readOnly: false },
                    magicType: { type: ['line', 'bar'] },
                    restore: {},
                    saveAsImage: {}
                  }
          },
          xAxis: {
              type: 'category',
              boundaryGap: true,//控制是否靠边
              data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
          },
          yAxis: {
              type: 'value',
              axisLabel: {
                formatter: '{value} °C'//y轴的单位
              }
          },

          dataZoom: [{//滚动条
                startValue: '2014-06-01',
                show: false,//显示,隐藏滚动条;

              }, {
                type: 'inside'
              }],

          visualMap: {//控制折线曲线颜色
                top: 10,
                right: 10,
                pieces: [{
                    gt: 0,
                    lte: 50,
                    color: '#096'
                }, {
                    gt: 50,
                    lte: 100,
                    color: '#ffde33'
                }, {
                    gt: 100,
                    lte: 150,
                    color: '#ff9933'
                }, {
                    gt: 150,
                    lte: 200,
                    color: '#cc0033'
                }, {
                    gt: 200,
                    lte: 300,
                    color: '#660099'
                }, {
                    gt: 300,
                    color: '#7e0023'
                }],
                outOfRange: {
                    color: '#999'
                }
           },
           series: [
                {//第一条线
                  name: '最高气温',
                  type: 'line',
                  smooth: true,//尖锐、圆弧
                  data: [11, 11, 15, 13, 12, 13, 10],
                  markPoint: {//最大、小值汽泡
                  data: [
                      { type: 'max', name: '最大值' },
                      { type: 'min', name: '最小值' }
                  ]
                },
                markLine: {
                      data: [
                          { type: 'average', name: '平均值' }
                      ]
                }
            },
              {//第2条线
                name: '最低气温',
                type: 'line',
                areaStyle: {},
                data: [1, -2, 2, 5, 3, 2, 0],
                markPoint: {
                       data: [
                            { name: '周最低', value: -2, xAxis: 1, yAxis: -1.5 }
                       ]
                },
                markPoint: {
                      data: [
                          // 纵轴,默认
                          {      type: 'max', name: '最大值',
                            symbol: 'emptyCircle',
                              itemStyle: {
                                  normal: {
                                         color: '#dc143c',
                                         label: {
                                            position: 'top'
                                        }
                                       }
                             }
                           },
                          {         type: 'min', name: '最小值',
                                    symbol: 'emptyCircle',
                               itemStyle: {
                                    normal: {
                                          color: '#dc143c',
                                           label: {
                                                position: 'bottom'
                                           }
                                     }
                              }
                          },
                          // 横轴
                          {   type: 'max',
                              name: '最大值',
                              valueIndex: 0,
                              symbol: 'emptyCircle',
                              itemStyle: {
                                  normal: {
                                        color: '#1e90ff',
                                           label: {
                                             position: 'right'
                                           }
                                    }
                               }
                           },
                          {      type: 'min',
                            name: '最小值',
                            valueIndex: 0,
                            symbol: 'emptyCircle',
                            itemStyle: {
                                  normal: {
                                         color: '#1e90ff',
                                         label: {
                                              position: 'left'
                                         }
                                      }
 
                                  }
                           }
                        ]
                    },
                  markLine: {
                        data: [
                            // 纵轴,默认
                            { type: 'max', name: '最大值', itemStyle: { normal: { color: '#dc143c' } } },
                            { type: 'min', name: '最小值', itemStyle: { normal: { color: '#dc143c' } } },
                            { type: 'average', name: '平均值', itemStyle: { normal: { color: '#dc143c' } } },
                            // 横轴
                            { type: 'max', name: '最大值', valueIndex: 0, itemStyle: { normal: { color: '#1e90ff' } } },
                            { type: 'min', name: '最小值', valueIndex: 0, itemStyle: { normal: { color: '#1e90ff' } } },
                            { type: 'average', name: '平均值', valueIndex: 0, itemStyle: { normal: { color: '#1e90ff' } } }
                        ]
                  }
              },
            ],
            markLine: {
                  data: [
                      { type: 'average', name: '平均值' },
                      [{
                          symbol: 'none',
                          x: '90%',
                          yAxis: 'max'
                      }, {
                          symbol: 'circle',
                          label: {
                          normal: {
                          position: 'start',
                          formatter: '最大值'
                         }
                      },
                      type: 'max',
                      name: '最高点'
                      }]
                    ]
                  },
 
                }
 
 
                ;
              if (option && typeof option === "object") {
                  myChart.setOption(option, true);
              }
        </script>
        </body>
        </html>

移动端引用echarts的折线图的更多相关文章

  1. echarts版本折线图

    1.效果如下:         绘制折线图,应该算是说echarts中使用最简单也算使用频率最高的一种功能了吧.根据官网列子能找出规律,只是有些属性对于初接触者来说,会有点陌生,不过仔细阅读一下还是不 ...

  2. Echarts line折线图使用(vue)

    实现 首先引入echarts工具 // vue文件中引入echarts工具 let echarts = require('echarts/lib/echarts') require('echarts/ ...

  3. ECharts使用—折线图动态加载

    最近需求中用到折线图,单线条,多线交错,之前是散点图,用的是另一个 amcharts.js,这个文档也能找的到,回归早本次重点:ECharts 一.首先引入echarts.common.min.js文 ...

  4. echarts实现折线图

    前端框架使用的angular,折线图使用echarts实现. 这里实现的折线图只是简单是折线图,折线图显示在table中,不需要xy轴的数据说明. 1. item.component.html < ...

  5. Echarts案例-折线图

    一:先在官网下载 https://www.echartsjs.com/zh/download.html 然后再建立工程,导入这两个包: 写代码: <!DOCTYPE html> <h ...

  6. echarts自定义折线图横坐标时间间隔踩坑总结

    折线图需求:横坐标为时间,要求按一定间隔展示,鼠标移至折线上间隔时间内的数据也可展示 其实很简单的一个配置就可搞定,但在不熟悉echarts配置的情况下,就很懵逼 xAxis: { boundaryG ...

  7. echarts之折线图介绍及使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. 使用Echarts实现折线图的一点总结

    使用Echarts的一点总结 1.安装,我使用得vue cnpm install echarts --save 2.在入口文件main.js中注册,并使用 // 引入折线图 echarts impor ...

  9. ECharts绘制折线图

    首先看实现好的页面 实现 首先引入echarts工具 // vue文件中引入echarts工具 let echarts = require('echarts/lib/echarts') require ...

随机推荐

  1. 测试oracle数据库连接

    1.ping 192.168.0.12.telnet 192.168.0.1 1521 按下ctrl+] 组合键出现命令回显才是端口连接成 3.tnsping 192.168.0.1:1521/db

  2. 使用python操作excel表格

    首先 pip install xlrd  安装相关模块 其次:使用方法: 1 导入模块 import xlrd 2 打开excel文件读取数据 worksheet=xlrd.open_workbook ...

  3. uva-10341-二分法

    题意:已知方程的根在0-1范围内,求解方程的根,如果方程不存在根,那就输出 no solution. 直接二分,保留四位小数. #include "pch.h" #include ...

  4. SAP生产机该不该开放Debuger权限(转)

    前段时间公司定制系统在调用SAP RFC接口的时候报错了,看错误消息一时半会儿也不知道是哪里参数数据错误,就想着进到SAP系统里面对这个接口做远程Debuger,跟踪一下参数变量的变化,结果发现根本就 ...

  5. py库: pyautogui (自动测试模块,模拟鼠标、键盘动作)

    PyAutoGUI 是一个人性化的跨平台 GUI 自动测试模块 pyautogui 库 2017-10-4 pip install pyautogui python pip.exe install p ...

  6. openx 添加新表和据库表和字段

    OpenX的版本是2.8.10.在数据表加完数据库之后,还不能读取和保存字段. OpenX使用scheme来 管理数据库表和字段, 修改数据库结构同时也要修改相关schema, 一个是etc/tabl ...

  7. ubuntu14.04 rabbitmq安装与使用 --修改RabbitMQ数据存储位置

    参考:https://blog.csdn.net/tianjiewang/article/details/58383062 说明: ubuntu14.04   rabiitmq 默认 安装路径 /va ...

  8. 静态方法@staticmethod

    staticmethod 返回函数的静态方法.该方法不强制要求传递参数,名义上在类里面归类管理,但是不能使用类的变量和实例的变量是类的工具包 如下声明一个静态方法: class Room: t = 1 ...

  9. STM32F103C8开发板原理图和管脚图

  10. subprocess.Popen模块

    该类用于在一个新的进程中执行一个子程序.subprocess模块底层的进程创建和管理是由Popen类来处理的. 1.subprocess.Popen的构造函数 class subprocess.Pop ...