violette 0 Junior Poster in Training

Hi,

Function GetReaderYear() As IDataReader

Dim command As New MySqlCommand("SELECT aa.alert_id as alert_name,(SELECT alert_value a FROM company_alert a WHERE a.alert_id=aa.alert_id AND a.stock_code='" & bplc1 & "' AND year_id= '" & byear1 & "' AND a.period_id= 5 ) AS b1 ,(SELECT alert_value b FROM company_alert b WHERE b.alert_id=aa.alert_id AND b.stock_code='" & bplc2 & "' AND year_id= '" & byear1 & "' AND b.period_id= 5 ) AS b2 FROM ref_alert aa ", conn)
Return command.ExecuteReader()

End Function

Dim reader3 As IDataReader = GetReaderYear()
Dim chart3 As New WebChart.ColumnChart()
chart3.DataXValueField = "alert_name"
chart3.DataYValueField = "b1"
chart3.DataSource = reader3
chart3.DataBind()
chart3.Fill.Color = Drawing.Color.Tomato
chart3.DataLabels.Visible = True
chart3.DataLabels.NumberFormat = "0.0"
chart3.Legend = bplc1
ChartControl1.Charts.Add(chart3)
ChartControl1.RedrawChart()
reader3.Close()

Dim reader4 As IDataReader = GetReaderYear()
Dim chart4 As New WebChart.ColumnChart()
chart4.DataXValueField = "alert_name"
chart4.DataYValueField = "b2"
chart4.DataSource = reader4
chart4.DataBind()
chart4.Fill.Color = Drawing.Color.Violet
chart4.DataLabels.Visible = True
chart4.DataLabels.NumberFormat = "0.0"
chart4.Legend = bplc2
ChartControl1.Charts.Add(chart4)
ChartControl1.RedrawChart()
reader4.Close()


i'm using above code to produce bar chart in vb.net using webchart.dll library..so im thinking to produce pie chart for another result for my project using the same library..but dunno how..can some one show me how..or i need to fine another library to generate pie chart..tq

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.