The Caliper.Charts Class

Summary

Creates charts and graphics.

Properties

Name Type Contents
UserChartControlWindow string If not null, use an existing window instead of creating a new one
WindowTitle string Name of chart window
Title string Chart title
ChartTitles array array of chart titles strings. See method AddTitle
AxisXTitle string X axis title string
AxisXLabelAngle int Label angle
LogarithmicAxisX boolean if true, then make axis logarithmic
AxisXAlignment string alignment of x axis (Zero, Near, or Far )
LogarithmicAxisY boolean if true, then make axis logarithmic
AxisYTitle string Y axis title string
AxisYAlignment string alignment of Y axis (Zero, Near, or Far )
LegendVisible bool show or hide chart legend
MarkerVisibility bool Show or hide point markers
AlwaysShowZeroLevelAxisX bool
AlwaysShowZeroLevelAxisY bool
SetRangeAxisX array min and maximum values
SetRangeAxisY array min and maximum values

Methods

DataSource(array options)

Define the data for the chart.

Option Type Description
DataView string Name of the dataview
SetName string Optional. Name of the set for the chart

ClearSeries()

Clear all series data.

ClearTitles()

Clear all series titles.

AddTitle(array options)

Add a title to the chart diagram.

Option Type Description
Text string Title text
FontName string Name of the font (Verdana, etc.). Default is Arial
FontSize int Font size. Default is 8
Alignment int Default is Center. One of Center, Left, Right
Bold bool Default is false
Italic bool Default is false
Underline bool Default is false
Strikeout bool Default is false

AxisX(array options)

Definition of X Axis.

Option Type Description
Title string Title text
Angle numeric Angle of axis labels
TitleFont string Name of the font (Verdana, etc.). Default is Arial
LabelFont string Name of the font (Verdana, etc.). Default is Arial
Logarithmic bool Default is false
Alignment string Zero, Near or Far. Default is Near
TextPattern string Text pattern
Margin numeric Margin size
ScaleMode string Automatic, Continuous, Interval or Manual

AxisY(array options)

Definition of Y Axis. See options above.

AddSeries(array options)

Add a data series from a view set.

Option Type Description
Name string Series Name
Y string Name of Y axis data field (value field)
X string Name of X axis data field (argument field)
Type string Type of series, one of (Bar, Bar3D, ManhattanBar, StackedBar, StackedBar3D, SideBySideStackedBar, SideBySideStackedBar3D, RotatedBar, RotatedBar3D, RotatedStackedBar, RotatedStackedBar3D, Point, Line, StackedLine, StackedLine3D, Line3D, Spline, Spline3D, StepLine, StepLine3D, Pie, Pie3D, Doughnut, Doughnut3D, Area, Area3D, SplineArea, StackedSplineArea, FullStackedSplineArea, StepArea, StepArea3D)
PointMarker string For point series one of (Circle, Cross, Diamond, Hexagon, InvertedTriangle, Pentagon, Plus, Square, Star, Triangle)
PointMarkerSize int For point series, the size in pixels of the point marker

AddSeriesData(array options)

Add series data from array of values. For additional series option see AddSeries().

Option Type Description
Name string Series name
Arguments array Macro array with argument (X) values
Values array Macro array with argument (Y) values

Show()

Shows a window with the chart.

ExportChart(string fn, array options)

Export the chart to a file and optionally launches the exported document.

Parameters Type Description
fn string Exports the chart to a file. Supported formats are: jpg, png, emf, wmf, bmp, pdf
Options array
OpenDocument bool Launch the document after exporting
Height int Optional. Default value 400. Height of exported image in pixels
Width int Optional. Default value 600. Width of exported image in pixels

Example

// Creates a chart of Land Value and SqFeet
macro "SimpleChartFromTable"
on error, notfound do
ShowMessage(GetLastError())
return()
end
folder = RunMacro("G30 Tutorial Folder")
table = "ParcelInfo.bin"
// Use AddTables Class to open a table file
opts.TableName = folder + table
obj = CreateObject("AddTables", opts)
c = CreateObject("Caliper.Charts")
c.AddTitle({Text: "Sample Chart", Dock: "Top"})
c.AddTitle({Text: "Pop ans SqFeet"})
c.SetDatasource({DataView: obj.TableView})
c.AddSeries({Name: "Land Value", X: "Street", Y: "FY99Tot", PointMarker: "Triangle",
PointMarkerSize: 12, Type: "Bar"})
c.AddSeries({Name: "SqFeet", X: "Street", Y: "Lot Size", PointMarker: "Circle",
PointMarkerSize: 12, Type: "Bar"})
c.AxisX({Title: "Street"})
c.LimitAxisYToDataValues = True
c.Show()
return(true)
endmacro
macro "SimpleChartFromArrays"
on error, notfound do
ShowMessage(GetLastError())
return()
end
c = CreateObject("Caliper.Charts")
c.AddTitle({Text: "Sample Chart from Array Values"})
c.AxisXTitle = "X"
c.AxisYTitle = "Y"
c.AddSeriesData({Name: "Series1", Arguments: {1, 2, 3, 4}, Values: {87, 45, -3, 22},
PointMarker: "Square", PointMarkerSize: 12, Type: "Line"})
c.AddSeriesData({Name: "Series2", Arguments: {1, 2, 3, 4}, Values: {22, 43, 432, 2},
PointMarker: "Triangle", PointMarkerSize: 12, Type: "Line"})
c.LimitAxisYToDataValues = True
c.Show()
// c.ExportChart(GetRandFileName("*.pdf"), {OpenDocument: true, Height: 400, Width: 900})
return(true)
endmacro

See Also:

AddLayerDB

AddTables

Calculate Tables

Caliper.Charts

CC.ModifyTableOperations

CC.Table

Clustering

Data.Finder

Data.Geocoder

PostgreSQL Connect

PostgreSQL Command

Routing.Bands

Routing.Path

Routing.Router

Table

Utilities.Mail