generate-graph-from-graph-spec

Create a basic-graph-spec object.

make-basic-graph-spec `
function`
`
start-x`
`
step-x`
`
range`
&key `
color`
`
thickness`
`
name`
`
x-offset`
`
y-offset`
`
x-scale`
`
y-scale`
`
var1`
`
var2`
`
var3`
`
var4`
`
var5`
`
var6`
=> `
basic-graph-spec`

The function `make-basic-graph-spec`

creates a basic-graph-spec object. This object can be modified by the `basic-graph-spec-*`

accessors. The function `generate-graph-from-graph-spec`

generates the graph using the current values in the basic-graph-spec object, which is a drawing-object which when drawn draws the graph, which means drawing a line between each two successive points.

`
function`
must be a function of two arguments: the basic-graph-spec and the x value. It needs to return the corresponding y value.

`
start-x`
, `
step-x`
and `
range`
define which x values to use: the first value is `
start-x`
, and then increase by `
step-x`
until the x is greater than (+ `
start-x`
`
range`
). For each x value, `generate-graph-from-graph-spec`

calls `
function`
with the `
graph-spec`
and the x value to generate the y value.

`
x-scale`
and `
y-scale`
(default to 1) are used to scale the x and y after calling `
function`
, by multiplying the x and y by `
x-scale`
and `
y-scale`
respectively.

`
x-offset`
and `
y-offset`
(default to 0) are used to translate the scaled values of x and y by adding the `
x-offset`
and `
y-offset`
to the scaled x and y.

The scaled and transformed pair x, y define a point. `generate-graph-from-graph-spec`

then generates a drawing-object that draws a line between each two successive points.

`
thickness`
and `
color`
specify the thickness and the color of the lines. The lines are drawn with `
scale-thickness`
`nil`

.

`
name`
and all the `var`

`
n`
values are arbitrary values, which you can use to store anything that the function needs to compute the y value. The system does not read or write them.

The function `copy-basic-graph-spec`

can be used to copy a basic-graph-spec. `basic-graph-spec-p`

is the predicate.

basic-graph-spec

generate-graph-from-pairs

drawing-object

Higher level - drawing graphs and bar charts

*CAPI User Guide and Reference Manual (Windows version) - 25 Feb 2015*