From 471b56f2a85f5a5e289199974a40ce893e94e065 Mon Sep 17 00:00:00 2001 From: Felix Date: Thu, 4 Jul 2019 15:34:42 +0100 Subject: [PATCH] New graph types added (not all working unfortunately), new section added for table views and probably a lot of messy code too! --- src/app/app.module.ts | 7 ++ .../dashboard-customer.component.html | 45 +++++----- .../dashboard/dashboard-customer.component.ts | 8 +- src/app/dashboard/dashboard.routing.ts | 6 ++ src/app/dashboard/new-section.component.html | 6 ++ src/app/dashboard/new-section.component.ts | 27 ++++++ src/app/layouts/full-layout.component.html | 8 ++ src/app/panels/candlestick.component.html | 19 +++++ src/app/panels/candlestick.component.ts | 84 +++++++++++++++++++ src/app/panels/pie-panel.component.ts | 3 +- src/app/panels/polar-panel.component.html | 19 +++++ src/app/panels/polar-panel.component.ts | 72 ++++++++++++++++ src/app/panels/stacked-bar.component.html | 19 +++++ src/app/panels/stacked-bar.component.ts | 68 +++++++++++++++ src/app/widgets/graph-widget.component.ts | 3 +- 15 files changed, 368 insertions(+), 26 deletions(-) create mode 100644 src/app/dashboard/new-section.component.html create mode 100644 src/app/dashboard/new-section.component.ts create mode 100644 src/app/panels/candlestick.component.html create mode 100644 src/app/panels/candlestick.component.ts create mode 100644 src/app/panels/polar-panel.component.html create mode 100644 src/app/panels/polar-panel.component.ts create mode 100644 src/app/panels/stacked-bar.component.html create mode 100644 src/app/panels/stacked-bar.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7844b44..7fb44f7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -40,12 +40,17 @@ import { P500Component } from './pages/500.component'; import { AuthModule } from './auth/auth.module'; import { DashboardModule } from './dashboard/dashboard.module'; +import { DxChartModule } from 'devextreme-angular'; +import { StackedBarChartComponent } from './panels/stacked-bar.component'; +import { NewSectionComponent } from './dashboard/new-section.component'; + @NgModule({ imports: [ BrowserModule, HttpClientModule, + DxChartModule, NgxPaginationModule, BsDropdownModule.forRoot(), TabsModule.forRoot(), @@ -56,12 +61,14 @@ import { DashboardModule } from './dashboard/dashboard.module'; ], declarations: [ AppComponent, + StackedBarChartComponent, FullLayoutComponent, SimpleLayoutComponent, NAV_DROPDOWN_DIRECTIVES, BreadcrumbsComponent, SIDEBAR_TOGGLE_DIRECTIVES, AsideToggleDirective, + NewSectionComponent, P404Component, P500Component, ], diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 07838a1..49e32b9 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -12,28 +12,33 @@
- -
-
-
-
-
-
-

Weekly Spending by Category

+ +
+
+
+
+
+ +
+
+
+

Weekly Spending by Category

+
+
+
+ + +
-
-
- -
+
-
diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 6c8cd77..ccca9ee 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -7,6 +7,8 @@ import { CustBarSnippetComponent } from '../snippets/cust-snippet-bar.component' import { PiePanel } from '../panels/pie-panel.component'; import { DataType } from '../shared/data-types.enum'; import * as moment from 'moment'; +import { NewSectionComponent } from '../dashboard/new-section.component'; +import { StackedBarChartComponent } from '../panels/stacked-bar.component'; @Component({ @@ -28,7 +30,7 @@ export class DashboardCustomerComponent implements OnInit { public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success', 'bg-danger', 'bg-warning', 'bg-info']; - public chartType = 'doughnut'; + public chartType = 'polarArea'; public chartLegend = true; public doughnutChartDataCategory: any[] = []; public doughnutChartLabelsCategory: string[] = []; @@ -148,9 +150,7 @@ export class DashboardCustomerComponent implements OnInit { this.setWeekData(result); this.setChartData(result.data.cat_total); this.totalCategoryList = result.data.cat_list; - if (this.totalCategoryList) { - this.showTotalCategoryList = true; - } + this.showTotalCategoryList = true; this.purchaseEssential = result.data.essentials.purchase_no_essential_total; this.purchaseNotEssential = result.data.essentials.purchase_no_total - this.purchaseEssential; this.barChartDataEssential = [ diff --git a/src/app/dashboard/dashboard.routing.ts b/src/app/dashboard/dashboard.routing.ts index 6505f9a..9df0646 100644 --- a/src/app/dashboard/dashboard.routing.ts +++ b/src/app/dashboard/dashboard.routing.ts @@ -17,6 +17,7 @@ import { PayrollLogComponent } from './payroll-log.component'; import { LeaderboardComponent } from './leaderboard.component'; import { MapComponent } from './map.component'; import { TrailMapComponent } from './trail-map.component'; +import { NewSectionComponent } from './new-section.component'; // Using child path to allow for FullLayout theming const routes: Routes = [ @@ -84,6 +85,11 @@ const routes: Routes = [ path: 'feedback', component: FeedbackComponent, data: { title: 'Give Feedback' }, + }, + { + path: 'new-section', + component: NewSectionComponent, + data: { title: 'New Section' } } ], } diff --git a/src/app/dashboard/new-section.component.html b/src/app/dashboard/new-section.component.html new file mode 100644 index 0000000..58e17c9 --- /dev/null +++ b/src/app/dashboard/new-section.component.html @@ -0,0 +1,6 @@ +
+
+

Hello World!

+
+
+ \ No newline at end of file diff --git a/src/app/dashboard/new-section.component.ts b/src/app/dashboard/new-section.component.ts new file mode 100644 index 0000000..28ec0ff --- /dev/null +++ b/src/app/dashboard/new-section.component.ts @@ -0,0 +1,27 @@ +import { Component, OnInit, AfterViewInit, Input, Output, EventEmitter, ViewChild, TemplateRef } from '@angular/core'; +import { ApiService } from '../providers/api-service'; +import { AgmCoreModule } from '@agm/core'; +import { BsModalService, ModalDirective } from 'ngx-bootstrap/modal'; +import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; + + +@Component({ + templateUrl: 'new-section.component.html', +}) +export class NewSectionComponent implements OnInit, AfterViewInit { + + constructor( + private api: ApiService, + ) { } + + ngOnInit(): void { + + } + + ngAfterViewInit() { + } + + + + +} diff --git a/src/app/layouts/full-layout.component.html b/src/app/layouts/full-layout.component.html index 58baf2c..0769c82 100644 --- a/src/app/layouts/full-layout.component.html +++ b/src/app/layouts/full-layout.component.html @@ -94,6 +94,14 @@
+