Skip to content

Commit

Permalink
Show how to use circumference and rotation options (chartjs#5326)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgiraud authored and simonbrunel committed Mar 10, 2018
1 parent 9e2f1b8 commit 7f6e2c0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions samples/charts/doughnut.html
Expand Up @@ -23,6 +23,7 @@
<button id="removeDataset">Remove Dataset</button>
<button id="addData">Add Data</button>
<button id="removeData">Remove Data</button>
<button id="changeCircleSize">Semi/Full Circle</button>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
Expand Down Expand Up @@ -138,6 +139,18 @@

window.myDoughnut.update();
});

document.getElementById('changeCircleSize').addEventListener('click', function() {
if (window.myDoughnut.options.circumference === Math.PI) {
window.myDoughnut.options.circumference = 2 * Math.PI;
window.myDoughnut.options.rotation = -Math.PI / 2;
} else {
window.myDoughnut.options.circumference = Math.PI;
window.myDoughnut.options.rotation = -Math.PI;
}

window.myDoughnut.update();
});
</script>
</body>

Expand Down

0 comments on commit 7f6e2c0

Please sign in to comment.