好的,抱歉耽搁了。我找不到更好的解决方案,但我找到了解决方法。
这是我所做的以及我建议大家尝试的:
将 tooltip.useHTML 属性设置为 true(现在您可以对 html 和 CSS 进行更多控制)。像这样:
tooltip: {
useHTML: true
}
取消设置所有可能与默认工具提示功能有关的默认工具提示操作。这就是我所做的......
tooltip: {
shared: false,
borderRadius: 0,
borderWidth: 0,
shadow: false,
enabled: true,
backgroundColor: 'none'
}
确保您的图表容器的 css 属性“溢出”设置为可见。同时确保所有包含图表容器的 DOM 元素(div、section 等...)将css“溢出”属性设置为“可见”。通过这种方式,您将确保您的工具提示始终可见,因为它会溢出他的父母和他的其他“祖先”(这是一个正确的术语吗?:))。
使用标准 CSS 样式根据需要自定义您的工具提示格式化程序。这是我所做的:
tooltip.formatter: {
< div class ="tooltipContainer"> Tooltip content here < /div >
}
这就是它的样子:
tooltip: {
tooltip.formatter: {
< div class ="tooltipContainer"> Tooltip content here < /div >
},
useHTML: true,
shared: false,
borderRadius: 0,
borderWidth: 0,
shadow: false,
enabled: true,
backgroundColor: 'none'
}
如果您有更好的解决方案,请发布。