Add the ability to specify a z-index for axis labels
Is your feature request related to a problem? Please describe.
Today, label rendering does not allow you to specify an order. In fact, label rendering on the z index is rather obscure. It seems to be something like:
- Built-in views (e.g. last price line label)
- Custom price lines
- Primitive views
Where primitive views are rendered simply by attachment order. I am finding this to be a pain because attachment order isn't really the desired rendering order.
More concretely, I have two plugins that do not interact particularly well with each other: a countdown plugin and a shape drawing plugin. In the following example, one shape is attached first, then the countdown plugin is attached, and then another shape is attached (e.g. drawn by a user later):
https://github.com/user-attachments/assets/b4c3c24e-54a5-456d-bf4d-3ba8a8f172ed
So the "lowest" label at 500 is always rendered behind. Then the countdown label renders in front of it. And then the price line added later has its label rendered in front of the countdown label.
Describe the solution you'd like
We should be able to programmatically configure label z ordering, rather than have it dictated only by primitive attachment order. In my example above, having the countdown render on top makes the most sense.
Additional context
The video above also shows rendering of time axis labels is broken when they are off of the time scale, where they are pushed to the far left. I need to investigate that problem still.
Source: tradingview/lightweight-charts