Hi Guys, i have a small problem. i am using ado.net to retrieve my data and that works fine, i need to display a tool tip for each series in my pie chart, i get the tool tip but its only displaying the last entry in my table as the tooltip, heres my code, please help
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Using myConnection As New SqlConnection
myConnection.ConnectionString = ConfigurationManager.ConnectionStrings("TempConn").ConnectionString
Dim myCommand As New SqlCommand
myCommand.Connection = myConnection
myCommand.CommandText = "SELECT CategoryName, color, COUNT(*) as ProductCount FROM Products p INNER JOIN Categories c ON c.CategoryID = p.CategoryID GROUP BY CategoryName,color ORDER BY CategoryName,color"
myConnection.Open()
Dim myReader As SqlDataReader = myCommand.ExecuteReader()
myReader.Close()
myReader = myCommand.ExecuteReader()
If myReader.HasRows = True Then
'start the loop
While myReader.Read
Chart1.Series("Series1").Points.AddY(myReader.Item("ProductCount").ToString)
Chart1.Series("Series1").ToolTip = myReader.Item("CategoryName").ToString & " " & myReader.Item("ProductCount").ToString
' chtCategoriesProductCount.Series(0).Points.Item(i).ToolTip = myReader.Item("color").ToString & " " & myReader.Item("ProductCount").ToString
'Chart1.Series("Series1").Color = System.Drawing.ColorTranslator.FromHtml(myReader.Item("color").ToString)
End While
End If
myReader.Close()
myConnection.Close()
End Using
End If
Chart1.Series("Series1").ChartType = SeriesChartType.Pie ' Set the bar width
Chart1.Series("Series1")("PointWidth") = "0.5" ' Show data points labels
Chart1.Series("Series1").IsValueShownAsLabel = True ' Set data points label style
Chart1.Series("Series1")("BarLabelStyle") = "Center" ' Show chart as 3D
Chart1.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True ' Draw chart as 3D Cylinder
Chart1.Series("Series1")("DrawingStyle") = "Cylinder"
End Sub