GraphExamples.graph
Sweetsun Chen, August 19, 1985 3:18:27 pm PDT
-- a simplest example
graph ← [ entities[
[3 6 9 12] -- entity 1, also the independent variable x.
[100.5 110.4 104.9 156.2] -- entity 2, one of the curves, as a function of x
[12 14.5 13.0 17.2] -- entity 3, the other curve.
];
-- another way of making the same graph
graph ← [ crosssections[
"month" "revenue" "net profit",
3 100.5 12 -- a vertical crosssection of the graph, where x = 3.
6 110.4 14.5 -- another vertical crosssection, where x = 6.
9 104.9 13.0 -- the third vertical crosssection, where x = 9.
12 156.2 17.2 -- the last vertical crosssection, where x = 12.
]];
-- a typical example
graph ← [
caption: "Typical Example",
curveSets: crosssection[
names: "Month" "Revenue" "Net Profit",
data: -- month, revenue, net profit
3 100.5 12
6 110.4 14.5
9 104.9 13.0
12 156.2 17.2
]
title: ["1984 Performance"],
xtitle: [text: "Time", place: [1.01, 0.01]],
ytitle: [text: "Million $", place: [-0.01, 1.01], color: 10, font: 1],
texts: [
["Break Even Point", [0.5, 0.5], 2]
["Target", [0, 0.75]]
];
]; -- typical example
-- a more elaborate example
graph ← [
color: [c3: [0.5, 0.5, 0.5]],
font: [f4: ["Helvetica", 14, 18]],
caption: ["Advanced Example"],
title: ["1984 Performance"],
xtitle: [text: "Month", color: ],
ytitle: ["Million $", [-0.01, 1.01], 1, 10],
texts: [
[text: "Break Even Point", place: [0.5, 0.5], 1, 10, 45, lowerRight]
["Target", [0, 0.75]]
],
curveSets:
crosssections[
nEntities: 3,
names: "Month" "Revenue" "Net Profit",
data: [-- month, revenue, net profit
3 100.5 12
6 110.4 14.5
9 104.9 13.0
12 156.2 17.2
]
]
entities[
["Gross Profit", [30, 35, 32, 44]]
["Expenses", [18, 20.5, 19, 26.8]]
["Month", [3, 6, 9, 12]],
xIndex: 3
]
];