anychart

AnyChart's AnyStock - can you layer an annotation such as a verticalRange behind the main candlestick plot?


Trying to layer a vertical range box behind the main candlestick plot, but the annotation always stays on top.

I've set barSeries.zIndex(1); and tradeRange.zIndex(0);

I've also tried setting the annotation before setting the candle series in the file.

I note that annotations use a different library. Are they always going to be on top?

For now I'm using transparency as a fix, but a full solution would be welcome.


Solution

  • To ensure an annotation appears below your main chart series, you need to explicitly set the zIndex of your series higher than the zIndex of the annotations controller.

    We've created a Playground example that demonstrates how to render annotations behind the series:
    Annotation Below Series – Playground

    You can also refer to the API reference for the Annotations Controller zIndex for more detailed control over annotation layering.

    By assigning a lower zIndex to the annotations controller and a higher zIndex to your series, the chart will render the series on top of the annotations as intended.