Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to limit price scale range #1393

Open
clark800 opened this issue Jul 15, 2023 · 4 comments
Open

Option to limit price scale range #1393

clark800 opened this issue Jul 15, 2023 · 4 comments
Labels
enhancement Feature requests, and general improvements.

Comments

@clark800
Copy link

I have a a set of baseline series that are always positive and I'd like to be able to zoom in on a narrow price range but don't want to allow the price scale to get into negative territory.

The ideal solution would be to have minimum and maximum options on the price scale that act like fixLeftEdge and fixRightEdge except that they are specified with a constant value instead of being based on the range of the data.

@SlicedSilver
Copy link
Contributor

When the chart is automatically adjusting the price scale min and max range values, this is called autoScale and what it is doing is automatically adjusting the scale to ensure that all the data fits within the chart.

You can disable autoScale on the Price scale with: https://tradingview.github.io/lightweight-charts/docs/api/interfaces/PriceScaleOptions#autoscale

You could also use the autoscaleInfoProvider option (which can be applied to any series via the series options) which allows to you customise the scaling. So if you used autoscaleInfoProvider on all the series, and made it return the minimum and maximum values which you would prefer then you could achieve the desired effect.

@clark800
Copy link
Author

@SlicedSilver Thanks for the idea. My feature request might not have been clear enough that the limit is about how far the user can adjust the scale (by dragging on the axis or chart area). The autoscale settings don't limit this, so I don't think it will help in this case.

@SlicedSilver
Copy link
Contributor

You are correct. AutoScaleInfo won't help for that case.
I'll mark the issue as a feature request.

@SlicedSilver SlicedSilver added the enhancement Feature requests, and general improvements. label Jul 17, 2023
@jabeztadesse
Copy link

Solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, and general improvements.
Projects
None yet
Development

No branches or pull requests

3 participants