Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using OWC chart object

Status
Not open for further replies.

Magnus53

Programmer
Jul 25, 2002
73
CA
Hey everyone

I'm playing with a example of using OWC chart to create dynamic web charts that I got from MSDN. It works fine so far but I'm fooling around with it to suit our needs, I've created a new SQL statement and have got the chart almost working. My problem is that I can only seem to get the chart to display one set of Values, I can't seem to figure out how to display more then one

Here is my SQL statement(It works)

Code:
SELECT REGIONS.RegionName, POPGROWTH.PopCY_1, POPGROWTH.PopCY_5, POPGROWTH.PopCY_10 FROM POPGROWTH INNER JOIN REGIONS ON (POPGROWTH.RegionType = REGIONS.RegionType) AND (POPGROWTH.RegionID = REGIONS.RegionID) WHERE (((REGIONS.RegionType)='RD') AND ((REGIONS.RegionID)=17) 
OR ((REGIONS.RegionType)='RD') AND ((REGIONS.RegionID)=33))

Here is how the chart is getting created
Code:
'Add a Clustered Column Chart with a legend to the Chartspace
set m_cspace = server.CreateObject("OWC.Chart")
set cht = m_cspace.Charts.Add()
set c = m_cspace.Constants
cht.Type = c.chChartTypeColumnClustered
cht.HasLegend = True

'set the Chartspace's data source to the Recordset and add the
'SalesPerson field for series names, the Month field for the chart's
'categories and the Sales field for the chart's values
set m_cspace.DataSource = m_rs
cht.SetData c.chDimSeriesNames, 0, "RegionName"
cht.SetData c.chDimCategories, 0, "POP Cy"
cht.SetData c.chDimValues, 0, "PopCY_1"

'add a chart title and format the title
cht.HasTitle = True
cht.Title.Caption = "POP Cycle"
set fnt = cht.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 10
fnt.Bold = True

'add a title to the category axis and format the title
set ax = cht.Axes(c.chAxisPositionBottom)
ax.HasTitle = True
ax.Title.Caption = "Cycles"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = True

'add a title to the value axis and format the title
set ax = cht.Axes(c.chAxisPositionLeft)
ax.HasTitle = True
ax.Title.Caption = "Population"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = True

'Save the current chart to a GIF file with a temporary, unique filename
set m_fso = CreateObject("Scripting.FileSystemObject")

sFullFileName = Server.MapPath(".") & "\" & m_fso.GetTempName()
m_cspace.ExportPicture sFullFileName, "gif", 400, 200

'Use On Error Resume Next to make sure we eventually delete
'the temporary GIF file even if something fails in the next couple
'of functions
on error resume next

'The GIF file has been created. Return the contents of the GIF file as
'binary data using the BinaryFileStream ActiveX DLL
set m_objBinaryFile = server.CreateObject("BinaryFileStream.Object")
Response.BinaryWrite m_objBinaryFile.GetFileBytes(CStr(sFullFileName))

'Delete the GIF file since it is no longer needed
m_objBinaryFile.DeleteFile CStr(sFullFileName)

Can anyone shed some light on what is wrong or clue me in on how to fix this?

TIA

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top