Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142406 | Jan 31,2019 11:34 PM UTC | Feb 4,2019 05:55 AM UTC | Angular - EJ 2 | 1 |
![]() |
Tags: Chart |
<ejs-chart #sopChart id='chart' style='display:block;' [chartArea]='chartArea' align='center' [primaryXAxis]='primaryXAxis'in .ts I handle it like this
[primaryYAxis]='primaryYAxis' [title]='title'>
<e-series-collection>
<e-series type='Column' xName='abbrevDate' yName='value' name='Quantity' width=2 [marker]='marker'> </e-series>
</e-series-collection>
</ejs-chart>
@ViewChild('sopChart') _chart: ChartComponent;
ngOnInit() {
this.loadData(true);
}
filterData(args: IChangedEventArgs){
if(this.notFirstRun){
this.dataSource = this.dataSource.filter((data: { [key: string]: Object }): Boolean => {
return (data.date >= new Date(+args.start) && data.date <= new Date(+args.end));
});
this.loadData(false);
}
this.notFirstRun=true;
}
loadData(load: boolean) {
if(load){
console.log('LOAD DATA');
console.log(this._chart);
this.reportingService.getMainSalesReport().subscribe(
data => {
this.dataSource = data;
this._chart.series[0].dataSource = this.dataSource;
this._chart.refresh();
});
} else{
console.log('RELOAD DATA');
console.log(this._chart);
this._chart.series[0].dataSource = this.dataSource;
this._chart.refresh();
}
}
ngOnInit() {
this.sopComp = new ChartComponent();
}
public changed(args: IChangedEventArgs): void {
this.sopComp.filterData(args);
}
Class BarChartComponent() implements AfterViewInit{
//….
ngAfterViewInit() {
this.loadData(true);
}
}
|
Class BarChartComponent() implements AfterViewInit{
//….
ngOnInit() {
this.xName = ‘abbrevDate’
this.yName = ‘value’
this.loadData(true);
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.