在Angular中遍历项目时,syncfusion chart的行为不一致

时间:2019-02-04 10:37:31

标签: angular syncfusion

我在应用程序中使用了Syncfusion图表。 我已经在下面的stackblitz链接中实现了一个示例。

https://stackblitz.com/edit/angular-ng8kss?file=src%2Fapp%2Fapp.component.html

如果我一次打印图表就可以了

问题:遍历项目时,图表未显示为tempArray中的项目数(请参阅app.component.html中的第一行代码) 请让我知道是否有人知道答案。

1 个答案:

答案 0 :(得分:1)

我们可以通过在图表 print 方法中传递父代ID 来满足您的要求,以便可以根据需要打印整个图表。

print.html

<div class="col-md-9" id="print1">
    <div *ngFor="let item of tempArray;let i = index">
       // Other chart configurations
    </div>
</div>

print.component.ts

// Getting instance of chart

@ViewChild('pie')
public pie: AccumulationChartComponent;

public mode(e: Event): void {
    // Passing the parent id
    this.pie.print("print1");
}

Sample

希望这会有所帮助。

谢谢, 达拉尼。