Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Hide series identifier (title) when showing legends via scripting
mas_h
Hi,
I have a chart that have 2 series which I named series1 and series2.
I want to show/hide the legend items based on some condition, so I use some scripting to achieve this.
The code looks like something like this:
if (..condition is met..) {
var llh = gcs.getRunTimeContext().getLegendLayoutHints();
var liha = llh.getLegendItemHints( );
var new_length = liha.length/2; // Note: I only want to show legend for one series
var nliha = [];
nidx = 0;
for( idx = 0; idx < new_length; idx++ ){
tli = liha[idx];
nliha[nidx++]=tli;
}
var nllh = new LegendLayoutHints(llh.getLegendSize(),llh.getTitleSize(), llh.getLaTitle(), llh.isMinSliceApplied(), null, nliha );
gcs.getRunTimeContext().setLegendLayoutHints(nllh);
}
The legends did show when the condition is met, but the series title (series1) also shows. (See attachment)
How can I hide the title "series1"?
If I do not have the script, the legends looks fine without the title.
But this happens in 3.7.2. Previously with 2.2.1, it was fine.
Thanks.
Find more posts tagged with
Comments
mwilliams
Can you reproduce your issue with the sample database and attach the report? Thanks!
mas_h
Hi..
We are able to solve it by setting the series identifier to " " in beforeGeneration(...) function.
mwilliams
Good enough! Let us know whenever you have questions!