Chart.js: Tooltip data for stacked bar chart

Created on 24 Nov 2016  Â·  4Comments  Â·  Source: chartjs/Chart.js

Hi there! I am trying to call the tooltip for the entire bar in a stacked bar chart instead of each individual stack. Basically I want the total amount of the bars to show up. Is that possible? Let me know if more information on this issue is needed.

Cheers

support

Most helpful comment

@leahthedestroyer you can add the following when creating the chart

options: {
  tooltips: {
    mode: 'index'
  }
}

See https://github.com/chartjs/Chart.js/blob/master/samples/tooltips/interaction-modes.html for all the different modes

All 4 comments

@leahthedestroyer this should be possible. Do you have an image of what you'd like to achieve that may help narrow down an answer.

One possibility is that you use the footer callback to generate a line that has the total in it.

@etimberg basically something like the example I linked below (except that one is done in angular-chart js. So a tool tip that provides the data of both stacks and somehow add them together :)

http://jtblin.github.io/angular-chart.js/examples/stacked-bars.html

@leahthedestroyer you can add the following when creating the chart

options: {
  tooltips: {
    mode: 'index'
  }
}

See https://github.com/chartjs/Chart.js/blob/master/samples/tooltips/interaction-modes.html for all the different modes

This worked! Such an easy solve I can't believe I couldn't figure this out haha thanks so much!

screen shot 2016-11-25 at 3 58 03 pm

Was this page helpful?
0 / 5 - 0 ratings