diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-04-19 21:58:00 +0200 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-04-19 21:58:00 +0200 |
commit | 092ea8c9a0a80857e2da47abc789d48d79af405a (patch) | |
tree | 77ae0c6eeb8785ea9008af8e862beffc98b4bd61 /frontend/src/app/_elements/line-chart | |
parent | 923188daa0c90a07c57ecdc6957fcb569b5aa73a (diff) | |
parent | 32d776709f2b5df14dbcfd3f610306a899959851 (diff) |
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into dev
Diffstat (limited to 'frontend/src/app/_elements/line-chart')
-rw-r--r-- | frontend/src/app/_elements/line-chart/line-chart.component.html | 8 | ||||
-rw-r--r-- | frontend/src/app/_elements/line-chart/line-chart.component.ts | 70 |
2 files changed, 28 insertions, 50 deletions
diff --git a/frontend/src/app/_elements/line-chart/line-chart.component.html b/frontend/src/app/_elements/line-chart/line-chart.component.html index 8607aac5..c8f406f4 100644 --- a/frontend/src/app/_elements/line-chart/line-chart.component.html +++ b/frontend/src/app/_elements/line-chart/line-chart.component.html @@ -1,9 +1,5 @@ <div class="chart-wrapper"> - <canvas baseChart - [datasets]="lineChartData" - [labels]="lineChartLabels" - [options]="lineChartOptions" - [legend]="lineChartLegend" - [plugins]="lineChartPlugins"> + <canvas id="myChart"> + </canvas> </div>
\ No newline at end of file diff --git a/frontend/src/app/_elements/line-chart/line-chart.component.ts b/frontend/src/app/_elements/line-chart/line-chart.component.ts index 7a06ecf5..68663861 100644 --- a/frontend/src/app/_elements/line-chart/line-chart.component.ts +++ b/frontend/src/app/_elements/line-chart/line-chart.component.ts @@ -1,57 +1,39 @@ -import { Component, OnInit } from '@angular/core'; -import { ChartOptions } from 'chart.js'; +import { Component, OnInit,Input } from '@angular/core'; import { BaseChartDirective } from 'ng2-charts'; - +import {Chart} from 'chart.js'; @Component({ selector: 'app-line-chart', templateUrl: './line-chart.component.html', styleUrls: ['./line-chart.component.css'] }) -export class LineChartComponent implements OnInit { +export class LineChartComponent implements OnInit { + @Input() dataAcc=[] ; + @Input() dataEpoch=[]; constructor() { } ngOnInit(): void { - } - lineChartData:Array<any> = [ - {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'}, - {data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'}, - {data: [18, 48, 77, 9, 100, 27, 40], label: 'Series C'} - ]; - lineChartLabels: BaseChartDirective["labels"] = ['January', 'February', 'March', 'April', 'May', 'June']; - lineChartOptions = { - responsive: true, - }; - lineChartColors:Array<any> = [ - { // grey - backgroundColor: 'rgba(148,159,177,0.2)', - borderColor: 'rgba(148,159,177,1)', - pointBackgroundColor: 'rgba(148,159,177,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(148,159,177,0.8)' + var myChart=new Chart("myChart", + { + type: 'line', + data: { + labels:this.dataEpoch, + datasets: [{ + label: 'Vrednost', + data: this.dataAcc, + borderWidth: 1 + }] }, - { // dark grey - backgroundColor: 'rgba(77,83,96,0.2)', - borderColor: 'rgba(77,83,96,1)', - pointBackgroundColor: 'rgba(77,83,96,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(77,83,96,1)' - }, - { // grey - backgroundColor: 'rgba(148,159,177,0.2)', - borderColor: 'rgba(148,159,177,1)', - pointBackgroundColor: 'rgba(148,159,177,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(148,159,177,0.8)' + options: { + scales: { + y: { + beginAtZero: true + } + } } - ]; - lineChartLegend = true; - lineChartPlugins = []; - lineChartType = 'line'; - + } + ); + + } } - - +
\ No newline at end of file |