cancel
Showing results for 
Search instead for 
Did you mean: 

Tooltip for Pie Charts

Astroraf
11 - Data Pipeline
11 - Data Pipeline

Hello @DRay @Liliia_DevX  @harikm007 ,

I saw @harikm007 other post about adding tooltip information to bar chart, column chart, etc, but I was wondering if there was code out there to add it to a pie chart (https://community.sisense.com/t5/build-analytics/add-additional-information-in-tooltip-column-bar-li...)? 

My attempt at it using ChatGPT:

// Add CART ID count to the query
widget.on("beforequery", function (se, ev) {
  var newJaql = {
    jaql: {
      column: "CART ID",
      agg: "count",
      datatype: "numeric",
      dim: "[GMV_ORDER_DASH_UNION.CART ID]",
      table: "GMV_ORDER_DASH_UNION",
      title: "Cart Count"
    }
  };
  ev.query.metadata.push(newJaql);
});

// Modify the tooltip content
widget.on("beforedatapointtooltip", function (se, args) {
  // Find the Cart Count index in the results
  var cartCountIndex = se.rawQueryResult.headers.indexOf("Cart Count");
  
  if (cartCountIndex !== -1) {
    // For pie charts, we need to match the category
    var category = args.context.category;
    var categoryIndex = se.rawQueryResult.headers.indexOf(se.metadata.panels[0].items[0].jaql.title);
    
    // Find the matching row for this pie slice
    for (var i = 0; i < se.rawQueryResult.values.length; i++) {
      var row = se.rawQueryResult.values[i];
      if (row[categoryIndex].text === category) {
        // Add Cart Count to the tooltip
        args.context.points.push({
          seriesName: "Cart Count",
          showPercentage: false,
          value: row[cartCountIndex].text,
          valueColor: args.context.points[0].valueColor
        });
        break;
      }
    }
  }
});

As you expected this does not work. Any possible ideas would be much appreciated. 

 

 

2 ACCEPTED SOLUTIONS

TriAnthony
Community Team Member
Community Team Member

Hi @Astroraf,

The Additional Data Chart Tooltip plugin can be used to add additional measures to the tooltip on Pie charts (as well as Column, Bar, Line, Area, and Polar charts). The article mentions that the plugin works only for Column charts, but this is inaccurate. We'll update it as soon as possible.

The implementation is actually simpler for Pie charts because the plugin adds an additional panel to the widget editor where you can add the measure(s) to add to the tooltip. See screenshot below for reference. Let me know if this is helpful.

-Tri

TriAnthony_0-1742429813711.png

 

Tri Anthony Situmorang

View solution in original post

Benji_PaldiTeam
11 - Data Pipeline
11 - Data Pipeline

Hi @Astroraf ,

I’d like to add to @TriAnthony’s recommendation by noting that the suggested plugin is a community-developed one. Community plugins often break when upgrading Sisense versions, which can lead to unexpected issues.

To stay on the safe side, I highly recommend checking out our officially supported and FREE Advanced Tooltip plugin. Once installed, you can easily enable tooltips for all widget types and customize them with any combination of dimensions and measures.

Benji_PaldiTeam_5-1742478236956.pngBenji_PaldiTeam_3-1742478175045.png

And the best part? You can fully style the tooltip to match your dashboard and brand identity.

Benji_PaldiTeam_2-1742478066150.png

Feel free to reach out to us at inquiries@paldi.solutions to get it. Hope this helps! 😊

View solution in original post

2 REPLIES 2

TriAnthony
Community Team Member
Community Team Member

Hi @Astroraf,

The Additional Data Chart Tooltip plugin can be used to add additional measures to the tooltip on Pie charts (as well as Column, Bar, Line, Area, and Polar charts). The article mentions that the plugin works only for Column charts, but this is inaccurate. We'll update it as soon as possible.

The implementation is actually simpler for Pie charts because the plugin adds an additional panel to the widget editor where you can add the measure(s) to add to the tooltip. See screenshot below for reference. Let me know if this is helpful.

-Tri

TriAnthony_0-1742429813711.png

 

Tri Anthony Situmorang

Benji_PaldiTeam
11 - Data Pipeline
11 - Data Pipeline

Hi @Astroraf ,

I’d like to add to @TriAnthony’s recommendation by noting that the suggested plugin is a community-developed one. Community plugins often break when upgrading Sisense versions, which can lead to unexpected issues.

To stay on the safe side, I highly recommend checking out our officially supported and FREE Advanced Tooltip plugin. Once installed, you can easily enable tooltips for all widget types and customize them with any combination of dimensions and measures.

Benji_PaldiTeam_5-1742478236956.pngBenji_PaldiTeam_3-1742478175045.png

And the best part? You can fully style the tooltip to match your dashboard and brand identity.

Benji_PaldiTeam_2-1742478066150.png

Feel free to reach out to us at inquiries@paldi.solutions to get it. Hope this helps! 😊

Type a product name