teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

追記

2016/01/20 12:52

投稿

退会済みユーザー
answer CHANGED
@@ -107,3 +107,81 @@
107
107
  [https://developers.google.com/chart/interactive/docs/gallery/linechart](https://developers.google.com/chart/interactive/docs/gallery/linechart)
108
108
 
109
109
  ![イメージ説明](fd33ad8a3bae38f12645589155484701.png)
110
+
111
+ ---
112
+
113
+ ```html
114
+ <!DOCTYPE HTML>
115
+ <html lang="ja">
116
+ <head>
117
+ <meta charset="UTF-8">
118
+ <meta name="robots" content="NOINDEX,NOFOLLOW" />
119
+ <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport' />
120
+ <link rel="icon" href="favicon.ico" />
121
+ <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
122
+ <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
123
+ <title>サンプル</title>
124
+ <style type="text/css">
125
+ .graph {
126
+ min-height: 300px;
127
+ border: 1px solid #333;
128
+ }
129
+ </style>
130
+ </head>
131
+ <body>
132
+ <div class="container">
133
+ <div class="row">
134
+ <div class="col-md-6 graph" data-type="bar" id="bar">
135
+
136
+ </div>
137
+ <div class="col-md-6 graph" data-type="line" id="line">
138
+
139
+ </div>
140
+ </div>
141
+ </div>
142
+ <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
143
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"></script>
144
+ <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
145
+ <script type="text/javascript">
146
+ function drawChart() {
147
+ $.getJSON('data.php', {type: 0}, function (json) {
148
+ var data = new google.visualization.arrayToDataTable(json);
149
+ var options = {
150
+ chart: {
151
+ title: 'Box Office Earnings in First Two Weeks of Opening',
152
+ subtitle: 'in millions of dollars (USD)'
153
+ },
154
+ axes: {
155
+ x: {
156
+ 0: {side: 'bottom'}
157
+ }
158
+ }
159
+ };
160
+ var chart = new google.charts.Line(document.getElementById('bar'));
161
+ chart.draw(data, options);
162
+ });
163
+ }
164
+ function drawChart2() {
165
+ $.getJSON('data.php', {type: 1}, function (json) {
166
+ var data = new google.visualization.arrayToDataTable(json);
167
+ var options = {
168
+ chart: {
169
+ title: 'Box Office Earnings in First Two Weeks of Opening'
170
+ },
171
+ axes: {
172
+ x: {
173
+ 0: {side: 'top'}
174
+ }
175
+ }
176
+ };
177
+ var chart = new google.charts.Line(document.getElementById('line'));
178
+ chart.draw(data, options);
179
+ });
180
+ }
181
+ google.charts.load('current', {'packages': ['line']});
182
+ google.charts.setOnLoadCallback(drawChart);
183
+ google.charts.setOnLoadCallback(drawChart2);
184
+ </script>
185
+ </body>
186
+ </html>
187
+ ```

2

追記

2016/01/20 12:52

投稿

退会済みユーザー
answer CHANGED
@@ -102,4 +102,8 @@
102
102
 
103
103
  Chrome での実行結果↓
104
104
 
105
- ![イメージ説明](d799ce9659b0d0bc0be0bb7ef3a2cc00.png)
105
+ ![イメージ説明](d799ce9659b0d0bc0be0bb7ef3a2cc00.png)
106
+
107
+ [https://developers.google.com/chart/interactive/docs/gallery/linechart](https://developers.google.com/chart/interactive/docs/gallery/linechart)
108
+
109
+ ![イメージ説明](fd33ad8a3bae38f12645589155484701.png)

1

追記

2016/01/20 10:31

投稿

退会済みユーザー
answer CHANGED
@@ -96,4 +96,10 @@
96
96
  </html>
97
97
  ```
98
98
 
99
- ![イメージ説明](46d24f1d1f07f7c0da2e8bf3d1da90bd.png)
99
+ ![イメージ説明](46d24f1d1f07f7c0da2e8bf3d1da90bd.png)
100
+
101
+ ---
102
+
103
+ Chrome での実行結果↓
104
+
105
+ ![イメージ説明](d799ce9659b0d0bc0be0bb7ef3a2cc00.png)