aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/line-chart/line-chart.component.ts
blob: 6866386147e9dbb511dd64583a53850ffd203a42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 {
  @Input() dataAcc=[] ;
  @Input() dataEpoch=[];
  constructor() { }

  ngOnInit(): void {
    var myChart=new Chart("myChart",
      {
        type: 'line',
    data: {
        labels:this.dataEpoch,
        datasets: [{
            label: 'Vrednost',
            data: this.dataAcc,
            borderWidth: 1
        }]
    },
    options: {
        scales: {
            y: {
                beginAtZero: true
            }
        }
    }
      }
    );
 
  }
}