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)
get current series value in a tooltip
jsherriff
Maybe there's another way to do this, but is it possible to get the current series value for appending to in the tooltip text? I'd like to append text to the series value and because the series value in this case is a computed value, it's making it difficult. It'd be very handy to just make reference to the current value somehow. ie: curVal + ' something'
Find more posts tagged with
Comments
mwilliams
Hi jsherriff,
Can you explain a little more what you're trying to do? I think I understand, but I wanted more info to be sure. Thanks.
jsherriff
the items we're trying to display tooltips for are computed and the tooltips for them have a string appended. Because they're painful to compute, it would be handy if we could just refer to the current value when specifying the tooltip text. IE: the value that would be displayed by default if we didn't specify the tooltip contents. In other words, I'd like to apply a suffix to the default tooltip, but don't know how.
bhanley
You should have access to all the data values (including the current series value) in the expression editor that is used to build the tool tip itself. You can build out a tool tip in the expression editor by treating the various components as JavaScript variables. <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>"Sales Details for " + row["PRODUCTLINE"] + " are " + row["VALUE"]</pre>
<br />
Where are you doing the calculation for the series value? If you give me an idea where the calculation is done, and where the resulting value is found I can probably put a sample up to help guide you.
jsherriff
Thanks, but in this case the series value isn't a row[] member, it's computed in a JS function. I know how to set the tooltip value to what I need, either by way of a global variable or re-computing it in the tooltip specification. That isn't the issue. I'd just like to know if there's an easier way - a way to refer to the current value when specifying the tooltip contents. I'm guessing there isn't. Perhaps if I knew what JS objects were in scope when the tooltip is evaluated, I'd know if it's possible to get the current series value.
bhanley
I understand what you want now. You can easily use a Persistent Global Variable to access the custom value.<br />
<br />
To set the Persistent Global Variable:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.setPersistentGlobalVariable("gvTest", "Some Value");</pre>
<br />
To Access the Persistent Global Variable on the Chart Interactivity:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.getPersistentGlobalVariable("gvTest")</pre>
<br />
I have attached a working sample for you to have a look at. In the sample, I set the Global Variable in the report's <strong class='bbc'><em class='bbc'>initialize</em></strong> event. I then access the global variable via the Pie Chart's Interactivity "<em class='bbc'>Mouse Over</em>" Hook. <br />
<br />
Report is built using the Classic models sample database on BIRT 2.3.2<br />
<br />
Good Luck!