hhuuthien
Posts: 11
Joined: Wed Mar 01, 2023 6:40 am

Candlestick chart lastPrice update with animation

Hi,

I'm now building a candlestick chart with data updating every seconds using socket. In this chart I use lastPrice (plotOptions.candlestick.lastPrice) to mark the last price. I wonder how this lastPrice line can be updated smoothly with animations? Is there any API to achieve this? Thanks
User avatar
dawid.d
Posts: 837
Joined: Thu Oct 06, 2022 11:31 am

Re: Candlestick chart lastPrice update with animation

Hi,

Welcome to our forum and thanks for contacting us with your question!

To add a point to the series you can use the addPoint method.
See: https://api.highcharts.com/class-refere ... s#addPoint

Demo: https://jsfiddle.net/BlackLabel/q3gyjdav/

Any available animations are then enabled by default. As you can see, the last price indicator does not have an update animation because it is drawn as a crosshair and the API does not have the option to enable crosshair animation.

If you think this would be a good feature idea for future Highcharts versions, you can request it here:
https://github.com/highcharts/highchart ... new/choose

​If you have further inquiries, you may reach out to me at any time.
Best regards!
Dawid Draguła
Highcharts Developer

Return to “Highcharts Stock”