回答編集履歴
3
追記
test
CHANGED
@@ -217,3 +217,159 @@
|
|
217
217
|
![イメージ説明](fd33ad8a3bae38f12645589155484701.png)
|
218
218
|
|
219
219
|
|
220
|
+
|
221
|
+
---
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
```html
|
226
|
+
|
227
|
+
<!DOCTYPE HTML>
|
228
|
+
|
229
|
+
<html lang="ja">
|
230
|
+
|
231
|
+
<head>
|
232
|
+
|
233
|
+
<meta charset="UTF-8">
|
234
|
+
|
235
|
+
<meta name="robots" content="NOINDEX,NOFOLLOW" />
|
236
|
+
|
237
|
+
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport' />
|
238
|
+
|
239
|
+
<link rel="icon" href="favicon.ico" />
|
240
|
+
|
241
|
+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
242
|
+
|
243
|
+
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
|
244
|
+
|
245
|
+
<title>サンプル</title>
|
246
|
+
|
247
|
+
<style type="text/css">
|
248
|
+
|
249
|
+
.graph {
|
250
|
+
|
251
|
+
min-height: 300px;
|
252
|
+
|
253
|
+
border: 1px solid #333;
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
</style>
|
258
|
+
|
259
|
+
</head>
|
260
|
+
|
261
|
+
<body>
|
262
|
+
|
263
|
+
<div class="container">
|
264
|
+
|
265
|
+
<div class="row">
|
266
|
+
|
267
|
+
<div class="col-md-6 graph" data-type="bar" id="bar">
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<div class="col-md-6 graph" data-type="line" id="line">
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
</div>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
284
|
+
|
285
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"></script>
|
286
|
+
|
287
|
+
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
288
|
+
|
289
|
+
<script type="text/javascript">
|
290
|
+
|
291
|
+
function drawChart() {
|
292
|
+
|
293
|
+
$.getJSON('data.php', {type: 0}, function (json) {
|
294
|
+
|
295
|
+
var data = new google.visualization.arrayToDataTable(json);
|
296
|
+
|
297
|
+
var options = {
|
298
|
+
|
299
|
+
chart: {
|
300
|
+
|
301
|
+
title: 'Box Office Earnings in First Two Weeks of Opening',
|
302
|
+
|
303
|
+
subtitle: 'in millions of dollars (USD)'
|
304
|
+
|
305
|
+
},
|
306
|
+
|
307
|
+
axes: {
|
308
|
+
|
309
|
+
x: {
|
310
|
+
|
311
|
+
0: {side: 'bottom'}
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
};
|
318
|
+
|
319
|
+
var chart = new google.charts.Line(document.getElementById('bar'));
|
320
|
+
|
321
|
+
chart.draw(data, options);
|
322
|
+
|
323
|
+
});
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
function drawChart2() {
|
328
|
+
|
329
|
+
$.getJSON('data.php', {type: 1}, function (json) {
|
330
|
+
|
331
|
+
var data = new google.visualization.arrayToDataTable(json);
|
332
|
+
|
333
|
+
var options = {
|
334
|
+
|
335
|
+
chart: {
|
336
|
+
|
337
|
+
title: 'Box Office Earnings in First Two Weeks of Opening'
|
338
|
+
|
339
|
+
},
|
340
|
+
|
341
|
+
axes: {
|
342
|
+
|
343
|
+
x: {
|
344
|
+
|
345
|
+
0: {side: 'top'}
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
}
|
350
|
+
|
351
|
+
};
|
352
|
+
|
353
|
+
var chart = new google.charts.Line(document.getElementById('line'));
|
354
|
+
|
355
|
+
chart.draw(data, options);
|
356
|
+
|
357
|
+
});
|
358
|
+
|
359
|
+
}
|
360
|
+
|
361
|
+
google.charts.load('current', {'packages': ['line']});
|
362
|
+
|
363
|
+
google.charts.setOnLoadCallback(drawChart);
|
364
|
+
|
365
|
+
google.charts.setOnLoadCallback(drawChart2);
|
366
|
+
|
367
|
+
</script>
|
368
|
+
|
369
|
+
</body>
|
370
|
+
|
371
|
+
</html>
|
372
|
+
|
373
|
+
```
|
374
|
+
|
375
|
+
|
2
追記
test
CHANGED
@@ -207,3 +207,13 @@
|
|
207
207
|
|
208
208
|
|
209
209
|
![イメージ説明](d799ce9659b0d0bc0be0bb7ef3a2cc00.png)
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
[https://developers.google.com/chart/interactive/docs/gallery/linechart](https://developers.google.com/chart/interactive/docs/gallery/linechart)
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
![イメージ説明](fd33ad8a3bae38f12645589155484701.png)
|
218
|
+
|
219
|
+
|
1
追記
test
CHANGED
@@ -195,3 +195,15 @@
|
|
195
195
|
|
196
196
|
|
197
197
|
![イメージ説明](46d24f1d1f07f7c0da2e8bf3d1da90bd.png)
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
---
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
Chrome での実行結果↓
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
![イメージ説明](d799ce9659b0d0bc0be0bb7ef3a2cc00.png)
|