Using Chart.js, how do I avoid having tooltips overlap?

我的未来我决定 提交于 2019-12-21 06:27:20

问题


I am using Chart.js via Angular Char. I have displayed all the tooltips in order to download a chart with the information displayed by creating a plugin.

The tooltips overlap, there doesn't seem to be any logic to distribute them so that they don't. Is there a way to do this?

Some of the plugin code. This isn't important to my question. The 'beforeRender' function creates a new Chart.Tooltip for each item in the dataset and afterDraw renders them:

// turn on tooltips
chart.options.tooltips.enabled = true;
Chart.helpers.each(chart.pluginTooltips, function (tooltip) {
tooltip.initialize();
tooltip.update();
// we don't actually need this since we are not animating tooltips
tooltip.pivot();
tooltip.transition(easing).draw();

The chart:

来源:https://stackoverflow.com/questions/42330467/using-chart-js-how-do-i-avoid-having-tooltips-overlap

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