0👍
The first thing you need to to is make sure every canvas has a unique ID. You can do that by adding the ItemIndex
to the id.
<canvas id="mychart_<%# Container.ItemIndex %>"></canvas>
After that you can use JavasScript to build the charts. There you use <%= Repeater1.Items.Count %>
to get the total item count.
<script type="text/javascript">
$(document).ready(function () {
for (var i = 0; i < <%= Repeater1.Items.Count %>; i++) {
buildCanvas("mychart_" + i);
}
});
</script>
- Chartjs-How to render data using chartjs in expressJS
- Chartjs-Chart.js line chart not showing in Google Chrome canvas(only in Microsoft Edge)
Source:stackexchange.com