Bar Graph wont stack
Posted: Thu Jan 20, 2005 10:17 pm
Hello,
I'm using v5, asp page, trying to create a stacked bar graph out of an MS Access db.
I can't seem to get the bars to stack. They are overlapping. Here is my code:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=xx;UID=;PWD=xx"
Set objCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = objConn
objCmd.CommandText = "UniqueNamesByVolume"
objCmd.CommandType = adCmdStoredProc
'Create Chart
Set DisruptionChart = CreateObject("TeeChart.TChart")
DisruptionChart.Width = 650
DisruptionChart.Height = 400
DisruptionChart.Legend.Visible=False
DisruptionChart.Panel.BevelOuter = 0
DisruptionChart.Panel.BorderStyle = 0
DisruptionChart.Axis.Bottom.Labels.DateTimeFormat = "MM/dd/yy"
DisruptionChart.Aspect.View3D = False
DisruptionChart.Axis.Bottom.Labels.Angle= 90
Set objRs = objCmd.Execute()
Dim i, j
i = 0
While Not objRs.EOF
DisruptionChart.AddSeries(scBar)
DisruptionChart.Series(i).asBar.MultiBar = mbStacked
DisruptionChart.Series(i).asBar.StackGroup = 1
DisruptionChart.Series(i).Marks.Visible = False
DisruptionChart.Series(i).Title = objRs("UniqueName")
DisruptionChart.Series(i).XValues.DateTime = True
i = i + 1
objRs.MoveNext
Wend
Set objCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = objConn
objCmd.CommandText = "MyDisruptions"
objCmd.CommandType = adCmdStoredProc
Set objRs = objCmd.Execute()
While Not objRs.EOF
For j = 0 To i - 1
If DisruptionChart.Series(j).Title = objRs("UniqueName") Then
DisruptionChart.Series(j).AddXY objRs("OutageDate"), objRs("Outages"), "", clTeeColor
Else
DisruptionChart.Series(j).AddNullXY objRs("OutageDate"), 0, ""
End If
Next
objRs.MoveNext
Wend
I'm using two queries because I want the series in the legend sortedby volume and the graph sorted by date. Any Help Appreciated.
I'm using v5, asp page, trying to create a stacked bar graph out of an MS Access db.
I can't seem to get the bars to stack. They are overlapping. Here is my code:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=xx;UID=;PWD=xx"
Set objCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = objConn
objCmd.CommandText = "UniqueNamesByVolume"
objCmd.CommandType = adCmdStoredProc
'Create Chart
Set DisruptionChart = CreateObject("TeeChart.TChart")
DisruptionChart.Width = 650
DisruptionChart.Height = 400
DisruptionChart.Legend.Visible=False
DisruptionChart.Panel.BevelOuter = 0
DisruptionChart.Panel.BorderStyle = 0
DisruptionChart.Axis.Bottom.Labels.DateTimeFormat = "MM/dd/yy"
DisruptionChart.Aspect.View3D = False
DisruptionChart.Axis.Bottom.Labels.Angle= 90
Set objRs = objCmd.Execute()
Dim i, j
i = 0
While Not objRs.EOF
DisruptionChart.AddSeries(scBar)
DisruptionChart.Series(i).asBar.MultiBar = mbStacked
DisruptionChart.Series(i).asBar.StackGroup = 1
DisruptionChart.Series(i).Marks.Visible = False
DisruptionChart.Series(i).Title = objRs("UniqueName")
DisruptionChart.Series(i).XValues.DateTime = True
i = i + 1
objRs.MoveNext
Wend
Set objCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = objConn
objCmd.CommandText = "MyDisruptions"
objCmd.CommandType = adCmdStoredProc
Set objRs = objCmd.Execute()
While Not objRs.EOF
For j = 0 To i - 1
If DisruptionChart.Series(j).Title = objRs("UniqueName") Then
DisruptionChart.Series(j).AddXY objRs("OutageDate"), objRs("Outages"), "", clTeeColor
Else
DisruptionChart.Series(j).AddNullXY objRs("OutageDate"), 0, ""
End If
Next
objRs.MoveNext
Wend
I'm using two queries because I want the series in the legend sortedby volume and the graph sorted by date. Any Help Appreciated.