diff options
author | TAMARA JERINIC <tamara.jerinic@gmail.com> | 2022-05-11 23:51:43 +0200 |
---|---|---|
committer | TAMARA JERINIC <tamara.jerinic@gmail.com> | 2022-05-11 23:51:43 +0200 |
commit | 2734c3593bbbf1aeeeb9724b41ade50471db3340 (patch) | |
tree | 3c41a1453a68abcaafad7b5bb832bdbf44edfa3d /frontend/src/app/_elements/_charts/pie-chart | |
parent | 781e458149b4c123d0ccfe99c36abc42f2e72055 (diff) | |
parent | 83874afbeb3d7676a469e70aff6a15615d1c7380 (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')
-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 |