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

Price axis width calculated based on displayed label. #1626

Open
xuzhaobin opened this issue Jul 2, 2024 · 3 comments
Open

Price axis width calculated based on displayed label. #1626

xuzhaobin opened this issue Jul 2, 2024 · 3 comments

Comments

@xuzhaobin
Copy link

image
image
When the chart is small, the blank space on the left is too large. I didn't activate lastPrice, so theoretically, all I need is calculate the width based on the displayed label.

@xuzhaobin xuzhaobin changed the title Price axis width calculated based on the actual displayed label. Price axis width calculated based on displayed label. Jul 2, 2024
@SlicedSilver
Copy link
Contributor

The price scale width is leaving extra space because it know how much space it would require to display a non-zero label. When the user scrolls, zooms, or new data is added then it is possible that the price scale range will change. In this case it would appear buggy if the width of the price scale was always changing.

If you only need to display the zero line on the chart then you could use a custom formatter and have it output a shorter label based on the input numbers.

The option you need to adjust depends on your case. You would probably want to adjust the percentageFormatter on the chart options.

@xuzhaobin
Copy link
Author

Even if I use PriceFormatterFn, this method will give me some data that is not displayed on the price axis, and I have no way to judge which ones are displayed on the price axis, so I will format them normally.
image
image
image

@jabeztadesse
Copy link

Working solution here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants