klinecharts / KLineChart

📈Lightweight k-line chart that can be highly customized. Zero dependencies. Support mobile.(可高度自定义的轻量级k线图,无第三方依赖,支持移动端)
https://klinecharts.com/
Apache License 2.0
2.49k stars 623 forks source link

Layer annotations and associated drawExtend above the crosshair cursor #117

Closed DeeeeLAN closed 1 year ago

DeeeeLAN commented 3 years ago

Hi, awesome work on the annotation feature, it is exactly what I was looking for. Is it possible to layer the annotations and their popups above the crosshair cursor? Currently when hovering,the crosshair is covering up some of the text. I see that the floating tooltip for the ohlc data is layered above the crosshairs, so I assume it is possible.

DeeeeLAN commented 3 years ago

Here is a screenshot of what I am talking about: image The bottom gray box is the annotation, the upper blue box is the associated drawExtend popup. With the crosshair cursor layering on top, it makes it hard to see the text.

liihuu commented 3 years ago

I'm thinking of a way to deal with hierarchical issues, do you have any good suggestions?

DeeeeLAN commented 3 years ago

Maybe this would be useful? https://stackoverflow.com/questions/9165766/html5-canvas-set-z-index

It looks like the best solution is usually to draw in the order you want it layered, but I am not sure if that is feasible in this situation or not.

liihuu commented 3 years ago

Yes, but this does not solve the problem completely.

DeeeeLAN commented 3 years ago

I am not super familiar with how canvas works. I assume you need to draw the crosshairs then draw the annotations? I can poke at the code and see if I can make it work as well.