Skip to content

Commit

Permalink
Add chart
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielShinj1 committed Jun 20, 2024
1 parent 19981e5 commit a78e01a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/app/core/test-page/test-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@
<app-image-grid [gridItems]="exemplosPhotos" [large]="true"></app-image-grid>

<app-image-grid [gridItems]="modalExemplo"></app-image-grid>
</section>
3 changes: 3 additions & 0 deletions src/app/core/test-page/test-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { environment } from '../../../environments/environment'
/* MQTT FINAL */
import { MongoClient } from 'mongodb';

import { Chart } from 'chart.js';

@Component({
selector: 'app-test-page',
templateUrl: './test-page.component.html',
Expand Down Expand Up @@ -74,6 +76,7 @@ export class TestPageComponent {
]



/* MQTT */
constructor(private _mqttService: MqttService) {
this.client = this._mqttService;
Expand Down
6 changes: 3 additions & 3 deletions src/app/models/chart.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ChartModel {
name: string
label?: string
labels?: Float32Array
data?: Float32Array
categories?: Float32Array
text: string
titleC?: string
}
1 change: 1 addition & 0 deletions src/app/shared/chart/chart.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<app-bar-chart></app-bar-chart>
55 changes: 30 additions & 25 deletions src/app/shared/chart/chart.component.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
import { Component, OnInit, Input } from '@angular/core';
import {
ChartComponent,
ApexAxisChartSeries,
ApexChart,
ApexXAxis,
ApexDataLabels,
ApexTitleSubtitle,
ApexStroke,
ApexGrid
} from "ng-apexcharts";

export type ChartOptions = {
series: ApexAxisChartSeries;
chart: ApexChart;
xaxis: ApexXAxis;
dataLabels: ApexDataLabels;
grid: ApexGrid;
stroke: ApexStroke;
title: ApexTitleSubtitle;
};
import { Component, Input, OnInit } from '@angular/core';
import { Chart } from 'chart.js';

@Component({
selector: 'app-chart',
templateUrl: './chart.component.html',
})

export class ChartsComponent implements OnInit {
@Input() name!: string


export class ChartComponent implements OnInit {
@Input() label?: string
@Input() labels?: Float32Array
@Input() data?: Float32Array
@Input() categories?: Float32Array
@Input() text!: string

public chart: any;

ngOnInit(): void {
this.createChart();
}

createChart(){

this.chart = new Chart("MyChart", {
type: 'line',

data: {
labels: [],
datasets: [
{
label: '',
data: [],
backgroundColor: 'blue'
},
]
},
options: {
aspectRatio:2.5
}
});
}

}

0 comments on commit a78e01a

Please sign in to comment.