Commit 6c97a118 authored by leon's avatar leon

feat: tooltip position

parent e4979a10
...@@ -241,6 +241,26 @@ const install = (Vue, vm) => { ...@@ -241,6 +241,26 @@ const install = (Vue, vm) => {
if (!tooltip) { if (!tooltip) {
return return
} }
tooltip = {
...tooltip,
position(point, params, dom, rect, size) {
let x = point[0];
let y = point[1];
const { contentSize, viewSize } = size;
const maxX = viewSize[0] - contentSize[0];
if (x > maxX) {
x -= contentSize[0];
}
const maxY = viewSize[1] - contentSize[1];
if (y > maxY) {
y -= contentSize[1];
}
if(y < 0) {
y = 0
}
return [x, y];
}
}
if (tooltip.formatter && tooltip.formatter.length) { if (tooltip.formatter && tooltip.formatter.length) {
return { return {
...tooltip, ...tooltip,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment