@swimlane/ngx-charts
Version:
Declarative Charting Framework for Angular2 and beyond!
53 lines (46 loc) • 1.07 kB
text/typescript
import {
Component,
Input,
OnChanges,
SimpleChanges,
ChangeDetectionStrategy
} from '@angular/core';
export class SvgLinearGradientComponent implements OnChanges {
orientation = 'vertical';
color;
name;
stops: any[];
x1: any;
x2: any;
y1: any;
y2: any;
ngOnChanges(changes: SimpleChanges): void {
this.x1 = '0%';
this.x2 = '0%';
this.y1 = '0%';
this.y2 = '0%';
if (this.orientation === 'horizontal') {
this.x2 = '100%';
} else if (this.orientation === 'vertical') {
this.y1 = '100%';
}
}
}