Open xuzhaobin opened 4 months ago
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.
PriceFormatCustom
The option you need to adjust depends on your case. You would probably want to adjust the percentageFormatter
on the chart options.
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.
Working solution here?
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.