| |
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 >
|
|