diff --git a/src/app/panels/candlestick.component.html b/src/app/panels/candlestick.component.html
new file mode 100644
index 0000000..9aa9cb5
--- /dev/null
+++ b/src/app/panels/candlestick.component.html
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/src/app/panels/candlestick.component.ts b/src/app/panels/candlestick.component.ts
new file mode 100644
index 0000000..4f8d3c0
--- /dev/null
+++ b/src/app/panels/candlestick.component.ts
@@ -0,0 +1,84 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import 'dist/chartjs-chart-financial/chartjs-chart-financial';
+import * as luxon from 'luxon';
+import 'chartjs-adapter-luxon';
+import { ChartOptions } from 'chart.js';
+import { Color, BaseChartDirective } from 'ng2-charts';
+
+@Component({
+ selector: 'app-financial-chart',
+ templateUrl: './financial-chart.component.html',
+ styleUrls: ['./financial-chart.component.css']
+})
+export class FinancialChartComponent implements OnInit {
+ barCount = 60;
+ initialDateStr = '01 Apr 2017 00:00 Z';
+
+ public financialChartData = [
+ {
+ label: 'CHRT - Chart.js Corporation',
+ data: this.getRandomData(this.initialDateStr, this.barCount)
+ },
+ ];
+ public financialChartOptions: ChartOptions = {
+ responsive: true,
+ maintainAspectRatio: false,
+ };
+ public financialChartColors: Color[] = [
+ {
+ borderColor: 'black',
+ backgroundColor: 'rgba(255,0,0,0.3)',
+ },
+ ];
+ public financialChartLegend : Boolean;
+ public chartLegend : Boolean;
+ public financialChartType = 'candlestick';
+ public chartType : string;
+ public financialChartPlugins = [];
+
+ @ViewChild(BaseChartDirective, { static: true }) chart: BaseChartDirective;
+
+ constructor() { }
+
+ ngOnInit() {
+ this.financialChartType = 'candlestick';
+ this.chartType=this.financialChartType;
+
+ this.financialChartLegend = this.chartLegend;
+ }
+
+ randomNumber(min: number, max: number) {
+ return Math.random() * (max - min) + min;
+ }
+
+ randomBar(date: luxon.DateTime, lastClose: number) {
+ const open = this.randomNumber(lastClose * 0.95, lastClose * 1.05);
+ const close = this.randomNumber(open * 0.95, open * 1.05);
+ const high = this.randomNumber(Math.max(open, close), Math.max(open, close) * 1.1);
+ const low = this.randomNumber(Math.min(open, close) * 0.9, Math.min(open, close));
+ return {
+ t: date.valueOf(),
+ o: open,
+ h: high,
+ l: low,
+ c: close
+ };
+ }
+
+ getRandomData(dateStr: string, count: number) {
+ let date = luxon.DateTime.fromRFC2822(dateStr);
+ const data = [this.randomBar(date, 30)];
+ while (data.length < count) {
+ date = date.plus({ days: 1 });
+ if (date.weekday <= 5) {
+ data.push(this.randomBar(date, data[data.length - 1].c));
+ }
+ }
+ return data;
+ }
+
+ update() {
+ // candlestick vs ohlc
+ this.financialChartType = this.financialChartType === 'candlestick' ? 'ohlc' : 'candlestick';
+ }
+}
\ No newline at end of file
diff --git a/src/app/panels/pie-panel.component.ts b/src/app/panels/pie-panel.component.ts
index a438811..b4b180c 100644
--- a/src/app/panels/pie-panel.component.ts
+++ b/src/app/panels/pie-panel.component.ts
@@ -9,9 +9,10 @@ import { ChartData } from '../_interfaces/chart-data';
selector: 'panel-pie',
templateUrl: 'pie-panel.component.html',
})
+
export class PiePanel implements OnInit {
- public chartType = 'doughnut';
+ public chartType = 'panel-pie';
public chartLegend = true;
public doughnutChartDataLocal: number[] = [];
public doughnutChartLabelsLocal: string[] = [];
diff --git a/src/app/panels/polar-panel.component.html b/src/app/panels/polar-panel.component.html
new file mode 100644
index 0000000..9aa9cb5
--- /dev/null
+++ b/src/app/panels/polar-panel.component.html
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/src/app/panels/polar-panel.component.ts b/src/app/panels/polar-panel.component.ts
new file mode 100644
index 0000000..e698fb4
--- /dev/null
+++ b/src/app/panels/polar-panel.component.ts
@@ -0,0 +1,72 @@
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { SingleDataSet, Label } from 'ng2-charts';
+import { ChartType } from 'chart.js';
+import { ApiService } from '../providers/api-service';
+import { CustPiesService } from '../providers/cust-pies.service';
+import { DataType } from '../shared/data-types.enum';
+import { ChartData } from '../_interfaces/chart-data';
+
+@Component({
+ selector: 'polar-area',
+ templateUrl: 'polar-panel.component.html',
+})
+
+export class PolarAreaChartComponent implements OnInit {
+ // PolarArea
+
+ public chartType : 'polar-area';
+ public polarAreaChartLabels: Label[];
+ public polarAreaChartData: SingleDataSet;
+ public chartLegend : Boolean;
+ public polarAreaLegend : Boolean;
+
+ public polarChartLabelsLocal: string[] = [];
+ public polarChartDataLocal: number[] = [];
+
+ public polarAreaChartType: ChartType = 'polarArea';
+
+ constructor(
+ private api: ApiService,
+ private pieService: CustPiesService,
+ ) {
+ this.pieService.getPie().subscribe(
+ result => {
+ this.setChartData(result.local_all);
+ },
+ error => {
+ console.log('Retrieval Error');
+ console.log( error._body );
+ }
+ );
+ }
+
+ ngOnInit() {
+ this.polarAreaLegend = this.chartLegend;
+ this.polarAreaLegend = true;
+ }
+
+ private setChartData(dataLocal: any) {
+ this.polarChartDataLocal = Object.keys(dataLocal).map(key => dataLocal[key]);
+ // setTimeout is currently a workaround for ng2-charts labels
+ setTimeout(() => this.polarChartLabelsLocal = Object.keys(dataLocal), 0);
+ }
+
+ public convertHex(hex: string, opacity: number) {
+ hex = hex.replace('#', '');
+ const r = parseInt(hex.substring(0, 2), 16);
+ const g = parseInt(hex.substring(2, 4), 16);
+ const b = parseInt(hex.substring(4, 6), 16);
+
+ const rgba = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity / 100 + ')';
+ return rgba;
+ }
+
+ // events
+ public chartClicked({ event, active }: { event: MouseEvent, active: {}[] }): void {
+ console.log(event, active);
+ }
+
+ public chartHovered({ event, active }: { event: MouseEvent, active: {}[] }): void {
+ console.log(event, active);
+ }
+}
\ No newline at end of file
diff --git a/src/app/panels/stacked-bar.component.html b/src/app/panels/stacked-bar.component.html
new file mode 100644
index 0000000..8a95a2e
--- /dev/null
+++ b/src/app/panels/stacked-bar.component.html
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/src/app/panels/stacked-bar.component.ts b/src/app/panels/stacked-bar.component.ts
new file mode 100644
index 0000000..3987dc5
--- /dev/null
+++ b/src/app/panels/stacked-bar.component.ts
@@ -0,0 +1,68 @@
+import { NgModule, enableProdMode } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { ApiService } from '../providers/api-service';
+import { CustPiesService } from '../providers/cust-pies.service';
+import { DataType } from '../shared/data-types.enum';
+import { ChartData } from '../_interfaces/chart-data';
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+
+import { DxChartModule } from 'devextreme-angular';
+
+if(!/localhost/.test(document.location.host)) {
+ enableProdMode();
+}
+
+@Component({
+ selector: 'stacked-bar',
+ templateUrl: 'stacked-bar.component.html',
+})
+@NgModule({
+ imports: [
+ BrowserModule,
+ DxChartModule
+ ],
+ declarations: [StackedBarChartComponent],
+ bootstrap: [StackedBarChartComponent]
+})
+export class StackedBarChartComponent {
+
+ public chartType: 'stacked-bar';
+ public chartLegend = true;
+ public stackedBarChartDataLocal : number[] = [];
+ public stackedBarChartLabelsLocal : string[] = [];
+
+ constructor(
+ private api: ApiService,
+ private pieService: CustPiesService,
+ ) {
+ this.pieService.getPie().subscribe(
+ result => {
+ this.setChartData(result.local_all);
+ },
+ error => {
+ console.log('Retrieval Error');
+ console.log( error._body );
+ }
+ );
+ }
+
+ public ngOnInit(): void {
+ console.log("stacked bar graph tried to initialise");
+ }
+
+ private setChartData(dataLocal: any) {
+ this.stackedBarChartDataLocal = Object.keys(dataLocal).map(key => dataLocal[key]);
+ // setTimeout is currently a workaround for ng2-charts labels
+ setTimeout(() => this.stackedBarChartLabelsLocal = Object.keys(dataLocal), 0);
+ }
+
+ customizeTooltip(arg: any) {
+ return {
+ text: arg.percentText + ' - ' + arg.valueText
+ };
+ }
+}
+
+
+platformBrowserDynamic().bootstrapModule(StackedBarChartComponent);
\ No newline at end of file
diff --git a/src/app/widgets/graph-widget.component.ts b/src/app/widgets/graph-widget.component.ts
index 8c5b55d..1e1ca21 100644
--- a/src/app/widgets/graph-widget.component.ts
+++ b/src/app/widgets/graph-widget.component.ts
@@ -12,6 +12,7 @@ interface ChartData {
selector: 'widget-graph',
templateUrl: 'graph-widget.component.html',
})
+
export class GraphWidget implements OnInit {
@Input() public graphName: string;
@Input() public graphTitle = 'Graph';
@@ -63,7 +64,7 @@ export class GraphWidget implements OnInit {
},
elements: {
line: {
- borderWidth: 1
+ borderWidth: 2
},
point: {
radius: 4,