From 04160d6fc2903562934934110890307a49d785cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:25:17 +0300 Subject: [PATCH] update dashboard --- src/components/dashboard/recentsaleswidget.ts | 2 +- .../dashboard/revenuestreamwidget.ts | 87 ++++++++++--------- src/views/dashboard.ts | 4 +- src/views/uikit/formlayoutdoc.ts | 2 +- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/components/dashboard/recentsaleswidget.ts b/src/components/dashboard/recentsaleswidget.ts index 9f3f66a..fba83cb 100644 --- a/src/components/dashboard/recentsaleswidget.ts +++ b/src/components/dashboard/recentsaleswidget.ts @@ -15,7 +15,7 @@ import { Product, ProductService } from '@/src/service/product.service'; ButtonModule, RippleModule, ], - template: `
+ template: `
Recent Sales
diff --git a/src/components/dashboard/revenuestreamwidget.ts b/src/components/dashboard/revenuestreamwidget.ts index 80b8712..726e912 100644 --- a/src/components/dashboard/revenuestreamwidget.ts +++ b/src/components/dashboard/revenuestreamwidget.ts @@ -9,7 +9,7 @@ import { LayoutService } from '@/src/service/layout.service'; imports: [ ChartModule, ], - template: `
+ template: `
Revenue Stream
`, @@ -35,61 +35,68 @@ export class RevenueStreamWidget { initChart() { const documentStyle = getComputedStyle(document.documentElement); - const textColor = documentStyle.getPropertyValue('--text-color'); - const textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary'); - const surfaceBorder = documentStyle.getPropertyValue('--surface-border'); + const borderColor = documentStyle.getPropertyValue('--surface-border'); + const textMutedColor = documentStyle.getPropertyValue('--text-color-secondary'); this.chartData = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], + labels: ['Q1', 'Q2', 'Q3', 'Q4'], datasets: [ { - label: 'First Dataset', - data: [65, 59, 80, 81, 56, 55, 40], - fill: false, - backgroundColor: documentStyle.getPropertyValue('--bluegray-700'), - borderColor: documentStyle.getPropertyValue('--bluegray-700'), - tension: .4 + type: 'bar', + label: 'Subscriptions', + backgroundColor: documentStyle.getPropertyValue('--p-primary-400'), + data: [4000, 10000, 15000, 4000], + barThickness: 32 }, { - label: 'Second Dataset', - data: [28, 48, 40, 19, 86, 27, 90], - fill: false, - backgroundColor: documentStyle.getPropertyValue('--green-600'), - borderColor: documentStyle.getPropertyValue('--green-600'), - tension: .4 + type: 'bar', + label: 'Advertising', + backgroundColor: documentStyle.getPropertyValue('--p-primary-300'), + data: [2100, 8400, 2400, 7500], + barThickness: 32 + }, + { + type: 'bar', + label: 'Affiliate', + backgroundColor: documentStyle.getPropertyValue('--p-primary-200'), + data: [4100, 5200, 3400, 7400], + borderRadius: { + topLeft: 8, + topRight: 8 + }, + borderSkipped: true, + barThickness: 32 } ] }; this.chartOptions = { - plugins: { - legend: { - labels: { - color: textColor - } + maintainAspectRatio: false, + aspectRatio: 0.8, + scales: { + x: { + stacked: true, + ticks: { + color: textMutedColor + }, + grid: { + color: 'transparent', + borderColor: 'transparent' } }, - scales: { - x: { - ticks: { - color: textColorSecondary - }, - grid: { - color: surfaceBorder, - drawBorder: false - } + y: { + stacked: true, + ticks: { + color: textMutedColor }, - y: { - ticks: { - color: textColorSecondary - }, - grid: { - color: surfaceBorder, - drawBorder: false - } + grid: { + color: borderColor, + borderColor: 'transparent', + drawTicks: false } } - }; + } + }; } ngOnDestroy() { diff --git a/src/views/dashboard.ts b/src/views/dashboard.ts index 6ac93f8..63df683 100644 --- a/src/views/dashboard.ts +++ b/src/views/dashboard.ts @@ -10,14 +10,14 @@ import { NotificationsWidget } from '@/src/components/dashboard/notificationswid imports: [StatsWidget, RecentSalesWidget, BestSellingWidget, RevenueStreamWidget, NotificationsWidget], template: `
- +
- +
`, diff --git a/src/views/uikit/formlayoutdoc.ts b/src/views/uikit/formlayoutdoc.ts index 8394e00..719f575 100644 --- a/src/views/uikit/formlayoutdoc.ts +++ b/src/views/uikit/formlayoutdoc.ts @@ -84,7 +84,7 @@ import {TextareaModule} from "primeng/textarea";
-
+
Advanced