COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: aydakut on 10 Feb 2012 02:38:46 AM

Title: Is it possible to change chart tooltip
Post by: aydakut on 10 Feb 2012 02:38:46 AM
Hi, We would like to know if we can change the tooltip of a chart dynamically by using parameters.
Thanks.
Title: Re: Is it possible to change chart tooltip
Post by: kattaviz on 13 Feb 2012 11:35:08 AM
Hi,
I have used the following script to chage the default tool tips for charts.

<script>
areas = document.getElementsByTagName('area');
var stop = 0;
var toMatch = new RegExp('Product line = " +  [Query1].[Product line] + "');
toMatch = toMatch.toString();
toMatch = toMatch.substring(1,toMatch.length -1);

for(i in areas) {
   if(areas.className='dl chart_area') {
      if(areas.title ){
         var title = areas.title;
         if( title.indexOf(toMatch) == 0 && title.indexOf('Revenue = ') > -1){
             areas.title = '" + [Query1].[Product line] + " - Quantity  - " + number2string([Query1].[Quantity]) + "';
            //alert( 'Changed ' + areas.title '  To  ' +  areas.title );
         }
      }
     }
}

</script>

HTH