Skip to content

Instantly share code, notes, and snippets.

@marorika
Created March 29, 2018 15:48
Show Gist options
  • Save marorika/c98d986499bedcd69c92bc4deef88823 to your computer and use it in GitHub Desktop.
Save marorika/c98d986499bedcd69c92bc4deef88823 to your computer and use it in GitHub Desktop.
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>
<canvas id="myBubble" style="width: 100%; height: 300px;"></canvas>
<script>
var myBubbleElement = document.getElementById("myBubble");
var myBubble = new Chart(myBubbleElement, {
type: 'bubble', // チャートのタイプ
data: { // チャートの内容
datasets: [{
label: 'red',
data: [{x:4, y:5}, {x:5, y:9, r:10}],
backgroundColor: 'RGBA(182,39,93, 0.4)',
borderColor: 'RGBA(182,39,93, 1)',
borderWidth: 1
}, {
label: 'green',
data: [{x:8, y:4}, {x:2, y:4, r:20}],
backgroundColor: 'RGBA(77,169,155, 0.4)',
borderColor: 'RGBA(77,169,155, 1)',
borderWidth: 1
}]
},
options: { // チャートのその他オプション
scales: {
xAxes: [{
ticks: {
max: 10,
min: 0
}
}],
yAxes: [{
ticks: {
max: 10,
min: 0
}
}]
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment