Hello.
A'm using ViewXY whith manual aspect ratio 1:1 and range 0..500 to both axis.
If window is not square, e.g. x dimension is larger, X axis range will automatic change to fill free window area.
The problem is that i can't get real (visible) axis range, because minimum and maximum returns 0, 500.
Visible axis range when using manual aspect ratio
Moderator: Queue Moderators
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Visible axis range when using manual aspect ratio
Hi there.
When setting aspect ratio to 1, it means say 100 pixels in Y dimension and 100 pixels in X dimension correspond to equal axis ranges of say 500 and 500. If the graph is not a square (width and size the same), other axis will adjust its range so that it keeps the correct 100 pixels / 500 axis units. The meaning of aspect ratio is that it doesn't stretch the contents of chart. A circle will be circle after zooming or resizing of chart, not oval.
When setting aspect ratio to 1, it means say 100 pixels in Y dimension and 100 pixels in X dimension correspond to equal axis ranges of say 500 and 500. If the graph is not a square (width and size the same), other axis will adjust its range so that it keeps the correct 100 pixels / 500 axis units. The meaning of aspect ratio is that it doesn't stretch the contents of chart. A circle will be circle after zooming or resizing of chart, not oval.
LightningChart Support Team, PT
Re: Visible axis range when using manual aspect ratio
I understand that.
At graph on the screen below AspectRatio set to Manual, ManualAspectRatioWH = 1 and for both axis SetRange(0, 500).
I'd like to get real visible axis range which should be about -180, 680 for X axis on the screen.
[img]axis%20range.png[/img]
At graph on the screen below AspectRatio set to Manual, ManualAspectRatioWH = 1 and for both axis SetRange(0, 500).
I'd like to get real visible axis range which should be about -180, 680 for X axis on the screen.
[img]axis%20range.png[/img]
- Attachments
-
- axis range.png (19.65 KiB) Viewed 16711 times
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Visible axis range when using manual aspect ratio
Is this still an open question, do you need help with it?
LightningChart Support Team, PT
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Visible axis range when using manual aspect ratio
It's really hard for me to understand the problem you are experiencing, sorry. Could you explain it in some other way?
If you keep ViewXY.ZoomPanOptions.AspectRatioOptions.AspectRatio = Manual, and AspectRatioOptions.ManualAspectRatioWH = 1, you get the ranges as you presented in your picture. And that seems to be. Graph width is almost twice the graph height, and so is the X axis range when compared Y axis range.
If you want to set range of 0-500 to both axes, don't use aspect ratio at all. Set ViewXY.ZoomPanOptions.AspectRatioOptions.AspectRatio = Off.
Then use
xAxis.SetRange(0,500);
yAxis.SetRange(0,500);
If you keep ViewXY.ZoomPanOptions.AspectRatioOptions.AspectRatio = Manual, and AspectRatioOptions.ManualAspectRatioWH = 1, you get the ranges as you presented in your picture. And that seems to be. Graph width is almost twice the graph height, and so is the X axis range when compared Y axis range.
If you want to set range of 0-500 to both axes, don't use aspect ratio at all. Set ViewXY.ZoomPanOptions.AspectRatioOptions.AspectRatio = Off.
Then use
xAxis.SetRange(0,500);
yAxis.SetRange(0,500);
LightningChart Support Team, PT
Re: Visible axis range when using manual aspect ratio
Ok, i'll try to explain another way.
After ViewXY.FitView() with enabled AspectRatio, showing boundaries are different from set by SetRange(), if the chart is not square.
And i want to get showing boundaries, wich could be larger then set by SetRange().
After ViewXY.FitView() with enabled AspectRatio, showing boundaries are different from set by SetRange(), if the chart is not square.
And i want to get showing boundaries, wich could be larger then set by SetRange().
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Visible axis range when using manual aspect ratio
Can you include a code and a picture of the problem.
LightningChart Support Team, PT
Re: Visible axis range when using manual aspect ratio
Ok, question is in sources.
I hope i was able to explain clearly
I hope i was able to explain clearly
- Attachments
-
- AxisRange.rar
- (85.7 KiB) Downloaded 973 times
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Visible axis range when using manual aspect ratio
You can't get 0...500 X range if you are using aspect ratio 1, and chart width is greater than height. When aspect ratio is used, X and Y axes are related together.
Please see this example code:
It produces chart like this.
The fpls contains a square X: 0...500 and Y: 0...500. And it looks like a square, not like a rectangle.
As you can see, aspect ratio of 1 is kept. Value range of 0...500 in Y axis covers 310 px. Also in X axis value range of 0...500 covers 310 px.
If you want to define value range of X = 0...500 and Y = 0...500 for the axes and keep them like that, don't use aspect ratio.
The same without aspect ratio:
Produces chart like this:
It is a rectangle, not square.
Please see this example code:
Code: Select all
m_chart.ViewXY.ZoomPanOptions.AspectRatioOptions.AspectRatio = ViewAspectRatio.Manual;
m_chart.ViewXY.ZoomPanOptions.AspectRatioOptions.ManualAspectRatioWH = 1;
m_chart.ViewXY.XAxes[0].LabelsAngle = 90;
m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
m_chart.ViewXY.XAxes[0].SetRange(0, 500);
m_chart.ViewXY.YAxes[0].SetRange(0, 500);
FreeformPointLineSeries fpls = new FreeformPointLineSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0]);
fpls.Points = new SeriesPoint[] { new SeriesPoint(0, 0), new SeriesPoint(0, 500), new SeriesPoint(500, 500), new SeriesPoint(500, 0), new SeriesPoint(0, 0) };
m_chart.ViewXY.FreeformPointLineSeries.Add(fpls);
As you can see, aspect ratio of 1 is kept. Value range of 0...500 in Y axis covers 310 px. Also in X axis value range of 0...500 covers 310 px.
If you want to define value range of X = 0...500 and Y = 0...500 for the axes and keep them like that, don't use aspect ratio.
The same without aspect ratio:
Code: Select all
m_chart.ViewXY.XAxes[0].LabelsAngle = 90;
m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
m_chart.ViewXY.XAxes[0].SetRange(0, 500);
m_chart.ViewXY.YAxes[0].SetRange(0, 500);
FreeformPointLineSeries fpls = new FreeformPointLineSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0]);
fpls.Points = new SeriesPoint[] { new SeriesPoint(0, 0), new SeriesPoint(0, 500), new SeriesPoint(500, 500), new SeriesPoint(500, 0), new SeriesPoint(0, 0) };
m_chart.ViewXY.FreeformPointLineSeries.Add(fpls);
LightningChart Support Team, PT