<script src="../dist/Chart.bundle.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style>
- body {
- padding: 0;
- margin: 0;
- }
-
- #canvas-holder {
- width: 30%;
+ canvas {
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
}
</style>
</head>
<body>
- <div id="canvas-holder" style="width:100%">
+ <div id="canvas-holder" style="width:75%">
<canvas id="chart-area" />
</div>
<button id="randomizeData">Randomize Data</button>
<button id="removeDataset">Remove Dataset</button>
<button id="addData">Add Data</button>
<button id="removeData">Remove Data</button>
- <div>
- <h3>Legend</h3>
- <div id="legendContainer">
-
- </div>
- </div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
}
};
- function updateLegend() {
- $legendContainer = $('#legendContainer');
- $legendContainer.empty();
- $legendContainer.append(window.myDoughnut.generateLegend());
- }
-
window.onload = function() {
var ctx = document.getElementById("chart-area").getContext("2d");
window.myDoughnut = new Chart(ctx, config);
- console.log(window.myDoughnut);
-
- updateLegend();
};
$('#randomizeData').click(function() {
});
window.myDoughnut.update();
- updateLegend();
});
$('#addDataset').click(function() {
config.data.datasets.push(newDataset);
window.myDoughnut.update();
- updateLegend();
});
$('#addData').click(function() {
});
window.myDoughnut.update();
- updateLegend();
}
});
$('#removeDataset').click(function() {
config.data.datasets.splice(0, 1);
window.myDoughnut.update();
- updateLegend();
});
$('#removeData').click(function() {
});
window.myDoughnut.update();
- updateLegend();
});
</script>
</body>