Commit 108ca11f by Ooh-Ao

no message

parent 4b46d3b0
...@@ -45,8 +45,8 @@ export class HomeCommonComponent { ...@@ -45,8 +45,8 @@ export class HomeCommonComponent {
allSelected = false; allSelected = false;
someSelected = false; someSelected = false;
today = new Date(); today = new Date();
startDate : string = '' startDate: string = ''
endDate : string = '' endDate: string = ''
itmes: string = ''; itmes: string = '';
selectedProjects: string[] = []; selectedProjects: string[] = [];
selectedEquipmentType: string = 'ALL'; selectedEquipmentType: string = 'ALL';
...@@ -162,104 +162,7 @@ export class HomeCommonComponent { ...@@ -162,104 +162,7 @@ export class HomeCommonComponent {
this.chartOptions9 = {
series: [
{
name: 'จำนวนการยืม',
data: [40, 55, 60, 80, 70, 65, 90]
},
{
name: 'จำนวนการคืน',
data: [30, 50, 58, 75, 68, 63, 85]
}
],
chart: {
height: 320,
type: 'line',
dropShadow: {
enabled: true,
color: '#000',
top: 18,
left: 7,
blur: 10,
opacity: 0.2
},
toolbar: {
show: false
},
events: {
mounted: (chart: any) => {
chart.windowResizeHandler();
}
},
},
colors: ['#845adf', '#23b7e5'],
dataLabels: {
enabled: true
},
stroke: {
curve: 'smooth'
},
title: {
text: '',
align: 'left',
style: {
fontSize: '13px',
fontWeight: 'bold',
color: '#8c9097'
},
},
grid: {
borderColor: '#f2f5f7',
},
markers: {
size: 3
},
xaxis: {
categories: ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.'],
title: {
text: 'เดือน',
style: {
color: "#8c9097",
fontSize: '13px',
fontWeight: 'bold',
}
},
labels: {
style: {
colors: "#8c9097",
fontSize: '11px',
fontWeight: 600
}
},
},
yaxis: {
title: {
text: 'จำนวนครั้ง',
style: {
color: "#8c9097",
fontSize: '13px',
fontWeight: 'bold',
}
},
labels: {
style: {
colors: "#8c9097",
fontSize: '11px',
fontWeight: 600
}
},
min: 0,
max: 100
},
legend: {
position: 'top',
horizontalAlign: 'right',
floating: true,
offsetY: -25,
offsetX: -5
}
};
this.chartOptions2 = { this.chartOptions2 = {
...@@ -915,11 +818,27 @@ export class HomeCommonComponent { ...@@ -915,11 +818,27 @@ export class HomeCommonComponent {
getDashbord() { getDashbord() {
this.DashboardService.getDashboard(this.startDate, this.endDate).subscribe(result => { this.DashboardService.getDashboard(this.startDate, this.endDate).subscribe(result => {
this.dashboardModel = result this.dashboardModel = result
this.updateChart(this.dashboardModel)
console.log(this.dashboardModel) console.log(this.dashboardModel)
}) })
} }
private updateChart(data: DashboardModel) {
// แมป monthly_trends ไปเป็น series + categories
const trends = data.monthly_trends;
this.chartOptions9.series = [
{ name: 'จำนวนการยืม', data: trends.map(t => t.borrowed) },
{ name: 'จำนวนการคืน', data: trends.map(t => t.returned) },
];
this.chartOptions9.xaxis = {
...this.chartOptions9.xaxis,
categories: trends.map(t => t.period)
};
}
filter(v: string) { filter(v: string) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment