How to hide a series at runtime

Stimulsoft Reports.NET discussion
unison
Posts: 17
Joined: Wed Dec 23, 2009 2:08 am

How to hide a series at runtime

Post by unison »

Good day,

Is it possible to hide a series at runtime?

For example, I have a chart with 5 different series. At times, some of those series can be empty, and I wish to hide that series on the graph and legend. Is this possible?

Regards,
David
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

How to hide a series at runtime

Post by Andrew »

Hello,

You may process the BeforePrintEvent in what the elements of diagram are allowed to be deleted:

if (MyCondition)
{
Chart1.Series.RemoveAt(index);
}

Thank you.
AliVa
Posts: 16
Joined: Tue Nov 20, 2012 3:29 am

Re: How to hide a series at runtime

Post by AliVa »

Hi Andrew,
I put chart in the data band and wants to hide/un-hide series based on the data. so I can see multiple charts for each record.

I put "Chart1.Series.RemoveAt(index)" in " Chart Beforeprint event" and it is working for the first record. but it will remove that series for the rest of the report.
Question is how can I un-hide a series? is there any property like "Enabled" for series which can dynamically set to "true" or "false"?

Regards,
Ali
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to hide a series at runtime

Post by HighAley »

Hello.

Sorry, maybe we don't understand your question.
Please, describe your problem more detailed with samples.

Thank you.
AliVa
Posts: 16
Joined: Tue Nov 20, 2012 3:29 am

Re: How to hide a series at runtime

Post by AliVa »

Hi Aleksey,

The report which I build has a databand and in this databand there is a multi series chart. Databand related to the "Master Datasource" and chart attached to "Detail data source" and by using chart condition field, I filter detail_datasource by Master_datasource data.
it is working properly.
now I have a request that in the chart, based on Master_data, just a collection of series become visible and the rest turns to disable.

for example if user wants to see "running total area chart", there is a Boolean field. based on this Boolean field I want to make an area series in the chart enable/disable.

does it make sense now?

the issue that I have with Chart1.Series.RemoveAt is if for one of the first rows, the value of the Boolean field is "false" it will work and remove the series, but if the same value is true for the next rows, the series doesn't show up (as it was removed from the chart)

hope it become more clear now.

Regards,
Ali
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to hide a series at runtime

Post by HighAley »

Hello, Ali.

Unfortunately, it's impossible to hide series. But you could use Filter property of the chart to hide unnecessary series.

Thank you.
AliVa
Posts: 16
Joined: Tue Nov 20, 2012 3:29 am

Re: How to hide a series at runtime

Post by AliVa »

Hello Aleksey,

Thanks for the replay. Filter almost did the job, however there is an issue whenever number of filters in one report is more than 6 or 7. report will break with "Problem when parsing Chart Argument".

is there a problem or limitation regarding number of filters in a report? Please LMK.

Thanks again for your help.

Regards,
Ali
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to hide a series at runtime

Post by Alex K. »

Hello,

Can you please send us your report with test data which reproduce the issue for analysis.

Thank you.
AliVa
Posts: 16
Joined: Tue Nov 20, 2012 3:29 am

Re: How to hide a series at runtime

Post by AliVa »

Hi Aleksey,

it is hard to send you the report. because datasources are dynamically created. is it enough if I send you just the report file? it cant be previewed.

if it is ok, please give me your email address and I will send it for you. because of copy right and privacy issue, I can not put it in the forum.

Regards,
Ali
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to hide a series at runtime

Post by Alex K. »

Hello,

Please send us your report on support@stimulsoft.com

Thank you.
Post Reply