Skip to content

Commit

Permalink
new code
Browse files Browse the repository at this point in the history
  • Loading branch information
filippov committed Aug 9, 2017
1 parent 94292f2 commit 8aaf683
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
[options]="{}"
[legend]="chartLegend"
[chartType]="chartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
(chartHover)="chartHover.emit($event)"
(chartClick)="chartClick.emit($event)"></canvas>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class CostsChartLayoutComponent {
public chartLabels: Array<any> = [];

public chartType: string = 'line';
public chartOptions: any = {responsive: true};
public chartLegend: boolean = true;

constructor() {
Expand All @@ -30,14 +29,6 @@ export class CostsChartLayoutComponent {
this.chartDataSet = true;
}

public chartClicked(e: any): void {
this.chartClick.emit(e);
}

public chartHovered(e: any): void {
this.chartHover.emit(e);
}

switchChart(type) {
this.chartType = type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<md-card-subtitle></md-card-subtitle>
</md-card-header>
<md-card-content>
<costs-chart-layout></costs-chart-layout>
<costs-chart-layout (chartClick)="chartClick($event)" (charthover)="chartHover($event)"></costs-chart-layout>
</md-card-content>
</md-card>
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ export class CostsChartComponent implements OnInit {
}
);
}

chartClick(e: any) {
console.log(e);
}

chartHover(e: any) {
console.log(e);
}
}
10 changes: 3 additions & 7 deletions src/app/modules/finance/components/costs/costs.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, ViewChild} from "@angular/core";
import {CostsChartComponent} from "../costs-chart/costs-chart.component";
import {CostsListComponent} from "../costs-list/costs-list.component";
import {CostsStatisticComponent} from "../costs-statistic/costs-statistic.component";

@Component({
selector: 'costs',
Expand All @@ -9,17 +10,12 @@ import {CostsListComponent} from "../costs-list/costs-list.component";
})
export class CostsComponent {

constructor(){
constructor() {
}

public options = {
position: ["bottom", "right"],
timeOut: 3000,
lastOnBottom: true
};

@ViewChild(CostsListComponent) private costsListComponent: CostsListComponent;
@ViewChild(CostsChartComponent) private costsChartComponent: CostsChartComponent;
@ViewChild(CostsStatisticComponent) private costsStatisticComponent: CostsStatisticComponent;

requestModifiedData() {
this.costsListComponent.getCosts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<spinner class="edit-cost-dialog-spinner" [hidden]="!loading" [strokeWidth]="strokeWidth" [width]="spinnerWidth" [height]="spinnerHeight"></spinner>
</div>
<div class="edit-cost-dialog-header">
<p>Добавить операцию</p>
<p>Изменить операцию</p>
</div>
<form [formGroup]="editCostForm" (ngSubmit)="updateCost(cost)">
<table cellpadding="0">
Expand Down

0 comments on commit 8aaf683

Please sign in to comment.