Skip to content
Advertisement

How can I create custom tooltips for each data point in a graph?

I have a stacked bar graph where I want to show the proportion of projects for which our qualitative analyst needs to complete the thematic coding process. However, the visitors to the webpage won’t necessarily know the context, but will just want some details in tooltips. I have two categories: (1) Total projects and (2) Coded projects. In a new line for the Total projects tooltips under “Remaining Projects: 170” I want “Description: The remainder of projects that have not yet been qualitatively coded.” Similarly for “Coded Projects: 70” I want a new line to show “Description: The number of projects that have been qualitatively coded.”

The last working version of my stacked bar graph is here: https://codepen.io/tenebris_silentio/pen/ZEWzXyr

JavaScript

Advertisement

Answer

Your tooltips.callbacks should look as follows:

JavaScript

Please have a look at your amended code below:

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement