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)
Chart Legend Tooltip
cypherdj
Hi,
I've created a chart where the legend labels can be quite long texts, and have tried setting a legend label interactivity tooltip to display the full text on hover.
However, the tooltip text always displays as row["NAME"], which I hoped it would map to the actual value but to no avail.
I know I could put the tooltip on the slice instead, but it would seem to be more intuitive for the user to hover over the legend.
Thanks,
Cedric
Find more posts tagged with
Comments
mwilliams
Hi Cedric,<br />
<br />
I don't think there is currently a way to do that without going into the source and modifying it to do that for you. That would be a good feature to request as an enhancement, however. You can do that at <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/reportabug.php'>http://www.eclipse.org/birt/phoenix/reportabug.php</a>
. You could also post a link to the enhancement request in here for tracking purposes.
zqian
You can somehow use Chart scripting to alter the tooltip value for each legend item. Here's the sample code:
var oldValue;
function beforeDrawLegendItem( lerh, bounds, icsc )
{
if (lerh.getLabel().getCaption().getValue().equals("AK"))
{
oldValue = icsc.getChartInstance().getLegend().getTriggers().get(0).getAction().getValue().getText();
icsc.getChartInstance().getLegend().getTriggers().get(0).getAction().getValue().setText("My AK Description");
}
}
function afterDrawLegendItem( lerh, bounds, icsc )
{
if (oldValue)
{
icsc.getChartInstance().getLegend().getTriggers().get(0).getAction().getValue().setText(oldValue);
oldValue = null;
}
}
Note the legend item can only bind to static text and not support direct binding to any row data, that's because legend items are not mapped to data rows in the model, though you can do some mappings by yourself through some additional scriptings.
cypherdj
Thanks for the suggestions zqian.
I found a way to get the legend to display correctly, using the "wrapping width" property of the legend layout. By default, this is set to 0, but setting this value to 100 seems to force the word wrapping.