-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
martinbobbio1@gmail.com
committed
Oct 9, 2018
1 parent
fcfa326
commit 6cc08fd
Showing
13 changed files
with
258 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/app/components/graphic-donut/graphic-donut.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h4>{{title}}</h4> | ||
|
||
<div style="display:block"> | ||
<canvas baseChart [data]="doughnutChartData" [labels]="doughnutChartLabels" chartType="doughnut"></canvas> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
src/app/components/graphic-donut/graphic-donut.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-graphic-donut', | ||
templateUrl: './graphic-donut.component.html', | ||
styles: [] | ||
}) | ||
export class GraphicDonutComponent implements OnInit { | ||
|
||
@Input('chartLabels') doughnutChartLabels:string[] = []; | ||
@Input('chartData') doughnutChartData:number[] = []; | ||
@Input() title:string; | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h3>{{leyend}}</h3> | ||
|
||
<div class="input-group"> | ||
<span class="input-group-btn"> | ||
<button class="btn btn-primary" type="button" (click)="changeValue(-5)"> | ||
<i class="mdi mdi-minus"></i> | ||
</button> | ||
</span> | ||
<input #txtPercent type="number" min="1" max="100" class="form-control" name="percent" [(ngModel)]="percent" (ngModelChange)="changeNgModel($event)"> | ||
<span class="input-group-btn"> | ||
<button class="btn btn-primary" type="button" (click)="changeValue(+5)"> | ||
<i class="mdi mdi-plus"></i> | ||
</button> | ||
</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Component, OnInit, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-incrementor', | ||
templateUrl: './incrementor.component.html', | ||
styles: [] | ||
}) | ||
export class IncrementorComponent implements OnInit { | ||
|
||
@ViewChild('txtPercent') txtPercent: ElementRef; | ||
|
||
@Input() percent:number = 50; | ||
@Input() leyend:string = 'Leyenda'; | ||
|
||
@Output() percentValue:EventEmitter<number> = new EventEmitter(); | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
changeValue(value){ | ||
|
||
if(this.percent >= 100 && value > 0){ | ||
this.percent = 100; | ||
return; | ||
} | ||
|
||
if(this.percent <= 0 && value < 0){ | ||
this.percent = 0; | ||
return; | ||
} | ||
|
||
this.percent += value; | ||
this.percentValue.emit(this.percent); | ||
this.txtPercent.nativeElement.focus(); | ||
} | ||
|
||
changeNgModel(value){ | ||
|
||
if(value >= 100) | ||
this.percent = 100; | ||
else if(value <= 0) | ||
this.percent = 0; | ||
else | ||
this.percent = value; | ||
|
||
this.txtPercent.nativeElement.value = Number(this.percent) | ||
this.percentValue.emit(this.percent); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
<p> | ||
graphic works! | ||
</p> | ||
<div class="row"> | ||
|
||
<div class="col-6"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<app-graphic-donut [chartLabels]="graficos.grafico1.labels" [chartData]="graficos.grafico1.data" [title]="graficos.grafico1.leyenda"></app-graphic-donut> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<app-graphic-donut [chartLabels]="graficos.grafico2.labels" [chartData]="graficos.grafico2.data" [title]="graficos.grafico2.leyenda"></app-graphic-donut> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<app-graphic-donut [chartLabels]="graficos.grafico3.labels" [chartData]="graficos.grafico3.data" [title]="graficos.grafico3.leyenda"></app-graphic-donut> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<app-graphic-donut [chartLabels]="graficos.grafico4.labels" [chartData]="graficos.grafico4.data" [title]="graficos.grafico4.leyenda"></app-graphic-donut> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
<p> | ||
progress works! | ||
</p> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
|
||
<h3 class="card-title">Barra de progreso</h3> | ||
|
||
<div class="progress"> | ||
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" [attr.ariaValueNow]="percent1" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" [style.width]="percent1 + '%'"></div> | ||
</div> | ||
<div class="progress mt-4"> | ||
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" role="progressbar" [attr.ariaValueNow]="percent2" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" [style.width]="percent2 + '%'"></div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
|
||
<app-incrementor (percentValue)="percent1 = $event" leyend="Primario" [percent]=percent1></app-incrementor> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
|
||
<app-incrementor (percentValue)="percent2 = $event" leyend="Secundario" [percent]=percent2></app-incrementor> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters