TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Chris.CHWU
- Newbie
- Posts: 57
- Joined: Wed Jan 30, 2008 12:00 am
Post
by Chris.CHWU » Mon Dec 28, 2009 10:21 am
Hello:
We are using Build 3.5.3498.27376. We use the following code to adjust label angle of bottom axis.
Code: Select all
Private Sub TChart_BeforeDrawSeries(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
Dim tchart As Steema.TeeChart.Chart = g.Chart
Dim iWidth As Integer = Math.Abs((tchart.Axes.Bottom.CalcXPosValue(1) - tchart.Axes.Bottom.CalcXPosValue(0))) / 4
// These codes are used to adjust box width, it works
For Each series As Steema.TeeChart.Styles.Series In tchart.Series
If TypeOf (series) Is Steema.TeeChart.Styles.Box Then
CType(series, Steema.TeeChart.Styles.Box).Box.HorizSize = iWidth
End If
Next
// We use this line to change label angle to 90, but the chart does not reflect to this change
tchart.Axes.Bottom.Labels.Angle = 90
End Sub
As you could see in the attached image, the box width is changed with the code, but the axis label angel is not changed.
- Box Plot Width and Angel.GIF (9.96 KiB) Viewed 6368 times
But we could see that the angel is changed to 90 in Chart Editor
- angel in editor is changed.GIF (18.92 KiB) Viewed 6368 times
Please advise how could we eliminate this issue, thanks
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue Dec 29, 2009 10:00 am
Hello Chris. CHWU
I think that your problem occurs because chart needs redraw or refresh. Please see next code and check works correctly.
Code: Select all
Dim box1 As Steema.TeeChart.Styles.Box
Dim box2 As Steema.TeeChart.Styles.Box
Dim box3 As Steema.TeeChart.Styles.Box
Private Sub InitializeChart()
box1 = New Steema.TeeChart.Styles.Box(tChart1.Chart)
box1.FillSampleValues()
box1.Position = 1
box2 = New Steema.TeeChart.Styles.Box(tChart1.Chart)
box2.FillSampleValues()
box2.Position = 2
box3 = New Steema.TeeChart.Styles.Box(tChart1.Chart)
box3.FillSampleValues()
box3.Position = 3
AddHandler tChart1.BeforeDrawSeries, AddressOf Me.tChart1_BeforeDrawSeries
tChart1.Draw()
End Sub
Private Sub tChart1_BeforeDrawSeries(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
Dim tchart As Steema.TeeChart.Chart = g.Chart
Dim iWidth As Integer = (Math.Abs((tchart.Axes.Bottom.CalcXPosValue(1) - tchart.Axes.Bottom.CalcXPosValue(0))) / 4)
For Each series As Steema.TeeChart.Styles.Series In tchart.Series
If (TypeOf series Is Steema.TeeChart.Styles.Box) Then
CType(series,Steema.TeeChart.Styles.Box).Box.HorizSize = iWidth
End If
tchart.Axes.Bottom.Labels.Angle = 90
Next
End Sub
I hope will helps.
Thanks,