Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I have a problem with my code at the moment, the chart is displaying and is showing correct results, however, it always displays at the bottom of the page, my question is, is there a way of hardcoding a position to display in VB.net, i cant hardcode it into html as i am manually creating the chart in the vb code. Is this a problem with my code or am i just missing a little code to position it? Please give example code to fix this if possible.

VB
Dim aConnectionString As String
           Dim aConnection As New OleDbConnection
           Dim aCommand As New OleDbCommand
           Dim SQLQuery As String
           Dim aDataAdapter As New OleDbDataAdapter
           Dim aDataSet = New DataSet

           SQLQuery = "SELECT  Distinct NightclubLocation, Count(NightclubLocation) As LocationCount from Nightclub Group By NightclubLocation"

           aConnectionString = "Provider=Microsoft.ace.oledb.12.0;Data Source=" & Server.MapPath("App_Data/NC11.accdb")
           aConnection.ConnectionString = aConnectionString
           aDataAdapter.SelectCommand = New OleDbCommand(SQLQuery, aConnection)
           aDataAdapter.Fill(aDataSet, "results")


           Dim ChartArea1 As ChartArea = New ChartArea()
           Dim Legend1 As Legend = New Legend()
           Dim Series1 As Series = New Series()
           Dim Chart1 = New Chart()

           Me.Controls.Add(Chart1)

           ChartArea1.Name = "ChartArea1"
           Chart1.ChartAreas.Add(ChartArea1)
           Legend1.Name = "Legend1"
           Chart1.Legends.Add(Legend1)
           Series1.ChartArea = "ChartArea1"
           Series1.Legend = "Legend1"
           Series1.Name = "Series1"
           Series1.ChartType = SeriesChartType.Column
           Chart1.Series.Add(Series1)


           Chart1.Series("Series1").XValueMember = "NightclubLocation"
           Chart1.Series("Series1").YValueMembers = "LocationCount"
           Dim CArea As ChartArea = Chart1.ChartAreas(0)
           CArea.BackColor = Color.Azure
           CArea.ShadowColor = Color.Red
           CArea.Area3DStyle.Enable3D = True


           Chart1.DataSource = aDataSet.Tables("results")
           Chart1.Visible = True


Any help is appreciated.
Thanks
Posted
Comments
Richard C Bishop 9-May-13 14:52pm    
How about adding it to a panel and apply a CSS class to the panel and use positioning to move it where you want?
Sergey Alexandrovich Kryukov 9-May-13 15:34pm    
You should be asking how avoid hard-coding of anything instead.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900