OWC chart x-axis category issue

M

mlsides

The following code produces a bar chart which should have 59 data value
listed showing the total number of records found in a database for eac
month in the range (59 months)

The problem I have is that the query returns the name of the mont
(January - December) as the category label for each datapoint. In th
59-month period, the January label is repeated 4 times. This causes
problem in the graph: If I include the following line of code, th
graph shows only 12 bars instead of the full 59. If I leave this lin
out, the graph shows all 59 bars but the x axis labels default to "1
though "59". How do I get the graph to show all the bars whil
repeating the same "January" through "December" labels on the X axis?

*objchartspace.Charts(0).SeriesCollection(0).SetDat
chConstants.chDimCategories, *

Any help would be appreciated. Thanks.


------------------------------
'query that returns records
set objRS = Server.CreateObject("ADODB.Recordset")
set objRS.ActiveConnection = objConn
objRS.CursorType = adOpenStatic
'objRS.CursorLocation = adUseClient
sql = _
"SELECT LTRIM(STR(YEAR(dtlogged))) + '-' + STR(MONTH(dtlogged),2) A
period, datename(month,dtlogged) as mth, COUNT(ID) AS count " &_
"FROM helpdesk " &_
"WHERE dtlogged>='1/1/2001' "&_
"GROUP BY LTRIM(STR(YEAR(dtlogged))) + '-' + STR(MONTH(dtlogged),2)
datename(month,dtlogged) " &_
"ORDER BY LTRIM(STR(YEAR(dtlogged))) + '-' + STR(MONTH(dtlogged),2)
datename(month,dtlogged)"
'response.write(sql
objRS.Open sql

'the query returns 1 line for each month of data with 3 fields:
'0 the "period" in the form of YYYY-MM
'1 the month name in the form "January" - "December"
(This is what I wan to use for X labels)
'2 the data value for that month


'store the values in arrays
dim asCategories(1000),aiValues(1000)
i=0
do while not objRS.EOF
'asCategories(i)=Cstr(Month(objRS(0))&"//"&year(objRS(0)))
asCategories(i)=objRS(1)
'response.write(asCategories(i))&"<br>"
aiValues(i)=objRS(2)
i=i+1
objRS.MoveNext
loop


'create chart
set objChartSpace=Server.CreateObject("OWC10.ChartSpace")
set chConstants=objChartSpace.Constants
set objChart = objChartSpace.Charts.Add()
objchartspace.Charts(0).Type
chConstants.chChartTypeColumnClustered3d
objchartspace.Charts(0).PlotArea.Interior.SetTexture
chConstants.chTextureParchment

'add series
objchartspace.Charts(0).SeriesCollection.Add
objchartspace.Charts(0).SeriesCollection(0).SetDat
chConstants.chDimValues, chConstants.chDataLiteral, aiValues

*'including this line of code forces the chart to show only the firs
12 data points.
objchartspace.Charts(0).SeriesCollection(0).SetDat
chConstants.chDimCategories, chConstants.chDataLiteral, asCategories



objchartspace.Charts(0).HasLegend = True

objChartSpace.ExportPictur
"d:\myverrilldana\secure\test\helpdesk.gif", "gif", 350, 250
Response.Write "<IMG SRC=""\secure\test\helpdesk.gif"">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top