ChartPart 1.0 API
These are the properties and methods that ChartPart supports accessing from your program. There are some undocumented ones, and you are of course welcome to do whatever you like with them, but these are the ones we'll try to make sure work the same from version to version. No guarantees on the others. :) See also the Read Me file for more examples.
Methods
addValue (value as integer, caption as string)
Used to add elements to the graph. The value parameter is the number you're graphing, and the caption is the label to be applied to that number.
Examples:
addValue(20,"January")
addValue(1500,"") // no caption
clearValues()
Clears out all the current data in the graph. Settings, such as colors and the chart type, are left unchanged.
Examples:
clearValues()
copyChart()
Copies the currently displayed chart to the clipboard as a graphic.
Examples:
copyChart()
drawToGraphics(g as graphics)
Normally the chart draws onto its own graphic area. If, however, you need the chart drawn to another graphics object, simply pass that graphic object to this routine.
Examples:
dim previewGraphic as graphic
drawToGraphics(previewGraphic)
printChart()
Prints the current chart sized to fill an entire page. If it's defined, it will make use of PageSetup, a printerSetup object.
Examples:
printChart()
redraw()
Refreshes the chart's display with the current data. Usually called after changing display options.
Examples:
redraw()
resetChart()
Resets the charts colors, data, type, and other settings to the defaults.
Examples:
resetChart()
Properties
autoScale as boolean
Determines whether the scale of the graph will be determined by the data being charted (true), or whether you'll be setting the min, max, and interval yourself (false). Defaults to true.
Examples:
autoScale=true
bgColor as color
The background color for the chart. Defaults to white.
Examples:
bgColor=rgb(255,255,255)
chartColor as color
The color for the elements of the charts, such as bars, pies, and the line that plots the data in the line graph. Defaults to medium gray.
Examples:
chartColor=rgb(128,128,128)
chartLineWidth as integer
How thick the lines (rules, pie slice seperators) will be drawn. Defaults to 2.
Examples:
chartLineWidth=1
chartType as integer
What type of chart to draw. 1=bar graph, 2=pie chart, 3=line graph. Defaults to bar graph.
Examples:
chartType=3
interval as double
How far apart the rules will be placed when not using autoscaling. Applies to bar and line graphs.
Examples:
interval = 5
min as double
The smallest value to be displayed on the chart when not using autoscaling. Applies to bar and line graphs.
Examples:
min = 5
max as double
The largest value to be displayed on the chart when not using autoscaling. Applies to bar and line graphs.
Examples:
max = 20
pageSetup as printSetup
This will be used by the printChart() function to determine the Page Setup options.
Examples:
pageSetup.pageSetupDialog
rules as integer
How to display the rules on the bar and line graphs. 0=don't display, 1=ticks at the left, 2=all the way across.
Examples:
rules=2
shadowColor as color
The color for the drop shadow that is displayed behind all of the data elements. Defaults to dark gray.
Examples:
chartColor=rgb(55,55,55)
shadowSize as integer
How far offset the shadows should be from the data elements that cast them. Defaults to 1.
Examples:
shadowSize=3
title as string
Title for the graph that will be displayed at its top. The rest of the graph is adjusted to make room for the title. If you need a multi-line title, include a CHR(13) in the string where you'd like the line break.
Examples:
title="Total Unit Sales" + chr(13) + "Widgets, Inc."
titleColor as color
The color the chart's text will be displayed with. Defaults to black.
Examples:
chartColor=rgb(0,0,0)
ChartPart and its documentation are Copyright 1998 Tech Consulting.