SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

Hi,

I am trying to show a 2D Scatter series having 4 points that form a square. Like (0;0), (1;0), (1;1) and (0;1). Is there a way to tell the chart to keep this thing square when I resize the surface, use zoom extent, rubber zoom etc? I basically need X/Y ratio to be fixed.

Thanks

Version
5.2
  • You must to post comments
0
0

Since its WPF, just put the SciChartSurface control inside a container which has a fixed aspect ratio.

https://stackoverflow.com/questions/1755329/how-to-keep-the-aspect-ratio-of-a-usercontrol

  • You must to post comments
0
0

Hi Andrew, thank you for your answer, but what I am trying to achieve is different. I am displaying a simple 4-point scatter series.

Currently, if I resize the window, it behaves like this:
Currently, if I resize the window, it behaves like this:

What I want to achieve is this:
What I want ti achieve is this:

So that square stays square when I resize the surface or use rubber band to zoom a part of it. ZoomExtents should also keep the X/Y ratio while also respecting GrowBy etc. Just like when you zoom a drawing in autocad or any other editor. I.e, 0 to 1 by X should have the same pixel size as 0 to 1 by Y.

I could of course bind Surface’s Width and Height together, as you suggested but this is not what desired. Either cropping or letterboxing would occur in this case, which I am trying to avoid.

Thanks for your help!

  • You must to post comments
0
0

Thanks for the excellent explanation Valeriy

I’m afraid we don’t support this in SciChart nor have any example how to do it, however I think it can be achieved.

1.) You will need to listen to the SciChartSurface.SizeChanged event
2.) You will need to get the SciChartSurface.RenderSurface.ActualWidth and ActualHeight
3.) You will need to compute the XAxis.VisibleRange as a ratio of the YAxis.VisibleRange to ensure that the aspect ratio stays the same

Please try that, let me know if it helps

Best regards,
Andrew

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.