You can remove these two lines and set the anchors like below:LineChart1.SetLeftAndRight(0,100%x)
LineChart1.SetTopAndBottom(0,100%y)
I think klaus mentioned to you that is the expected behavior. If you want a chart that fills the screen whether in portrait or when you rotate the device to landscape, comment this line: LineChart1.Rotation = 90I have attached the project again with the amendments.
Why don't you then set this line : It will be locked to landscape regardless of the device's rotationThis is why I wanted to draw the chart rotated by 90 degrees regardless of the device's orientation.
Is the below equivalent to what you are trying to do without having to memorize the chart dimensions and positions.n the attached project I memorize the size and position of the chart.
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout")
CreateChartData
End Sub
Sub CreateChartData
If 100%Y > 100%x Then ' portrait mode
#SupportedOrientations: Portrait
Else
#SupportedOrientations: Landscape
End If
LineChart1.ClearData
LineChart1.AddLine("First line", Colors.Blue)
LineChart1.AddLine("Second line", Colors.Magenta)
For i = 0 To 100
LineChart1.AddLineMultiplePoints(i, Array As Double(i, 100-i), i Mod 10 = 0)
Next
LineChart1.Title = "Chart Title"
LineChart1.XAxisName = "X Axis"
LineChart1.YAxisName = "Y Axis"
LineChart1.IncludeLegend = "TOP_RIGHT"
LineChart1.YScaleMinValue = 0
LineChart1.AutomaticScale = True
LineChart1.XScaleTextOrientation = "45 DEGREES"
LineChart1.DrawChart
End Sub
If 100%Y > 100%x Then ' portrait mode
#SupportedOrientations: Portrait
Else
#SupportedOrientations: Landscape
End If
In your case, the chart portrait look shows that is simply an inverted horizontal chart. In portrait mode, the y Axis is on top of the screen and horizontal, and the X axis is vertical. It does not look natural. But, if the OP is seeking that look, that is all it counts.He wants to have both orientations available.
I agree with you.It does not look natural.