aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/_charts/scatterchart/scatterchart.component.ts
blob: 12795c70b8d0a91fdca470269135aa45846adbed (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { Component, OnInit } from '@angular/core';
import {Chart} from 'node_modules/chart.js';

@Component({
  selector: 'app-scatterchart',
  templateUrl: './scatterchart.component.html',
  styleUrls: ['./scatterchart.component.css']
})
export class ScatterchartComponent implements OnInit {

  constructor() { }

  ngOnInit(){
    const myChart = new Chart("ScatterCharts", {
      type: 'scatter',
      data: {
          datasets: [{
              label: 'Scatter Example:',
              data: [{x: 1, y: 11}, {x:2, y:12}, {x: 1, y: 2}, {x: 2, y: 4}, {x: 3, y: 8},{x: 4, y: 16}, {x: 1, y: 3}, {x: 3, y: 4}, {x: 4, y: 6}, {x: 6, y: 9},
                {x: 11, y: 9},
                {x: 12, y: 8},
                {x: 13, y: 6},
                {x: 14, y: 0},
                {x: 15, y: 5},
                {x: 16, y: 3},
                {x: 17, y: 2}],
                borderColor: 'white',
            }]
      },
      options: {
          scales: {
              x:{
                ticks: {
                  color: 'white'
                },
                grid: {
                  color: "rgba(0, 99, 171, 0.5)"
                }
              },
              y: {
                  beginAtZero: true,
                  ticks: {
                    color: 'white'
                  },
                  grid: {
                    color: "rgba(0, 99, 171, 0.5)"
                  }
              }
              
          }
          
          
      }
  });
  }
}