aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/_charts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_elements/_charts')
-rw-r--r--frontend/src/app/_elements/_charts/box-plot/box-plot.component.ts124
-rw-r--r--frontend/src/app/_elements/_charts/line-chart/line-chart.component.css9
-rw-r--r--frontend/src/app/_elements/_charts/line-chart/line-chart.component.html5
-rw-r--r--frontend/src/app/_elements/_charts/line-chart/line-chart.component.ts69
-rw-r--r--frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts41
-rw-r--r--frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.css12
-rw-r--r--frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.html4
7 files changed, 163 insertions, 101 deletions
diff --git a/frontend/src/app/_elements/_charts/box-plot/box-plot.component.ts b/frontend/src/app/_elements/_charts/box-plot/box-plot.component.ts
index d6f4b6ec..bf5e3fd6 100644
--- a/frontend/src/app/_elements/_charts/box-plot/box-plot.component.ts
+++ b/frontend/src/app/_elements/_charts/box-plot/box-plot.component.ts
@@ -16,16 +16,31 @@ Chart.register(BoxPlotController, BoxAndWiskers, LinearScale, CategoryScale);
})
export class BoxPlotComponent implements AfterViewInit {
- @Input()width?: number;
- @Input()height?: number;
-
+ @Input() width?: number;
+ @Input() height?: number;
+ @Input() mean?: number;
+ @Input() median?: number;
+ @Input() min?: number;
+ @Input() max?: number;
+ @Input() q1?: number;
+ @Input() q3?: number;
+
+ updateChart(min: number, max: number, q1: number, q3: number, median: number) {
+ if (this.myChart) {
+ this.boxplotData.datasets[0].data = [[min, q1, median, q3, max]]
+ this.myChart.update();
+ }
+ };
+
@ViewChild('boxplot') chartRef!: ElementRef;
- constructor() { }
+ constructor() {
+ //this.updateChart();
+ }
boxplotData = {
// define label tree
- labels: ['January'/*, 'February', 'March', 'April', 'May', 'June', 'July'*/],
- datasets: [{
+ //labels: ['January'/*, 'February', 'March', 'April', 'May', 'June', 'July'*/],
+ datasets: [{
label: 'Dataset 1',
backgroundColor: '#0063AB',
borderColor: '#dfd7d7',
@@ -35,68 +50,43 @@ export class BoxPlotComponent implements AfterViewInit {
padding: 10,
itemRadius: 0,
data: [
- randomValues(100, 0, 100),
- /*randomValues(100, 0, 20),
- randomValues(100, 20, 70),
- randomValues(100, 60, 100),
- randomValues(40, 50, 100),
- randomValues(100, 60, 120),
- randomValues(100, 80, 100)*/
- ]}/*, {
- label: 'Dataset 2',
- backgroundColor: 'rgba(0,0,255,0.5)',
- borderColor: 'blue',
- borderWidth: 1,
- outlierColor: '#999999',
- padding: 10,
- itemRadius: 0,
- data: [
- randomValues(100, 60, 100),
- randomValues(100, 0, 100),
- randomValues(100, 0, 20),
- randomValues(100, 20, 70),
- randomValues(40, 60, 120),
- randomValues(100, 20, 100),
- randomValues(100, 80, 100)
- ]
- }*/]
- };
+ randomValues(100, 0, 100),
+ ]
+ }]
+ };
ngAfterViewInit(): void {
- const myChart = new Chart(this.chartRef.nativeElement, {
- type: "boxplot",
- data: this.boxplotData,
- options: {
- /*title: {
- display: true,
- text: 'Predicted world population (millions) in 2050'
- }*/
- plugins:{
- legend: {
- display: false
- },
- },
- scales : {
- x: {
- ticks: {
- color: '#dfd7d7'
- },
- grid: {
- color: "rgba(0, 99, 171, 0.5)"
- }
- },
- y : {
- min: -50,
- max: 200,
- ticks: {
- color: '#dfd7d7'
- },
- grid: {
- color: "rgba(0, 99, 171, 0.5)"
- }
- }
+ this.myChart = new Chart(this.chartRef.nativeElement, {
+ type: "boxplot",
+ data: this.boxplotData,
+ options: {
+ plugins: {
+ legend: {
+ display: false
+ },
+ },
+ scales: {
+ x: {
+ ticks: {
+ color: '#dfd7d7'
+ },
+ grid: {
+ color: "rgba(0, 99, 171, 0.5)"
+ }
+ },
+ y: {
+ min: this.min,
+ max: this.max,
+ ticks: {
+ color: '#dfd7d7'
+ },
+ grid: {
+ color: "rgba(0, 99, 171, 0.5)"
+ }
}
- }
- });
-}
+ }
+ }
+ });
+ }
+ myChart?: Chart;
}
diff --git a/frontend/src/app/_elements/_charts/line-chart/line-chart.component.css b/frontend/src/app/_elements/_charts/line-chart/line-chart.component.css
index e69de29b..a190693a 100644
--- a/frontend/src/app/_elements/_charts/line-chart/line-chart.component.css
+++ b/frontend/src/app/_elements/_charts/line-chart/line-chart.component.css
@@ -0,0 +1,9 @@
+canvas{
+
+ width:100% !important;
+ height:90% !important;
+ border: 1px solid var(--ns-primary);
+ background-color: var(--ns-bg-dark-100);
+ border-radius: 5px;
+ margin: 10px;
+ } \ No newline at end of file
diff --git a/frontend/src/app/_elements/_charts/line-chart/line-chart.component.html b/frontend/src/app/_elements/_charts/line-chart/line-chart.component.html
index 7f18256a..5bb7aae6 100644
--- a/frontend/src/app/_elements/_charts/line-chart/line-chart.component.html
+++ b/frontend/src/app/_elements/_charts/line-chart/line-chart.component.html
@@ -1,3 +1,4 @@
- <canvas id="myChart" style="width: 100%; height: 530px;">
- </canvas> \ No newline at end of file
+ <canvas id="myChart" >
+ </canvas>
+ \ No newline at end of file
diff --git a/frontend/src/app/_elements/_charts/line-chart/line-chart.component.ts b/frontend/src/app/_elements/_charts/line-chart/line-chart.component.ts
index 655db9ec..e873618c 100644
--- a/frontend/src/app/_elements/_charts/line-chart/line-chart.component.ts
+++ b/frontend/src/app/_elements/_charts/line-chart/line-chart.component.ts
@@ -13,22 +13,18 @@ export class LineChartComponent implements AfterViewInit {
dataMAE: number[] = [];
dataMSE: number[] = [];
dataLOSS: number[] = [];
-
+ dataValAcc:number[]=[];
+ dataValMAE:number[]=[];
+ dataValMSE:number[]=[];
+ dataValLoss:number[]=[];
dataEpoch: number[] = [];
constructor() {
- /*let i = 0;
- setInterval(() => {
- this.dataAcc.push(0.5);
- this.dataEpoch.push(i);
- i++;
- this.update();
- }, 200);*/
}
myChart!: Chart;
- update(myEpochs: number[], myAcc: number[], myLoss: number[], myMae: number[], myMse: number[]) {
+ update(myEpochs: number[], myAcc: number[], myLoss: number[], myMae: number[], myMse: number[], myValAcc:number[],myValLoss:number[],myValMae:number[],myValMse:number[]) {
this.dataAcc.length = 0;
this.dataAcc.push(...myAcc);
@@ -42,6 +38,18 @@ export class LineChartComponent implements AfterViewInit {
this.dataLOSS.push(...myLoss);
this.dataMSE.length = 0;
+ this.dataMSE.push(...myValAcc);
+
+ this.dataMSE.length = 0;
+ this.dataMSE.push(...myValLoss);
+
+ this.dataMSE.length = 0;
+ this.dataMSE.push(...myValMae);
+
+ this.dataMSE.length = 0;
+ this.dataMSE.push(...myValMse);
+
+ this.dataMSE.length = 0;
this.dataMSE.push(...myMse);
this.myChart.update();
@@ -54,8 +62,15 @@ export class LineChartComponent implements AfterViewInit {
data: {
labels: this.dataEpoch,
datasets: [{
+
label: 'Accuracy',
data: this.dataAcc,
+ borderWidth: 1,
+
+ },
+ {
+ label: 'VAl_Accuracy',
+ data: this.dataMSE,
borderWidth: 1
},
{
@@ -64,18 +79,47 @@ export class LineChartComponent implements AfterViewInit {
borderWidth: 1
},
{
+ label: 'Val_Loss',
+ data: this.dataMSE,
+ borderWidth: 1
+ },
+ {
label: 'MAE',
data: this.dataMAE,
borderWidth: 1
},
{
+ label: 'Val_MAE',
+ data: this.dataMSE,
+ borderWidth: 1
+ },
+ {
label: 'MSE',
data: this.dataMSE,
borderWidth: 1
+ },
+ {
+ label: 'Val_MSE',
+ data: this.dataMSE,
+ borderWidth: 1
}
]
},
options: {
+ responsive: true,
+ maintainAspectRatio: true,
+
+ plugins: {
+ legend: {
+ labels: {
+ // This more specific font property overrides the global property
+ color:'white',
+ font: {
+ size: 10
+ }
+ }
+ }
+ },
scales: {
x: {
ticks: {
@@ -83,21 +127,24 @@ export class LineChartComponent implements AfterViewInit {
},
grid: {
color: "rgba(0, 99, 171, 0.5)"
- }
+ },
},
y: {
beginAtZero: true,
ticks: {
color: 'white'
+
},
grid: {
color: "rgba(0, 99, 171, 0.5)"
}
}
+ },
+ animation: {
+ duration: 0
}
-
}
}
);
diff --git a/frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts b/frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts
index f141f522..c2bd3262 100644
--- a/frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts
+++ b/frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts
@@ -10,21 +10,36 @@ export class PieChartComponent implements AfterViewInit {
@Input()width?: number;
@Input()height?: number;
+ @Input()uniqueValues?: string[] = [];
+ @Input()uniqueValuesPercent?: number[] = [];
+
+ updatePieChart(uniqueValues: string[], uniqueValuesPercent: number[]){
+ console.log(this.uniqueValues, this.uniqueValuesPercent);
+ const newPieChartData = {
+ datasets: [{
+ label: "Population (millions)",
+ backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
+ data: [2478,5267,734,784,433],
+ }]
+
+ }
+ };
@ViewChild('piechart') chartRef!: ElementRef;
constructor() { }
+ pieChartData = {
+ datasets: [{
+ label: "Population (millions)",
+ backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
+ data: [2478,5267,734,784,433]
+ }]
+}
+
ngAfterViewInit(): void {
const myChart = new Chart(this.chartRef.nativeElement, {
type: 'pie',
- data: {
- labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
- datasets: [{
- label: "Population (millions)",
- backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
- data: [2478,5267,734,784,433],
- }]
- },
+ data: this.pieChartData,
options: {
/*title: {
display: true,
@@ -36,11 +51,9 @@ export class PieChartComponent implements AfterViewInit {
},
},
layout: {
- padding: 15}
+ padding: 15
+ }
}
-});
-
- }
+ });}
-
-}
+} \ No newline at end of file
diff --git a/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.css b/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.css
index 005cb692..3e91b926 100644
--- a/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.css
+++ b/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.css
@@ -1,4 +1,8 @@
-#divScatterChart{
-
- display: block;
-} \ No newline at end of file
+canvas{
+ width:95% !important;
+ height:95% !important;
+ border: 1px solid var(--ns-primary);
+ background-color: var(--ns-bg-dark-100);
+ border-radius: 5px;
+ margin: 10px;
+ } \ No newline at end of file
diff --git a/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.html b/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.html
index ef41775a..eedc6ade 100644
--- a/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.html
+++ b/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.html
@@ -1,4 +1,2 @@
-<div id="divScatterChart" style="width: 100%;height: 100%;">
- <canvas id="ScatterCharts" style="width: 100%;height: 280px;"> </canvas>
-</div> \ No newline at end of file
+ <canvas id="ScatterCharts"> </canvas>