Home
Analytics
Chart mouse over tooltip via script
hallj05
<p>Hey,</p><p> </p><p>In OS BIRT 4.2.2</p><p> </p><p>How do I change what is showing in the mouse over text (what shows when the mouse hovers over a bar in a bar graph) by using a script? I know it can be changed by editing the chart, but I need to be able to access and change what is displayed in a script on the chart.</p><p> </p><p>Since in the scripting I can get the data to match the locales that we are using, because we are using two locales at the same time, one for words and another for numbers. Which in the hover text we have both and if it's in the script I can get each part to match the locale that we have set.</p><p> </p><p>Thanks for any help!</p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p><p> </p><p>Before writing script, have you tried using the Expression Builder to create the Tooltip Text? It is located in the Chart Builder under Format Chart --> Value Y Series --> Interactivity. Just in case this might be simpler...</p><p> </p><p>P.</p>
hallj05
<p>Yeah I had tried to use the Expression Builder, but was unable to get it to be able to format numbers/currency fields to a different locale than the current locale for the report.</p>
pricher
<p>Hi again,</p><p> </p><p>If you just want to change the locale of your report at run time, you can reset it by writing one line of script in the beforeFactory of your report.</p><p> </p><p>For example:</p><p> </p><p>[font="'courier new', courier, monospace;"]reportContext.getDesignHandle().setStringProperty("locale",params["ReportLocale"].value);[/font]</p><p> </p><p>will change the locale of your report to a value passed by a run-time parameter. After that, the format of your date and numeric fields will be formatted accordingly.</p><p> </p><p>Full example is attached.</p><p> </p><p>P.</p>
hallj05
<p>Well we are trying to use two locales at the same time, one for strings and another for dates/numbers formatting. Since we are trying to allow the BIRT reports to display in any language (as long as it has the properties file to match) and for the user to be allowed to use any locale formatting.</p><p> </p><p>So they could have the language displaying in English (en_US) and what the date/number formatting to be the French style (fr_FR).</p><p> </p><p>I've figured out how to make the x/y-axis labels to allow two different locales but it has to be done by changing the values by scripting, which is why I've been trying to figure out a way to access the hover tooltip text by scripting, or maybe it would work if I created the tooltip within the script (think I read something about that)</p>
hallj05
<p>So it seems like I would need to use TooltipValueImpl to get/set the values that are being set in the tooltip for the chart. I haven't been able to get it to work and there are not any good examples showing how to do this in scripts.</p>