Graph Builder: Examples in Source Code
Return to TechNote
PLAIN GRAPH
var g = new Graph(200,200);
g.addRow( 4208,  10535,  10762, 10517, 4066,  4477, 10547);
g.addRow( 2178,   4017,   3803, 22481, 2733,  2385,  4072);
g.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
g.build();

PLAIN GRAPH WITH SCALE
var t = new Graph(200,200);
t.scale = 5000;
t.addRow( -4208,  10535,  10762, 10517, 4066,  4477, 10547);
t.addRow( 2178,   -4017,   3803, 22481, -2733,  2385,  -14072);
t.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
t.build();

var s = new Graph(200,200);
s.scale = 5000;
s.setXScale("",1);
s.addRow( 4208,  10535,  10762, 10517, 4066,  4477, 10547);
s.addRow( 2178,   4017,   3803, 22481, 2733,  2385, 14072);
s.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
s.build();

GRAPH WITH LEGEND
var p = new Graph(200,200);
p.scale = 3000;
p.setXScale("",1);
p.setLegend("red rulers","blue baddies","green gremlins");
p.addRow( 4208,  10535,  10762, 10517, 4066,  4477, 10547);
p.addRow( 2178,   4017,   3803, 22481, 2733,  2385,  4072);
p.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
p.build();

GRAPH WITH LABELS AND TITLE
var q = new Graph(200,200);
q.scale = 3000;
q.title = "Governing Peoples";
q.yLabel = "Hits";
q.xLabel = "Date";
q.setDate(8,5,1998);
q.setLegend("red rulers","blue baddies","green gremlins");
q.addRow( 4208,  10535,  10762, 10517, 4066,  4477, 10547);
q.addRow( 2178,   4017,   3803, 22481, 2733,  2385,  4072);
q.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
q.build();

STACKED-TYPE GRAPH WITH BACKGROUND COLOR
var h = new Graph(200,200,true);
h.bgColor = "#DDDDDD";
h.scale = 5000;
h.setDate(8,5,1998);
h.setLegend("red rulers","blue baddies","green gremlins");
h.addRow( 4208,  10535,  10762, 10517, 4066,  4477, 10547);
h.addRow( 2178,   4017,   3803, 22481, 2733,  2385,  4072);
h.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
h.build();

STACKED-TYPE RELATIVE-AREA GRAPH
var i = new Graph(300,200);
i.scale = 10;
i.relative = true;
i.setDate(8,5,1998);
i.longDate = true;
i.setLegend("red rulers","blue baddies","green gremlins");
i.addRow( 4208,  10535,  10762, 10517, 4066,  4477, 10547);
i.addRow( 2178,   4017,   3803, 22481, 2733,  2385,  4072);
i.addRow( 1000,   2000,   3000,   400, 1000,  2000,   300);
i.build();