aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_elements')
-rw-r--r--frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts39
-rw-r--r--frontend/src/app/_elements/column-table/column-table.component.ts18
2 files changed, 40 insertions, 17 deletions
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 932ed963..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
@@ -12,21 +12,34 @@ export class PieChartComponent implements AfterViewInit {
@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,
@@ -38,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/column-table/column-table.component.ts b/frontend/src/app/_elements/column-table/column-table.component.ts
index 95c0cb71..6ed76ba4 100644
--- a/frontend/src/app/_elements/column-table/column-table.component.ts
+++ b/frontend/src/app/_elements/column-table/column-table.component.ts
@@ -60,6 +60,19 @@ export class ColumnTableComponent implements AfterViewInit {
});
}
+ updatePieChart(){
+ //min: number, max: number, q1: number, q3: number, median: number
+ let i=0;
+ const pieChart = this.piechartComp.toArray();
+ this.dataset?.columnInfo.forEach(colInfo =>
+ { if (this.experiment.columnTypes[i] == ColumnType.categorical)
+ {
+ pieChart[i].updatePieChart(colInfo!.uniqueValues, colInfo.uniqueValuesPercent);
+ i++;
+ }
+ });
+ }
+
loadDataset(dataset: Dataset) {
console.log("LOADED DATASET");
this.dataset = dataset;
@@ -87,6 +100,7 @@ export class ColumnTableComponent implements AfterViewInit {
this.loaded = true;
this.updateCharts();
+ this.updatePieChart();
}
ngAfterViewInit(): void {
@@ -388,7 +402,5 @@ export class Tab {
public value: Table
) { }
}
-function BoxplotComponent(BoxplotComponent: any) {
- throw new Error('Function not implemented.');
-}
+