mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-04 15:34:04 +01:00
Show how to use circumference and rotation options (#5326)
This commit is contained in:
committed by
Simon Brunel
parent
b7025fedbe
commit
d0b26dbddd
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user