Files
WhiteLagoon/WhiteLagoon.Web/wwwroot/js/dashboard/getCustomerBookingPieChart.js
T
2025-05-20 11:46:50 -04:00

46 lines
1.0 KiB
JavaScript

$(document).ready(function () {
loadCustomerBookingPieChart();
});
function loadCustomerBookingPieChart() {
$(".chart-spinner").show();
$.ajax({
url: "/Dashboard/GetBookingPieChartData",
type: 'GET',
dataType: 'json',
success: function (data) {
loadPieChart("customerBookingsPieChart", data);
$(".chart-spinner").hide();
}
});
}
function loadPieChart(id, data) {
var chartColors = getChartColorsArray(id);
var options = {
colors: chartColors,
series: data.series,
labels: data.labels,
chart: {
width: 380,
type: 'pie',
},
stroke: {
show: false
},
legend: {
position: 'bottom',
horizontalAlign: 'center',
labels: {
colors: "#fff",
useSeriesColors: true
},
},
};
var chart = new ApexCharts(document.querySelector("#" + id), options);
chart.render();
}