Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


OWC Object- Charts in ASP

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,25277
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> OWC Object- Charts in ASP
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 OWC Object- Charts in ASP - 8/25/2005 3:47:10 AM   
  sanctos

 

Posts: 2
Score: 0
Joined: 8/25/2005
Status: offline
Hi there,
I am new to the post but I have a question that is really stumping me.

I have created an ASP chart using an OWC object, which displays two different series of data based on values coming from a query in SQL Server.  The X-Axis shows "Report Dates" which are of type datetime, while the Y-Axis shows amounts.  My problem only lies in the formatting of the X-Axis....

I am trying to show a year's worth of data (By week....so 52 entries in the x-axis) and I am trying to fit it on one page.  However, the dates(axis labels) are displayed on the x-axis horizontally, which is way too wide.  Is there anyway to display the dates vertically (i.e.  rotate the values 90 degrees) so everything fits nicely?

I have been scouring web sites and the OWC11 reference guide to no avail.

Here is some code to give you an idea: (NOTE: The connection and recordset objects are not shown)


Dim strChartAbsPath
Dim strChartRelPath
Dim objChartSpace
Dim objChart
Dim c
Dim objSeries
Dim objAxis
Dim objFont
Dim strChartFile

'Get the relative and absolute path names for the GIF folder
strChartAbsPath = Server.MapPath("/CPA/temp")
strChartRelPath = "temp"

'Create ChartSpace
Set objChartSpace = Server.CreateObject("OWC.Chart") 

'Create Chart
Set objChart = objChartSpace.Charts.Add()

'Create Constants Object
Set c = objChartSpace.Constants

'Set the datasource (SQL Server Database recordset)
Set objChartSpace.DataSource = rsHistory

'Chart Properties
With objChart
'title (header) 
.HasTitle   = True
.Title.Caption  = "CPA History for " & strClient
.Title.Font.Bold = True

'legend (footer)
.HasLegend   = True
.Legend.Position = chLegendPositionBottom


End With

'*************************************************
'SERIES
'*************************************************

'Create Series 1
Set objSeries = objChart.SeriesCollection.Add()

'Series 1 Properties
With objSeries 
'methods
.SetData          c.chDimCategories, 0, "ReportDate"
.SetData          c.chDimValues, 0, "Charges"

'line
.Caption  = "Charges" 
.Type   = c.chChartTypeLineMarkers  
.Line.Color  = "Black"
.Marker.Style = c.chMarkerStyleSquare
.Interior.Color = "Blue"
End With

'Create Series 2
Set objSeries = objChart.SeriesCollection.Add()

'Series 2 Properties
With objSeries
'methods
.SetData          c.chDimCategories, 0, "ReportDate"
.SetData          c.chDimValues, 0, "Payments"

'line
.Caption  = "Charges" 
.Type   = c.chChartTypeLineMarkers  
.Line.Color  = "Black"
.Marker.Style = c.chMarkerStyleSquare
.Interior.Color = "Purple"
End With

'*************************************************
'AXIS
'*************************************************
'Create Horizontal Axis
Set objAxis = objChart.Axes(c.chAxisPositionBottom)

'Axis Properties
With objAxis
.HasTitle = True
.Title.Caption = "Report Dates" 
.TickMarkSpacing = 1
.Scaling.Orientation = c.chScaleOrientationMinMax
.Font.Size = 8
End With

'Create Font (Horizontal Axis)
Set objFont = objAxis.Title.Font

'Font Properties
With objFont
.Name = "Helvetica"
.Size = 16
.Bold = True
End With

'Create Vertical Axis
Set objAxis = objChart.Axes(c.chAxisPositionLeft)

'Axis Properties
With objAxis
.NumberFormat = "Currency"
.HasTitle = True
.Title.Caption = "Amount" 
.Font.Size = 8
End With

'Create Font (Horizontal Axis)
Set objFont = objAxis.Title.Font

'Font Properties
With objFont
.Name = "Helvetica"
.Size = 16
.Bold = True
End With

'Create Line Chart in GIF File Format
strChartFile = ExportChartToGIF(objChartSpace, strChartAbsPath, strChartRelPath)

'**************************************************************
'MAIN
'**************************************************************
Response.Write "<h2>CPA Results for " & strClient & "</h2>"
Response.Write "<br /><br />"

'Write Chart to ASP Page
Response.Write "<img src='" & strChartFile & "'><p>"

'Clean out old GIF files - Saves space and memory
CleanUpGIF strChartAbsPath          'Function not shown

'Clean up objects
Set objChartSpace = Nothing
Set objChart  = Nothing
Set c    = Nothing
Set objSeries  = Nothing
Set objAxis   = Nothing
Set objFont   = Nothing



Any help on this would be cool

Sanctos

< Message edited by Country73 -- 8/25/2005 7:48:01 AM >
 
 
Post #: 1
 
 RE: OWC Object- Charts in ASP - 8/25/2005 3:48:00 AM   
  sanctos

 

Posts: 2
Score: 0
Joined: 8/25/2005
Status: offline
I used the [code][/code] tags and it still looks like this.  I apologize for the mess............

(in reply to sanctos)
 
 
Post #: 2
 
 RE: OWC Object- Charts in ASP - 9/25/2005 3:07:03 AM   
  cs168

 

Posts: 3
Score: 0
Joined: 9/23/2005
Status: offline
Hi Santos,
                 Can you please show me all your code on displaying the data into a line graph? I would appreciated is you able to guide me & show ont his.
I am looking for a way to show my data in line graph as what I had posted in below link:-
I need from you the connection and recordset objects code too...So I will know how to make it happen..

http://www.visualbasicscript.com/m_26239/mpage_1/key_/tm.htm#26239

Tks a lot...

(in reply to sanctos)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> OWC Object- Charts in ASP Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts