diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-05-11 23:36:40 +0200 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-05-11 23:36:40 +0200 |
commit | 83874afbeb3d7676a469e70aff6a15615d1c7380 (patch) | |
tree | ad8bf420afb51ccbd74725822e6b02cbd0cb8829 /frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts | |
parent | 3e1dd2a20b4cbb3fd18c097d287c175adfad2997 (diff) | |
parent | 9b688a23e280af246b45bb588ffcf74ca8741db4 (diff) |
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into redesign
Diffstat (limited to 'frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts')
-rw-r--r-- | frontend/src/app/_elements/_charts/pie-chart/pie-chart.component.ts | 39 |
1 files changed, 25 insertions, 14 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 |