Commit 6c97a118 authored by leon's avatar leon

feat: tooltip position

parent e4979a10
......@@ -240,10 +240,30 @@ const install = (Vue, vm) => {
const dealTooltip = (tooltip) => {
if (!tooltip) {
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) {
return {
...tooltip,
...tooltip,
formatter: (val) => {
return converFunction(tooltip.formatter, val)
},
......
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