zoukankan      html  css  js  c++  java
  • The open source JavaScript graphing library that powers Plotly

    https://plot.ly/javascript/time-series/

    https://plot.ly/javascript/

    https://github.com/plotly/plotly.js

    <!DOCTYPE html>
    <html>
    
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Time Series in plotly.js</title>
      <!-- Plotly.js -->
      <script src="dist/plotly.min.js" type="text/javascript"></script>
    </head>
    
    <body>
      
      <div id="myDiv"><!-- Plotly chart will be drawn inside this DIV --></div>
      <script>
        <!-- JAVASCRIPT CODE GOES HERE -->
    Plotly.d3.csv("finance-charts-apple.csv", function(err, rows){
    
      function unpack(rows, key) {
      return rows.map(function(row) { return row[key]; });
    }
    
      
    var trace1 = {
      type: "scatter",
      mode: "lines",
      name: 'AAPL High',
      x: unpack(rows, 'Date'),
      y: unpack(rows, 'AAPL.High'),
      line: {color: '#17BECF'}
    }
    
    var trace2 = {
      type: "scatter",
      mode: "lines",
      name: 'AAPL Low',
      x: unpack(rows, 'Date'),
      y: unpack(rows, 'AAPL.Low'),
      line: {color: '#7F7F7F'}
    }
    
    var data = [trace1,trace2];
        
    var layout = {
      title: 'Basic Time Series', 
    };
    
    Plotly.newPlot('myDiv', data, layout);
    })  </script>
    </body>
    

      

    <!DOCTYPE html>
    <html>
    
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Time Series in plotly.js</title>
      <!-- Plotly.js -->
      <script src="dist/plotly.min.js" type="text/javascript"  charset="utf-8"></script>
        <script src="dist/plotly-locale-zh-cn.js" charset="utf-8" type="text/javascript"></script>
    </head>
    
    <body>
      
      <div id="myDiv"><!-- Plotly chart will be drawn inside this DIV --></div>
      <script>
        <!-- JAVASCRIPT CODE GOES HERE -->
    Plotly.setPlotConfig({locale: 'zh-CN'})  //月份显示中文
    Plotly.d3.csv("finance-charts-apple.csv", function(err, rows){
    
      function unpack(rows, key) {
      return rows.map(function(row) { return row[key]; });
    }
    
      
    var trace1 = {
      type: "scatter",
      mode: "lines",
      name: 'AAPL High',
      x: unpack(rows, 'Date'),
      y: unpack(rows, 'AAPL.High'),
      line: {color: '#17BECF'}
    }
    
    var trace2 = {
      type: "scatter",
      mode: "lines",
      name: 'AAPL Low',
      x: unpack(rows, 'Date'),
      y: unpack(rows, 'AAPL.Low'),
      line: {color: '#7F7F7F'}
    }
    
    var data = [trace1,trace2];
        
    var layout = {
      title: 'Basic Time Series', 
    };
    
    Plotly.newPlot('myDiv', data, layout,{locale: 'zh-CN'}); //
    })  
    
    </script>
    </body>
    </html>
    

      

  • 相关阅读:
    The Zen of Python —— Python 之禅
    单片机最小系统
    处理器是如何驱动外设的
    嵌入式系统、开发板概念
    Xilinx Zynq ZC-702 开发(02)—— 通过 Xilinx SDK 调试 Linux 应用
    Linux 总线、设备、驱动模型 与 设备树
    Xilinx Zynq ZC-702 开发(01)—— 概览
    DLL 函数中使用结构体指针作函数参数(C# 调用 C++ 的 DLL)
    新装 Win7 系统装完驱动精灵,一打开到检测界面就卡死——原因与解决方案
    WPF 主窗口关闭时结束所有相关线程
  • 原文地址:https://www.cnblogs.com/geovindu/p/9229601.html
Copyright © 2011-2022 走看看