'How I connect chart.js to database in ASP.NET web form?
How I can connect my chart to database?
My chart source is:
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['agency1', 'agency2', 'agency3', 'agency4', 'agency5', 'agency6', 'agency7'],
datasets: [{
label: 'all sell',
data: [1200, 1900, 300, 1700, 600, 300, 700],
backgroundColor: "rgba(53,24,51,0.6)"
}, {
label: 'count ticket',
data: [200, 290, 500, 50, 200, 300, 1000],
backgroundColor: "rgba(255,53,0,0.6)"
}]
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.min.js"></script>
<div class="container">
<canvas id="myChart"></canvas>
</div>
So, I have customer_table, for every agency I have sum(countticket) & sum(Epayprice) for tickets.
Now how I can load my data from customer_table?
Please, guide me.
Solution 1:[1]
you can use a web method to send data to client side: http://www.softdeveloperszone.com/2018/02/chartjs-example-in-aspnet-webforms.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zolfaghari |
