Created
November 5, 2016 02:16
-
-
Save webloglife/9841601587c3a034d280a8fa4ba26879 to your computer and use it in GitHub Desktop.
折れ線グラフ(2軸)
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
<canvas id="myChart4" width="400" height="250"></canvas> | |
<script> | |
var config = { | |
type: 'line', | |
data: { | |
labels: ['8/1','8/2','8/3','8/4','8/5','8/6','8/7','8/8','8/9','8/10','8/11','8/12','8/13','8/14','8/15'], | |
datasets: [ | |
{ | |
label: "Yahoo", | |
fill: false, | |
lineTension: 0.1, | |
backgroundColor: "#FF0000", | |
borderColor: "#FF0000", | |
borderCapStyle: 'butt', | |
borderDash: [], | |
borderDashOffset: 0.0, | |
borderJoinStyle: 'miter', | |
pointBorderColor: "#FF0000", | |
pointBackgroundColor: "#fff", | |
pointBorderWidth: 1, | |
pointHoverRadius: 5, | |
pointHoverBackgroundColor: "#FF0000", | |
pointHoverBorderColor: "#FF0000", | |
pointHoverBorderWidth: 2, | |
pointRadius: 1, | |
pointHitRadius: 10, | |
data: [24,18,25,79,46,20,21,33,39,45,33,41,38,22,22], | |
spanGaps: false, | |
},{ | |
label: "Google", | |
fill: false, | |
lineTension: 0.1, | |
backgroundColor: "#337AB7", | |
borderColor: "#337AB7", | |
borderCapStyle: 'butt', | |
borderDash: [], | |
borderDashOffset: 0.0, | |
borderJoinStyle: 'miter', | |
pointBorderColor: "#337AB7", | |
pointBackgroundColor: "#fff", | |
pointBorderWidth: 1, | |
pointHoverRadius: 5, | |
pointHoverBackgroundColor: "#337AB7", | |
pointHoverBorderColor: "#337AB7", | |
pointHoverBorderWidth: 2, | |
pointRadius: 1, | |
pointHitRadius: 10, | |
data: [21,18,21,21,21,20,21,19,19,11,13,9,9,7,11], | |
spanGaps: false, | |
}] | |
}, | |
options: { | |
responsive: true, | |
scales: { | |
xAxes: [{ | |
display: true, | |
stacked: false, | |
gridLines: { | |
display: false | |
} | |
}], | |
yAxes: [{ | |
display: true, | |
scaleLabel: { | |
display: true, | |
labelString: '順位', | |
fontFamily: 'monospace', | |
fontSize: 14 | |
}, | |
ticks: { | |
reverse: true, | |
beginAtZero: false, | |
min: 1, | |
callback: function(value){ | |
return value+'位'; | |
} | |
} | |
}] | |
} | |
} | |
}; | |
window.onload = function() { | |
var ctx = document.getElementById("myChart4").getContext("2d"); | |
window. myLine = new Chart(ctx, config); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment