components.ts 4.18 KB
Newer Older
Ooh-Ao committed
1
import { Component, EventEmitter, OnInit, Output, SimpleChanges } from "@angular/core";
Ooh-Ao committed
2 3 4
import { EChartsOption } from 'echarts';
import { NgxEchartsModule } from 'ngx-echarts';
import * as echarts from 'echarts';
Ooh-Ao committed
5
import { HttpClient, HttpClientModule, HttpHeaders } from "@angular/common/http";
Ooh-Ao committed
6 7 8 9 10

export interface Service {
  id: number;
  title: string;
  description: string;
Ooh-Ao committed
11 12 13
  dataModel: any;
  dataSoure: any;
  api: string;
Ooh-Ao committed
14 15 16 17 18 19
}

export enum ServiceTypes {
  consultancy, // 0
  trainings, // 1
  engineering, // 2
Ooh-Ao committed
20
  statistic, //3
Ooh-Ao committed
21 22 23 24
}

@Component({
  selector: 'consultancy',
Ooh-Ao committed
25 26
  standalone: true,
  imports: [NgxEchartsModule],
Ooh-Ao committed
27
  template: `
Ooh-Ao committed
28
  <div>{{model}}</div>
Ooh-Ao committed
29
    <div echarts [options]="model" class="demo-chart"></div>
Ooh-Ao committed
30 31
  `,
})
Ooh-Ao committed
32
export class ConsultancyComponent {
Ooh-Ao committed
33
  model: any = {
Ooh-Ao committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    },
    yAxis: {
      type: 'value',
    },
    series: [
      {
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line',
      },
    ],
  };
}

Ooh-Ao committed
50 51
@Component({
  selector: 'engineering',
Ooh-Ao committed
52 53
  standalone: true,
  imports: [NgxEchartsModule],
Ooh-Ao committed
54
  template: `
Ooh-Ao committed
55
    <div echarts [options]="model" class="demo-chart"></div>
Ooh-Ao committed
56 57
  `,
})
Ooh-Ao committed
58
export class SoftwareEngineeringComponent {
Ooh-Ao committed
59
  model: any = {
Ooh-Ao committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    legend: {},
    tooltip: {},
    dataset: {
      dimensions: ['product', '2015', '2016', '2017'],
      source: [
        { product: 'Matcha Latte', '2015': 43.3, '2016': 85.8, '2017': 93.7 },
        { product: 'Milk Tea', '2015': 83.1, '2016': 73.4, '2017': 55.1 },
        { product: 'Cheese Cocoa', '2015': 86.4, '2016': 65.2, '2017': 82.5 },
        { product: 'Walnut Brownie', '2015': 72.4, '2016': 53.9, '2017': 39.1 }
      ]
    },
    xAxis: { type: 'category' },
    yAxis: {},
    // Declare several bar series, each will be mapped
    // to a column of dataset.source by default.
    series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
  };



}
Ooh-Ao committed
81 82 83

@Component({
  selector: 'trainings',
Ooh-Ao committed
84 85
  standalone: true,
  imports: [NgxEchartsModule],
Ooh-Ao committed
86
  template: `
Ooh-Ao committed
87
    <div>{{model}}</div>
Ooh-Ao committed
88
    <div echarts [options]="model" class="demo-chart"></div>
Ooh-Ao committed
89 90
  `,
})
Ooh-Ao committed
91
export class TrainingsComponent {
Ooh-Ao committed
92
  model: any = {
Ooh-Ao committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
    legend: {},
    tooltip: {},
    dataset: {
      source: [
        ['product', '2012', '2013', '2014', '2015', '2016', '2017'],
        ['Milk Tea', 86.5, 92.1, 85.7, 83.1, 73.4, 55.1],
        ['Matcha Latte', 41.1, 30.4, 65.1, 53.3, 83.8, 98.7],
        ['Cheese Cocoa', 24.1, 67.2, 79.5, 86.4, 65.2, 82.5],
        ['Walnut Brownie', 55.2, 67.1, 69.2, 72.4, 53.9, 39.1]
      ]
    },
    series: [
      {
        type: 'pie',
        radius: '20%',
        center: ['25%', '30%']
        // No encode specified, by default, it is '2012'.
      },
      {
        type: 'pie',
        radius: '20%',
        center: ['75%', '30%'],
        encode: {
          itemName: 'product',
          value: '2013'
        }
      },
      {
        type: 'pie',
        radius: '20%',
        center: ['25%', '75%'],
        encode: {
          itemName: 'product',
          value: '2014'
        }
      },
      {
        type: 'pie',
        radius: '20%',
        center: ['75%', '75%'],
        encode: {
          itemName: 'product',
          value: '2015'
        }
      }
    ]
  };


}
Ooh-Ao committed
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181


@Component({
  selector: 'statistic',
  standalone: true,
  imports: [NgxEchartsModule],
  template: `
    <div echarts [options]="model" class="demo-chart"></div>
  `,
})
export class StatisticComponent {

  model: any = {
    legend: {},
    tooltip: {},
    dataset: {
      dimensions: ['product', '2015', '2016', '2017'],
      source: [
        { product: 'Matcha Latte', '2015': 43.3, '2016': 85.8, '2017': 93.7 },
        { product: 'Milk Tea', '2015': 83.1, '2016': 73.4, '2017': 55.1 },
        { product: 'Cheese Cocoa', '2015': 86.4, '2016': 65.2, '2017': 82.5 },
        { product: 'Walnut Brownie', '2015': 72.4, '2016': 53.9, '2017': 39.1 }
      ]
    },
    xAxis: { type: 'category' },
    yAxis: {},
    // Declare several bar series, each will be mapped
    // to a column of dataset.source by default.
    series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
  };

  constructor(private http: HttpClient) {

  }

  ngOnInit(): void {
  }

}