Unlike most of the other ASPired2 products, ASPired2Graph does not have a web based interface. ASPired2Graph is a VisualBasic class for creating bar graphs and therefore, it displays what you program it to display. In other words, you have to write the code to describe your graph.

Getting Started

The ASPired2Graph file needs to be included in the page that will display a graph.

<!--#include file="ASPired2Graph.asp"-->

Displaying a graph requires a few lines of code. Below is an example of how to create a simple bar graph.

<% Set objChart1 = New class_ASPired2Graph

With objChart1
.Graph_Title = "Days of Rain"
.Graph_Footer = "Tallahassee Rain Watchers"
.Graph_Caption = "Why are there only 10 months?"
.Graph_Width = 30
.Graph_UseImage = IMAGES_PATH & "p_Red1.gif"
.Graph_PrintValueLoc = 1
.Graph_TotalLoc = 1
.Graph_LegendText = "Total"

If Not .Append_Labels(d_arr_Labels) Then Response.Write "Error: " & .Graph_ErrorMsg
If Not .Append_Values(d_arr_Values, 0) Then Response.Write "Error: " & .Graph_ErrorMsg
If Not .Create_1VertGraph Then Response.Write "Error: " & .Graph_ErrorMsg
End With

Set objChart1 = Nothing
%>

The data that you set between creating the object and closing the object is pretty flexible as long as you include an Append_Values call and the Create_Graph call is the last call.

ASPired2Graph Functions

ASPired2Graph Class
class_ASPired2Graph This is the class that describes the graphing funtions and data.
Set objChart1 = New class_ASPired2Graph
Graphing Functions
Create_1VertGraph This creates a vertical bar graph with a single set of data.
objChart1.Create_1VertGraph()
Create_1HorizGraph This creates a horizontal bar graph with a single set of data.
objChart1.Create_1HorizGraph()
Create_StackVGraph This creates a stacked vertical bar graph with up to 3 sets of data
objChart1.Create_StackVGraph()
Create_StackHGraph This creates a stacked horizontal bar graph with up to 3 sets of data
objChart1.Create_StackHGraph()
Create_MultiVGraph This creates a vertical bar graph with up to 3 sets of data
objChart1.Create_MultiHGraph()
Create_MultiHGraph This creates a horizontal bar graph with up to 3 sets of data
objChart1.Create_MultiHGraph()
Text Setting Functions
Graph_Title Sets the title for the graph.
objChart1.Graph_Title = "My Graph Title"
Graph_Caption Sets the caption for the graph.
objChart1.Graph_Caption = "The Caption Below the Title"
Graph_Footer Sets the footer text for the graph
objChart1.Graph_footer = "The Footer Below the Graph"
Graph_LegendText Sets the labels for the legend on a single data set graph.
objChart1.Graph_LegendText = "Total"
Graph_ARRLegendText Sets the labels for the legend on a stacked or multi graph. The array can contain 2 or 3 titles.
objChart1.Graph_ARRLegendText = Array("South", "Central", "North")
Image Setting Functions
Graph_UseImage Sets the image used for the bars in single data set graphs.
objChart1.Graph_UseImage = IMAGES_PATH & "purple.gif"
Graph_ARRImages Sets the images used for the bars in either the stacked or multi graphs. The array can contain 2 or 3 strings.
objChart1.Graph_ARRImages = Array(IMAGES_PATH & "p_purple1.gif", IMAGES_PATH & "p_red1.gif", IMAGES_PATH & "p_Blue1.gif")
Graph_YImage This sets the image to be displayed on the side of the graph
objChart1.Graph_YImage = IMAGES_PATH & "Y100.gif"
Size Setting Functions
Graph_Height Sets the height of the horizontal bar.
objChart1.Graph_Height = 12
Graph_Width Sets the width of the vertical bar.
objChart1.Graph_Width = 12
Data Setting Functions
Append_Labels This adds the labels for each item in the graph
objChart1.Append_Labels(arr_Labels)
Append_Values This adds the values to the graph. The second parameter identifies the type of the graph.
0 = Single Graphs
1 = Stacked or multi graphs
objChart1.Append_Values(arr_Values)
Display Option Functions
Graph_Normalization This normalizes the data by dividing the values by the normalization factor.
Bar Length in pixels = dataValue / Graph_Normalization
objChart1.Graph_Normalization = 100
Graph_PrintValueLoc This determines where the values display.
0 = None
1 = Top
2 = Bottom
objChart1.Graph_PrintValueLoc = 1
Graph_TotalLoc This determines where the total displays.
0 = None
1 = Top
2 = Bottom
objChart1.Graph_TotalLoc = 2
Graph_PrintAverage This displays an average for the entire graph. If PrintAverage has data, then an average displays and the text in PrintAverage displays as a title.
objChart1.Graph_PrintAverage = "Average"
Status Functions
Graph_ErrorMsg This retrieves the error messages. If an error occurred during the creation of the graph, the error message is recorded. Graph_ErrorMsg retrieves the stored error message.
Response.write objChart1.Graph_ErrorMsg

Everything Else

  1. Here are a few tips to get the most out of ASPired2Graph.
  2. Experiment with the options. Once you understand how they interact, you will be able to create better looking graphs.
  3. Create your own images for the bars. You can even use tiled images to create fancier looking bars.
  4. Look at the examples included with the package. These examples show how to use each feature.