How to Cancel rendering of StiChart

Stimulsoft Reports.WPF discussion
Post Reply
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

How to Cancel rendering of StiChart

Post by sandynith »

Greetings,

We have a report with text data and with a chart with functionality to cancel the report while it is still in rendering phase.

Currently I do this (which serves the purspose):

Code: Select all

report.Rendering += (s, e) => {
    if (cancelled && !report.IsStopped)
    {
        report.IsStopped = true;
        Log.Trace("Cancellation of report rendering requested after {0} pages", report.RenderedPages.Count);
    }
};
As I understand the Rendering event handler is fired after rendering each page. So after rendering a page we get the opportunity to check if the report is being cancelled and set IsStopped=true.
Usually a page is rendered quite fast hence this usually works fine for a report which just has text.

Problem: When I try to render a chart which has too many series to plot then it may take long time to complete the rendering.
Because Chart is rendered in only ONE PAGE, the Rendering event handler is not fired during chart rendering process and hence I do not have any way to to check if report is being cancelled and say report.IsStopped=true (from the same thread context which is rendering the report).

So, I would like to know is there any good way to cancel a report which is rending a chart which may take quite long time to load. Like, Is there any event handler which can be called during the chart rendering phase or which can be called periodically.
Any advice will be of great help.

Thanks,
Sandeep
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to Cancel rendering of StiChart

Post by HighAley »

Hello, Sandeep.

To improve rendering time we check IsStopped property of the report after rendering each page.
So there is no way to stop rendering before the page is completely rendered. Even if you set the IsStopped property earlier the page rendering will be finished.

Thank you.
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

Re: How to Cancel rendering of StiChart

Post by sandynith »

Hi Aleksey,
Does that mean during the chart rendering (which may take long time to render) there is NO way to cancel the rendering process?

As I said, we have reports which may try to render a chart taking long time (more than 30 mins), and with the current code if we cancel the report then it just locks up the whole system till the chart page is rendered and this is not nice.

Can you think of any workaround?

Thanks,
Sandeep
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to Cancel rendering of StiChart

Post by HighAley »

Hello.

At first check our latest prerelease build. We made there large optimization of chart rendering.
If there still be such long chart rendering time, please, send us a sample report template with all necessary data or better a project which reproduces the issue.

Thank you.
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

Re: How to Cancel rendering of StiChart

Post by sandynith »

Hi Aleksey,

I tested my big reports which are plotting charts with latest 2014.2 (WPF) build and I must appreciate that there is a significant improvement in terms of chart rendering time.
Now Charts are able to handle much larger reports (compared to 2014.1) and are able to plot the chart in just couple of minutes.
Hence now its rare to see our process locking up if someone cancels the report when chart rendering is still in progress.

We are quite happy with this and as a consequence now we can increase the data point limits of our reports which can be plotted on a chart.

A big kudos to your team !!
Sandeep
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to Cancel rendering of StiChart

Post by HighAley »

Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply