Smith Smith - 3 months ago 11
Vb.net Question

Why is my chart tilted like this?

I dont know why my charts are tilted like this
enter image description here

this is the code i used in charting them

DrawChart(chart12Month, SeriesChartType.Column, _dt12MonthOrders, "mth", "total")
DrawChart( ch12MonthCusts, SeriesChartType.Bar, _dt12MonthCust, "mth", "cnt")

Private Sub DrawChart(ByRef TheChart As Chart, _
Byval ChartType As SeriesChartType, _
ByVal TheTable As DataTable, _
ByVal XCol As String, _
ByVal YCol As String)

TheChart.Series.Clear()
TheChart.Titles.Clear()
TheChart.ChartAreas(0).BackColor = Color.White
TheChart.ChartAreas(0).AxisX.MajorGrid.LineColor = Color.LightSlateGray
TheChart.ChartAreas(0).Area3DStyle.Enable3D = True

Dim Series1 As Series
For Each dr As DataRow In TheTable.Rows
Series1 = New Series(dr(XCol)) '
Series1.Points.AddXY(dr(XCol).ToString(), dr(YCol).ToString())
TheChart.Series.Add(Series1)
Next
End Sub


i need it to look like this not tilted
enter image description here

EDIT

Designer generated code

'
'chart12Month
'
ChartArea1.Name = "ChartArea1"
Me.chart12Month.ChartAreas.Add(ChartArea1)
Me.chart12Month.Dock = System.Windows.Forms.DockStyle.Fill
Legend1.Name = "Legend1"
Me.chart12Month.Legends.Add(Legend1)
Me.chart12Month.Location = New System.Drawing.Point(0, 0)
Me.chart12Month.Name = "chart12Month"
Series1.ChartArea = "ChartArea1"
Series1.Legend = "Legend1"
Series1.Name = "Series1"
Me.chart12Month.Series.Add(Series1)
Me.chart12Month.Size = New System.Drawing.Size(398, 187)
Me.chart12Month.TabIndex = 0
Me.chart12Month.Text = "Chart1"
'
'chartPPN
'
ChartArea2.Name = "ChartArea1"
Me.chartPPN.ChartAreas.Add(ChartArea2)
Me.chartPPN.Dock = System.Windows.Forms.DockStyle.Fill
Legend2.Name = "Legend1"
Me.chartPPN.Legends.Add(Legend2)
Me.chartPPN.Location = New System.Drawing.Point(0, 0)
Me.chartPPN.Name = "ch12MonthCusts"
Series2.ChartArea = "ChartArea1"
Series2.Legend = "Legend1"
Series2.Name = "Series1"
Me.chartPPN.Series.Add(Series2)
Me.chartPPN.Size = New System.Drawing.Size(398, 187)
Me.chartPPN.TabIndex = 0
Me.chartPPN.Text = "Chart1"

Answer

Have a play with the properties of .Area3DSty‌​le such as .Inclination, .Rotation and .Perspective to customize the 3D orientation.