LoginSignup
1
0

More than 5 years have passed since last update.

plotly で折れ線グラフを描く

Last updated at Posted at 2018-03-30

次のようなグラフを作成します。
plotly_mar3001.png

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8" />
<!--
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
-->
<script src="/js/plotly-latest.min.js"></script>
</head>

<body>  
<h2>サンプル</h2>
<div id="myDiv"></div>
<script src="ex01.js"></script>
Mar/30/2018<p />
</body>
</html>
ex01.js
// ---------------------------------------------------------------
//  ex01.js
//
//                  Mar/30/2018
//
// ---------------------------------------------------------------
var trace1 = {
      x: [0,1,2,3,4,5],
      y: [3,10, 15, 13, 17,12],
      type: 'scatter'
}

var trace2 = {
      x: [0,1,2,3,4,5],
      y: [5,16, 5, 11, 9,8],
      type: 'scatter'
}

var trace3 = {
      x: [0,1,2,3,4,5],
      y: [7,10, 8, 12, 4,3],
      type: 'scatter'
}

var data = [trace1,trace2,trace3];

Plotly.newPlot('myDiv', data);

// ---------------------------------------------------------------
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0