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

autoSize is not smooth #1724

Open
vishnuc opened this issue Nov 8, 2024 · 6 comments
Open

autoSize is not smooth #1724

vishnuc opened this issue Nov 8, 2024 · 6 comments

Comments

@vishnuc
Copy link

vishnuc commented Nov 8, 2024

Please check this video

https://youtu.be/q4TgSq-eZ-M

When resized from right to left its smooth.. but when resized left to right its shaking and not giving smooth effect.

I tried

new ResizeObserver((entries) => {
	if (entries.length === 0 || entries[0].target !== container) {
		return;
	}
	const newRect = entries[0].contentRect;
	chart.applyOptions({ height: newRect.height, width: newRect.width });
}).observe(container);

, also tried autoSize : true option ,

even debounced , but when widht is increased on left side its causing this unpleasent experience.

@vishnuc
Copy link
Author

vishnuc commented Nov 19, 2024

hi @SlicedSilver , can you check this issue , please watch this video - https://youtu.be/J4hFzGIGR4o

price pane and time pane is jumping when resized and autoSize is set to true ,, its smooth in original tradingview website.. how to keep it fixed and autosize affects only the chart ??

@signatenkov
Copy link

Hey @vishnuc,

I've made a snippet with autoSize and it works fine in both directions.

https://stackblitz.com/edit/vitejs-vite-qtrscy?embed=1&file=index.ts&hideExplorer=1&view=preview

My initial assumption is:

  • It's unrelated to chart itself
  • I'm missing some steps

Could you please have a look? Can you reproduce it in isolation?

@vishnuc
Copy link
Author

vishnuc commented Nov 21, 2024

Hi , check this out - https://stackblitz.com/edit/stackblitz-starters-qp2nbt?file=index.html

when u drag the horizontal bar up and down to resize.. u can see time pane is jumping.. also if resize from left u can see price pane is shaking..

if u cannot reproduce , let me know will share video..It happens same in mac and windows.

@signatenkov
Copy link

@vishnuc Thanks, i've checked you example and this jumping occurs when chart container width is not aligned to fixed value. Charts are pixel perfect by design so they resize in fixed increments while you supplying continues values. Container width of 443.281px resolves to chart width of 442px.

@vishnuc
Copy link
Author

vishnuc commented Nov 21, 2024

Hi , so what is the solution ? I increase height of container by percentage .. I cannot use pixels......also i tried to use rounded pixels like u said ,, still panes are jumping/shaking.

@vishnuc
Copy link
Author

vishnuc commented Nov 22, 2024

@signatenkov : please check - https://youtu.be/-BASMYx9fKo , how smooth panes are in main tradingview library

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

2 participants