all groups > sql server reporting services > october 2006 >
You're in the

sql server reporting services

group:

Dundas: Feature request: Allow expression on enabled property of chart legend


Dundas: Feature request: Allow expression on enabled property of chart legend Steve MunLeeuw
10/12/2006 3:51:32 PM
sql server reporting services: In our horizontal stacked bar charts we use a zero line as a watermark.
Because we need to re-arange the sort order from left to right, rather than
from the zero line we use a custom legend. Depending on the data availible
we show one of two sets of statistics. I'd like to build two custom legends
and show/hide them as appropriate, but the enabled property doesn't allow
expressions. Should I try to accomplish setting the enabled property on the
legends from an event in the chart instance, or from code behind in the
report? I have the chart in a list, frequently I will want to show legend
'A' for the first list item, and legend 'B' for the remainder. The standard
chart that ships with RS doesn't have this feature either.


Thanks,
Steve MunLeeuw

Re: Dundas: Feature request: Allow expression on enabled property of chart legend andrewb NO[at]SPAM dundas.com
11/3/2006 6:47:14 AM
Steve,

The best solution for this is to use our code editor and set a named
"code parameter" value with an expression. Then, during one of the
events, use the boolean value determined by your expression expression
and set it to the enabled property of the legend that you want to hide.

I would suggest doing this during either the PostInitialize OR the
PostApplyData events. the C# code would look like:

// a code parameter called ShowLegend should be defined with a value
// that will be resolved as a boolean
if(codeParams.ContainsKey("ShowLegend"))
{
bool showLegend = false;
if(bool.TryParse(codeParams["ShowLegend"].ToString(), out showLegend))
chartObj.Legends[0].Enabled = showLegend;
}

For faster response to questions, please use the dundas forums:

http://support.dundas.com/forum/

Thanks

Andrew Bryan



[quoted text, click to view]
Re: Dundas: Feature request: Allow expression on enabled property of chart legend Steve MunLeeuw
11/4/2006 10:57:23 PM
Excellent, thanks

[quoted text, click to view]

AddThis Social Bookmark Button