Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Chart tooltip issues
hallj05
<p>Hey,</p>
<p> </p>
<p>We are using BIRT 4.2.2 Open Source.</p>
<p> </p>
<p>When adding a tooltip text (text that displays when hovering over the chart).</p>
<p> </p>
<p>The series option and chart area option are shown in the Chart.png</p>
<p> </p>
<p>If I do it via the series option then it allows code and has the fx option (right picture in the ToolTip.png) This will allow the localization to work correctly.</p>
<p> </p>
<p>If I do it via the chart area option then it only allows plain text (left picture in the ToolTip.png) This doesn't allow the localization to work, and just displays the code in plain text.</p>
<p> </p>
<p>Which I need to use the chart area since this is text that needs to display when the user hovers over any area of the chart and I need it to allow the use of code so that we can use the localization to allow the text to change language using the properties files.</p>
<p> </p>
<p>Thanks for any help!</p>
Find more posts tagged with
Comments
mwilliams
You could set the default text in the tooltip, then, in your chart script, you could do something like this to convert it:<br><br><pre class="_prettyXprint _lang-auto _linenums:0">
function beforeGeneration( chart, icsc )
{
origVal = chart.getBlock().getTriggers().get(0).getAction().getValue().getText();
newVal = //determine the converted value from properties file
chart.getBlock().getTriggers().get(0).getAction().getValue().setText(newVal);
}
</pre>Hope this helps.
hallj05
<p>I tried to do the following</p>
<p> </p>
<p>function beforeGeneration( chart, icsc )<br>
{<br>
importPackage(Packages.java.text);<br>
importPackage(Packages.java.util);<br><br>
chart.getBlock().getTriggers().get(0).getAction().getValue().setText(reportContext.getMessage("ReportID.text", reportContext.getLocale()));<br><br>
}</p>
<p> </p>
<p>Which the reportContext.getMessage("ReportID.text", reportContext.getLocale()) gets the correct text for the locale.</p>
<p> </p>
<p>But when I try this I get the following:</p>
<p>TypeError: Cannot find function setText in object org.eclipse.birt.chart.model.attribute.impl.MultiURLValuesImpl@73d62b65 (tooltip: null). at line 62 of chart script:''</p>
<p> </p>
<p>The chart that we are using is a Line chart and we are only needing the tooltip (hovertext) to display when the mouse is over any part of the chart (since we are telling them that they need to double click to drill down to the next report).</p>
mwilliams
<p>Inside the chart script, you won't be able to use reportContext. You'll need to do icsc.getExternalContext().getScriptable().getMessage... most likely.</p>
<p> </p>
<p>As for the error you're getting, it's because you're using multiple triggers. The drill down is apparently the first trigger in your list of triggers, so you could try get(1) instead of get(0) or you could be more dynamic and loop through the triggers to find the tooltip one.</p>
hallj05
<p>That explains why it was doing that, I used the get(1) and it works like a charm.</p>
<p> </p>
<p>Thanks for the help!</p>