cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member

Introduction

This article will demonstrate how to change the category name displayed in the tooltip for a specific series. In my example, we have a simple line chart that displays the current year's sales per month, along with the values from the past year.
When we hover over the tooltip for the 'past year' series, the category displayed will be the month from the current year. We want to show the previous year's value in the tooltip.
 

Implementation

I used the following script to accomplish this. Its also attached to this post.
In your situation, you would want to modify the variable 'seriesName' to be the name of the series in your widget.
widget.on("beforedatapointtooltip", function (se, args){
 seriesName="Past Year Total OrderQty";
 
 if (args.context.pointScope.series.name==seriesName){
  newYear= parseInt(args.context.category.slice(-4)) - 1;
  args.context.category = args.context.category.slice(0,-4)+newYear
  
 } 
 })
More information on how to edit a widget's script can be found here: Sisense Javascript API & Add-ons
Rate this article:
Version history
Last update:
‎03-02-2023 09:06 AM
Updated by:
Contributors