How can I position tooltip caret above and middle of bar?

谁都会走 提交于 2021-02-11 16:49:35

问题


The goal is to adjust the caret tooltip to be positioned above my horizontal stacked bar graph. oddly it works by setting yAlign to bottom and not to top. However it does not place the tooltip in the middle of the bar and it throws a TS ERROR saying Object literal may only specify known properties, and 'yAlign' does not exist in type 'ChartTooltipOptions'. Is there a correct way to do this besides setting the ts to ignore.

options: {
    tooltips: {
      yAlign: 'bottom',
      displayColors: false,
      callbacks: {
        title: (tooltipItems, data) => {
          return '';
        },
        label: (tooltipItem, data: any) => {
          const datasetLabel = null;

          // to only show value
          return data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]; 
        },
      }

    },

来源:https://stackoverflow.com/questions/65586632/how-can-i-position-tooltip-caret-above-and-middle-of-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!