Different label on tooltip vs X Axis?

Hi, thanks for creating this library, it’s some awesome work.

Is it possible to have a different label on the X axis vs on the tool tip? I took a quick glance at the code and it doesn’t look like it to me, but I may have missed something.

In particular, I want less data on the X axis (it’s just a series of dates in my case, so I could see it only having a label for every 3rd day or whatever), but I want a more full description on the tooltip, and definitely don’t want the label skipped in the tooltip.

Author: Fantashit

3 thoughts on “Different label on tooltip vs X Axis?

  1. It be most fantastic to also point out how 🙂
    No matter where and when I affect the tick label or on scale (afterTickToLabelConversion) level, it changes the label for both the axis and tooltip.

  2. I think instead of using the label callback, you can use the beforeLabel callback and then override the title callback to return an empty string.

    tooltips: {
      callbacks: {
         title: function() {
           return '';
         },
         beforeLabel: function(tooltipItem, data) { 
           //return formatted date
           return tooltipItem.xLabel;
         }
      }
    },
    

Comments are closed.