-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 Scale AutoScale does not work for small values #1495
Comments
I got it working, but the workaround was discovered by accident. I'm not sure why it works. To reproduce, first I've set both left and right price scales to visible when creating the chart instance leftPriceScale: {
autoScale: true,
visible: true,
},
rightPriceScale: {
autoScale: true,
visible: true,
} After which i add however many line series that i need to, all with the priceScaleId: 'left' const lineSeries = chart.addLineSeries({
color: Object.values(colorList)[index] as string,
lastValueVisible: false,
priceLineVisible: false,
lineWidth: 2,
priceScaleId: "left",
}) Then at the end i remove the right price scale, now the price scales auto recalculates and scales everything appropriately chart.applyOptions({ rightPriceScale: { visible: false } })
chart.timeScale().fitContent() The issue is solved, but i still think this isn't the intended behaviour, or maybe I'm misunderstanding something |
Lightweight Charts™ Version:
Steps/code to reproduce:
Actual behavior:
I have a chart that is clickable (through the legends below to toggle visibility), with autoScale it has always worked as intended.
Before hiding
After hiding, price scale is automatically scaled as intended
HOWEVER, when a dataset with extremely small values (in this case 0.03333..) after hiding a chart with a larger set of values, the autoScale of price scale does nothing.
Example 1:
Before hiding
After hiding
Example 2:
Before hiding
After hiding
And since the localization is triggered here, I have also tried to disable it, and got the same results.
Expected behavior:
Expected Example 1:
Expected Example 2:
Screenshots:
CodeSandbox/JSFiddle/etc link:
The text was updated successfully, but these errors were encountered: