Trying to display more than one chart on a page using ChartDirector. i can only get one chart to display or one chart and 5 missing images. If anyone can help, please do. Thanks
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SelectedDate As Date = Request("SelectedDate"
Dim WkBeginDate As Date = Request("wkBeginDate"
Dim MoBeginDate As Date = Request("moBeginDate"
Dim YrBeginDate As Date = Request("yrBeginDate"
Build_Chart(SelectedDate, WkBeginDate)
End Sub
Private Sub Build_Chart(ByVal SelectedDate, ByVal wkBegin)
Dim cnnQA As New SqlConnection(ConfigurationSettings.AppSettings("QA_DSN")
'Dim cmdDef As SqlCommand = New SqlCommand("spCodedDefects", cnnQA)
'cmdDef.CommandType = CommandType.StoredProcedure
Dim strSQL As String = New String("spCodedDefects @begindate='" & wkBegin & "', @enddate='" & SelectedDate & "'"
Dim da As SqlDataAdapter = New SqlDataAdapter(strSQL, cnnQA)
cnnQA.Open()
Dim myDataSet As New System.Data.DataSet()
da.Fill(myDataSet, "Defects"
cnnQA.Close()
Dim dv As DataView = New DataView(myDataSet.Tables("Defects")
dv.Sort = "Problem"
Dim p As Integer
Dim htmlStr As String
Dim Area As String
For p = 1 To 6 Step 1
Select Case p
Case 1
Area = "Assembly"
Case 2
Area = "Deck Rig"
Case 3
Area = "Lamination"
Case 5
Area = "Small Parts"
Case 6
Area = "Sub Assembly"
End Select
htmlStr = "<asp:image id=""chartImg" & p & " runat=""server""></asp:image>"
dv.RowFilter = "Area = '" & Area & "'"
Dim a As Integer = dv.Count
a = a - 1
Dim Problem(a) As String
Dim Count(a) As Double
Dim drv As DataRowView
Dim i As Integer = 0
For Each drv In dv
Problem(i) = drv.Item(2)
Count(i) = drv.Item(3)
i = i + 1
Next
'Dim c As New XYChart(420, 240)
Dim c(p) As XYChart
c(p) = New XYChart(750, 440)
'Set the chart background
c(p).setBackground(&HFFFFC0, &HFFFFC0, 2)
'Set the plotarea and background color.
c(p).setPlotArea(45, 65, 638, 298, &HFFFFFF, -1, 1, Chart.Transparent)
'Add a title to the chart
c(p).addTitle("Coded Defects For " & Area, "timesbi.ttf".setBackground(&HFFFF00)
'Add a legend box at the top of the plotarea
c(p).addLegend(70, 30, 0, "", 8).setBackground(Chart.Transparent)
'Add a bar chart layer using the supplied data
c(p).addBarLayer(Count, &H3333CC, "Total".setBorderColor(-1, 1)
'Set the x axis labels.
c(p).xAxis().setLabels(Problem).setFontAngle(90)
'Set the x-axis width to 2 pixels
c(p).xAxis().setWidth(2)
'Set the y axis title
c(p).yAxis().setTitle("Coded Defects"
'Set the y-axis width to 2 pixels
c(p).yAxis().setWidth(2)
<!--THIS IS THE HAZEY PART-->
'Output the chart
'Session("chart" = c(p).makeChart2(Chart.PNG)
'Session("imgNo" = Session("imgNo" + p
Response.ContentType = "image/png"
Response.BinaryWrite(c(p).makeChart2(Chart.PNG))
Response.Write(htmlStr)
'Response.Write("<br><p>Break</p><br>"
'Response.Write("<img src = ""myimage.aspx?img=chart&id=""" & Session.SessionID & """_""" & Session("imgNo" > ""
Next p
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SelectedDate As Date = Request("SelectedDate"
Dim WkBeginDate As Date = Request("wkBeginDate"
Dim MoBeginDate As Date = Request("moBeginDate"
Dim YrBeginDate As Date = Request("yrBeginDate"
Build_Chart(SelectedDate, WkBeginDate)
End Sub
Private Sub Build_Chart(ByVal SelectedDate, ByVal wkBegin)
Dim cnnQA As New SqlConnection(ConfigurationSettings.AppSettings("QA_DSN")
'Dim cmdDef As SqlCommand = New SqlCommand("spCodedDefects", cnnQA)
'cmdDef.CommandType = CommandType.StoredProcedure
Dim strSQL As String = New String("spCodedDefects @begindate='" & wkBegin & "', @enddate='" & SelectedDate & "'"
Dim da As SqlDataAdapter = New SqlDataAdapter(strSQL, cnnQA)
cnnQA.Open()
Dim myDataSet As New System.Data.DataSet()
da.Fill(myDataSet, "Defects"
cnnQA.Close()
Dim dv As DataView = New DataView(myDataSet.Tables("Defects")
dv.Sort = "Problem"
Dim p As Integer
Dim htmlStr As String
Dim Area As String
For p = 1 To 6 Step 1
Select Case p
Case 1
Area = "Assembly"
Case 2
Area = "Deck Rig"
Case 3
Area = "Lamination"
Case 5
Area = "Small Parts"
Case 6
Area = "Sub Assembly"
End Select
htmlStr = "<asp:image id=""chartImg" & p & " runat=""server""></asp:image>"
dv.RowFilter = "Area = '" & Area & "'"
Dim a As Integer = dv.Count
a = a - 1
Dim Problem(a) As String
Dim Count(a) As Double
Dim drv As DataRowView
Dim i As Integer = 0
For Each drv In dv
Problem(i) = drv.Item(2)
Count(i) = drv.Item(3)
i = i + 1
Next
'Dim c As New XYChart(420, 240)
Dim c(p) As XYChart
c(p) = New XYChart(750, 440)
'Set the chart background
c(p).setBackground(&HFFFFC0, &HFFFFC0, 2)
'Set the plotarea and background color.
c(p).setPlotArea(45, 65, 638, 298, &HFFFFFF, -1, 1, Chart.Transparent)
'Add a title to the chart
c(p).addTitle("Coded Defects For " & Area, "timesbi.ttf".setBackground(&HFFFF00)
'Add a legend box at the top of the plotarea
c(p).addLegend(70, 30, 0, "", 8).setBackground(Chart.Transparent)
'Add a bar chart layer using the supplied data
c(p).addBarLayer(Count, &H3333CC, "Total".setBorderColor(-1, 1)
'Set the x axis labels.
c(p).xAxis().setLabels(Problem).setFontAngle(90)
'Set the x-axis width to 2 pixels
c(p).xAxis().setWidth(2)
'Set the y axis title
c(p).yAxis().setTitle("Coded Defects"
'Set the y-axis width to 2 pixels
c(p).yAxis().setWidth(2)
<!--THIS IS THE HAZEY PART-->
'Output the chart
'Session("chart" = c(p).makeChart2(Chart.PNG)
'Session("imgNo" = Session("imgNo" + p
Response.ContentType = "image/png"
Response.BinaryWrite(c(p).makeChart2(Chart.PNG))
Response.Write(htmlStr)
'Response.Write("<br><p>Break</p><br>"
'Response.Write("<img src = ""myimage.aspx?img=chart&id=""" & Session.SessionID & """_""" & Session("imgNo" > ""
Next p
End Sub