質問編集履歴

1

コードの追加

2019/07/04 05:16

投稿

tttu
tttu

スコア26

test CHANGED
File without changes
test CHANGED
@@ -15,3 +15,61 @@
15
15
 
16
16
 
17
17
  ![イメージ説明](83d95cc14c958070ce192c57406561a1.png)
18
+
19
+
20
+
21
+ ```Javascript
22
+
23
+ <div class="chart_container"><canvas id="myChart" height="330" width="650"></canvas></div>
24
+
25
+
26
+
27
+ <script>
28
+
29
+ var ctx = document.getElementById("myChart").getContext('2d');
30
+
31
+ var myChart = new Chart(ctx, {
32
+
33
+ type: 'line',
34
+
35
+ data: {
36
+
37
+ labels: <%= raw @graph_date %> ,
38
+
39
+ datasets: [{
40
+
41
+ label: "weight",
42
+
43
+ data: <%= raw @graph_weights %>,
44
+
45
+ lineTension: 0,
46
+
47
+ backgroundColor: 'rgba(0, 123, 255, 1.0)',
48
+
49
+ borderColor: 'rgba(0, 123, 255, 1.0)',
50
+
51
+ fill: false,
52
+
53
+ pointRadius:6.5,
54
+
55
+ pointHoverRadius: 7
56
+
57
+ }]
58
+
59
+ },
60
+
61
+ options: {
62
+
63
+ responsive: true,
64
+
65
+ maintainAspectRatio: false,
66
+
67
+ }
68
+
69
+ });
70
+
71
+ </script>
72
+
73
+
74
+
75
+ ```