JavaScript Diagram Builder - The Diagram object

The Diagram object provides the possibility, to draw a diagram at a defined position with a defined size on the window document. The appropriate scale will be drawn automatically, corresponding to the specified xmin, xmax, ymin and ymax values. The diagram provides - also when not drawn - some useful functions which can be used to transform screen positions into real world positions and vice versa.
This diagram was generated by
<SCRIPT Language="JavaScript">;
var D=new Diagram();
D.SetFrame(80, 160, 420, 360);
D.SetBorder(10, 50, 0, 4);
D.Draw("#80FF80","#0000FF",true,"Click on me !","DiagramClick()");
function DiagramClick()
{ alert("Use your own function here."); }
You can use the following methods: Before drawing, you can set the following properties: After calling D.GetXGrid() / D.GetYGrid() you can read: Because of a bug in Netscape 4.x you must add the following code in the web page
before using the diagram objects:
<DIV STYLE="position:absolute; top:0px"></DIV>
Also for Netscape 4.x the file transparent.gif must be in the directory of the web page.

If you want to draw the diagram into another window, you can specify the target window:
_DiagramTarget is a global variable, which is valid within the entire document.
The default _DiagramTarget is the window object of the current document.
The Diagram in the new window was generated by:

<SCRIPT Language="JavaScript">
function MyXScale(nn)
{ var tt=new Array("left", "center", "right");
function NewWindow()
  with (_DiagramTarget.document)
  { open();
    writeln("<HTML><HEAD><TITLE>Diagram in a new window</TITLE></HEAD><BODY>");
    var D2=new Diagram();
    D2.SetFrame(60, 40, 400, 240);
    D2.SetBorder(0, 3, 0, 4);
    D2.XScale="function MyXScale";
    D2.SetText("","", "Diagram with small font and function-scale");
    D2.SetGridColor("#cccccc", "#eeddcc");
    D2.Draw("#FFEECC", "#336699", false, "Click on me !", "opener.DiagramClick()");

« Introduction The Bar object »