A Pen by takayuki_kimura on CodePen.
Created
July 19, 2019 06:14
-
-
Save yukikim/d421ea71f7dd5569a447d477e757db15 to your computer and use it in GitHub Desktop.
Test Chart 3
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="myChart" width="400" height="400"></canvas> |
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
var ctx = document.getElementById('myChart') | |
var barChartData = { | |
labels: ['1', '2', '3', '4', '5', '6', '7'], | |
datasets: [ | |
{ | |
label: 'Dataset 1', | |
backgroundColor: 'chocolate', | |
data: [ | |
20, | |
20, | |
20, | |
20, | |
20, | |
20, | |
20 | |
] | |
}, | |
{ | |
label: 'Dataset 2', | |
backgroundColor: 'cadetblue', | |
data: [ | |
20, | |
20, | |
20, | |
20, | |
20, | |
20, | |
12 | |
] | |
}, | |
{ | |
label: 'Dataset 3', | |
backgroundColor: 'sandybrown', | |
data: [ | |
10, | |
5, | |
23, | |
10, | |
26, | |
20, | |
] | |
} | |
] | |
}; | |
myChart = new Chart(ctx, { | |
type: 'horizontalBar', | |
data: barChartData, | |
options: { | |
title: { | |
display: true, | |
text: 'Chart.js Bar Chart - Stacked' | |
}, | |
//responsive: true, | |
scales: { | |
xAxes: [{ | |
stacked: true, | |
}], | |
yAxes: [{ | |
stacked: true, | |
ticks: { | |
max: 100 | |
} | |
}] | |
} | |
} | |
}); |
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.8.0/Chart.bundle.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment