Created
March 29, 2018 15:29
-
-
Save marorika/6f98131c5a4cbc484d34ed06f7c4e31d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script> | |
<canvas id="myLine" style="width: 100%; height: 300px;"></canvas> | |
<script> | |
var ctx = document.getElementById("myLine"); | |
var myLine = new Chart(ctx, { | |
type: 'line', // チャートのタイプ | |
data: { // チャートの内容 | |
labels: ["one", "two", "three", "four", "five", "six"], | |
datasets: [{ | |
label: 'red', | |
lineTension: 0, // ベジェ曲線を無効化 | |
data: [12, 19, 3, 5, 2, 3], | |
backgroundColor: 'RGBA(182,39,93, 0.4)', | |
borderColor: 'RGBA(182,39,93, 1)', | |
borderWidth: 1 | |
}, { | |
label: 'green', | |
data: [10, 14, 6, 8, 1, 4], | |
backgroundColor: 'RGBA(77,169,155, 0.4)', | |
borderColor: 'RGBA(77,169,155, 1)', | |
borderWidth: 1 | |
}] | |
}, | |
options: { // チャートのその他オプション | |
scales: { | |
yAxes: [{ | |
ticks: { | |
beginAtZero:true | |
} | |
}] | |
} | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment