Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147437 | Sep 10,2019 10:21 PM UTC | Sep 13,2019 02:13 PM UTC | Blazor | 1 |
![]() |
Tags: Charts |
<button class="btn btn-primary" @onclick="Print">Print Chart</button>
<EjsChart Title="@compId" @ref="chart" ID="@compId" Width="@ChartWidth">
<ChartEvents Loaded="ChartLoad"></ChartEvents>
</EjsChart>
@code{
public void Print()
{
this.noOfChartLoaded = 0;
this.printId = new List<string>();
ChartWidth = "50%"; //here you can set your required width
StateHasChanged();
this.isPrint = true;
}
public void ChartLoad(ILoadedEventArgs args)
{
this.noOfChartLoaded++;
if(this.noOfChartLoaded == totalData.Count && this.isPrint)
{
this.chart.Print(this.printId.ToArray());
this.printId = new List<string>();
ChartWidth = "100%"; //reset to the default width
this.isPrint = false;
}
}
} |
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.