project-nv / night-vision

Highly customizable charting library, created for professional traders
https://nightvision.dev
MIT License
250 stars 58 forks source link

How to change the zoom level #77

Closed wk1210 closed 1 year ago

wk1210 commented 1 year ago

Description

When loading 1000 candlesticks, the default zoom level displays too few candlesticks, requiring mouse scrolling to show more. How can I change this? Also, when loading candlesticks in real-time, a fullReset call is necessary to refresh. I would like to default to displaying more candlesticks when refreshing. Do you have any suggestions?

Suggested solution

image image

Alternative

No response

Additional context

No response

Validations

DmitrijLVs commented 1 year ago

You can use 'DEFAULT_LEN' property to control how many candlesticks you want to show - https://nightvision.dev/guide/api/chart-config.html#config-default-len

To update data in real-time you don't need to update full chart, just data: this.chart.update('data');

Hope it helps

wk1210 commented 1 year ago

You can use 'DEFAULT_LEN' property to control how many candlesticks you want to show - https://nightvision.dev/guide/api/chart-config.html#config-default-len

To update data in real-time you don't need to update full chart, just data: this.chart.update('data');

Hope it helps

Thank you for your response, DEFAULT_LEN is working and it has resolved the issue. I really appreciate your help. Regarding your suggestion of using this.chart.update('data'), I tested it and found that the data is indeed updated, but the x-axis remains unchanged. So, currently, I am using this.chart.fullReset()which allows me to update the x-axis.