Show how to use circumference and rotation options (#5326)

This commit is contained in:
Pierre GIRAUD
2018-03-10 16:56:27 +01:00
committed by Simon Brunel
parent b7025fedbe
commit d0b26dbddd

View File

@@ -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);
@@ -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>