- users active is recorded when users logges in - add active broker and active customer multi axis line chart - add filter option of 30 days and 7 days
55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<x-dashboard.card class="col-span-1 h-75">
|
|
<canvas id="category-wise-deals-pie-chart"></canvas>
|
|
</x-dashboard.card>
|
|
@push('scripts')
|
|
<script async>
|
|
window.addEventListener('DOMContentLoaded', async () => {
|
|
const dealsPieChart = document.getElementById('category-wise-deals-pie-chart');
|
|
try {
|
|
// const response = await axios.get('/api/stats/customer/active/30');
|
|
// const apiData = response.data.data;
|
|
|
|
|
|
// Fill the data from api response
|
|
// const chartData = labels.map((date) => {
|
|
// let found = apiData.find(item => item.date === date);
|
|
// return found ? found.userCount : 0;
|
|
// })
|
|
|
|
const data = {
|
|
labels: [
|
|
'Real Estate',
|
|
'Food',
|
|
'Sell & Deal',
|
|
'Palaces'
|
|
],
|
|
datasets: [{
|
|
label: 'My First Dataset',
|
|
data: [30, 20, 15, 5],
|
|
backgroundColor: [
|
|
'rgb(255, 99, 132)',
|
|
'rgb(54, 162, 235)',
|
|
'rgb(255, 205, 86)',
|
|
'rgb(99,102,255)',
|
|
],
|
|
hoverOffset: 4
|
|
}]
|
|
};
|
|
|
|
const config = {
|
|
type: 'pie',
|
|
data: data,
|
|
options: {
|
|
maintainAspectRatio: false,
|
|
responsive: true,
|
|
}
|
|
};
|
|
const chart = new Chart(dealsPieChart, config);
|
|
// toggleShimmer(false, activeChartParent);
|
|
} catch (e) {
|
|
console.log(e)
|
|
}
|
|
})
|
|
</script>
|
|
@endpush
|