Index: openacs-4/packages/diagram/.project =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/.project,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/.project 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,11 @@ + + + diagram + + + + + + + + Index: openacs-4/packages/diagram/diagram.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/diagram.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/diagram.info 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,28 @@ + + + + + Diagram + Diagrams + f + t + + + Nima Mazloumi + Extension to acs-templating package to give support for diagrams. + 2005-11-25 + Universität Mannheim + This package gives support to multirow based diagrams. Like template::list::create you can easily define your diagram and pass the multirow to be used. Currently it has only support for Javascript based diagrams. The underlying library used is JavaScript Diagram Builder v3.3 from Lutz Tautenhahn. The rendering is encapsulated though. This allows future version to give support for different engines like GNUPlot. + 0 + + + + + + + + + + + + Index: openacs-4/packages/diagram/catalog/diagram.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/catalog/diagram.de_DE.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/catalog/diagram.de_DE.ISO-8859-1.xml 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,5 @@ + + + + Legende + Index: openacs-4/packages/diagram/catalog/diagram.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/catalog/diagram.en_US.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/catalog/diagram.en_US.ISO-8859-1.xml 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,5 @@ + + + + Legend + Index: openacs-4/packages/diagram/catalog/diagram.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/catalog/diagram.es_ES.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/catalog/diagram.es_ES.ISO-8859-1.xml 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,5 @@ + + + + Leyenda + Index: openacs-4/packages/diagram/resources/diagram/cockpit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/resources/diagram/cockpit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/resources/diagram/cockpit.adp 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,37 @@ + + + + +<% set col [expr "$elements(rownum) % 2"]; %> + + + +
+ +
+
+
+ + + Index: openacs-4/packages/diagram/resources/diagram/curve.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/resources/diagram/curve.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/resources/diagram/curve.adp 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,57 @@ + + + +
+
+ +
+
+#diagram.Legend# + +<% set col [expr "$elements(rownum) % 2"] %> +<% set index [expr "int(ceil($elements(rownum)/2))"];%> + +
@elements.label;noquote@
+
+
+
+ + Index: openacs-4/packages/diagram/resources/diagram/pie.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/resources/diagram/pie.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/resources/diagram/pie.adp 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,53 @@ + +<% set index 0 %> +
+ +
+ Index: openacs-4/packages/diagram/sql/oracle/diagram-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/sql/oracle/diagram-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/sql/oracle/diagram-create.sql 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,35 @@ +-- The following table is only created for illustration. You can remove it on a productive site. + +-- Table: diagram_dummy_logs +CREATE TABLE diagram_dummy_logs +( + x1 timestamptz, + y1 int4, + x2 timestamptz, + y2 int4, + x3 timestamptz, + y3 int4 +); + + +-- Some dummy data +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:11.868964+01',2,'2005-11-21 23:06:11.868964+01',1.0,'2005-11-21 23:06:10.868964+01',2); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:12.913197+01',2,'2005-11-21 23:06:12.913197+01',0,'2005-11-21 23:06:13.913197+01',3); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:13.207786+01',3,'2005-11-21 23:06:13.207786+01',2,'2005-11-21 23:06:16.207786+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:14.358372+01',2,'2005-11-21 23:06:14.358372+01',3,'2005-11-21 23:06:19.358372+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:15.489034+01',3,'2005-11-21 23:06:15.489034+01',7,'2005-11-21 23:06:21.489034+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:16.614377+01',3,'2005-11-21 23:06:16.614377+01',3,'2005-11-21 23:06:23.614377+01',0); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:17.735309+01',4,'2005-11-21 23:06:17.735309+01',6,'2005-11-21 23:06:26.735309+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:18.453809+01',4,'2005-11-21 23:06:18.453809+01',1,'2005-11-21 23:06:29.453809+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:19.186141+01',4,'2005-11-21 23:06:20.186141+01',6,'2005-11-21 23:06:31.186141+01',3); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:20.077621+01',5,'2005-11-21 23:06:22.077621+01',8,'2005-11-21 23:06:33.077621+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:21.362135+01',5,'2005-11-21 23:06:23.362135+01',5,'2005-11-21 23:06:36.362135+01',7); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:22.700218+01',5,'2005-11-21 23:06:25.700218+01',0,'2005-11-21 23:06:39.700218+01',0); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:23.850676+01',4,'2005-11-21 23:06:26.850676+01',6,'2005-11-21 23:06:41.850676+01',4); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:24.041068+01',5,'2005-11-21 23:06:27.041068+01',7,'2005-11-21 23:06:43.041068+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:25.171647+01',5,'2005-11-21 23:06:28.171647+01',0,'2005-11-21 23:06:46.171647+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:26.317253+01',6,'2005-11-21 23:06:29.317253+01',4,'2005-11-21 23:06:49.317253+01',9); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:27.423928+01',6,'2005-11-21 23:06:30.423928+01',3,'2005-11-21 23:06:51.423928+01',5); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:28.528976+01',7,'2005-11-21 23:06:31.528976+01',2,'2005-11-21 23:06:53.528976+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:29.557702+01',7,'2005-11-21 23:06:32.557702+01',7,'2005-11-21 23:06:56.557702+01',2); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:30.708037+01',5,'2005-11-21 23:06:33.708037+01',5.5,'2005-11-21 23:06:59.708037+01',9); Index: openacs-4/packages/diagram/sql/oracle/diagram-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/sql/oracle/diagram-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/sql/oracle/diagram-drop.sql 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1 @@ +DROP TABLE diagram_dummy_logs; \ No newline at end of file Index: openacs-4/packages/diagram/sql/postgresql/diagram-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/sql/postgresql/diagram-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/sql/postgresql/diagram-create.sql 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,35 @@ +-- The following table is only created for illustration. You can remove it on a productive site. + +-- Table: diagram_dummy_logs +CREATE TABLE diagram_dummy_logs +( + x1 timestamptz, + y1 int4, + x2 timestamptz, + y2 int4, + x3 timestamptz, + y3 int4 +); + + +-- Some dummy data +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:11.868964+01',2,'2005-11-21 23:06:11.868964+01',1.0,'2005-11-21 23:06:10.868964+01',2); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:12.913197+01',2,'2005-11-21 23:06:12.913197+01',0,'2005-11-21 23:06:13.913197+01',3); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:13.207786+01',3,'2005-11-21 23:06:13.207786+01',2,'2005-11-21 23:06:16.207786+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:14.358372+01',2,'2005-11-21 23:06:14.358372+01',3,'2005-11-21 23:06:19.358372+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:15.489034+01',3,'2005-11-21 23:06:15.489034+01',7,'2005-11-21 23:06:21.489034+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:16.614377+01',3,'2005-11-21 23:06:16.614377+01',3,'2005-11-21 23:06:23.614377+01',0); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:17.735309+01',4,'2005-11-21 23:06:17.735309+01',6,'2005-11-21 23:06:26.735309+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:18.453809+01',4,'2005-11-21 23:06:18.453809+01',1,'2005-11-21 23:06:29.453809+01',8); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:19.186141+01',4,'2005-11-21 23:06:20.186141+01',6,'2005-11-21 23:06:31.186141+01',3); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:20.077621+01',5,'2005-11-21 23:06:22.077621+01',8,'2005-11-21 23:06:33.077621+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:21.362135+01',5,'2005-11-21 23:06:23.362135+01',5,'2005-11-21 23:06:36.362135+01',7); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:22.700218+01',5,'2005-11-21 23:06:25.700218+01',0,'2005-11-21 23:06:39.700218+01',0); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:23.850676+01',4,'2005-11-21 23:06:26.850676+01',6,'2005-11-21 23:06:41.850676+01',4); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:24.041068+01',5,'2005-11-21 23:06:27.041068+01',7,'2005-11-21 23:06:43.041068+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:25.171647+01',5,'2005-11-21 23:06:28.171647+01',0,'2005-11-21 23:06:46.171647+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:26.317253+01',6,'2005-11-21 23:06:29.317253+01',4,'2005-11-21 23:06:49.317253+01',9); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:27.423928+01',6,'2005-11-21 23:06:30.423928+01',3,'2005-11-21 23:06:51.423928+01',5); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:28.528976+01',7,'2005-11-21 23:06:31.528976+01',2,'2005-11-21 23:06:53.528976+01',6); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:29.557702+01',7,'2005-11-21 23:06:32.557702+01',7,'2005-11-21 23:06:56.557702+01',2); +INSERT INTO diagram_dummy_logs VALUES ('2005-11-21 23:06:30.708037+01',5,'2005-11-21 23:06:33.708037+01',5.5,'2005-11-21 23:06:59.708037+01',9); Index: openacs-4/packages/diagram/sql/postgresql/diagram-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/sql/postgresql/diagram-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/sql/postgresql/diagram-drop.sql 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1 @@ +DROP TABLE diagram_dummy_logs; \ No newline at end of file Index: openacs-4/packages/diagram/tcl/diagram-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/tcl/diagram-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/tcl/diagram-procs.tcl 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,797 @@ +ad_library { + Procs for the diagram builder. + + @author Nima Mazloumi (mazloumi@uni-mannheim.de) + @creation-date 2005-11-18 + @cvs-id $Id: diagram-procs.tcl,v 1.1 2006/01/10 07:34:17 nimam Exp $ +} + +namespace eval template {} +namespace eval template::diagram {} +namespace eval template::diagram::element {} + +##### +# +# template::diagram namespace +# +##### + +ad_proc -public template::diagram::create { + {-name:required} + {-multirow ""} + {-title ""} + {-x_label "x"} + {-y_label "y"} + {-scales "1 1"} + {-color "#c0c0c0"} + {-left 0} + {-top 0} + {-right 100} + {-bottom 100} + {-ulevel 1} + {-elements:required} + {-template "curve"} +} { + Defines a diagram to be displayed in a template. The diagram works in conjunction with a multirow, which contains the data for the diagram. + The diagram is output using templating tag <diagram> and internally also <diagramelement>. + + Three diagrams types are currently supported: "curve", "pie" and "cockpit". The type is defined by passing the name to the template switch. + The templates are defined in the diagram package under resources/diagram/. +

+ + Here's an example of a fairly simple diagram. Note that you must specify the multirow before the diagram since the columns names of the multirow + are retrieved dynamically. + +

+    db_multirow mydata select_objects {
+	select x, y from logs
+    }
+
+    template::diagram::create
+	-name mydiagram
+	-multirow mydata
+	-title "My Diagram"
+	-x_label "X-Label"
+	-y_label "Y-Label"
+	-left $left -top $top -right $width -bottom $height
+	-scales "1 1"
+	-template curve
+	-elements {
+	    mycurve {
+		color "\#c0c0c0"
+		type 1
+		label "My Curve"
+		size 2
+		dot_type 1
+	    }
+	}
+    
+ + And the ADP template would include this: + +
+    <property name="header_stuff"><SCRIPT Language="JavaScript" src="/resources/diagram/diagram/diagram.js"></SCRIPT></property>
+    <diagram name="mydiagram"></diagram>
+    
+ + You can also provide a csv export of the data rendered in the diagram by simply adding this to you page: + +
+    #at the beginning of your tcl page
+    ad_page_contract {
+    } {
+	{csv ""}
+    }
+    
+ +
+    #after you template definition
+    if {[exists_and_not_null csv]} {
+	template::diagram::write_output -name mydiagram
+    }
+    
template::diagram::element::create for details. + @param template The template to use for the rendering. Currently there is support only for Javascript based diagrams. They have been tested for firefox, IE, Opera, safari and camino. + Other ways to generated the diagrams can be integrated by writing your own templates and for instance using GNUPlot. + The current templates availabe are: "curve", "pie" and "cockpit" + + @see template::diagram::element::create + @author Nima Mazloumi (nima.mazloumi@gmx.de) + +} { + set level [template::adp_level] + + # Get an upvar'd reference to diagram_properties + get_reference -create -name $name + + # Setup some list defaults + array set diagram_properties { + title {} + x_label {} + y_label {} + scales {} + color {} + left {} + top {} + right {} + bottom {} + multirow {} + template {} + } + + # These are defauls for internally maintained properties + array set diagram_properties { + elements {} + element_refs {} + display_elements {} + ulevel {} + output {} + } + + # Set default for no_data + # Set ulevel to the level of the page, so we can access it later + set diagram_properties(ulevel) "\#[expr [info level] - $ulevel]" + + # Set properties from the parameters passed + foreach elm { + name + title + x_label + y_label + scales + color + left + top + right + bottom + multirow + template + } { + set diagram_properties($elm) [set $elm] + } + + # Default 'multirow' to list name + if { [empty_string_p $diagram_properties(multirow)] } { + set diagram_properties(multirow) $name + } + + set columns [template::multirow columns $multirow] + set i 0 + foreach {curve spec} $elements { + + set x [lindex $columns $i] + set y [lindex $columns [expr "$i+1"]] + + # Need to uplevel 2 the subst command to get to our caller's namespace + template::diagram::element::create \ + -diagram_name $name \ + -element_name $x \ + -spec $spec \ + -ulevel 2 + + template::diagram::element::create \ + -diagram_name $name \ + -element_name $y \ + -spec $spec \ + -ulevel 2 + + incr i 2 + } + + # Done, prepare the list. This has to be done while we still have access to the caller's scope + prepare \ + -name $name \ + -ulevel 2 +} + + +ad_proc -private template::diagram::resources_path { +} { + return "/resources/diagram/diagram/" +} + +ad_proc -private template::diagram::prepare_value { + -value:required + -scale:required +} { + prepares the values given the scale. 0 nothing, 1 numerical, 2,... date +} { + switch $scale { + 0 - 1 {return $value;} + default {return "Date.UTC($value)";} + } +} + +ad_proc -private template::diagram::prepare_positioning { + -name:required +} { + Sets the position of the diagram in accordance to the given coordinates +} { + get_reference -name $name + set bottom $diagram_properties(bottom) + set right $diagram_properties(right) + set diagram_properties(height) [expr "$bottom + 30"] + set diagram_properties(width) [expr "$right + 20"] +} + +ad_proc -private template::diagram::get_slice_color { + {-part:required} + {-sum:required} +} { +} { + if { $sum == 0 } { set sum 1} + + set d [expr $sum - $part] + + set r [expr 255 / $sum * $part] + set g [expr 255 / $sum * $d] + set b 0 + + return "$r,$g,$b" +} + +ad_proc -private template::diagram::update_borders { + {-scale:required} + {-list:required} + {-min:required} + {-max:required} + {-sum:required} + {-local_list:required} +} { +} { + upvar $min mn + upvar $max mx + upvar $sum sm + upvar $local_list l + + set _min "" + set _max "" + + switch $scale { + #its numerical + 0 - 1 { + set l [lsort -real -increasing $list] + set _min [lindex $l 0] + set _max [lindex $l [expr "[llength $l] - 1"]] + lappend sm [expr "[join $l "+"]"] + } + #its a date scale + default { + set l [lsort -increasing $list] + set _min "Date.UTC([lindex $l 0])" + set _max "Date.UTC([lindex $l [expr "[llength $l] - 1"]])" + } + } + #ns_log Notice "List: $l" + + if {[empty_string_p $mn] || $_min < $mn} { + set mn $_min + } + + if {[empty_string_p $mx] || $_max > $mx} { + set mx $_max + } +} + +ad_proc -private template::diagram::set_borders { + -name:required +} { + Sets the borders for the axis +} { + get_reference -name $name + + set count [expr "[llength $diagram_properties(display_elements)] / 2"] + set diagram_properties(count) $count + + for {set j 1} {$j <= [llength $diagram_properties(display_elements)]} {incr j} { + set col$j [list] + } + + #iterate over the multirow + template::multirow foreach $diagram_properties(multirow) { + + #iterate over each column + for {set j 0} {$j < [llength $diagram_properties(display_elements)]} {incr j} { + set element [lindex $diagram_properties(display_elements) $j] + template::diagram::element::get_reference \ + -diagram_name $name \ + -element_name $element \ + -local_name __element_properties + + if { [info exists $__element_properties(name)] } { + lappend "col[expr "$j + 1"]" "[lindex [set $__element_properties(name)] 0]" + } + } + } + + set x_min "" + set x_max "" + set y_min "" + set y_max "" + + set scales $diagram_properties(scales) + set minima [list] + set sum [list] + + #lets iterate over all columns and get the borders + for {set j 1} {$j <= [llength $diagram_properties(display_elements)]} {incr j} { + + #first we check which axis to use (odd columns represent the x, even the y axis) + set xy [expr "$j % 2"] + + #now we need a counter for each diagram + set d [expr "int(ceil(($j/2) % $count)) + 1"] + + #we need to update min and max + + set list [list] + + #its the x axis + if {$xy == 1} { + update_borders -scale [lindex $scales 0] -list [set col$j] -local_list list -min x_min -max x_max -sum sum + lappend minima "x$d=D.ScreenX([prepare_value -value [lindex $list 0] -scale [lindex $scales 0]])" + + #its the y axis + } else { + update_borders -scale [lindex $scales 1] -list [set col$j] -local_list list -min y_min -max y_max -sum sum + lappend minima "y$d=D.ScreenY([prepare_value -value [lindex $list 0] -scale [lindex $scales 1]])" + } + + #ns_log Notice "X($x_min,$x_max), Y($y_min,$y_max)" + } + + set borders [list $x_min $x_max $y_min $y_max] + + #some important helpers + set diagram_properties(sum) $sum + set diagram_properties(minima) "var [join $minima ";\nvar "];" + set diagram_properties(borders) "[join $borders ","]" + set diagram_properties(x0) "D.ScreenX($x_min)" + set diagram_properties(y0) "D.ScreenY($y_min)" + set diagram_properties(scales) "D.XScale=[lindex $scales 0];\nD.YScale=[lindex $scales 1];" + set diagram_properties(x_scale) [lindex $scales 0] + set diagram_properties(y_scale) [lindex $scales 1] + #ns_log Notice "\nSum $sum\nMinima $minima\nBorders $borders" +} + +ad_proc -private template::diagram::prepare { + {-name:required} + {-ulevel 1} +} { + Prepare list for rendering +} { + # Get an upvar'd reference to diagram_properties + get_reference -name $name + + # Default the display_elements property to be all elements + if { [llength $diagram_properties(display_elements)] == 0 } { + set diagram_properties(display_elements) $diagram_properties(elements) + } +} + +ad_proc -private template::diagram::get_refname { + {-name:required} +} { + return "$name:properties" +} + +ad_proc -private template::diagram::get_reference { + {-name:required} + {-local_name "diagram_properties"} + {-create:boolean} +} { + set refname [get_refname -name $name] + + if { !$create_p && ![uplevel \#[template::adp_level] [list info exists $refname]] } { + error "List '$name' not found" + } + + uplevel upvar #[template::adp_level] $refname $local_name +} + +ad_proc -private template::diagram::write_output { + -name:required +} { + Writes the output to the connection if output isn't set to template. + Will automatically issue an ad_script_abort, if the output has been written + directly to the connection instead of through the templating system. +} { + # Get an upvar'd reference to diagram_properties + get_reference -name $name + + write_csv -name $name + ad_script_abort +} + +ad_proc -private template::diagram::csv_quote { + string +} { + Quote a string for inclusion as a csv element +} { + regsub -all {\"} $string {""} result + return $result +} + +ad_proc -private template::diagram::write_csv { + -name:required +} { + Writes a CSV to the connection + @author Nima Mazloumi (nima.mazloumi@gmx.de) +} { + # Creates the '_eval' columns and aggregates + template::diagram::prepare -name $name + + get_reference -name $name + + set __diagram_name $name + set __output {} + + # Output header row + set __cols [list] + foreach __element_name $diagram_properties(display_elements) { + lappend __cols [csv_quote $__element_name] + } + append __output "\"[join $__cols "\";\""]\"\n" + + # Output rows + template::multirow foreach $diagram_properties(multirow) { + + set __cols [list] + + foreach __element_name $diagram_properties(display_elements) { + template::diagram::element::get_reference \ + -diagram_name $__diagram_name \ + -element_name $__element_name \ + -local_name __element_properties + + if { [info exists $__element_properties(csv_col)] } { + lappend __cols [csv_quote [set $__element_properties(csv_col)]] + } + } + append __output "\"[join $__cols "\";\""]\"\n" + } + + ns_set put [ad_conn outputheaders] Content-Disposition "attachment;filename=diagram.csv" + ns_return 200 text/csv $__output +} + +ad_proc -private template::diagram::template { + {-name:required} + {-template ""} +} { + Process a list template with the special hacks into becoming a + 'real' ADP template, as if it was included directly in the page. + Will provide that template with a multirow named 'elements'. +} { + set level [template::adp_level] + + # Get an upvar'd reference to diagram_properties + get_reference -name $name + + + # + # Create 'elements' multirow + # + + # Manually construct a multirow by upvar'ing each of the element refs + set elements:rowcount 0 + + foreach element_name $diagram_properties(display_elements) { + set element_ref [template::diagram::element::get_refname \ + -diagram_name $name \ + -element_name $element_name] + upvar #$level $element_ref element_properties + + incr elements:rowcount + + # get a reference by index for the multirow data source + upvar #$level $element_ref elements:${elements:rowcount} + + # Also set the rownum pseudocolumn + set "elements:${elements:rowcount}(rownum)" ${elements:rowcount} + } + + # + # Find the list template + # + + if { [string equal $template {}] } { + set template $diagram_properties(template) + } + + if { [string equal $template {}] } { + set template [parameter::get \ + -package_id [ad_conn subsite_id] \ + -parameter DefaultDiagramTemplate \ + -default [parameter::get \ + -package_id [apm_package_id_from_key "diagram"] \ + -parameter DefaultDiagramTemplate \ + -default "curve"]] + } + set file_stub "[acs_root_dir]/packages/diagram/resources/diagram/$template" + + # ensure that the template template has been compiled and is up-to-date + template::adp_init adp $file_stub + + # get result of template output procedure into __adp_output + # the only data source on which this template depends is the "elements" + # multirow data source. The output of this procedure will be + # placed in __adp_output in this stack frame. + + template::code::adp::$file_stub + + return $__adp_output +} + +ad_proc -private template::diagram::render { + {-name:required} + {-template ""} +} { + set level [template::adp_level] + + set_borders -name $name + prepare_positioning -name $name + + # Get an upvar'd reference to diagram_properties + get_reference -name $name + + # This gets and actually compiles the dynamic template into the template to use for the output + # Thus, we need to do the dynamic columns above before this step + set __adp_output [template -name $name -template $template] + + # set __adp_stub so includes work. Only fully qualified includes will work with this + + set __list_code { + set __adp_stub "" + } + append __list_code [template::adp_compile -string $__adp_output] + + # Get the multirow upvar'd to this namespace + template::multirow upvar $diagram_properties(multirow) + + # evaluate the code and return the rendered HTML for the list + set __output [template::adp_eval __list_code] + + return $__output +} + +##### +# +# template::diagram::element namespace +# +##### + +ad_proc -private template::diagram::element::create { + {-diagram_name:required} + {-element_name:required} + {-spec:required} + {-ulevel 1} +} { + Adds an element to a diagram builder diagram. + +

+ This proc shouldn't be called directly, only through template::diagram::create. +

+ + The properties depend on the diagram type used (-template switch of template::diagram::create). + These are the general properties in the spec: + +

+

+ + The curve diagram type has the following properties as well: + + + For the curve type dot you can specify another property called "dot_type": 1,3,4,5=different plus types, 2,5=rectangles. + + @param diagram_name Name of diagram. + @param element_name Name of the element. + @param spec The spec for this element. This is an array list of property/value pairs, where the right hand side + is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow. + @param ulevel Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope. + + @see template::diagram::create + @author Nima Mazloumi (nima.mazloumi@gmx.de) +} { + # Get an upvar'd reference to diagram_properties + template::diagram::get_reference -name $diagram_name + + # Get the list properties + lappend diagram_properties(elements) $element_name + + # We store the full element ref name, so its easy to find later + lappend diagram_properties(element_refs) [get_refname -diagram_name $diagram_name -element_name $element_name] + + # Create the element properties array + get_reference -create -diagram_name $diagram_name -element_name $element_name + + # Setup element defaults + array set element_properties { + label {} + color {} + type {} + csv_col {} + image {} + dot_type {} + size {} + } + + # These attributes are internal listbuilder attributes + array set element_properties { + subrownum 0 + } + + # Let the element know its own name + set element_properties(name) $element_name + + # Let the element know its owner's name + set element_properties(diagram_name) $diagram_name + + incr ulevel + + set_properties \ + -diagram_name $diagram_name \ + -element_name $element_name \ + -spec $spec \ + -ulevel $ulevel + + # Default csv_col to name + if { [empty_string_p $element_properties(csv_col)] } { + set element_properties(csv_col) $element_properties(name) + } +} + +ad_proc -private template::diagram::element::get_refname { + {-diagram_name:required} + {-element_name:required} +} { + @return the name used for the list element properties array. +} { + return "$diagram_name:element:$element_name:properties" +} + +ad_proc -private template::diagram::element::get_reference { + {-diagram_name:required} + {-element_name:required} + {-local_name "element_properties"} + {-create:boolean} +} { + upvar the list element to the callers scope as $local_name +} { + # Check that the list exists + template::diagram::get_reference -name $diagram_name + + set refname [get_refname -diagram_name $diagram_name -element_name $element_name] + + if { !$create_p && ![uplevel \#[template::adp_level] [list info exists $refname]] } { + error "Element '$element_name' not found in list '$diagram_name'" + } + + uplevel upvar #[template::adp_level] $refname $local_name +} + +ad_proc -private template::diagram::element::set_property { + {-diagram_name:required} + {-element_name:required} + {-property:required} + {-value:required} + {-ulevel 1} +} { + # Get an upvar'd reference to diagram_properties + template::diagram::get_reference -name $diagram_name + + get_reference \ + -diagram_name $diagram_name \ + -element_name $element_name + + switch $property { + default { + # We require all properties to be initialized to the empty string in the array, otherwise they're illegal. + if { ![info exists element_properties($property)] } { + error "Unknown element property '$property'. Allowed properties are [join [array names element_properties] ", "]." + } + + # All other vars, do an uplevel subst on the value now + set element_properties($property) [uplevel $ulevel [list subst $value]] + } + } +} + +ad_proc -private template::diagram::element::set_properties { + {-diagram_name:required} + {-element_name:required} + {-spec:required} + {-ulevel 1} +} { + incr ulevel + + foreach { property value } $spec { + set_property \ + -diagram_name $diagram_name \ + -element_name $element_name \ + -property $property \ + -value $value \ + -ulevel $ulevel + } +} + +ad_proc -private template::diagram::element::render { + {-diagram_name:required} + {-element_name:required} +} { + Returns an ADP chunk, which must be evaluated +} { + set level [template::adp_level] + + # Get an upvar'd reference to diagram_properties + template::diagram::get_reference -name $diagram_name + + set multirow $diagram_properties(multirow) + + set output "@$multirow.$element_name@" + + return $output +} + +##### +# +# Templating system ADP tags +# +##### + +template_tag diagram { chunk params } { + + set level [template::adp_level] + + set diagram_name [template::get_attribute diagram $params name] + + set template [ns_set iget $params template] + + template::adp_append_code "set diagram_properties(name) [list $diagram_name]" + + template::adp_append_string \ + "\[template::diagram::render -name \"$diagram_name\" -template \"$template\"\]" +} + +template_tag diagramelement { params } { + + set element_name [template::get_attribute diagramelement $params name] + + # diagram_properties will be available, because + + template::adp_append_string \ + "\[template::diagram::element::render -diagram_name \${diagram_properties(name)} -element_name $element_name\]" +} \ No newline at end of file Index: openacs-4/packages/diagram/www/doc/cockpit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/cockpit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/cockpit.adp 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/diagram/www/doc/cockpit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/cockpit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/cockpit.tcl 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,46 @@ +ad_page_contract { +} { + {width 100} + {height 100} + {size 2} + {color "ff5533"} + {csv ""} + {template cockpit} + {limit 1} + {top 100} + {left 100} +} + +set query "select + y3 as x1, case when random()>0.3 then (-1*(random()*y3/10)+y3) else ((random()*y3/10)+y3) end as x2, + y3 as x3, case when random()>0.3 then (-1*(random()*y3/10)+y3) else ((random()*y3/10)+y3) end as x4 + from diagram_dummy_logs + order by random() + limit $limit" + + +db_multirow datasource select_objects $query + +template::diagram::create \ + -name dia1 \ + -multirow datasource \ + -title "System Monitoring" \ + -left $left -top $top -right $width -bottom $height \ + -template $template \ + -elements { + d1 { + label "Monitor" + color "\#ff5533" + size $size + } + d2 { + label "CPU1" + color "\#$color" + size $size + } + } + +if {[exists_and_not_null csv]} { + template::diagram::write_output -name dia1 +} +ad_return_template Index: openacs-4/packages/diagram/www/doc/curve.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/curve.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/curve.adp 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/diagram/www/doc/curve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/curve.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/curve.tcl 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,72 @@ +ad_page_contract { +} { + {d1 1} + {d2 2} + {width 480} + {height 150} + {dot_type 1} + {size 2} + {d1_color "ff5533"} + {d2_color "aaee33"} + {csv ""} + {x_scale 2} + {y_scale 1} + {template curve} + {limit 20} + {top 40} + {left 100} +} + +set query "select + to_char(x1, 'YYYY,MM,DD,HH24,MI,SS') as x1, + y1, + to_char(x2, 'YYYY,MM,DD,HH24,MI,SS') as x2, + y2, + to_char(x3, 'YYYY,MM,DD,HH24,MI,SS') as x3, + y3 + from diagram_dummy_logs + order by x1 + limit $limit" + + +db_multirow datasource select_objects $query + + +template::diagram::create \ + -name dia1 \ + -multirow datasource \ + -title "Monitoring - Dummy" \ + -x_label "Time" \ + -y_label "Count" \ + -left $left -top $top -right $width -bottom $height \ + -scales "$x_scale $y_scale" \ + -template $template \ + -elements { + d1 { + color "#$d1_color" + type 1 + label "Objects" + size 7 + dot_type 3 + } + d2 { + color "#$d2_color" + type 4 + label "Memory" + size 1 + dot_type 3 + } + d3 { + color "#c0c0c0" + type 3 + label "Disc Usage" + size 4 + dot_type 4 + } + } + +if {[exists_and_not_null csv]} { + template::diagram::write_output -name dia1 +} + +ad_return_template \ No newline at end of file Index: openacs-4/packages/diagram/www/doc/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/index.adp 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,71 @@ + + + +

Introduction Diagram v0.2b

+by Nima Mazloumi, and with help of Lutz Tautenhahn +

This package extends the templating system of OpenACS by providing another +builder next to the list and form builder. The diagram builder is very similar +to the list builder. Two differences are important though: The multirow to be +used must me defined bofore template::diagram::create is called since the +column names are retrieved dynamically. +

+

+The diagram builder was developed in a way that it can be extended to use +different engines for the rendering of the diagrams. Currently it is based on +the "Javascript Diagram Builder", v3.3 Lutz Tautenhahn. But other engines +could be integrated in future like GNUPlot. +

+

Extending the Diagram Builder

+

The rendering is taking place in +the templates defined under resources/diagram/..
. Currently we support +the following types: pie, curve and cockpit. You can customize the way they +render the diagrams by editing the corresponding templates or adding new +ones. Once a template is created you simply pass its name with the -template +switch of template::diagram::create. +

+

+

Examples

+

You need to run the diagram-create.sql to view the examples +below. It will create a table with dummy data. You can remove the table again +using diagram-drop.sql.

+

A detailed example is given in the API Browser. This page also contains +examples for the three diagram types "pie", "curve" and "cockpit". As you can +see the diagrams are beautifully inserted inside the page flow. Also +CSV-Export is possible. +

+CSV + + +

Limitations

+

In order to make this builder easier to be extended the Javascript specific +parts have to be removed: +

    +
  • Affected are the procs: template::diagram::prepare_value, +template::diagram::update_borders and +template::diagram::set_borders which nead a clean up. Maybe +moving these information into the templates would be best. +
  • Date and Timestamp based values from the database have to be formatted in +a special way. You must use to_char(mydate, 'YYYY,MM,DD[,HH24][,MI][,SS]') in +your sql query to return a meaningful value. As you can see some elements are +optional. For details please view the Date and UTC +objects documentation for JavaScript. +
+

+

Future Work

+

Not everything available in the Javascript Diagram Builder was fully +integrated. There are many other things that could be done in future as well. Here some ideas: +

    +
  • Give support for GNUPlot - a very powerful engine that has support for all +diagram types including world maps... +
  • Allow the definition of scales. Currently a developer would need to touch +the Javascript Library to add new scales types +
  • Add another package depeding on diagrams and portals and allows the definition of a +repository of monitors and associate them with a role. Thus a given user could +select from a extensible list of diagrams and define a user-specific report +page. This would extend OpenACS towards real business intelligence toolkit for +companies, universities and research labs. It would be important though to +extend diagram to use from a pool of data sources like: databases, tcl +scripts, remove web services... +
  • Provide an XoTCL version in order to support different classes of diagrams +and to improve reusablity. +
\ No newline at end of file Index: openacs-4/packages/diagram/www/doc/pie.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/pie.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/pie.adp 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/diagram/www/doc/pie.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/doc/pie.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/doc/pie.tcl 10 Jan 2006 07:34:17 -0000 1.1 @@ -0,0 +1,50 @@ +ad_page_contract { +} { + {d1 1} + {d2 2} + {width 80} + {height 80} + {dot_type 1} + {size 2} + {d1_color "ff5533"} + {d2_color "aaee33"} + {csv ""} + {x_scale 2} + {y_scale 1} + {template pie} + {limit 2} + {top 0} + {left 0} +} + +set query "select + to_char(x1, 'HH24:MI:SS') as x1, + y1 + from diagram_dummy_logs + order by x1 + limit $limit" + + +db_multirow datasource select_objects $query + +template::diagram::create \ + -name dia1 \ + -multirow datasource \ + -title "Objects" \ + -x_label "Time" \ + -y_label "Count" \ + -left $left -top $top -right $width -bottom $height \ + -scales "$x_scale $y_scale" \ + -template $template \ + -elements { + d1 { + color "#$d1_color" + label "Pie 1" + size $size + } + } + +if {[exists_and_not_null csv]} { + template::diagram::write_output -name dia1 +} +ad_return_template \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/area_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/area_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/area_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,83 @@ + + + +JavaScript Diagram Builder - The Area object + + + + + +
+
+

JavaScript Diagram Builder - The Area object

+
+The Area object is used to display an area chart into the diagram. You can also hide, move and delete it +after it has been drawn. In order to draw the area object you need the images o_rrggbb.gif, d_rrggbb.gif, +p_rrggbb.gif, q_rrggbb.gif and b_rrggbb.gif, which must be in the same directory. Red, blue and black +images are already available. If you want to use other colors, you must first generate the required images. +
+ + +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 520, 360);
+D.SetBorder(Date.UTC(2000,11,15,0,0,0), Date.UTC(2001,11,15,0,0,0), -300, 1100);
+D.SetText("","", "profit/loss per day during the last year");
+D.XScale=4;
+D.YScale=" $";
+D.Draw("#FFFFCC", "#000000", false);
+var i, t0, t1, P0, P1, base=D.ScreenY(0);
+t1=D.ScreenX(Date.UTC(2000,11,15,0,0,0));
+P1=0;
+for (i=0; i<12; i++)
+{ t0=t1; P0=P1;
+  t1=D.ScreenX(Date.UTC(2001,i,15,0,0,0));
+  P1+=(i/5-Math.random())*100;
+  new Area(t0, D.ScreenY(P0), t1, D.ScreenY(P1), "ff0000", base, "profit/loss per day");
+}
+document.close();
+</SCRIPT> +

+You can use the following methods: +
    +
  • var A = new Area(theX0, theY0, theX1, theY1, theColor, theBase[, theTooltipText[,
    +theOnClickAction[, theOnMouseoverAction[, theOnMouseoutAction]]]])

    +//Constructor and Display, requires images o_*, d_*, p_* q_* and b_* (*=theColor+".gif")
  • +
  • A.SetColor(theColor) //Color
  • +
  • A.SetVisibility(isVisible) //Show or Hide
  • +
  • A.SetTitle(theTitle) //TooltipText
  • +
  • A.MoveTo(theLeft, theTop) //Move
  • +
  • A.ResizeTo(theX0, theY0, theX1, theY1) //Resize
  • +
  • A.Delete() //Delete DIV object of A from the document
  • +
  • delete A //Destructor
  • +

+
+ + + +
« The Line objectThe Arrow object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/arrow_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/arrow_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/arrow_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,71 @@ + + + +JavaScript Diagram Builder - The Arrow object + + + + + +
+
+

JavaScript Diagram Builder - The Arrow object

+
+The Arrow object is used to display an arrow on the screen, especially to draw it in a diagram area. It is +possible to hide, move and delete an arrow after it has been drawn. The Arrow object has a quite large +invisible border, so that it can interfere with the TooltipText and onClick event of neighbouring objects. +Because of that you should always draw the Arrow objects first, before drawing any neighbouring Bar or Box objects. +
+ + +
+This arrows were generated by

+<SCRIPT Language="JavaScript">
+document.open();
+var D=new Diagram();
+D.SetFrame(60, 140, 300, 380);
+D.SetBorder(-1, 1, -1, 1);
+var i, x, y;
+for (i=0; i<11; i++)
+{ x=Math.sin((i+0.5)*2*Math.PI/11);
+  y=Math.cos((i+0.5)*2*Math.PI/11);
+  new Arrow(D.ScreenX(x/3), D.ScreenY(y/3), D.ScreenX(x), D.ScreenY(y), "#0000ff", i%5+1);
+}
+document.close();
+</SCRIPT> +
+
+

+You can use the following methods: +
    +
  • var A = new Arrow(theX0, theY0, theX1, theY1, theColor[, theSize[, theTooltipText[,
    +theOnClickAction[, theOnMouseoverAction[, theOnMouseoutAction]]]]])
    +//Constructor and Display
  • +
  • A.SetColor(theColor) //Color
  • +
  • A.SetVisibility(isVisible) //Show or Hide
  • +
  • A.SetTitle(theTitle) //TooltipText
  • +
  • A.MoveTo(theLeft, theTop) //Move
  • +
  • A.ResizeTo(theX0, theY0, theX1, theY1) //Resize
  • +
  • A.Delete() //Delete DIV object of A from the document
  • +
  • delete A //Destructor
  • +

+
+ + + +
« The Area objectThe Pie object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/b_000000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/b_000000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/b_0000ff.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/b_0000ff.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/b_ff0000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/b_ff0000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/bar_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/bar_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/bar_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,87 @@ + + + +JavaScript Diagram Builder - The Bar object + + + + + +
+
+

JavaScript Diagram Builder - The Bar object

+
+The Bar object is used to display a bar on the screen, especially to draw it in a diagram area. In order to +find the appropriate screen position and size of the bar, the diagram functions ScreenX, ScreenY, RealX and +RealY can be used. It is also possible, to move, resize, hide and delete a bar after it has been drawn. +
+ + +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 520, 360);
+D.SetBorder(-1, 13, 0, 1000);
+D.SetText("","", "Website Hits 2001");
+D.XScale=0;
+D.Draw("#FFFF80", "#004080", false);
+var i, j, y;
+Month=new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
+for (i=0; i<12; i++)
+{ y=500+Math.random()*400;
+  j=D.ScreenX(i+0.5);
+  if (i%2==0) new Bar(j-15, D.ScreenY(y), j+15, D.ScreenY(0), "#0000FF", Month[i], "#FFFFFF", "Hits per month");
+  else new Bar(j-15, D.ScreenY(y), j+15, D.ScreenY(0), "#FF0000", Month[i], "#000000", "Hits per month");
+}
+document.close();
+</SCRIPT> +

+You can use the following methods: +
    +
  • var B = new Bar(theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor
    +[, theTooltipText[, theOnClickAction[, theOnMouseoverAction[, theOnMouseoutAction]]]])

    +//Constructor and Display, if theText="" then min_height=1 else min_height=12
    +//if you want to use B.SetText() later, then you must initialize with a Text<>""
  • +
  • B.SetColor(theColor) //Color
  • +
  • B.SetVisibility(isVisible) //Show or Hide
  • +
  • B.SetText(theText) //Text or Image
  • +
  • B.SetTitle(theTitle) //TooltipText
  • +
  • B.MoveTo(theLeft, theTop) //Move
  • +
  • B.ResizeTo(theLeft, theTop, theWidth, theHeight) //Resize
  • +
  • B.Delete() //Delete DIV object of B from the document
  • +
  • delete B //Destructor
  • +
+Before drawing, you can change the text style: +
+_BFont=theFont;
+_BFont is a global variable, which is valid for all Bar and Box objects. +The default setting is
+_BFont="font-family:Verdana;font-weight:bold;font-size:10pt;line-height:13pt;". +

+
+ + + +
« The Diagram objectThe Box object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/blank.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/blank.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/blank.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/box_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/box_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/box_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,85 @@ + + + +JavaScript Diagram Builder - The Box object + + + + + +
+
+

JavaScript Diagram Builder - The Box object

+
+The Box object is similar to the bar object. It has 2 additional properties: BorderWidth and BorderColor. +Bar and box objects can also be used with an image-tag instead of the text. In this way you can display +the objects also in 3D look. For transparent objects (this diagram) use the background color "". +
+ + +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 520, 360);
+D.SetBorder(Date.UTC(2000,11,15,0,0,0), Date.UTC(2001,11,15,0,0,0), 0, 1000);
+D.SetText("","", "Website Hits 2001");
+D.XScale=4;
+D.Draw("", "#004080", false);
+var i, j, y, y0=D.ScreenY(0);
+for (i=0; i<12; i++)
+{ y=D.ScreenY(500+Math.random()*400);
+  j=D.ScreenX(Date.UTC(2001,i,1,0,0,0));
+  if (i%2==0) new Box(j-12, y, j+12, y0, "#0000FF", "v_blue.gif", "#FFFFFF", 1, "#000000");
+  else new Box(j-12, y, j+12, y0, "#FF0000", "v_red.gif", "#000000", 1, "#000000");
+}
+document.close();
+</SCRIPT> +

+You can use the following methods: +
    +
  • var B = new Box(theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor
    +[, theBorderWidth[, theBorderColor[, theTooltipText[, theOnClickAction[,
    theOnMouseoverAction[, theOnMouseoutAction]]]]]])

    +//Constructor and Display, if theText="" then min_height=1 else min_height=12
    +//if you want to use B.SetText() later, then you must initialize with a Text<>""
  • +
  • B.SetColor(theColor) //Color
  • +
  • B.SetVisibility(isVisible) //Show or Hide
  • +
  • B.SetText(theText) //Text or Image
  • +
  • B.SetTitle(theTitle) //TooltipText
  • +
  • B.MoveTo(theLeft, theTop) //Move
  • +
  • B.ResizeTo(theLeft, theTop, theWidth, theHeight) //Resize
  • +
  • B.Delete() //Delete DIV object of B from the document
  • +
  • delete B //Destructor
  • +
+Before drawing, you can change the text style: +
+_BFont=theFont;
+_BFont is a global variable, which is valid for all Bar and Box objects. +The default setting is
+_BFont="font-family:Verdana;font-weight:bold;font-size:10pt;line-height:13pt;". +

+
+ + + +
« The Bar objectThe Dot object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/browser_support.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/browser_support.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/browser_support.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,233 @@ + + + + + + +JavaScript Diagram Builder - Browser support + + + + + +
+
+

JavaScript Diagram Builder - Browser support

+
+The JavaScript Diagram Builder works with Microsoft Internet Explorer 4.x, Netscape 4.x, Netscape 6.x and Opera 5.x +under Windows and with Netscape 6.x, Opera 5.x and Konqueror 3.x under Linux. Most of the methods, which dynamically change +the properties of the objects, will only work correctly with IE 5, Netscape 6, Opera 7 and Konqueror 3 or higher. +Here you can test the methods for the single objects. +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method\ObjectDiagramBarBoxDotPixelLineAreaArrowPie
Draw/SetColor
SetVisibility
SetText      
SetTitle 
MoveTo 
ResizeTo   
Delete
+
+
+
+Because of a bug in Netscape 4.x (N4) you should add the following code in the web page
+before using the diagram objects:
+<DIV STYLE="position:absolute; top:0px"></DIV>
+Also for N4 the file transparent.gif must be in the directory of the web page.
+Furthermore, N4 has trouble when opening a page with a diagram in a new window, because the extern script will not be +included. In order to work around this bug, you must reload the page, it also can be done automatically with
+<SCRIPT Language="JavaScript">if ((document.layers)&&(history.length==1)) location.href=location.href+"#";</SCRIPT> +
which must be written in the head before including the extern script.
+Tooltiptext will not work at all with N4. Click on a Bar or Box works only with N4, if you click on the text.
+
+In order to print all objects correctly, you must specify in your browser settings to print also the background. +For instance in Internet Explorer, use the menu View->Internet Options->Advanced and enable "Print backgrounds colors and images".
+
+Since version 2.8 the formerly script file diagram.js is splitted into the 3 files diagram.js (13 kB - browser independent code), +diagram_nav.js (98 kb - code for Netscape 4) and diagram_dom.js (89 kB - code for browsers which are DOM conform). +In this way the total file size for the download decreases, because the new file diagram.js automatically loads - depending on the detected browser +- only one of the files diagram_nav.js or diagram_dom.js. This makes also the execution of the script a bit faster, because +browser dependent overhead within the methods of the objects is no longer required.
+If you do not use Line, Area, Arrow or Pie objects, then you can significantly reduce the file size by deleting the appropriate code from the script file.
+If the script files diagram*.js are not in the same directory as the html page which uses the script, then you must edit +the file diagram.js and set the correct relative or absolute path in the variable _PathToScript.
+
+The last remark is about names of variables, functions and IDs: The Diagram Builder uses some global variables and functions, +all of them start with the letter "_" (for instance "_Draw()"). In order to prevent bugs caused by duplicate names of +variables or functions, you should not use names which begin with the letter "_" in your script. Additionally, there are +IDs for the objects, which start with "Dia", "Bar", "Box", "Dot", "Pix", "Line", "Area", "Arrow" or "Pie". Don't use ID's in your HTML page, +which start with this letters (for instance don't use <div id='Dia1'>...</div>). +
+
+ + + +
« Logarithmic Scale ExamplePHP & ASP »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/cockpit.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/cockpit.png,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/d_000000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/d_000000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/d_0000ff.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/d_0000ff.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/d_ff0000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/d_ff0000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/diagram.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/diagram.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/diagram.js 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,389 @@ +// JavaScript Diagram Builder 3.31 +// Copyright (c) 2001-2005 Lutz Tautenhahn, all rights reserved. +// +// The Author grants you a non-exclusive, royalty free, license to use, +// modify and redistribute this software, provided that this copyright notice +// and license appear on all copies of the software. +// This software is provided "as is", without a warranty of any kind. + +var _N_Dia=0, _N_Bar=0, _N_Box=0, _N_Dot=0, _N_Pix=0, _N_Line=0, _N_Area=0, _N_Arrow=0, _N_Pie=0, _zIndex=0; +var _dSize = (navigator.appName == "Microsoft Internet Explorer") ? 1 : -1; +if (navigator.userAgent.search("Opera")>=0) _dSize=-1; +var _IE=0; +if (_dSize==1) +{ _IE=1; + if (window.document.documentElement.clientHeight) _dSize=-1; //IE in standards-compliant mode +} +var _nav4 = (document.layers) ? 1 : 0; +var _DiagramTarget=window; +var _BFont="font-family:Verdana;font-weight:bold;font-size:10pt;line-height:13pt;" +var _PathToScript="/resources/diagram/diagram/"; +if (document.layers) document.write(""); +else document.write(""); + +function Diagram() +{ this.xtext=""; + this.ytext=""; + this.title=""; + this.XScale=1; + this.YScale=1; + this.XScalePosition="bottom"; + this.YScalePosition="left"; + this.Font="font-family:Verdana;font-weight:normal;font-size:10pt;line-height:13pt;"; + this.ID="Dia"+_N_Dia; _N_Dia++; _zIndex++; + this.zIndex=_zIndex; + this.logsub=new Array(0.301, 0.477, 0.602, 0.699, 0.778, 0.845, 0.903, 0.954); + this.SetFrame=_SetFrame; + this.SetBorder=_SetBorder; + this.SetText=_SetText; + this.SetGridColor=_SetGridColor; + this.SetXGridColor=_SetXGridColor; + this.SetYGridColor=_SetYGridColor; + this.ScreenX=_ScreenX; + this.ScreenY=_ScreenY; + this.RealX=_RealX; + this.RealY=_RealY; + this.XGrid=new Array(3); + this.GetXGrid=_GetXGrid; + this.YGrid=new Array(3); + this.GetYGrid=_GetYGrid; + this.XGridDelta=0; + this.YGridDelta=0; + this.XSubGrids=0; + this.YSubGrids=0; + this.SubGrids=0; + this.XGridColor=""; + this.YGridColor=""; + this.XSubGridColor=""; + this.YSubGridColor=""; + this.MaxGrids=0; + this.DateInterval=_DateInterval; + this.Draw=_Draw; + this.SetVisibility=_SetVisibility; + this.SetTitle=_SetTitle; + this.Delete=_Delete; + return(this); +} +function _SetFrame(theLeft, theTop, theRight, theBottom) +{ this.left = theLeft; + this.right = theRight; + this.top = theTop; + this.bottom = theBottom; +} +function _SetBorder(theLeftX, theRightX, theBottomY, theTopY) +{ this.xmin = theLeftX; + this.xmax = theRightX; + this.ymin = theBottomY; + this.ymax = theTopY; +} +function _SetText(theScaleX, theScaleY, theTitle) +{ this.xtext=theScaleX; + this.ytext=theScaleY; + this.title=theTitle; +} +function _SetGridColor(theGridColor, theSubGridColor) +{ this.XGridColor=theGridColor; + this.YGridColor=theGridColor; + if ((theSubGridColor)||(theSubGridColor=="")) + { this.XSubGridColor=theSubGridColor; + this.YSubGridColor=theSubGridColor; + } +} +function _SetXGridColor(theGridColor, theSubGridColor) +{ this.XGridColor=theGridColor; + if ((theSubGridColor)||(theSubGridColor=="")) + this.XSubGridColor=theSubGridColor; +} +function _SetYGridColor(theGridColor, theSubGridColor) +{ this.YGridColor=theGridColor; + if ((theSubGridColor)||(theSubGridColor=="")) + this.YSubGridColor=theSubGridColor; +} +function _ScreenX(theRealX) +{ return(Math.round((theRealX-this.xmin)/(this.xmax-this.xmin)*(this.right-this.left)+this.left)); +} +function _ScreenY(theRealY) +{ return(Math.round((this.ymax-theRealY)/(this.ymax-this.ymin)*(this.bottom-this.top)+this.top)); +} +function _RealX(theScreenX) +{ return(this.xmin+(this.xmax-this.xmin)*(theScreenX-this.left)/(this.right-this.left)); +} +function _RealY(theScreenY) +{ return(this.ymax-(this.ymax-this.ymin)*(theScreenY-this.top)/(this.bottom-this.top)); +} +function _sign(rr) +{ if (rr<0) return(-1); else return(1); +} +function _DateInterval(vv) +{ var bb=140*24*60*60*1000; //140 days + this.SubGrids=4; + if (vv>=bb) //140 days < 5 months + { bb=8766*60*60*1000;//1 year + if (vv=bb) { this.SubGrids=7; return(bb/5); } //14 days + bb/=2; //35 days + if (vv>=bb) { this.SubGrids=7; return(bb/5); } //7 days + bb/=7; bb*=4; //20 days + if (vv>=bb) return(bb/5); //4 days + bb/=2; //10 days + if (vv>=bb) return(bb/5); //2 days + bb/=2; //5 days + if (vv>=bb) return(bb/5); //1 day + bb/=2; //2.5 days + if (vv>=bb) return(bb/5); //12 hours + bb*=3; bb/=5; //1.5 day + if (vv>=bb) { this.SubGrids=6; return(bb/6); } //6 hours + bb/=2; //18 hours + if (vv>=bb) { this.SubGrids=6; return(bb/6); } //3 hours + bb*=2; bb/=3; //12 hours + if (vv>=bb) return(bb/6); //2 hours + bb/=2; //6 hours + if (vv>=bb) return(bb/6); //1 hour + bb/=2; //3 hours + if (vv>=bb) { this.SubGrids=6; return(bb/6); } //30 mins + bb/=2; //1.5 hours + if (vv>=bb) { this.SubGrids=5; return(bb/6); } //15 mins + bb*=2; bb/=3; //1 hour + if (vv>=bb) { this.SubGrids=5; return(bb/6); } //10 mins + bb/=3; //20 mins + if (vv>=bb) { this.SubGrids=5; return(bb/4); } //5 mins + bb/=2; //10 mins + if (vv>=bb) return(bb/5); //2 mins + bb/=2; //5 mins + if (vv>=bb) return(bb/5); //1 min + bb*=3; bb/=2; //3 mins + if (vv>=bb) { this.SubGrids=6; return(bb/6); } //30 secs + bb/=2; //1.5 mins + if (vv>=bb) { this.SubGrids=5; return(bb/6); } //15 secs + bb*=2; bb/=3; //1 min + if (vv>=bb) { this.SubGrids=5; return(bb/6); } //10 secs + bb/=3; //20 secs + if (vv>=bb) { this.SubGrids=5; return(bb/4); } //5 secs + bb/=2; //10 secs + if (vv>=bb) return(bb/5); //2 secs + return(bb/10); //1 sec +} +function _DayOfYear(dd,mm,yy) //Unused, you can use this for your own date format +{ DOM=new Array(31,28,31,30,31,30,31,31,30,31,30,31); + var ii, nn=dd; + for (ii=0; ii2)&&(yy%4==0)) nn++; + return(nn); +} +function _GetKWT(dd,mm,yy) //Unused, you can use this for your own date format +{ //this is the implementation of DIN 1355, not of the american standard! + var ss=new Date(yy,0,1); + var ww=ss.getDay(); //0=Sun,1=Mon,2=Tue,3=Wed,4=Thu,5=Fri,6=Sat + ww=(ww+2)%7-3; //0=Mon,1=Tue,2=Wed,3=Thu,-3=Fri,-2=Sat,-1=Sun + ww+=(_DayOfYear(dd,mm,yy)-1); + if (ww<0) return(_GetKWT(24+dd,12,yy-1)); + if ((mm==12)&&(dd>28)) + { if (ww%7+29<=dd) return("01/"+eval(ww%7+1)); //31: Mon-Wed, 30: Mon-Tue, 29: Mon + } + ss=Math.floor(ww/7+1); + if (ss<10) ss="0"+ss; + return(ss+"/"+eval(ww%7+1)); +} +function _DateFormat(vv, ii, ttype) +{ var yy, mm, dd, hh, nn, ss, vv_date=new Date(vv); + Month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); + Weekday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); + if (ii>15*24*60*60*1000) + { if (ii<365*24*60*60*1000) + { vv_date.setTime(vv+15*24*60*60*1000); + yy=vv_date.getUTCFullYear()%100; + if (yy<10) yy="0"+yy; + mm=vv_date.getUTCMonth()+1; + if (ttype==5) ;//You can add your own date format here + if (ttype==4) return(Month[mm-1]); + if (ttype==3) return(Month[mm-1]+" "+yy); + return(mm+"/"+yy); + } + vv_date.setTime(vv+183*24*60*60*1000); + yy=vv_date.getUTCFullYear(); + return(yy); + } + vv_date.setTime(vv); + yy=vv_date.getUTCFullYear(); + mm=vv_date.getUTCMonth()+1; + dd=vv_date.getUTCDate(); + ww=vv_date.getUTCDay(); + hh=vv_date.getUTCHours(); + nn=vv_date.getUTCMinutes(); + ss=vv_date.getUTCSeconds(); + if (ii>=86400000)//1 day + { if (ttype==5) ;//You can add your own date format here + if (ttype==4) return(Weekday[ww]); + if (ttype==3) return(mm+"/"+dd); + return(dd+"."+mm+"."); + } + if (ii>=21600000)//6 hours + { if (hh==0) + { if (ttype==5) ;//You can add your own date format here + if (ttype==4) return(Weekday[ww]); + if (ttype==3) return(mm+"/"+dd); + return(dd+"."+mm+"."); + } + else + { if (ttype==5) ;//You can add your own date format here + if (ttype==4) return((hh<=12) ? hh+"am" : hh%12+"pm"); + if (ttype==3) return((hh<=12) ? hh+"am" : hh%12+"pm"); + return(hh+":00"); + } + } + if (ii>=60000)//1 min + { if (nn<10) nn="0"+nn; + if (ttype==5) ;//You can add your own date format here + if (ttype==4) return((hh<=12) ? hh+"."+nn+"am" : hh%12+"."+nn+"pm"); + if (nn=="00") nn=""; + else nn=":"+nn; + if (ttype==3) return((hh<=12) ? hh+nn+"am" : hh%12+nn+"pm"); + if (nn=="") nn=":00"; + return(hh+nn); + } + if (ii>=1000)//1 sec + { if (nn<10) nn="0"+nn; + if (nn=="00") nn=""; + else nn=":"+nn; + if (ss<10) ss="0"+ss; + if (ss=="00") ss=""; + else ss=":"+ss; + if (ttype==5) ;//You can add your own date format here + if (ttype==4) return hh+nn+ss; + if (ttype==3) return((hh<=12) ? hh+nn+"am" : hh%12+nn+"pm"); + return(hh+nn); + } + if (ss<10) ss="0"+ss; + return(nn+":"+ss); +} +function _GetXGrid() +{ var x0,i,j,l,x,r,dx,xr,invdifx,deltax; + dx=(this.xmax-this.xmin); + if (Math.abs(dx)>0) + { invdifx=(this.right-this.left)/(this.xmax-this.xmin); + if ((this.XScale==1)||(isNaN(this.XScale))) + { r=1; + while (Math.abs(dx)>=100) { dx/=10; r*=10; } + while (Math.abs(dx)<10) { dx*=10; r/=10; } + if (Math.abs(dx)>=50) { this.SubGrids=5; deltax=10*r*_sign(dx); } + else + { if (Math.abs(dx)>=20) { this.SubGrids=5; deltax=5*r*_sign(dx); } + else { this.SubGrids=4; deltax=2*r*_sign(dx); } + } + } + else deltax=this.DateInterval(Math.abs(dx))*_sign(dx); + if (this.XGridDelta!=0) deltax=this.XGridDelta; + if (this.XSubGrids!=0) this.SubGrids=this.XSubGrids; + x=Math.floor(this.xmin/deltax)*deltax; + i=0; + this.XGrid[1]=deltax; + if (deltax!=0) this.MaxGrids=Math.floor(Math.abs((this.xmax-this.xmin)/deltax))+2; + else this.MaxGrids=0; + for (j=this.MaxGrids; j>=-1; j--) + { xr=x+j*deltax; + x0=Math.round(this.left+(-this.xmin+xr)*invdifx); + if ((x0>=this.left)&&(x0<=this.right)) + { if (i==0) this.XGrid[2]=xr; + this.XGrid[0]=xr; + i++; + } + } + } + return(this.XGrid); +} +function _GetYGrid() +{ var y0,i,j,l,y,r,dy,yr,invdify,deltay; + dy=this.ymax-this.ymin; + if (Math.abs(dy)>0) + { invdify=(this.bottom-this.top)/(this.ymax-this.ymin); + if ((this.YScale==1)||(isNaN(this.YScale))) + { r=1; + while (Math.abs(dy)>=100) { dy/=10; r*=10; } + while (Math.abs(dy)<10) { dy*=10; r/=10; } + if (Math.abs(dy)>=50) { this.SubGrids=5; deltay=10*r*_sign(dy); } + else + { if (Math.abs(dy)>=20) { this.SubGrids=5; deltay=5*r*_sign(dy); } + else { this.SubGrids=4; deltay=2*r*_sign(dy); } + } + } + else deltay=this.DateInterval(Math.abs(dy))*_sign(dy); + if (this.YGridDelta!=0) deltay=this.YGridDelta; + if (this.YSubGrids!=0) this.SubGrids=this.YSubGrids; + y=Math.floor(this.ymax/deltay)*deltay; + this.YGrid[1]=deltay; + i=0; + if (deltay!=0) this.MaxGrids=Math.floor(Math.abs((this.ymax-this.ymin)/deltay))+2; + else this.MaxGrids=0; + for (j=-1; j<=this.MaxGrids; j++) + { yr=y-j*deltay; + y0=Math.round(this.top+(this.ymax-yr)*invdify); + if ((y0>=this.top)&&(y0<=this.bottom)) + { if (i==0) this.YGrid[2]=yr; + this.YGrid[0]=yr; + i++; + } + } + } + return(this.YGrid); +} +function _nvl(vv, rr) +{ if (vv==null) return(rr); + var ss=String(vv); + while (ss.search("'")>=0) ss=ss.replace("'","'"); + return(ss); +} +function _cursor(aa) +{ if (aa) + { if (_dSize==1) return("cursor:hand;"); + else return("cursor:pointer;"); + } + return(""); +} +function _GetArrayMin(aa) +{ var ii, mm=aa[0]; + for (ii=1; iiaa[ii]) mm=aa[ii]; + } + return(mm); +} +function _GetArrayMax(aa) +{ var ii, mm=aa[0]; + for (ii=1; ii"); + if (_IsImage(theDrawColor)) + divtext="
"; + else + divtext="
 
"; + if ((this.XScale==1)||(isNaN(this.XScale))) + { u=""; + fn=""; + if (isNaN(this.XScale)) + { if (this.XScale.substr(0,9)=="function ") fn=eval("window."+this.XScale.substr(9)); + else u=this.XScale; + } + dx=(this.xmax-this.xmin); + if (Math.abs(dx)>0) + { invdifx=(this.right-this.left)/(this.xmax-this.xmin); + r=1; + while (Math.abs(dx)>=100) { dx/=10; r*=10; } + while (Math.abs(dx)<10) { dx*=10; r/=10; } + if (Math.abs(dx)>=50) { this.SubGrids=5; deltax=10*r*_sign(dx); } + else + { if (Math.abs(dx)>=20) { this.SubGrids=5; deltax=5*r*_sign(dx); } + else { this.SubGrids=4; deltax=2*r*_sign(dx); } + } + if (this.XGridDelta!=0) deltax=this.XGridDelta; + if (this.XSubGrids!=0) this.SubGrids=this.XSubGrids; + sub=deltax*invdifx/this.SubGrids; + sshift=0; + if ((this.XScalePosition=="top-left")||(this.XScalePosition=="bottom-left")) sshift=-Math.abs(deltax*invdifx/2); + if ((this.XScalePosition=="top-right")||(this.XScalePosition=="bottom-right")) sshift=Math.abs(deltax*invdifx/2); + x=Math.floor(this.xmin/deltax)*deltax; + itext=0; + if (deltax!=0) this.MaxGrids=Math.floor(Math.abs((this.xmax-this.xmin)/deltax))+2; + else this.MaxGrids=0; + for (j=this.MaxGrids; j>=-1; j--) + { xr=x+j*deltax; + x0=Math.round(this.left+(-this.xmin+xr)*invdifx); + if (this.XSubGridColor) + { for (k=1; kthis.left+1)&&(x0-k*sub"; + } + if (this.SubGrids==-1) + for (k=0; k<8; k++) + { if ((x0-this.logsub[k]*sub*_sign(deltax)>this.left+1)&&(x0-this.logsub[k]*sub*_sign(deltax)"; + } + } + if ((x0>=this.left)&&(x0<=this.right)) + { itext++; + if ((itext!=2)||(!isScaleText)) + { if (r>1) + { if (fn) l=fn(xr)+""; + else l=xr+""+u; + } + else + { if (fn) l=fn(Math.round(10*xr/r)/Math.round(10/r))+""; + else l=Math.round(10*xr/r)/Math.round(10/r)+""+u; + } + if (l.charAt(0)==".") l="0"+l; + if (l.substr(0,2)=="-.") l="-0"+l.substr(1,100); + } + else l=this.xtext; + if (this.XScalePosition.substr(0,3)!="top") + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + divtext+="
"+l+"
"; + divtext+="
"; + } + else + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + divtext+="
"+l+"
"; + divtext+="
"; + } + if ((this.XGridColor)&&(x0>this.left)&&(x0"; + } + } + } + } + if ((!isNaN(this.XScale))&&(this.XScale>1)) + { dx=(this.xmax-this.xmin); + if (Math.abs(dx)>0) + { invdifx=(this.right-this.left)/(this.xmax-this.xmin); + deltax=this.DateInterval(Math.abs(dx))*_sign(dx); + if (this.XGridDelta!=0) deltax=this.XGridDelta; + if (this.XSubGrids!=0) this.SubGrids=this.XSubGrids; + sub=deltax*invdifx/this.SubGrids; + sshift=0; + if ((this.XScalePosition=="top-left")||(this.XScalePosition=="bottom-left")) sshift=-Math.abs(deltax*invdifx/2); + if ((this.XScalePosition=="top-right")||(this.XScalePosition=="bottom-right")) sshift=Math.abs(deltax*invdifx/2); + x=Math.floor(this.xmin/deltax)*deltax; + itext=0; + if (deltax!=0) this.MaxGrids=Math.floor(Math.abs((this.xmax-this.xmin)/deltax))+2; + else this.MaxGrids=0; + for (j=this.MaxGrids; j>=-2; j--) + { xr=x+j*deltax; + x0=Math.round(this.left+(-this.xmin+x+j*deltax)*invdifx); + if (this.XSubGridColor) + { for (k=1; kthis.left+1)&&(x0-k*sub"; + } + } + if ((x0>=this.left)&&(x0<=this.right)) + { itext++; + if ((itext!=2)||(!isScaleText)) l=_DateFormat(xr, Math.abs(deltax), this.XScale); + else l=this.xtext; + if (this.XScalePosition.substr(0,3)!="top") + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + divtext+="
"+l+"
"; + divtext+="
"; + } + else + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + divtext+="
"+l+"
"; + divtext+="
"; + } + if ((this.XGridColor)&&(x0>this.left)&&(x0"; + } + } + } + } + if ((this.YScale==1)||(isNaN(this.YScale))) + { u=""; + fn=""; + if (isNaN(this.YScale)) + { if (this.YScale.substr(0,9)=="function ") fn=eval("window."+this.YScale.substr(9)); + else u=this.YScale; + } + dy=this.ymax-this.ymin; + if (Math.abs(dy)>0) + { invdify=(this.bottom-this.top)/(this.ymax-this.ymin); + r=1; + while (Math.abs(dy)>=100) { dy/=10; r*=10; } + while (Math.abs(dy)<10) { dy*=10; r/=10; } + if (Math.abs(dy)>=50) { this.SubGrids=5; deltay=10*r*_sign(dy); } + else + { if (Math.abs(dy)>=20) { this.SubGrids=5; deltay=5*r*_sign(dy); } + else { this.SubGrids=4; deltay=2*r*_sign(dy); } + } + if (this.YGridDelta!=0) deltay=this.YGridDelta; + if (this.YSubGrids!=0) this.SubGrids=this.YSubGrids; + sub=deltay*invdify/this.SubGrids; + sshift=0; + if ((this.YScalePosition=="left-top")||(this.YScalePosition=="right-top")) sshift=-Math.abs(deltay*invdify/2); + if ((this.YScalePosition=="left-bottom")||(this.YScalePosition=="right-bottom")) sshift=Math.abs(deltay*invdify/2); + y=Math.floor(this.ymax/deltay)*deltay; + itext=0; + if (deltay!=0) this.MaxGrids=Math.floor(Math.abs((this.ymax-this.ymin)/deltay))+2; + else this.MaxGrids=0; + for (j=-1; j<=this.MaxGrids; j++) + { yr=y-j*deltay; + y0=Math.round(this.top+(this.ymax-yr)*invdify); + if (this.YSubGridColor) + { for (k=1; kthis.top+1)&&(y0+k*sub"+nbsp+""; + } + if (this.SubGrids==-1) + { for (k=0; k<8; k++) + { if ((y0+this.logsub[k]*sub*_sign(deltay)>this.top+1)&&(y0+this.logsub[k]*sub*_sign(deltay)"+nbsp+""; + } + } + } + if ((y0>=this.top)&&(y0<=this.bottom)) + { itext++; + if ((itext!=2)||(!isScaleText)) + { if (r>1) + { if (fn) l=fn(yr)+""; + else l=yr+""+u; + } + else + { if (fn) l=fn(Math.round(10*yr/r)/Math.round(10/r))+""; + else l=Math.round(10*yr/r)/Math.round(10/r)+""+u; + } + if (l.charAt(0)==".") l="0"+l; + if (l.substr(0,2)=="-.") l="-0"+l.substr(1,100); + } + else l=this.ytext; + if (this.YScalePosition.substr(0,5)!="right") + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + divtext+="
"+l+"
"; + divtext+="
"+nbsp+"
"; + } + else + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + divtext+="
"+l+"
"; + divtext+="
"+nbsp+"
"; + } + if ((this.YGridColor)&&(y0>this.top)&&(y0"+nbsp+""; + } + } + } + } + if ((!isNaN(this.YScale))&&(this.YScale>1)) + { dy=this.ymax-this.ymin; + if (Math.abs(dy)>0) + { invdify=(this.bottom-this.top)/(this.ymax-this.ymin); + deltay=this.DateInterval(Math.abs(dy))*_sign(dy); + if (this.YGridDelta!=0) deltay=this.YGridDelta; + if (this.YSubGrids!=0) this.SubGrids=this.YSubGrids; + sub=deltay*invdify/this.SubGrids; + sshift=0; + if ((this.YScalePosition=="left-top")||(this.YScalePosition=="right-top")) sshift=-Math.abs(deltay*invdify/2); + if ((this.YScalePosition=="left-bottom")||(this.YScalePosition=="right-bottom")) sshift=Math.abs(deltay*invdify/2); + y=Math.floor(this.ymax/deltay)*deltay; + itext=0; + if (deltay!=0) this.MaxGrids=Math.floor(Math.abs((this.ymax-this.ymin)/deltay))+2; + else this.MaxGrids=0; + for (j=-2; j<=this.MaxGrids; j++) + { yr=y-j*deltay; + y0=Math.round(this.top+(this.ymax-y+j*deltay)*invdify); + if (this.YSubGridColor) + { for (k=1; kthis.top+1)&&(y0+k*sub"+nbsp+""; + } + } + if ((y0>=this.top)&&(y0<=this.bottom)) + { itext++; + if ((itext!=2)||(!isScaleText)) l=_DateFormat(yr, Math.abs(deltay), this.YScale); + else l=this.ytext; + if (this.YScalePosition.substr(0,5)!="right") + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + divtext+="
"+l+"
"; + divtext+="
"+nbsp+"
"; + } + else + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + divtext+="
"+l+"
"; + divtext+="
"+nbsp+"
"; + } + if ((this.YGridColor)&&(y0>this.top)&&(y0"+nbsp+""; + } + } + } + } + if (this.XScalePosition.substr(0,3)!="top") + divtext+="
"+this.title+"
"; + else + divtext+="
"+this.title+"
"; + if (lay<-1) + selObj.innerHTML=divtext; + else + _DiagramTarget.document.writeln(divtext+""); +} + +function Bar(theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Bar"+_N_Bar; _N_Bar++; _zIndex++; + this.left=theLeft; + this.top=theTop; + this.width=theRight-theLeft; + this.height=theBottom-theTop; + this.DrawColor=theDrawColor; + this.Text=String(theText); + this.TextColor=theTextColor; + this.BorderWidth=""; + this.BorderColor=""; + this.Cursor=_cursor(theOnClickAction); + this.SetVisibility=_SetVisibility; + this.SetColor=_SetBarColor; + this.SetText=_SetBarText; + this.SetTitle=_SetTitle; + this.MoveTo=_MoveTo; + this.ResizeTo=_ResizeTo; + this.Delete=_Delete; + var EventActions=""; + if (_nvl(theOnClickAction,"")!="") EventActions+="onClick='"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + if (_nvl(theText,"")!="") + { var tt=theText; + if (_IsImage(theText)) tt=""; + _DiagramTarget.document.writeln("
"+tt+"
"); + } + else + { var vv=(this.height>0) ? "" : ";visibility:hidden"; + _DiagramTarget.document.writeln("
 
"); + } + return(this); +} +function Box(theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor, theBorderWidth, theBorderColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Box"+_N_Box; _N_Box++; _zIndex++; + this.left=theLeft; + this.top=theTop; + this.width=theRight-theLeft; + this.height=theBottom-theTop; + this.DrawColor=theDrawColor; + this.Text=String(theText); + this.TextColor=theTextColor; + this.BorderWidth=theBorderWidth; + this.BorderColor=theBorderColor; + this.Cursor=_cursor(theOnClickAction); + this.SetVisibility=_SetVisibility; + this.SetColor=_SetBarColor; + this.SetText=_SetBarText; + this.SetTitle=_SetTitle; + this.MoveTo=_MoveTo; + this.ResizeTo=_ResizeTo; + this.Delete=_Delete; + var EventActions=""; + if (_nvl(theOnClickAction,"")!="") EventActions+="onClick='"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var bb=""; + var ww=theBorderWidth; + if (_nvl(theBorderWidth,"")=="") ww=0; + if ((_nvl(theBorderWidth,"")!="")&&(_nvl(theBorderColor,"")!="")) + bb="border-style:solid;border-width:"+theBorderWidth+"px;border-color:"+theBorderColor+";"; + if (_nvl(theText,"")!="") + { var tt=theText; + if (_IsImage(theText)) tt=""; + _DiagramTarget.document.writeln("
"+tt+"
"); + } + else + { var vv=(this.height>=2*ww) ? "" : ";visibility:hidden"; + _DiagramTarget.document.writeln("
 
"); + } + return(this); +} +function _SetBarColor(theColor) +{ var id=this.ID, selObj; + this.DrawColor=theColor; + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + selObj.style.backgroundColor=theColor; +} +function _SetBarText(theText) +{ var id=this.ID, selObj; + this.Text=String(theText); + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + var tt=theText; + if (_IsImage(theText)) + { var ww=0; + if (this.BorderWidth) ww=this.BorderWidth; + tt=""; + } + selObj.innerHTML=tt; +} +function Dot(theX, theY, theSize, theType, theColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.Size=theSize; + this.ID="Dot"+_N_Dot; _N_Dot++; _zIndex++; + this.X=theX; + this.Y=theY; + this.dX=Math.round(theSize/2); + this.dY=Math.round(theSize/2); + this.Type=theType; + this.Color=theColor; + this.Cursor=_cursor(theOnClickAction); + this.SetVisibility=_SetVisibility; + this.SetColor=_SetDotColor; + this.SetTitle=_SetTitle; + this.MoveTo=_DotMoveTo; + this.Delete=_Delete; + var EventActions=""; + if (_nvl(theOnClickAction,"")!="") EventActions+="onClick='"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + _DiagramTarget.document.write("
"); + if (isNaN(theType)) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + else + { if (theType%6==0) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + if (theType%6==1) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + if (theType%6==2) + _DiagramTarget.document.write("
"); + if (theType%6==3) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + if (theType%6==4) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + if (theType%6==5) + { if (_dSize==1) + _DiagramTarget.document.write("
"); + else + _DiagramTarget.document.write("
"); + } + } + _DiagramTarget.document.writeln("
"); + return(this); +} +function _SetDotColor(theColor) +{ this.Color=theColor; + var tt="", selObj; + if (document.all) selObj=eval("_DiagramTarget.document.all."+this.ID); + else selObj=_DiagramTarget.document.getElementById(this.ID); + if (isNaN(this.Type)) + { tt+="
"; + tt+="
"; + } + else + { if (this.Type%6==0) + { tt+="
"; + tt+="
"; + } + if (this.Type%6==1) + { tt+="
"; + tt+="
"; + } + if (this.Type%6==2) + tt+="
"; + if (this.Type%6==3) + { tt+="
"; + tt+="
"; + } + if (this.Type%6==4) + { tt+="
"; + tt+="
"; + } + if (this.Type%6==5) + { if (_dSize==1) + tt+="
"; + else + tt+="
"; + } + } + selObj.innerHTML=tt; +} +function _DotMoveTo(theX, theY) +{ var id=this.ID, selObj; + if (!isNaN(parseInt(theX))) this.X=theX; + if (!isNaN(parseInt(theY))) this.Y=theY; + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { if (!isNaN(parseInt(theX))) left=eval(theX-this.dX)+"px"; + if (!isNaN(parseInt(theY))) top=eval(theY-this.dY)+"px"; + visibility="visible"; + } +} +function Pixel(theX, theY, theColor) +{ this.ID="Pix"+_N_Pix; _N_Pix++; _zIndex++; + this.left=theX; + this.top=theY; + this.dX=0; + this.dY=0; + this.Color=theColor; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetPixelColor; + this.MoveTo=_DotMoveTo; + this.Delete=_Delete; + _DiagramTarget.document.writeln("
"); + return(this); +} +function _SetPixelColor(theColor) +{ var id=this.ID, selObj; + this.Color=theColor; + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + selObj.style.backgroundColor=theColor; +} +function _SetVisibility(isVisible) +{ var ll, id=this.ID, selObj; + if (document.all) + { selObj=eval("_DiagramTarget.document.all."+id); + if (isVisible) selObj.style.visibility="visible"; + else selObj.style.visibility="hidden"; + } + else + { selObj=_DiagramTarget.document.getElementById(id); + if (isVisible) selObj.style.visibility="visible"; + else selObj.style.visibility="hidden"; + if (id.substr(0,3)=='Dia') + { var ii=0; + selObj=_DiagramTarget.document.getElementById(id+'i'+eval(ii++)); + while (selObj!=null) + { if (isVisible) selObj.style.visibility="visible"; + else selObj.style.visibility="hidden"; + selObj=_DiagramTarget.document.getElementById(id+'i'+eval(ii++)); + } + } + } +} +function _SetTitle(theTitle) +{ var id=this.ID, selObj; + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + selObj.title=theTitle; +} +function _MoveTo(theLeft, theTop) +{ var id=this.ID, selObj, ww=0; + if (this.BorderWidth) ww=this.BorderWidth; + if (!isNaN(parseInt(theLeft))) this.left=theLeft; + if (!isNaN(parseInt(theTop))) this.top=theTop; + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { if (!isNaN(parseInt(theLeft))) left=theLeft+"px"; + if (!isNaN(parseInt(theTop))) top=theTop+"px"; + if (this.height<=2*ww) visibility="hidden"; + else visibility="visible"; + } +} +function _ResizeTo(theLeft, theTop, theWidth, theHeight) +{ var id=this.ID, selObj, ww=0; + if (this.BorderWidth) ww=this.BorderWidth; + if (!isNaN(parseInt(theLeft))) this.left=theLeft; + if (!isNaN(parseInt(theTop))) this.top=theTop; + if (!isNaN(parseInt(theWidth))) this.width=theWidth; + if (!isNaN(parseInt(theHeight))) this.height=theHeight; + if (_IsImage(this.Text)) this.SetText(this.Text); + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { if (!isNaN(parseInt(theLeft))) left=theLeft+"px"; + if (!isNaN(parseInt(theTop))) top=theTop+"px"; + if (!isNaN(parseInt(theWidth))) width=eval(theWidth-ww+ww*_dSize)+"px"; + if (!isNaN(parseInt(theHeight))) height=eval(theHeight-ww+ww*_dSize)+"px"; + if (this.height<=2*ww) visibility="hidden"; + else visibility="visible"; + } +} +function _Delete() +{ var id=this.ID, selObj; + if (document.all) + { selObj=eval("_DiagramTarget.document.all."+id); + selObj.outerHTML=""; + } + else + { selObj=_DiagramTarget.document.getElementById(id); + selObj.parentNode.removeChild(selObj); + } +} +function _SetColor(theColor) +{ this.Color=theColor; + if ((theColor!="")&&(theColor.lengththis.Y0)&&(this.X1>this.X0))||((this.Y1"); + if ((ww==0)||(hh==0)) + _DiagramTarget.document.write("
"+nbsp+"
"); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + ccl++; + } + } + } + _DiagramTarget.document.writeln(""); + return(this); +} +function _LineResizeTo(theX0, theY0, theX1, theY1) +{ var xx0, yy0, xx1, yy1, ll, rr, tt, bb, ww, hh, ccl, ccr, cct, ccb, id=this.ID,selObj="",divtext=""; + var ss2=Math.floor(this.Size/2), nbsp="";//(_IE)? " " : ""; + if (!isNaN(parseInt(theX0))) this.X0=theX0; + if (!isNaN(parseInt(theY0))) this.Y0=theY0; + if (!isNaN(parseInt(theX1))) this.X1=theX1; + if (!isNaN(parseInt(theY1))) this.Y1=theY1; + var ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+nbsp+""; + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + ccl++; + } + } + } + selObj.innerHTML=divtext; +} +function _LineMoveTo(theLeft, theTop) +{ var id=this.ID, selObj; + var ss2=Math.floor(this.Size/2); + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { if (!isNaN(parseInt(theLeft))) left=eval(theLeft-ss2)+"px"; + if (!isNaN(parseInt(theTop))) top=eval(theTop-ss2)+"px"; + visibility="visible"; + } +} +//You can delete the following 2 functions, if you do not use Area objects +function Area(theX0, theY0, theX1, theY1, theColor, theBase, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Area"+_N_Area; _N_Area++; _zIndex++; + this.X0=theX0; + this.Y0=theY0; + this.X1=theX1; + this.Y1=theY1; + this.Color=theColor; + this.Base=theBase; + this.Cursor=_cursor(theOnClickAction); + this.SetVisibility=_SetVisibility; + this.SetColor=_SetColor; + this.SetTitle=_SetTitle; + this.MoveTo=_MoveTo; + this.ResizeTo=_AreaResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+="onClick='"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var dd, ll, rr, tt, bb, ww, hh; + if (theX0<=theX1) { ll=theX0; rr=theX1; } + else { ll=theX1; rr=theX0; } + if (theY0<=theY1) { tt=theY0; bb=theY1; } + else { tt=theY1; bb=theY0; } + ww=rr-ll; hh=bb-tt; + if (theBase<=tt) + _DiagramTarget.document.write("
"); + else + _DiagramTarget.document.write("
"); + if (theBase<=tt) + { if ((theBase0)) + _DiagramTarget.document.write("
"); + if (((theY0theY1)&&(theX0>theX1))) + _DiagramTarget.document.write("
"); + if (((theY0>theY1)&&(theX0theX1))) + _DiagramTarget.document.write("
"); + } + if ((theBase>tt)&&(theBasetheY1)&&(theX0>theX1))) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + if (((theY0>theY1)&&(theX0theX1))) + { _DiagramTarget.document.write("
"); + _DiagramTarget.document.write("
"); + } + } + if (theBase>=bb) + { if ((theBase>bb)&&(ww>0)) + _DiagramTarget.document.write("
"); + if (((theY0theY1)&&(theX0>theX1))) + _DiagramTarget.document.write("
"); + if (((theY0>theY1)&&(theX0theX1))) + _DiagramTarget.document.write("
"); + } + _DiagramTarget.document.writeln("
"); +} +function _AreaResizeTo(theX0, theY0, theX1, theY1) +{ var dd, ll, rr, tt, bb, ww, hh, id=this.ID,selObj="",divtext=""; + if (!isNaN(parseInt(theX0))) this.X0=theX0; + if (!isNaN(parseInt(theY0))) this.Y0=theY0; + if (!isNaN(parseInt(theX1))) this.X1=theX1; + if (!isNaN(parseInt(theY1))) this.Y1=theY1; + if (this.X0<=this.X1) { ll=this.X0; rr=this.X1; } + else { ll=this.X1; rr=this.X0; } + if (this.Y0<=this.Y1) { tt=this.Y0; bb=this.Y1; } + else { tt=this.Y1; bb=this.Y0; } + ww=rr-ll; hh=bb-tt; + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { if (this.Base<=tt) { left=ll+"px"; top=this.Base+"px"; width=ww+"px"; height=hh+"px"; } + else { left=ll+"px"; top=tt+"px"; width=ww+"px"; height=Math.max(hh, this.Base-tt)+"px";} + } + if (this.Base<=tt) + { if ((this.Base0)) + divtext+="
"; + if (((this.Y0this.Y1)&&(this.X0>this.X1))) + divtext+="
"; + if (((this.Y0>this.Y1)&&(this.X0this.X1))) + divtext+="
"; + } + if ((this.Base>tt)&&(this.Basethis.Y1)&&(this.X0>this.X1))) + { divtext+="
"; + divtext+="
"; + } + if (((this.Y0>this.Y1)&&(this.X0this.X1))) + { divtext+="
"; + divtext+="
"; + } + } + if (this.Base>=bb) + { if ((this.Base>bb)&&(ww>0)) + divtext+="
"; + if (((this.Y0this.Y1)&&(this.X0>this.X1))) + divtext+="
"; + if (((this.Y0>this.Y1)&&(this.X0this.X1))) + divtext+="
"; + } + selObj.innerHTML=divtext; +} +//You can delete the following 3 functions, if you do not use Arrow objects +function Arrow(theX0, theY0, theX1, theY1, theColor, theSize, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Arrow"+_N_Arrow; _N_Arrow++; _zIndex++; + this.X0=theX0; + this.Y0=theY0; + this.X1=theX1; + this.Y1=theY1; + this.Color=theColor; + if ((theColor!="")&&(theColor.length==6)) this.Color="#"+theColor; + this.Size=Number(_nvl(theSize,1)); + this.Cursor=_cursor(theOnClickAction); + this.Border=8*this.Size; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetColor; + this.SetTitle=_SetTitle; + this.MoveTo=_ArrowMoveTo; + this.ResizeTo=_ArrowResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+="onClick='"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var xx0, yy0, xx1, yy1, ll, rr, tt, bb, ww, hh, ccl, ccr, cct, ccb; + var ddir, ss2=Math.floor(this.Size/2), nbsp="";//(_IE)? " " : ""; + + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"); + if ((ww==0)||(hh==0)) + _DiagramTarget.document.write("
"+nbsp+"
"); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+"
"); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + ccl++; + } + } + } + var LL=1, ll0=ll, tt0=tt; + var ccL=8*theSize+4, ccB=2*theSize+1; + var DDX=theX1-theX0, DDY=theY1-theY0; + if ((DDX!=0)||(DDY!=0)) LL=Math.sqrt((DDX*DDX)+(DDY*DDY)); + this.X0=theX1-Math.round(1/LL*(ccL*DDX-ccB*DDY)); + this.Y0=theY1-Math.round(1/LL*(ccL*DDY+ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+nbsp+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + ccl++; + } + } + } + this.X0=theX1-Math.round(1/LL*(ccL*DDX+ccB*DDY)); + this.Y0=theY1-Math.round(1/LL*(ccL*DDY-ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+nbsp+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""); + else + _DiagramTarget.document.write("
"+nbsp+"
"); + ccl++; + } + } + } + _DiagramTarget.document.writeln(""); + this.X0=theX0; + this.Y0=theY0; + return(this); +} +function _ArrowResizeTo(theX0, theY0, theX1, theY1) +{ var xx0, yy0, xx1, yy1, ll, rr, tt, bb, ww, hh, ccl, ccr, cct, ccb, id=this.ID,selObj="",divtext=""; + var ss2=Math.floor(this.Size/2), nbsp="";//(_IE)? " " : ""; + if (!isNaN(parseInt(theX0))) this.X0=theX0; + if (!isNaN(parseInt(theY0))) this.Y0=theY0; + if (!isNaN(parseInt(theX1))) this.X1=theX1; + if (!isNaN(parseInt(theY1))) this.Y1=theY1; + var tmpX0=this.X0, tmpY0=this.Y0; + var ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+nbsp+""; + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + ccl++; + } + } + } + var LL=1, ll0=ll, tt0=tt; + var ccL=8*this.Size+4, ccB=2*this.Size+1; + var DDX=this.X1-tmpX0, DDY=this.Y1-tmpY0; + if ((DDX!=0)||(DDY!=0)) LL=Math.sqrt(0+(DDX*DDX)+(DDY*DDY)); + this.X0=this.X1-Math.round(1/LL*(ccL*DDX-ccB*DDY)); + this.Y0=this.Y1-Math.round(1/LL*(ccL*DDY+ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+nbsp+""; + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + ccl++; + } + } + } + this.X0=this.X1-Math.round(1/LL*(ccL*DDX+ccB*DDY)); + this.Y0=this.Y1-Math.round(1/LL*(ccL*DDY-ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+nbsp+""; + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"+nbsp+""; + else + divtext+="
"+nbsp+"
"; + ccl++; + } + } + } + selObj.innerHTML=divtext; + this.X0=tmpX0; + this.Y0=tmpY0; +} +function _ArrowMoveTo(theLeft, theTop) +{ var id=this.ID, selObj; + var ss2=Math.floor(this.Size/2); + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { if (!isNaN(parseInt(theLeft))) left=eval(theLeft-ss2-this.Border)+"px"; + if (!isNaN(parseInt(theTop))) top=eval(theTop-ss2-this.Border)+"px"; + visibility="visible"; + } +} +//You can delete the following 3 functions, if you do not use Pie objects +function Pie(theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1, theColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Pie"+_N_Pie; _N_Pie++; _zIndex++; + this.XCenter=theXCenter; + this.YCenter=theYCenter; + this.Offset=theOffset; + this.Radius=theRadius; + this.dX=theRadius; + this.dY=theRadius; + this.Angle0=theAngle0; + this.Angle1=theAngle1; + this.Color=theColor; + if ((theColor!="")&&(theColor.length==6)) this.Color="#"+theColor; + this.Cursor=_cursor(theOnClickAction); + this.SetVisibility=_SetVisibility; + this.SetColor=_SetColor; + this.SetTitle=_SetTitle; + this.MoveTo=_PieMoveTo; + this.ResizeTo=_PieResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+="onClick='"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var aa0, aa1, xx, yy, tt, xxo=0, yyo=0, rr2=this.Radius*this.Radius, xx0, yy0, xx1, yy1, pid180=Math.PI/180, ss0, ss1; + var nbsp="";//(_IE)? " " : ""; + aa0=this.Angle0; + aa1=this.Angle1; + while (aa0>=360) aa0-=360; + while (aa0<0) aa0+=360; + while (aa1>=360) aa1-=360; + while (aa1<0) aa1+=360; + if (aa0aa1) + { xxo=Math.sin((aa0+aa1+360)*pid180/2)*this.Offset; + yyo=-Math.cos((aa0+aa1+360)*pid180/2)*this.Offset; + } + _DiagramTarget.document.write("
"); + if (aa0==aa1) + { if (this.Angle0"+nbsp+"
"); + } + } + } + else + { xx0=Math.sin(aa0*pid180)*this.Radius; + yy0=-Math.cos(aa0*pid180)*this.Radius; + xx1=Math.sin(aa1*pid180)*this.Radius; + yy1=-Math.cos(aa1*pid180)*this.Radius; + for (yy=-this.Radius; yy<0; yy++) + { xx=Math.round(Math.sqrt(rr2-(yy+0.5)*(yy+0.5))); + tt=yy+this.Radius; + if ((yy0>=0)&&(yy1>=0)) + { if (xx0"+nbsp+""); + } + else if ((yy0<0)&&(yy1<0)) + { if ((yy0))||((xx0<0)&&(xx1<=xx0))||((xx1>0)&&(xx0>=xx1))) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if ((yy>=yy0)&&(yy>=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0"+nbsp+""); + else + { _DiagramTarget.document.write("
"+nbsp+"
"); + _DiagramTarget.document.write("
"+nbsp+"
"); + } + } + else if (yy>=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else + { ss1=yy*xx1/yy1; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + } + else if (yy0<0) + { if (yy>=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if (xx0<0) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else + { if (yy>=yy1) + { ss1=yy*xx1/yy1; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if (xx1>0) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + } + for (yy=0; yyxx1) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if ((yy0>0)&&(yy1>0)) + { if ((yy>yy0)&&(yy>yy1)) + { if (((xx1<0)&&(xx0>0))||((xx1<0)&&(xx0<=xx1))||((xx0>0)&&(xx1>=xx0))) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if ((yy<=yy0)&&(yy<=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0>xx1) + _DiagramTarget.document.write("
"+nbsp+"
"); + else + { _DiagramTarget.document.write("
"+nbsp+"
"); + _DiagramTarget.document.write("
"+nbsp+"
"); + } + } + else if (yy<=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else + { ss1=yy*xx1/yy1; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + } + else if (yy0>0) + { if (yy<=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if (xx0>0) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else + { if (yy<=yy1) + { ss1=yy*xx1/yy1; + _DiagramTarget.document.write("
"+nbsp+"
"); + } + else if (xx1<0) + _DiagramTarget.document.write("
"+nbsp+"
"); + } + } + } + _DiagramTarget.document.writeln(""); + return(this); +} +function _PieResizeTo(theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1) +{ var id=this.ID,selObj="",divtext=""; + if (!isNaN(parseInt(theXCenter))) this.XCenter=theXCenter; + if (!isNaN(parseInt(theYCenter))) this.YCenter=theYCenter; + if (!isNaN(parseInt(theOffset))) this.Offset=theOffset; + if (!isNaN(parseInt(theRadius))) this.Radius=theRadius; + if (!isNaN(parseInt(theAngle0))) this.Angle0=theAngle0; + if (!isNaN(parseInt(theAngle1))) this.Angle1=theAngle1; + var aa0, aa1, xx, yy, tt, xxo=0, yyo=0, rr2=this.Radius*this.Radius, xx0, yy0, xx1, yy1, pid180=Math.PI/180, ss0, ss1; + var nbsp="";//(_IE)? " " : ""; + aa0=this.Angle0; + aa1=this.Angle1; + if (aa0aa1) + { xxo=Math.sin((aa0+aa1+360)*pid180/2)*this.Offset; + yyo=-Math.cos((aa0+aa1+360)*pid180/2)*this.Offset; + } + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { left=Math.round(this.XCenter-this.Radius+xxo)+"px"; + top=Math.round(this.YCenter-this.Radius+yyo)+"px"; + width=eval(2*this.Radius)+"px"; + height=eval(2*this.Radius)+"px"; + } + if (aa0==aa1) + { if (this.Angle0"+nbsp+""; + } + } + } + else + { xx0=Math.sin(aa0*pid180)*this.Radius; + yy0=-Math.cos(aa0*pid180)*this.Radius; + xx1=Math.sin(aa1*pid180)*this.Radius; + yy1=-Math.cos(aa1*pid180)*this.Radius; + for (yy=-this.Radius; yy<0; yy++) + { xx=Math.round(Math.sqrt(rr2-(yy+0.5)*(yy+0.5))); + tt=yy+this.Radius; + if ((yy0>=0)&&(yy1>=0)) + { if (xx0"+nbsp+""; + } + else if ((yy0<0)&&(yy1<0)) + { if ((yy0))||((xx0<0)&&(xx1<=xx0))||((xx1>0)&&(xx0>=xx1))) + divtext+="
"+nbsp+"
"; + } + else if ((yy>=yy0)&&(yy>=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0"+nbsp+""; + else + { divtext+="
"+nbsp+"
"; + divtext+="
"+nbsp+"
"; + } + } + else if (yy>=yy0) + { ss0=yy*xx0/yy0; + divtext+="
"+nbsp+"
"; + } + else + { ss1=yy*xx1/yy1; + divtext+="
"+nbsp+"
"; + } + } + else if (yy0<0) + { if (yy>=yy0) + { ss0=yy*xx0/yy0; + divtext+="
"+nbsp+"
"; + } + else if (xx0<0) + divtext+="
"+nbsp+"
"; + } + else + { if (yy>=yy1) + { ss1=yy*xx1/yy1; + divtext+="
"+nbsp+"
"; + } + else if (xx1>0) + divtext+="
"+nbsp+"
"; + } + } + for (yy=0; yyxx1) + divtext+="
"+nbsp+"
"; + } + else if ((yy0>0)&&(yy1>0)) + { if ((yy>yy0)&&(yy>yy1)) + { if (((xx1<0)&&(xx0>0))||((xx1<0)&&(xx0<=xx1))||((xx0>0)&&(xx1>=xx0))) + divtext+="
"+nbsp+"
"; + } + else if ((yy<=yy0)&&(yy<=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0>xx1) + divtext+="
"+nbsp+"
"; + else + { divtext+="
"+nbsp+"
"; + divtext+="
"+nbsp+"
"; + } + } + else if (yy<=yy0) + { ss0=yy*xx0/yy0; + divtext+="
"+nbsp+"
"; + } + else + { ss1=yy*xx1/yy1; + divtext+="
"+nbsp+"
"; + } + } + else if (yy0>0) + { if (yy<=yy0) + { ss0=yy*xx0/yy0; + divtext+="
"+nbsp+"
"; + } + else if (xx0>0) + divtext+="
"+nbsp+"
"; + } + else + { if (yy<=yy1) + { ss1=yy*xx1/yy1; + divtext+="
"+nbsp+"
"; + } + else if (xx1<0) + divtext+="
"+nbsp+"
"; + } + } + } + selObj.innerHTML=divtext; +} +function _PieMoveTo(theXCenter, theYCenter, theOffset) +{ var xxo=0, yyo=0, pid180=Math.PI/180, id=this.ID, selObj; + if (!isNaN(parseInt(theXCenter))) this.XCenter=theXCenter; + if (!isNaN(parseInt(theYCenter))) this.YCenter=theYCenter; + if (!isNaN(parseInt(theOffset))) this.Offset=theOffset; + if (this.Angle0this.Angle1) + { xxo=Math.sin((this.Angle0+this.Angle1+360)*pid180/2)*this.Offset; + yyo=-Math.cos((this.Angle0+this.Angle1+360)*pid180/2)*this.Offset; + } + if (document.all) selObj=eval("_DiagramTarget.document.all."+id); + else selObj=_DiagramTarget.document.getElementById(id); + with (selObj.style) + { left=Math.round(this.XCenter-this.Radius+xxo)+"px"; + top=Math.round(this.YCenter-this.Radius+yyo)+"px"; + width=eval(2*this.Radius)+"px"; + height=eval(2*this.Radius)+"px"; + visibility="visible"; + } +} \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/diagram_nav.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/diagram_nav.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/diagram_nav.js 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,1465 @@ +// JavaScript Diagram Builder 3.31 +// Copyright (c) 2001-2005 Lutz Tautenhahn, all rights reserved. +// +// The Author grants you a non-exclusive, royalty free, license to use, +// modify and redistribute this software, provided that this copyright notice +// and license appear on all copies of the software. +// This software is provided "as is", without a warranty of any kind. + +function _Draw(theDrawColor, theTextColor, isScaleText, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ var x0,y0,i,j,itext,l,x,y,r,u,fn,dx,dy,xr,yr,invdifx,invdify,deltax,deltay,id=this.ID,lay=0,ii=0,oo,k,sub; + var c151="—"; + var EventActions=""; + if (_nvl(theOnClickAction,"")!="") EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + lay++; if (document.layers[id]) lay++; + var drawCol=(_nvl(theDrawColor,"")=="") ? "" : "bgcolor="+theDrawColor; + var drawImg='transparent.gif'; + if (_IsImage(theDrawColor)) { drawImg=theDrawColor; drawCol=""; } + if (lay>1) + { with(_DiagramTarget.document.layers[id]) + { top=this.top; + left=this.left; + document.open(); + document.writeln("
"+_nvl(theTooltipText,"")+"
"); + } + } + else + { _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + } + if ((this.XScale==1)||(isNaN(this.XScale))) + { u=""; + fn=""; + if (isNaN(this.XScale)) + { if (this.XScale.substr(0,9)=="function ") fn=eval("window."+this.XScale.substr(9)); + else u=this.XScale; + } + dx=(this.xmax-this.xmin); + if (Math.abs(dx)>0) + { invdifx=(this.right-this.left)/(this.xmax-this.xmin); + r=1; + while (Math.abs(dx)>=100) { dx/=10; r*=10; } + while (Math.abs(dx)<10) { dx*=10; r/=10; } + if (Math.abs(dx)>=50) { this.SubGrids=5; deltax=10*r*_sign(dx); } + else + { if (Math.abs(dx)>=20) { this.SubGrids=5; deltax=5*r*_sign(dx); } + else { this.SubGrids=4; deltax=2*r*_sign(dx); } + } + if (this.XGridDelta!=0) deltax=this.XGridDelta; + if (this.XSubGrids!=0) this.SubGrids=this.XSubGrids; + sub=deltax*invdifx/this.SubGrids; + sshift=0; + if ((this.XScalePosition=="top-left")||(this.XScalePosition=="bottom-left")) sshift=-Math.abs(deltax*invdifx/2); + if ((this.XScalePosition=="top-right")||(this.XScalePosition=="bottom-right")) sshift=Math.abs(deltax*invdifx/2); + x=Math.floor(this.xmin/deltax)*deltax; + itext=0; + if (deltax!=0) this.MaxGrids=Math.floor(Math.abs((this.xmax-this.xmin)/deltax))+2; + else this.MaxGrids=0; + for (j=this.MaxGrids; j>=-1; j--) + { xr=x+j*deltax; + x0=Math.round(this.left+(-this.xmin+xr)*invdifx); + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.XSubGridColor) + { for (k=1; kthis.left+1)&&(x0+k*sub
"); + } + if (this.SubGrids==-1) + { for (k=0; k<8; k++) + { if ((x0-this.logsub[k]*sub*_sign(deltax)>this.left+1)&&(x0-this.logsub[k]*sub*_sign(deltax)
"); + } + } + } + } + if ((x0>=this.left)&&(x0<=this.right)) + { itext++; + if ((itext!=2)||(!isScaleText)) + { if (r>1) + { if (fn) l=fn(xr)+""; + else l=xr+""+u; + } + else + { if (fn) l=fn(Math.round(10*xr/r)/Math.round(10/r))+""; + else l=Math.round(10*xr/r)/Math.round(10/r)+""+u; + } + if (l.charAt(0)==".") l="0"+l; + if (l.substr(0,2)=="-.") l="-0"+l.substr(1,100); + } + else l=this.xtext; + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.XScalePosition.substr(0,3)!="top") + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + writeln("
"+l+"
"); + writeln("
"); + } + else + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + writeln("
"+l+"
"); + writeln("
"); + } + if ((this.XGridColor)&&(x0>this.left)&&(x0
"); + } + } + } + } + } + if ((!isNaN(this.XScale))&&(this.XScale>1)) + { dx=(this.xmax-this.xmin); + if (Math.abs(dx)>0) + { invdifx=(this.right-this.left)/(this.xmax-this.xmin); + deltax=this.DateInterval(Math.abs(dx))*_sign(dx); + if (this.XGridDelta!=0) deltax=this.XGridDelta; + if (this.XSubGrids!=0) this.SubGrids=this.XSubGrids; + sub=deltax*invdifx/this.SubGrids; + sshift=0; + if ((this.XScalePosition=="top-left")||(this.XScalePosition=="bottom-left")) sshift=-Math.abs(deltax*invdifx/2); + if ((this.XScalePosition=="top-right")||(this.XScalePosition=="bottom-right")) sshift=Math.abs(deltax*invdifx/2); + x=Math.floor(this.xmin/deltax)*deltax; + itext=0; + if (deltax!=0) this.MaxGrids=Math.floor(Math.abs((this.xmax-this.xmin)/deltax))+2; + else this.MaxGrids=0; + for (j=this.MaxGrids; j>=-2; j--) + { xr=x+j*deltax; + x0=Math.round(this.left+(-this.xmin+x+j*deltax)*invdifx); + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.XSubGridColor) + { for (k=1; kthis.left+1)&&(x0+k*sub
"); + } + } + } + if ((x0>=this.left)&&(x0<=this.right)) + { itext++; + if ((itext!=2)||(!isScaleText)) l=_DateFormat(xr, Math.abs(deltax), this.XScale); + else l=this.xtext; + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.XScalePosition.substr(0,3)!="top") + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + writeln("
"+l+"
"); + writeln("
"); + } + else + { if ((x0+sshift>=this.left)&&(x0+sshift<=this.right)) + writeln("
"+l+"
"); + writeln("
"); + } + if ((this.XGridColor)&&(x0>this.left)&&(x0
"); + } + } + } + } + } + if ((this.YScale==1)||(isNaN(this.YScale))) + { u=""; + fn=""; + if (isNaN(this.YScale)) + { if (this.YScale.substr(0,9)=="function ") fn=eval("window."+this.YScale.substr(9)); + else u=this.YScale; + } + dy=this.ymax-this.ymin; + if (Math.abs(dy)>0) + { invdify=(this.bottom-this.top)/(this.ymax-this.ymin); + r=1; + while (Math.abs(dy)>=100) { dy/=10; r*=10; } + while (Math.abs(dy)<10) { dy*=10; r/=10; } + if (Math.abs(dy)>=50) { this.SubGrids=5; deltay=10*r*_sign(dy); } + else + { if (Math.abs(dy)>=20) { this.SubGrids=5; deltay=5*r*_sign(dy); } + else { this.SubGrids=4; deltay=2*r*_sign(dy); } + } + if (this.YGridDelta!=0) deltay=this.YGridDelta; + if (this.YSubGrids!=0) this.SubGrids=this.YSubGrids; + sub=deltay*invdify/this.SubGrids; + sshift=0; + if ((this.YScalePosition=="left-top")||(this.YScalePosition=="right-top")) sshift=-Math.abs(deltay*invdify/2); + if ((this.YScalePosition=="left-bottom")||(this.YScalePosition=="right-bottom")) sshift=Math.abs(deltay*invdify/2); + y=Math.floor(this.ymax/deltay)*deltay; + itext=0; + if (deltay!=0) this.MaxGrids=Math.floor(Math.abs((this.ymax-this.ymin)/deltay))+2; + else this.MaxGrids=0; + for (j=-1; j<=this.MaxGrids; j++) + { yr=y-j*deltay; + y0=Math.round(this.top+(this.ymax-yr)*invdify); + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.YSubGridColor) + { for (k=1; kthis.top+1)&&(y0+k*sub
"); + } + if (this.SubGrids==-1) + { for (k=0; k<8; k++) + { if ((y0+this.logsub[k]*sub*_sign(deltay)>this.top+1)&&(y0+this.logsub[k]*sub*_sign(deltay)
"); + } + } + } + } + if ((y0>=this.top)&&(y0<=this.bottom)) + { itext++; + if ((itext!=2)||(!isScaleText)) + { if (r>1) + { if (fn) l=fn(yr)+""; + else l=yr+""+u; + } + else + { if (fn) l=fn(Math.round(10*yr/r)/Math.round(10/r))+""; + else l=Math.round(10*yr/r)/Math.round(10/r)+""+u; + } + if (l.charAt(0)==".") l="0"+l; + if (l.substr(0,2)=="-.") l="-0"+l.substr(1,100); + } + else l=this.ytext; + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.YScalePosition.substr(0,5)!="right") + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + writeln("
"+l+"
"); + writeln("
"); + } + else + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + writeln("
"+l+"
"); + writeln("
"); + } + if ((this.YGridColor)&&(y0>this.top)&&(y0
"); + } + } + } + } + } + if ((!isNaN(this.YScale))&&(this.YScale>1)) + { dy=this.ymax-this.ymin; + if (Math.abs(dy)>0) + { invdify=(this.bottom-this.top)/(this.ymax-this.ymin); + deltay=this.DateInterval(Math.abs(dy))*_sign(dy); + if (this.YGridDelta!=0) deltay=this.YGridDelta; + if (this.YSubGrids!=0) this.SubGrids=this.YSubGrids; + sub=deltay*invdify/this.SubGrids; + sshift=0; + if ((this.YScalePosition=="left-top")||(this.YScalePosition=="right-top")) sshift=-Math.abs(deltay*invdify/2); + if ((this.YScalePosition=="left-bottom")||(this.YScalePosition=="right-bottom")) sshift=Math.abs(deltay*invdify/2); + y=Math.floor(this.ymax/deltay)*deltay; + itext=0; + if (deltay!=0) this.MaxGrids=Math.floor(Math.abs((this.ymax-this.ymin)/deltay))+2; + else this.MaxGrids=0; + for (j=-2; j<=this.MaxGrids; j++) + { yr=y-j*deltay; + y0=Math.round(this.top+(this.ymax-y+j*deltay)*invdify); + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.YSubGridColor) + { for (k=1; kthis.top+1)&&(y0+k*sub
"); + } + } + } + if ((y0>=this.top)&&(y0<=this.bottom)) + { itext++; + if ((itext!=2)||(!isScaleText)) l=_DateFormat(yr, Math.abs(deltay), this.YScale); + else l=this.ytext; + if (lay>1) oo=_DiagramTarget.document.layers[id]; + else oo=_DiagramTarget; + with(oo.document) + { if (this.YScalePosition.substr(0,5)!="right") + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + writeln("
"+l+"
"); + writeln("
"); + } + else + { if ((y0+sshift>=this.top)&&(y0+sshift<=this.bottom)) + writeln("
"+l+"
"); + writeln("
"); + } + if ((this.YGridColor)&&(y0>this.top)&&(y0
"); + } + } + } + } + } + if (lay>1) + { with(_DiagramTarget.document.layers[id]) + { if (this.XScalePosition.substr(0,3)!="top") + document.writeln("
"+this.title+"
"); + else + document.writeln("
"+this.title+"
"); + document.close(); + } + } + else + { if (this.XScalePosition.substr(0,3)!="top") + _DiagramTarget.document.writeln("
"+this.title+"
"); + else + _DiagramTarget.document.writeln("
"+this.title+"
"); + _DiagramTarget.document.writeln("
"); + } +} + +function Bar(theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Bar"+_N_Bar; _N_Bar++; _zIndex++; + this.left=theLeft; + this.top=theTop; + this.width=theRight-theLeft; + this.height=theBottom-theTop; + this.DrawColor=theDrawColor; + this.Text=String(theText); + this.TextColor=theTextColor; + this.BorderWidth=0; + this.BorderColor=""; + this.TooltipText=theTooltipText; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetBarColor; + this.SetText=_SetBarText; + this.SetTitle=_SetBarTitle; + this.MoveTo=_MoveTo; + this.ResizeTo=_ResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var tt=""; + while (tt.length"; + else tt=this.Text; + if (_IsImage(this.Text)) tt=""+_nvl(theTooltipText,"")+""; + var drawCol=(_nvl(theDrawColor,"")=="") ? "" : "bgcolor="+theDrawColor; + var textCol=(_nvl(theTextColor,"")=="") ? "" : "color:"+theTextColor+";"; + var vv=(this.height>1) ? "" : " visibility=hide"; + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln("
"+tt+"
"); + _DiagramTarget.document.writeln("
"); + return(this); +} +function Box(theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor, theBorderWidth, theBorderColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Box"+_N_Box; _N_Box++; _zIndex++; + this.left=theLeft; + this.top=theTop; + this.width=theRight-theLeft; + this.height=theBottom-theTop; + this.DrawColor=theDrawColor; + this.Text=String(theText); + this.TextColor=theTextColor; + this.BorderWidth=theBorderWidth; + this.BorderColor=theBorderColor; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetBarColor; + this.SetText=_SetBarText; + this.SetTitle=_SetBarTitle; + this.MoveTo=_MoveTo; + this.ResizeTo=_ResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var bb=""; + var ww=theBorderWidth; + if (_nvl(theBorderWidth,"")=="") ww=0; + if ((_nvl(theBorderWidth,"")!="")&&(_nvl(theBorderColor,"")!="")) + bb="bordercolor="+theBorderColor; + var tt=""; + while (tt.length"; + else tt=this.Text; + if (_IsImage(this.Text)) tt=""+_nvl(theTooltipText,"")+""; + var drawCol=(_nvl(theDrawColor,"")=="") ? "" : "bgcolor="+theDrawColor; + var textCol=(_nvl(theTextColor,"")=="") ? "" : "color:"+theTextColor+";"; + var vv=(this.height>2*ww+1) ? "" : " visibility=hide"; + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln("
"+tt+"
"); + _DiagramTarget.document.writeln("
"); + return(this); +} +function _SetBarColor(theColor) +{ var id=this.ID; + this.DrawColor=theColor; + var ww=this.BorderWidth; + if (_nvl(this.BorderWidth,"")=="") ww=0; + var tt=""; + while (tt.length"; + else tt=this.Text; + if (_IsImage(this.Text)) tt=""+_nvl(this.TooltipText,"")+""; + var drawCol=(_nvl(this.DrawColor,"")=="") ? "" : "bgcolor="+this.DrawColor; + var textCol=(_nvl(this.TextColor,"")=="") ? "" : "color:"+this.TextColor+";"; + with(_DiagramTarget.document.layers[id]) + { document.open(); + if ((_nvl(this.BorderWidth,"")!="")&&(_nvl(this.BorderColor,"")!="")) + document.writeln("
"+tt+"
"); + else + document.writeln("
"+tt+"
"); + document.close(); + } +} +function _SetBarTitle(theTitle) +{ this.TooltipText=theTitle; + this.SetColor(this.DrawColor); +} +function _SetBarText(theText) +{ var id=this.ID; + this.Text=String(theText); + var ww=this.BorderWidth; + if (_nvl(this.BorderWidth,"")=="") ww=0; + var tt=""; + while (tt.length"; + else tt=this.Text; + if (_IsImage(this.Text)) tt=""+_nvl(this.TooltipText,"")+""; + var drawCol=(_nvl(this.DrawColor,"")=="") ? "" : "bgcolor="+this.DrawColor; + var textCol=(_nvl(this.TextColor,"")=="") ? "" : "color:"+this.TextColor+";"; + with(_DiagramTarget.document.layers[id]) + { document.open(); + if ((_nvl(this.BorderWidth,"")!="")&&(_nvl(this.BorderColor,"")!="")) + document.writeln("
"+tt+"
"); + else + document.writeln("
"+tt+"
"); + document.close(); + } +} +function Dot(theX, theY, theSize, theType, theColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.Size=theSize; + this.ID="Dot"+_N_Dot; _N_Dot++; _zIndex++; + this.X=theX; + this.Y=theY; + this.dX=Math.round(theSize/2); + this.dY=Math.round(theSize/2); + this.Type=theType; + this.Color=theColor; + this.TooltipText=theTooltipText; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetDotColor; + this.SetTitle=_SetDotTitle; + this.MoveTo=_DotMoveTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + _DiagramTarget.document.writeln(""); + if (isNaN(theType)) + { var cc=(_nvl(theColor,"")=="") ? "" : " bgcolor="+theColor; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+"
"); + } + else + { if (theType%6==0) + { _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + } + if (theType%6==1) + { _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + } + if (theType%6==2) + _DiagramTarget.document.writeln("
"); + if (theType%6==3) + { _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + } + if (theType%6==4) + { _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + _DiagramTarget.document.writeln("
"+_nvl(theTooltipText,"")+"
"); + } + if (theType%6==5) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + _DiagramTarget.document.writeln("
"); + return(this); +} +function _SetDotColor(theColor) +{ if (theColor!="") this.Color=theColor; + with(_DiagramTarget.document.layers[this.ID]) + { document.open(); + if (isNaN(this.Type)) + { var cc=(_nvl(this.Color,"")=="") ? "" : " bgcolor="+this.Color; + document.writeln(""+_nvl(this.TooltipText,"")+"
"); + } + else + { if (this.Type%6==0) + { document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + } + if (this.Type%6==1) + { document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + } + if (this.Type%6==2) + document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + if (this.Type%6==3) + { document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + } + if (this.Type%6==4) + { document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + document.writeln("
"+_nvl(this.TooltipText,"")+"
"); + } + if (this.Type%6==5) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + document.close(); + } +} +function _SetDotTitle(theTitle) +{ this.TooltipText=theTitle; + this.SetColor(""); +} +function _DotMoveTo(theX, theY) +{ var id=this.ID; + if (!isNaN(parseInt(theX))) this.X=theX; + if (!isNaN(parseInt(theY))) this.Y=theY; + with(_DiagramTarget.document.layers[id]) + { if (!isNaN(parseInt(theX))) left=eval(theX-this.dX); + if (!isNaN(parseInt(theY))) top=eval(theY-this.dY); + visibility="show"; + } +} +function Pixel(theX, theY, theColor) +{ this.ID="Pix"+_N_Pix; _N_Pix++; _zIndex++; + this.left=theX; + this.top=theY; + this.dX=2; + this.dY=2; + this.Color=theColor; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetPixelColor; + this.MoveTo=_DotMoveTo; + this.Delete=_Delete; + _DiagramTarget.document.writeln(""); + return(this); +} +function _SetPixelColor(theColor) +{ this.Color=theColor; + with(_DiagramTarget.document.layers[this.ID]) + { document.open(); + document.writeln(""); + document.close(); + } +} +function _SetVisibility(isVisible) +{ var ll, id=this.ID; + with(_DiagramTarget.document.layers[id]) + { if (isVisible) visibility="show"; + else visibility="hide"; + } +} +function _SetTitle(theTitle) +{ this.TooltipText=theTitle; + if (this.ResizeTo) this.ResizeTo("","","",""); +} +function _MoveTo(theLeft, theTop) +{ var id=this.ID; + if (!isNaN(parseInt(theLeft))) this.left=theLeft; + if (!isNaN(parseInt(theTop))) this.top=theTop; + var ww=this.BorderWidth; + if (_nvl(this.BorderWidth,"")=="") ww=0; + with(_DiagramTarget.document.layers[id]) + { if (!isNaN(parseInt(theLeft))) left=theLeft; + if (!isNaN(parseInt(theTop))) top=theTop; + if (this.height<=2*ww+1) visibility="hide"; + else visibility="show"; + } +} +function _ResizeTo(theLeft, theTop, theWidth, theHeight) +{ var id=this.ID; + if (!isNaN(parseInt(theLeft))) this.left=theLeft; + if (!isNaN(parseInt(theTop))) this.top=theTop; + if (!isNaN(parseInt(theWidth))) this.width=theWidth; + if (!isNaN(parseInt(theHeight))) this.height=theHeight; + var ww=this.BorderWidth; + if (_nvl(this.BorderWidth,"")=="") ww=0; + var tt=""; + while (tt.length"; + else tt=this.Text; + if (_IsImage(this.Text)) tt=""+_nvl(this.TooltipText,"")+""; + var drawCol=(_nvl(this.DrawColor,"")=="") ? "" : "bgcolor="+this.DrawColor; + var textCol=(_nvl(this.TextColor,"")=="") ? "" : "color:"+this.TextColor+";"; + with(_DiagramTarget.document.layers[id]) + { top=this.top; + left=this.left; + if (this.height<=2*ww+1) visibility="hide"; + else visibility="show"; + document.open(); + if ((_nvl(this.BorderWidth,"")!="")&&(_nvl(this.BorderColor,"")!="")) + document.writeln("
"+tt+"
"); + else + document.writeln("
"+tt+"
"); + document.close(); + } +} +function _Delete() +{ var id=this.ID; + with(_DiagramTarget.document.layers[id]) + { document.open(); + document.close(); + } +} +function _SetColor(theColor) +{ this.Color=theColor; + if ((theColor!="")&&(theColor.lengththis.Y0)&&(this.X1>this.X0))||((this.Y1"); + if ((ww==0)||(hh==0)) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + ccl++; + } + } + } + _DiagramTarget.document.writeln(""); + return(this); +} +function _LineResizeTo(theX0, theY0, theX1, theY1) +{ var xx0, yy0, xx1, yy1, ll, rr, tt, bb, ww, hh, ccl, ccr, cct, ccb, id=this.ID; + var ss2=Math.floor(this.Size/2); + if (!isNaN(parseInt(theX0))) this.X0=theX0; + if (!isNaN(parseInt(theY0))) this.Y0=theY0; + if (!isNaN(parseInt(theX1))) this.X1=theX1; + if (!isNaN(parseInt(theY1))) this.Y1=theY1; + var ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+_nvl(this.TooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + ccl++; + } + } + } + document.close(); + } +} +function _LineMoveTo(theLeft, theTop) +{ var id=this.ID; + var ss2=Math.floor(this.Size/2); + if (!isNaN(parseInt(theLeft))) this.left=theLeft; + if (!isNaN(parseInt(theTop))) this.top=theTop; + with(_DiagramTarget.document.layers[id]) + { if (!isNaN(parseInt(theLeft))) left=theLeft-ss2; + if (!isNaN(parseInt(theTop))) top=theTop-ss2; + visibility="show"; + } +} +//You can delete the following 2 functions, if you do not use Area objects +function Area(theX0, theY0, theX1, theY1, theColor, theBase, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Area"+_N_Area; _N_Area++; _zIndex++; + this.X0=theX0; + this.Y0=theY0; + this.X1=theX1; + this.Y1=theY1; + this.Color=theColor; + this.Base=theBase; + this.TooltipText=theTooltipText; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetColor; + this.SetTitle=_SetTitle; + this.MoveTo=_MoveTo; + this.ResizeTo=_AreaResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var dd, ll, rr, tt, bb, ww, hh; + if (theX0<=theX1) { ll=theX0; rr=theX1; } + else { ll=theX1; rr=theX0; } + if (theY0<=theY1) { tt=theY0; bb=theY1; } + else { tt=theY1; bb=theY0; } + ww=rr-ll; hh=bb-tt; + if (theBase<=tt) + _DiagramTarget.document.writeln(""); + else + _DiagramTarget.document.writeln(""); + if (theBase<=tt) + { if ((theBase0)) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + if (((theY0theY1)&&(theX0>theX1))) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + if (((theY0>theY1)&&(theX0theX1))) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + if ((theBase>tt)&&(theBasetheY1)&&(theX0>theX1))) + { _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + if (((theY0>theY1)&&(theX0theX1))) + { _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + if (theBase>=bb) + { if ((theBase>bb)&&(ww>0)) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + if (((theY0theY1)&&(theX0>theX1))) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + if (((theY0>theY1)&&(theX0theX1))) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + _DiagramTarget.document.writeln(""); +} +function _AreaResizeTo(theX0, theY0, theX1, theY1) +{ var dd, ll, rr, tt, bb, ww, hh, id=this.ID; + if (!isNaN(parseInt(theX0))) this.X0=theX0; + if (!isNaN(parseInt(theY0))) this.Y0=theY0; + if (!isNaN(parseInt(theX1))) this.X1=theX1; + if (!isNaN(parseInt(theY1))) this.Y1=theY1; + if (this.X0<=this.X1) { ll=this.X0; rr=this.X1; } + else { ll=this.X1; rr=this.X0; } + if (this.Y0<=this.Y1) { tt=this.Y0; bb=this.Y1; } + else { tt=this.Y1; bb=this.Y0; } + ww=rr-ll; hh=bb-tt; + with(_DiagramTarget.document.layers[id]) + { if (this.Base<=tt) { left=ll; top=this.Base; } + else { left=ll; top=tt; } + document.open(); + if (this.Base<=tt) + { if ((this.Base0)) + document.writeln(""+_nvl(this.TooltipText,"")+""); + if (((this.Y0this.Y1)&&(this.X0>this.X1))) + document.writeln(""+_nvl(this.TooltipText,"")+""); + if (((this.Y0>this.Y1)&&(this.X0this.X1))) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + if ((this.Base>tt)&&(this.Basethis.Y1)&&(this.X0>this.X1))) + { document.writeln(""+_nvl(this.TooltipText,"")+""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + if (((this.Y0>this.Y1)&&(this.X0this.X1))) + { document.writeln(""+_nvl(this.TooltipText,"")+""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + if (this.Base>=bb) + { if ((this.Base>bb)&&(ww>0)) + document.writeln(""+_nvl(this.TooltipText,"")+""); + if (((this.Y0this.Y1)&&(this.X0>this.X1))) + document.writeln(""+_nvl(this.TooltipText,"")+""); + if (((this.Y0>this.Y1)&&(this.X0this.X1))) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + document.close(); + } +} +//You can delete the following 3 functions, if you do not use Arrow objects +function Arrow(theX0, theY0, theX1, theY1, theColor, theSize, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Arrow"+_N_Arrow; _N_Arrow++; _zIndex++; + this.X0=theX0; + this.Y0=theY0; + this.X1=theX1; + this.Y1=theY1; + this.Color=theColor; + if ((theColor!="")&&(theColor.length==6)) this.Color="#"+theColor; + this.Size=Number(_nvl(theSize,1)); + this.TooltipText=theTooltipText; + this.Border=8*this.Size; + this.SetVisibility=_SetVisibility; + this.SetColor=_SetColor; + this.SetTitle=_SetTitle; + this.MoveTo=_ArrowMoveTo; + this.ResizeTo=_ArrowResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var xx0, yy0, xx1, yy1, ll, rr, tt, bb, ww, hh, ccl, ccr, cct, ccb; + var ss2=Math.floor(this.Size/2); + var ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"); + if ((ww==0)||(hh==0)) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + ccl++; + } + } + } + var LL=1, ll0=ll, tt0=tt; + var ccL=8*theSize+4, ccB=2*theSize+1; + var DDX=theX1-theX0, DDY=theY1-theY0; + if ((DDX!=0)||(DDY!=0)) LL=Math.sqrt((DDX*DDX)+(DDY*DDY)); + this.X0=theX1-Math.round(1/LL*(ccL*DDX-ccB*DDY)); + this.Y0=theY1-Math.round(1/LL*(ccL*DDY+ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+_nvl(theTooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + ccl++; + } + } + } + this.X0=theX1-Math.round(1/LL*(ccL*DDX+ccB*DDY)); + this.Y0=theY1-Math.round(1/LL*(ccL*DDY-ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+_nvl(theTooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + _DiagramTarget.document.writeln(""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + ccl++; + } + } + } + _DiagramTarget.document.writeln(""); + this.X0=theX0; + this.Y0=theY0; + return(this); +} +function _ArrowResizeTo(theX0, theY0, theX1, theY1) +{ var xx0, yy0, xx1, yy1, ll, rr, tt, bb, ww, hh, ccl, ccr, cct, ccb, id=this.ID; + var ss2=Math.floor(this.Size/2); + if (!isNaN(parseInt(theX0))) this.X0=theX0; + if (!isNaN(parseInt(theY0))) this.Y0=theY0; + if (!isNaN(parseInt(theX1))) this.X1=theX1; + if (!isNaN(parseInt(theY1))) this.Y1=theY1; + var tmpX0=this.X0, tmpY0=this.Y0; + var ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+_nvl(this.TooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + ccl++; + } + } + } + var LL=1, ll0=ll, tt0=tt; + var ccL=8*this.Size+4, ccB=2*this.Size+1; + var DDX=this.X1-tmpX0, DDY=this.Y1-tmpY0; + if ((DDX!=0)||(DDY!=0)) LL=Math.sqrt(0+(DDX*DDX)+(DDY*DDY)); + this.X0=this.X1-Math.round(1/LL*(ccL*DDX-ccB*DDY)); + this.Y0=this.Y1-Math.round(1/LL*(ccL*DDY+ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+_nvl(this.TooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + ccl++; + } + } + } + this.X0=this.X1-Math.round(1/LL*(ccL*DDX+ccB*DDY)); + this.Y0=this.Y1-Math.round(1/LL*(ccL*DDY-ccB*DDX)); + ddir=(((this.Y1>this.Y0)&&(this.X1>this.X0))||((this.Y1"+_nvl(this.TooltipText,"")+""); + else + { if (ww>hh) + { ccr=0; + cct=0; + while (ccr"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + cct++; + } + } + else + { ccb=0; + ccl=0; + while (ccb"); + else + document.writeln(""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + ccl++; + } + } + } + document.close(); + } + this.X0=tmpX0; + this.Y0=tmpY0; +} +function _ArrowMoveTo(theLeft, theTop) +{ var id=this.ID; + var ss2=Math.floor(this.Size/2); + if (!isNaN(parseInt(theLeft))) this.left=theLeft; + if (!isNaN(parseInt(theTop))) this.top=theTop; + with(_DiagramTarget.document.layers[id]) + { if (!isNaN(parseInt(theLeft))) left=theLeft-ss2-this.Border; + if (!isNaN(parseInt(theTop))) top=theTop-ss2-this.Border; + visibility="show"; + } +} +//You can delete the following 3 functions, if you do not use Pie objects +function Pie(theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1, theColor, theTooltipText, theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) +{ this.ID="Pie"+_N_Pie; _N_Pie++; _zIndex++; + this.XCenter=theXCenter; + this.YCenter=theYCenter; + this.Offset=theOffset; + this.Radius=theRadius; + this.dX=theRadius; + this.dY=theRadius; + this.Angle0=theAngle0; + this.Angle1=theAngle1; + this.Color=theColor; + if ((theColor!="")&&(theColor.length==6)) this.Color="#"+theColor; + this.TooltipText=theTooltipText; + this.Cursor=_cursor(theOnClickAction); + this.SetVisibility=_SetVisibility; + this.SetColor=_SetColor; + this.SetTitle=_SetTitle; + this.MoveTo=_PieMoveTo; + this.ResizeTo=_PieResizeTo; + this.Delete=_Delete; + this.EventActions=""; + if (_nvl(theOnClickAction,"")!="") this.EventActions+=" href='javascript:"+_nvl(theOnClickAction,"")+"' "; + if (_nvl(theOnMouseoverAction,"")!="") this.EventActions+="onMouseover='"+_nvl(theOnMouseoverAction,"")+"' "; + if (_nvl(theOnMouseoutAction,"")!="") this.EventActions+="onMouseout='"+_nvl(theOnMouseoutAction,"")+"' "; + var aa0, aa1, xx, yy, tt, xxo=0, yyo=0, rr2=this.Radius*this.Radius, xx0, yy0, xx1, yy1, pid180=Math.PI/180, ss0, ss1; + var nbsp="";//(_IE)? " " : ""; + aa0=this.Angle0; + aa1=this.Angle1; + while (aa0>=360) aa0-=360; + while (aa0<0) aa0+=360; + while (aa1>=360) aa1-=360; + while (aa1<0) aa1+=360; + if (aa0aa1) + { xxo=Math.sin((aa0+aa1+360)*pid180/2)*this.Offset; + yyo=-Math.cos((aa0+aa1+360)*pid180/2)*this.Offset; + } + _DiagramTarget.document.writeln(""); + if (aa0==aa1) + { if (this.Angle0"+_nvl(theTooltipText,"")+""); + } + } + } + else + { xx0=Math.sin(aa0*pid180)*this.Radius; + yy0=-Math.cos(aa0*pid180)*this.Radius; + xx1=Math.sin(aa1*pid180)*this.Radius; + yy1=-Math.cos(aa1*pid180)*this.Radius; + for (yy=-this.Radius; yy<0; yy++) + { xx=Math.round(Math.sqrt(rr2-(yy+0.5)*(yy+0.5))); + tt=yy+this.Radius+2; + if ((yy0>=0)&&(yy1>=0)) + { if (xx0"+_nvl(theTooltipText,"")+""); + } + else if ((yy0<0)&&(yy1<0)) + { if ((yy0))||((xx0<0)&&(xx1<=xx0))||((xx1>0)&&(xx0>=xx1))) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if ((yy>=yy0)&&(yy>=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0"+_nvl(theTooltipText,"")+""); + else + { _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + else if (yy>=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else + { ss1=yy*xx1/yy1; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + else if (yy0<0) + { if (yy>=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if (xx0<0) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else + { if (yy>=yy1) + { ss1=yy*xx1/yy1; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if (xx1>0) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + for (yy=0; yyxx1) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if ((yy0>0)&&(yy1>0)) + { if ((yy>yy0)&&(yy>yy1)) + { if (((xx1<0)&&(xx0>0))||((xx1<0)&&(xx0<=xx1))||((xx0>0)&&(xx1>=xx0))) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if ((yy<=yy0)&&(yy<=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0>xx1) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + else + { _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + else if (yy<=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else + { ss1=yy*xx1/yy1; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + else if (yy0>0) + { if (yy<=yy0) + { ss0=yy*xx0/yy0; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if (xx0>0) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else + { if (yy<=yy1) + { ss1=yy*xx1/yy1; + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + else if (xx1<0) + _DiagramTarget.document.writeln(""+_nvl(theTooltipText,"")+""); + } + } + } + _DiagramTarget.document.writeln(""); + return(this); +} +function _PieResizeTo(theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1) +{ var id=this.ID; + if (!isNaN(parseInt(theXCenter))) this.XCenter=theXCenter; + if (!isNaN(parseInt(theYCenter))) this.YCenter=theYCenter; + if (!isNaN(parseInt(theOffset))) this.Offset=theOffset; + if (!isNaN(parseInt(theRadius))) this.Radius=theRadius; + if (!isNaN(parseInt(theAngle0))) this.Angle0=theAngle0; + if (!isNaN(parseInt(theAngle1))) this.Angle1=theAngle1; + var aa0, aa1, xx, yy, xxo=0, yyo=0, rr2=this.Radius*this.Radius, xx0, yy0, xx1, yy1, pid180=Math.PI/180, ss0, ss1; + var nbsp="";//(_IE)? " " : ""; + aa0=this.Angle0; + aa1=this.Angle1; + if (aa0aa1) + { xxo=Math.sin((aa0+aa1+360)*pid180/2)*this.Offset; + yyo=-Math.cos((aa0+aa1+360)*pid180/2)*this.Offset; + } + with(_DiagramTarget.document.layers[id]) + { top=Math.round(this.YCenter-this.Radius+yyo); + left=Math.round(this.XCenter-this.Radius+xxo); + document.open(); + if (aa0==aa1) + { if (this.Angle0"+_nvl(this.TooltipText,"")+""); + } + } + } + else + { xx0=Math.sin(aa0*pid180)*this.Radius; + yy0=-Math.cos(aa0*pid180)*this.Radius; + xx1=Math.sin(aa1*pid180)*this.Radius; + yy1=-Math.cos(aa1*pid180)*this.Radius; + for (yy=-this.Radius; yy<0; yy++) + { xx=Math.round(Math.sqrt(rr2-(yy+0.5)*(yy+0.5))); + tt=yy+this.Radius+2; + if ((yy0>=0)&&(yy1>=0)) + { if (xx0"+_nvl(this.TooltipText,"")+""); + } + else if ((yy0<0)&&(yy1<0)) + { if ((yy0))||((xx0<0)&&(xx1<=xx0))||((xx1>0)&&(xx0>=xx1))) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if ((yy>=yy0)&&(yy>=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0"+_nvl(this.TooltipText,"")+""); + else + { document.writeln(""+_nvl(this.TooltipText,"")+""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + else if (yy>=yy0) + { ss0=yy*xx0/yy0; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else + { ss1=yy*xx1/yy1; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + else if (yy0<0) + { if (yy>=yy0) + { ss0=yy*xx0/yy0; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if (xx0<0) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else + { if (yy>=yy1) + { ss1=yy*xx1/yy1; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if (xx1>0) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + for (yy=0; yyxx1) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if ((yy0>0)&&(yy1>0)) + { if ((yy>yy0)&&(yy>yy1)) + { if (((xx1<0)&&(xx0>0))||((xx1<0)&&(xx0<=xx1))||((xx0>0)&&(xx1>=xx0))) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if ((yy<=yy0)&&(yy<=yy1)) + { ss0=yy*xx0/yy0; + ss1=yy*xx1/yy1; + if (xx0>xx1) + document.writeln(""+_nvl(this.TooltipText,"")+""); + else + { document.writeln(""+_nvl(this.TooltipText,"")+""); + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + else if (yy<=yy0) + { ss0=yy*xx0/yy0; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else + { ss1=yy*xx1/yy1; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + else if (yy0>0) + { if (yy<=yy0) + { ss0=yy*xx0/yy0; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if (xx0>0) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else + { if (yy<=yy1) + { ss1=yy*xx1/yy1; + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + else if (xx1<0) + document.writeln(""+_nvl(this.TooltipText,"")+""); + } + } + } + document.close(); + } +} +function _PieMoveTo(theXCenter, theYCenter, theOffset) +{ var xxo=0, yyo=0, pid180=Math.PI/180, id=this.ID; + if (!isNaN(parseInt(theXCenter))) this.XCenter=theXCenter; + if (!isNaN(parseInt(theYCenter))) this.YCenter=theYCenter; + if (!isNaN(parseInt(theOffset))) this.Offset=theOffset; + if (this.Angle0this.Angle1) + { xxo=Math.sin((this.Angle0+this.Angle1+360)*pid180/2)*this.Offset; + yyo=-Math.cos((this.Angle0+this.Angle1+360)*pid180/2)*this.Offset; + } + with(_DiagramTarget.document.layers[id]) + { left=Math.round(this.XCenter-this.Radius+xxo); + top=Math.round(this.YCenter-this.Radius+yyo); + visibility="show"; + } +} \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/diagram_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/diagram_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/diagram_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,164 @@ + + + +JavaScript Diagram Builder - The Diagram object + + + + + +
+
+

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">
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 420, 360);
+D.SetBorder(10, 50, 0, 4);
+D.SetText("X-Label","Y-Label","Title");
+D.SetGridColor("#44CC44");
+D.Draw("#80FF80","#0000FF",true,"Click on me !","DiagramClick()");
+document.close();
+function DiagramClick()
+{ alert("Use your own function here."); }
+</SCRIPT> +
+
+You can use the following methods: +
    +
  • var D = new Diagram() //Constructor
  • +
  • D.SetFrame(theLeft, theTop, theRight, theBottom) //Screen
  • +
  • D.SetBorder(theLeftX, theRightX, theBottomY, theTopY) //World
  • +
  • D.SetText(theScaleX, theScaleY, theTitle) //Labels (optional)
  • +
  • D.ScreenX(theRealX) //Coordinate transformation world->screen
  • +
  • D.ScreenY(theRealY) //Coordinate transformation world->screen
  • +
  • D.RealX(theScreenX) //Coordinate transformation screen->world
  • +
  • D.RealY(theScreenY) //Coordinate transformation screen->world
  • +
  • D.GetXGrid() //returns array, which contains min, delta and max of the X grid
  • +
  • D.GetYGrid() //returns array, which contains min, delta and max of the Y grid
  • +
  • D.SetGridColor(theGridColor[, theSubGridColor]) //Colors of X and Y grid lines
  • +
  • D.SetXGridColor(theGridColor[, theSubGridColor]) //Colors of X grid lines
  • +
  • D.SetYGridColor(theGridColor[, theSubGridColor]) //Colors of Y grid lines
  • +
  • D.Draw(theDrawColor, theTextColor, isScaleText[, theTooltipText[, theOnClickAction +[, theOnMouseoverAction[, theOnMouseoutAction]]]]) //Display, +theDrawColor can be an image
  • +
  • D.SetVisibility(isVisible) //Show or Hide
  • +
  • D.SetTitle(theTitle) //TooltipText
  • +
  • D.Delete() //Delete DIV object of D from the document
  • +
  • delete D //Destructor
  • +
+Before drawing, you can set the following properties: +
    +
  • D.XScale // 0 = no scale; 1 = numeric (default); 2, 3, ... = date/time; string = numeric+unit +
    "function FunctionName" = FunctionName(ScaleValue)
  • +
  • D.YScale // 0 = no scale; 1 = numeric (default); 2, 3, ... = date/time; string = numeric+unit +
    "function FunctionName" = FunctionName(ScaleValue)
  • +
  • D.XScalePosition // "bottom" (default), "botom-left", "bottom-right", "top", "top-left", "top-right"
  • +
  • D.YScalePosition // "left" (default), "left-top", "left-bottom", "right", "right-top", "right-bottom"
  • +
  • D.XGridDelta //Grid interval in X-direction, if it is 0 (default) it will be detected automatically
  • +
  • D.YGridDelta //Grid interval in Y-direction, if it is 0 (default) it will be detected automatically
  • +
  • D.XSubGrids //Number of Sub-Grid intervals within one Grid interval in X-direction, if it is 0 (default) it will be detected automatically, if it is -1 then a logarithmic Sub-Grid will be drawn
  • +
  • D.YSubGrids //Number of Sub-Grid intervals within one Grid interval in Y-direction, if it is 0 (default) it will be detected automatically, if it is -1 then a logarithmic Sub-Grid will be drawn
  • +
  • D.Font //Text style, default = "font-family:Verdana;font-weight:normal;font-size:10pt;line-height:13pt;"
  • +
+After calling D.GetXGrid() / D.GetYGrid() you can read: +
    +
  • D.XGrid[0], D.XGrid[1] and D.XGrid[2] // min, delta and max of the X grid
  • +
  • D.YGrid[0], D.YGrid[1] and D.YGrid[2] // min, delta and max of the Y grid
  • +
+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=theTargetWindow;
+_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");
+  return("<b>"+tt[nn]+"</b>");
+}
+function NewWindow()
+{ _DiagramTarget=window.open("","",
+  "width=460,height=300,menubar=no,locationbar=no,resizable=yes,status=no,scrollbars=no");
+  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.XGridDelta=1;
+    D2.XScale="function MyXScale";
+    D2.XScalePosition="top-right";
+    D2.YSubGrids=1;
+    D2.Font="font-family:Verdana;font-weight:normal;font-size:8pt;line-height:13pt;";
+    D2.SetText("","", "Diagram with small font and function-scale");
+    D2.SetGridColor("#cccccc", "#eeddcc");
+    D2.Draw("#FFEECC", "#336699", false, "Click on me !", "opener.DiagramClick()");
+    writeln("</BODY></HTML>");
+    close();
+  }
+}
+</SCRIPT> +


+ + + +
« IntroductionThe Bar object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/dot_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/dot_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/dot_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,76 @@ + + + +JavaScript Diagram Builder - The Dot object + + + + + +
+
+

JavaScript Diagram Builder - The Dot object

+
+The Dot object is used to display a dot on the screen, especially to draw it in a diagram area. In order to +find the appropriate screen position of a dot, the diagram functions ScreenX, ScreenY, RealX and +RealY can be used. It is also possible, to move, hide and delete a dot after it has been drawn. +
+ + +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 640, 460);
+D.SetBorder(6, 18, 0, 6);
+D.XGridDelta=1;
+D.SetGridColor("#808080");
+D.Draw("#FF80FF", "#000000", false);
+var Size, Type, x;
+Color=new Array("#000000","#FF0000","#0000FF","#000000","#FF0000","#0000FF");
+for (Size=6; Size<=18; Size++)
+{ x=D.ScreenX(Size);
+  new Dot(x, D.ScreenY(0), Size, 'smile.gif', "", "Type: smile.gif, Size:"+Size);
+  for (Type=1; Type<7; Type++)
+    new Dot(x, D.ScreenY(Type), Size, Type, Color[Type-1], "Type:"+Type+", Size:"+Size);
+}
+document.close();
+</SCRIPT> +

+You can use the following methods: +
    +
  • var D = new Dot(theX, theY, theSize, theType, theColor[, theTooltipText
    +[, theOnClickAction[, theOnMouseoverAction[, theOnMouseoutAction]]]])

    //Constructor and Display, size should be 6..18, type should be 1..6 or an image
  • +
  • D.SetColor(theColor) //Color
  • +
  • D.SetVisibility(isVisible) //Show or Hide
  • +
  • D.SetTitle(theTitle) //TooltipText
  • +
  • D.MoveTo(theX, theY) //Move
  • +
  • D.Delete() //Delete DIV object of D from the document
  • +
  • delete D //Destructor
  • +

+
+ + + +
« The Box objectThe Pixel object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/download.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/download.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/download.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,26 @@ + + + +JavaScript Diagram Builder - Download + + + +
+
+

LT Diagram Builder - Download

+
+Download of v. 3.3 +

+
+ + + +
« PHP & ASPLutz Tautenhahn
© 2001-2005
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/dynamic_example.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/dynamic_example.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/dynamic_example.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,172 @@ + + + +JavaScript Diagram Builder - Dynamic example + + + + + + +
+
+

JavaScript Diagram Builder - Dynamic example

+
+
+ + + + + + + + + + + + + + + + +
x-min:x-max:y-min:y-max:
y=
+
+ +
+The diagram displays the function which you type into the input field in the specified +x and y interval.
+You can use the standard operators
+
++ - * / ( )
+
+the constants of the JavaScript Math object
+
+E LN2 LN10 LOG2E LOG10E PI SQRT1_2 SQRT2
+
+and the functions of the Math object
+
+abs acos asin atan ceil cos exp floor log max min pow random round +sin sqrt tan
+
+to define a function.
+
+When the page is loaded, first a new diagram object and new pixel objects are created:
+
+<SCRIPT Language="JavaScript">
+document.open();
+var D=new Diagram();
+D.SetFrame(60, 175, 635, 500);
+D.SetBorder(-1, 1, -1, 1);
+D.SetText("x","y", "y=f(x)");
+D.SetGridColor("#808080", "#CCCCCC");
+D.Draw("#DDDDDD", "#000000", true, "");
+var i, j, x, y;
+j= D.ScreenY(0);
+P=new Array(636);
+for (i=60; i<=635; i++)
+  P[i]=new Pixel(i, j, "#0000FF");
+document.close();
+</SCRIPT>
+
+After you click the "Draw" button, the properties of the already existing objects are changed, +to display the new function:
+
+<SCRIPT Language="JavaScript">
+function Draw()
+{ // ... some code was cutted here
+  D.SetBorder(xmin, xmax, ymin, ymax);
+  D.SetText("x", "y", "y="+document.inputform.fx.value);
+  D.SetGridColor("#808080", "#CCCCCC");
+  D.Draw("#DDDDDD", "#000000", true, "y="+document.inputform.fx.value);
+  var isEvalSafe=(window.EvalSafe)&&(EvalSafe("1+1")==2);
+  for (i=60; i<=635; i++)
+  { x = D.RealX(i);
+    if (isEvalSafe)
+    { y=EvalSafe(document.inputform.fx.value);
+      if (isNaN(parseInt(y)))
+      { alert(document.inputform.fx.value+" can not be evaluated for x="+x);
+        return;
+      }
+    }
+    else
+    { with (Math) y=eval(document.inputform.fx.value);
+    }
+    if ((ymin<=y)&&(y<=ymax)) P[i].MoveTo(i, D.ScreenY(y));
+    else P[i].SetVisibility(false);
+  }
+}
+</SCRIPT>
+The above example will only work correctly with IE 5.x or Netscape 6.x. However, instead of dynamically changing +the properties of the objects you can use two frames - the first for the input and the second for the diagram. +After clicking the "Draw" button the first frame writes the parameters to variables in the parent window and reloads +the second frame (use location.href=url, not history.go(0)!), which reads the variables from the parent window and +draws the diagram and function corresponding to the parameters.
+This will work with all browsers. +
+

+ + + + +
« Static ExampleIframe Example »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/evalsafe.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/evalsafe.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/evalsafe.js 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,11 @@ +function EvalSafe(ss) +{ var jj=""; + if (ss.indexOf("^")>=0) return(""); + try + { with (Math) jj=eval(ss); + } + catch(error) + { return(""); + } + return(jj); +} Index: openacs-4/packages/diagram/www/resources/diagram/evalsave.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/evalsave.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/evalsave.js 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,10 @@ +function EvalSave(ss) +{ var jj=""; + try + { with (Math) jj=eval(ss); + } + catch(error) + { return(""); + } + return(jj); +} Index: openacs-4/packages/diagram/www/resources/diagram/fx_display.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/fx_display.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/fx_display.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,41 @@ + + + +JavaScript Diagram Builder + + + + + + +
+ + + Index: openacs-4/packages/diagram/www/resources/diagram/fx_input.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/fx_input.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/fx_input.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,50 @@ + + + +JavaScript Diagram Builder + + + +
+ + + + + + + + + + + + + + + + +
x-min:x-max:y-min:y-max:
y=
+
+ + + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/fx_main.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/fx_main.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/fx_main.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,16 @@ + + + +JavaScript Diagram Builder + + + + + + + + + + Index: openacs-4/packages/diagram/www/resources/diagram/h_blue.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/h_blue.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/h_green.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/h_green.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/h_orange.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/h_orange.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/h_red.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/h_red.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/iframe_example.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/iframe_example.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/iframe_example.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,55 @@ + + + +JavaScript Diagram Builder - Iframe Example + + + + + +
+ +

JavaScript Diagram Builder - Iframe Example

+By using an iframe as _DiagramTarget you can put a diagram to a relative position within a +webpage (for instance after text 1 and before text 2). With this there is no need anymore to use absolute positioned +divs to keep the text outside of the diagram area. Test it by altering the width of your window and see +how the diagram moves and does not overlap with the text. However take care: Although they belong to the +HTML 4.0 standard, iframes are by now not supported by all web browsers. +
+ + +
+This diagram was generated by
+<iframe frameborder=0 scrolling="no" width=400 height=240 name="F1"></iframe>
+<SCRIPT Language="JavaScript">
+_DiagramTarget=window.frames["F1"];
+_DiagramTarget.document.open();
+_DiagramTarget.document.writeln("<html><head></head><body bgcolor='#eeeeee'>");
+var D=new Diagram();
+D.SetFrame(70, 30, 380, 200);
+D.SetBorder(10, 50, 0, 4);
+D.SetText("X-Label","Y-Label","Title");
+D.Draw("#80FF80","#0000FF",true,"Click on me !","parent.F1DiagramClick()");
+_DiagramTarget.document.writeln("</body></html>");
+_DiagramTarget.document.close();
+function F1DiagramClick(){ alert("Use your own function here."); }
+</SCRIPT>
+
+ + + +
« Dynamic ExampleRelative Position »
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/index.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/index.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,26 @@ + + + +JavaScript Diagram Builder + + + + + + + + + + Index: openacs-4/packages/diagram/www/resources/diagram/introduction.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/introduction.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/introduction.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,54 @@ + + + +JavaScript Diagram Builder - Introduction + + + +
+
+

JavaScript Diagram Builder - Introduction

+
+The JavaScript Diagram Builder v. 3.3 is a library of some objects and functions, which can help you to display +a coordinate diagram (resp. a chart or graph) in your webpage in an easy way. The file 'diagram.js' contains all the necessary objects and functions. +This file must be included in the header of your webpage:

+<SCRIPT Language="JavaScript" src="diagram.js"></SCRIPT>

+The script will best work with Microsoft Internet Explorer 5.x, Netscape 6.x, Opera 7.x or Konqueror 3.x under Windows and +Linux, but it will also work with Netscape 4.x and Opera 5.x under Windows and Linux with some restrictions.

+The JavaScript Diagram Builder is especially useful, if you want to display a coordinate diagram (chart or graph) which depends +on the client's input parameter or from data of a database.
+
+The JavaScript Diagram Builder v. 3.3 is copyrighted freeware. It is provided "as is", without a warranty of any kind. +If you encounter any bugs, or if you have any suggestions for further versions, then send me an email.
+
+Here is the history of new features:
    +
  • object 'Line' and object 'Area' available (v. 2.4)
  • +
  • draw scale with unit (v. 2.4)
  • +
  • define target window for the diagram (v. 2.4)
  • +
  • get grid values without drawing the diagram (v. 2.4)
  • +
  • scale text can be defined as function of scale values (v. 2.5)
  • +
  • grid lines can be drawn (v. 2.5)
  • +
  • scale interval (and consequently number of scale lines) can be defined (v. 2.5)
  • +
  • font can be changed for diagram scale, Bar- and Box-objects (v. 2.5)
  • +
  • sub-grid lines can be drawn (v. 2.6)
  • +
  • the code is conform with XHTML 1.0 standard (v. 2.7)
  • +
  • method SetColor available for all objects (v. 2.8)
  • +
  • script file is splitted into browser specific parts (v. 2.8)
  • +
  • object 'Arrow' available (v. 2.9)
  • +
  • image can be used as type of a 'Dot' object (v. 2.9)
  • +
  • PHP and ASP versions of the script available! (v. 3.0)
  • +
  • method of Diagram object 'SetGridColor' should be used for compatibility (v. 3.0)
  • +
  • method of Diagram object 'SetGridColor' should be used for compatibility (v. 3.0)
  • +
  • grid color and scale position for X and Y can be specified (v. 3.1)
  • +
  • image can be used for theDrawColor of Diagram object and Text of Bar/Box (v. 3.1)
  • +
  • logarithmic scale can be drawn (v. 3.2)
  • +
  • object 'Pie' available, onMouseOver and onMouseOut can be used (v. 3.3)
  • +
+

+
+ + + +
Lutz Tautenhahn
© 2001-2005
The Diagram object »
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/line_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/line_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/line_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,90 @@ + + + +JavaScript Diagram Builder - The Line object + + + + + +
+
+

JavaScript Diagram Builder - The Line object

+
+The Line object is used to display a line on the screen, especially to draw it in a diagram area. It is +possible to hide, move and delete a line after it has been drawn. Unlike in older versions, the images +o_rrggbb.gif are no longer required to draw Line objects. +
+ + +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+function Fahrenheit(vv){ return("<nobr>"+Math.round(vv*18+320)/10+"� F</nobr>"); }
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 520, 360);
+D.SetBorder(6, 18, 20, 30);
+D.SetText("","", "temperature measured during the day");
+D.XScale=" h";
+D.YScale="� C";
+D.SetGridColor("#cccccc");
+D.Draw("#FFEECC", "#663300", false);
+var t, T0, T1;
+D.GetYGrid();
+_BFont="font-family:Verdana;font-size:10pt;line-height:13pt;";
+for (t=D.YGrid[0]; t<=D.YGrid[2]; t+=D.YGrid[1])
+  new Bar(D.right+6, D.ScreenY(t)-8, D.right+6, D.ScreenY(t)+8, "", Fahrenheit(t), "#663300");
+T1=22;
+for (t=6; t<18; t++)
+{ T0=T1;
+  T1=23-4*Math.cos(t/4)+Math.random();
+  new Line(D.ScreenX(t), D.ScreenY(T0), D.ScreenX(t+1), D.ScreenY(T1), "#cc9966", 2, "temperature");
+}
+document.close();
+</SCRIPT> +

+You can use the following methods: +
    +
  • var L = new Line(theX0, theY0, theX1, theY1, theColor[, theSize[, theTooltipText[,
    +theOnClickAction [, theOnMouseoverAction[, theOnMouseoutAction]]]]])
    +//Constructor and Display
  • +
  • L.SetColor(theColor) //Color
  • +
  • L.SetVisibility(isVisible) //Show or Hide
  • +
  • L.SetTitle(theTitle) //TooltipText
  • +
  • L.MoveTo(theLeft, theTop) //Move
  • +
  • L.ResizeTo(theX0, theY0, theX1, theY1) //Resize
  • +
  • L.Delete() //Delete DIV object of L from the document
  • +
  • delete L //Destructor
  • +

+
+ + + +
« The Pixel objectThe Area object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/linreg_display.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/linreg_display.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/linreg_display.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,75 @@ + + + +JavaScript Diagram Builder + + + + + + +
+ + + Index: openacs-4/packages/diagram/www/resources/diagram/linreg_input.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/linreg_input.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/linreg_input.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,32 @@ + + + +JavaScript Diagram Builder + + + +
+ + + + + + + +
x:y:
+
+ + + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/linreg_main.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/linreg_main.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/linreg_main.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,17 @@ + + + +JavaScript Diagram Builder - Linear Regression Example + + + + + + + + + + Index: openacs-4/packages/diagram/www/resources/diagram/logarithmic_scale.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/logarithmic_scale.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/logarithmic_scale.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,87 @@ + + + +JavaScript Diagram Builder - Logarithmic Example + + + + + +
+
+

JavaScript Diagram Builder - Logarithmic Scale Example

+
+To draw a coordinate diagram with a logarithmic scale, define a function-scale (like shown in the example below) +and use GridDelta=1 (increasing values) +or GridDelta=-1 (decreasing values) and use SubGrids=-1 to get a logatithmic sub-grid. Use the logarithmic values in the +functions SetBorder and ScreenX or ScreenY, as it is shown below. +
+ +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+Hosts=new Array(28174, 80000, 290000, 500000, 727000, 1200000, 2217000, 4852000, 9472000,
+16146000, 29670000, 43230000, 72398092, 109574429, 147344723);
+function LogScale(vv)
+{ if ((vv>3)||(vv<-3)) return("10<sup>"+vv+"</sup>");
+  if (vv>=0) return(Math.round(Math.exp(vv*Math.LN10)));
+  else return(1/Math.round(Math.exp(-vv*Math.LN10)));
+}
+document.open();
+var D=new Diagram();
+D.SetFrame(100, 140, 580, 460);
+D.SetBorder(1988, 2002, Math.log(Hosts[0])/Math.LN10, Math.log(Hosts[14])/Math.LN10);
+D.SetText("Year", "Hosts", "<B>Internet growth</B>");
+D.XGridDelta=2;
+D.XSubGrids=2;
+D.YGridDelta=1;
+D.YSubGrids=-1;
+D.YScale="function LogScale";
+D.SetGridColor("#FFFFFF", "#EEEEEE");
+D.Draw("#DDDDDD", "#000000", true);
+for (var n=1; n<Hosts.length; n++)
+{ new Line(D.ScreenX(1987+n), D.ScreenY(Math.log(Hosts[n-1])/Math.LN10),
+           D.ScreenX(1988+n), D.ScreenY(Math.log(Hosts[n])/Math.LN10), "#0000ff", 2, "internet hosts");
+}
+for (n=0; n<Hosts.length; n++)
+{ new Dot(D.ScreenX(1988+n), D.ScreenY(Math.log(Hosts[n])/Math.LN10), 10, 1, "#ff0000",
+          eval(1988+n)+": "+Hosts[n]+" hosts");
+}
+document.close();
+</SCRIPT> +

+
+ + + +
« Relative PositionBrowser Support »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/menu.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/menu.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/menu.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,38 @@ + + + +JavaScript Diagram Builder - Menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

JavaScript Diagram Builder 3.3


Introduction

The Diagram object
The Bar object
The Box object
The Dot object
The Pixel object
The Line object
The Area object
The Arrow object
The Pie object

Static example
Dynamic example
Iframe example
Relative position
Logarithmic scale

Browser support

PHP & ASP

Download

Lutz Tautenhahn
© 2001-2005
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/o_000000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/o_000000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/o_0000ff.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/o_0000ff.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/o_ff0000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/o_ff0000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/p_000000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/p_000000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/p_0000ff.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/p_0000ff.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/p_ff0000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/p_ff0000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/php_and_asp.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/php_and_asp.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/php_and_asp.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,13 @@ + + + +JavaScript Diagram Builder - PHP & ASP + + + + + + + + + Index: openacs-4/packages/diagram/www/resources/diagram/php_and_asp_menu.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/php_and_asp_menu.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/php_and_asp_menu.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,42 @@ + + + +JavaScript Diagram Builder - PHP and ASP Menu + + + + + + + +
« Browser Support + +Download »
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/php_and_asp_versions.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/php_and_asp_versions.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/php_and_asp_versions.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,217 @@ + + + +JavaScript Diagram Builder - PHP & ASP versions + + + +
+

LT Diagram Builder - PHP & ASP versions

+
+Since version 3.0 you can generate images of coordinate diagrams (resp. charts or graphs) at serverside (using PHP or ASP) +and save it as file or send it back as a stream. These 2 versions are independent from the clientside JavaScript version +of the script. The method calls of the 2 scripts are very similar to the method calls of the JavaScript version. +However, the methods for changing the properties of objects (MoveTo, ResizeTo, SetColor, etc.) are not available, +because it is not possible to change these properties after the image has been created. Because of this, the bar, box, dot, +pixel, line, area, arrow and pie objects in the JavaScript version, are methods of the diagram object in the PHP and ASP version. +The usage of the script versions is shown in the following table:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Include the script file
JavaScript<SCRIPT Language="JavaScript" src="diagram.js"></SCRIPT>
PHPinclude ("diagram.php");
ASP<!--#include file="diagram.asp"-->
Generate a new diagram
JavaScript +//_DiagramTarget=window; //only necessary, if the target is not the current window
+D=new Diagram();
PHP$D=new Diagram();
+$D->Img=@ImageCreate(480, 320) or die("Cannot create a new GD image.");
+ImageColorAllocate($D->Img, 255, 255, 255); //background color
ASP +Set D=New Diagram
+Set D.Img=CreateObject("gdImage.Images.1")
+D.Img.ImageCreate 480, 320
+D.Img.ImageColorAllocate 0,255,255,255 'Background Color +
Add a bar, box, dot, etc...
JavaScript +new Bar(10, 20, 80, 40, "#ff0000", "This is Text", "#000000", "This is TooltipText", "alert(\"This is onClick event.\")");
PHP +$D->Bar(10, 20, 80, 40, "#ff0000", "This is Text", "#000000", "This is TooltipText", "alert(\"This is onClick event.\")");
ASP +D.Bar 10, 20, 80, 40, "#ff0000", "This is Text", "#000000", "This is TooltipText", "alert(""This is onClick event."")"
Save the image as file
JavaScript//not available and not necessary
PHP +ImagePng($D->Img, "my_image.png");
+ImageDestroy($D->Img);
ASP +D.Img.ImagePng 0, Server.mappath("my_image.png")
+D.Img.ImageDestroy 0
+Set D.Img=Nothing
Send the image from the server back to the client as a stream
JavaScript//not available and not necessary
PHP +header("Content-type: image/png");
+ImagePng($D->Img);
+ImageDestroy($D->Img);
ASP +'There is no direct support but you can get it working this way:
+Set objFS=Server.CreateObject("Scripting.FileSystemObject")
+FN = objFS.GetTempName()
+FN=Server.mappath(FN)
+D.Img.ImagePng 0, FN
+Set objStream = Server.CreateObject("ADODB.Stream")
+objStream.Charset = "x-ansi"
+objStream.Type = 2
+objStream.Open
+objStream.LoadFromFile FN
+Response.ContentType = "image/png"
+Response.AddHeader "Content-Disposition","filename=image.png"
+objStream.Position = 0
+objStream.Type = 1
+Response.BinaryWrite objStream.Read()
+objStream.Close
+Set objStream = Nothing
+objFS.DeleteFile FN, false
+Set objFS=Nothing
+D.Img.ImageDestroy 0
+Set D.Img=Nothing
+ +

Differences between JavaScript version and +PHP/ASP version

+In JavaScript you can use code like
+ +D.Font="font-family:Verdana;font-weight:normal;font-size:10pt;line-height:13pt;";
+_BFont="font-family:Verdana;font-weight:bold;font-size:10pt;line-height:13pt;";
+
+to set the font for the Diagram object or the Bar/Box object.
+In PHP (ASP) you will use code like
+$D->Font=4; D.Font=4
+$D->BFont=5; D.BFont=5
+to set the font(1..5) for the Diagram object or the Bar/Box object.
+You can set the font of the bar and box object BFont to -1..-5 for vertical text.
+For vertical text of the X-axis use a Font value from -1..-5.
+
+In JavaScript you can use the result of the predefined JavaScript function
+Date.UTC(2001,0,1,0,0,0); //date/time: year, month(0..11), day, hour, min, sec
+as argument for the SetBorder method of a diagram with date/time scale.
+In PHP (ASP) you can use the function
+UTC(2001,1,1,0,0,0); UTC(2001,1,1,0,0,0) //date/time: year, month(1..12), day, hour, min, sec
+which is defined in the script file diagram.php diagram.asp.
+Take care with the difference in the argument for the month! + +
+

PHP version

+You can use the following methods: +
    +
  • $D=new Diagram() //Constructor
  • +
  • $D->SetFrame($theLeft, $theTop, $theRight, $theBottom) //Screen
  • +
  • $D->SetBorder($theLeftX, $theRightX, $theBottomY, $theTopY) //World
  • +
  • $D->SetText($theScaleX, $theScaleY, $theTitle) //Labels (optional)
  • +
  • $D->ScreenX($theRealX) //Coordinate transformation world->screen
  • +
  • $D->ScreenY($theRealY) //Coordinate transformation world->screen
  • +
  • $D->RealX($theScreenX) //Coordinate transformation screen->world
  • +
  • $D->RealY($theScreenY) //Coordinate transformation screen->world
  • +
  • $D->GetXGrid() //returns array, which contains min, delta and max of the X grid
  • +
  • $D->GetYGrid() //returns array, which contains min, delta and max of the Y grid
  • +
  • $D->SetGridColor($theGridColor[, $theSubGridColor]) //Colors of X and Y grid lines
  • +
  • $D->SetXGridColor($theGridColor[, $theSubGridColor]) //Colors of X grid lines
  • +
  • $D->SetYGridColor($theGridColor[, $theSubGridColor]) //Colors of Y grid lines
  • +
  • $D->Draw($theDrawColor, $theTextColor, $isScaleText[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]]) //Display
  • +
+Before drawing, you can set the following properties: +
    +
  • $D->XScale // 0 = no scale; 1 = numeric (default); 2, 3, ... = date/time; string = numeric+unit +
    "function FunctionName" = FunctionName(ScaleValue)
  • +
  • $D->YScale // 0 = no scale; 1 = numeric (default); 2, 3, ... = date/time; string = numeric+unit +
    "function FunctionName" = FunctionName(ScaleValue)
  • +
  • $D->XScalePosition // "bottom" (default), "botom-left", "bottom-right", "top", "top-left", "top-right"
  • +
  • $D->YScalePosition // "left" (default), "left-top", "left-bottom", "right", "right-top", "right-bottom"
  • +
  • $D->XGridDelta //Grid interval in X-direction, if it is 0 (default) it will be detected automatically
  • +
  • $D->YGridDelta //Grid interval in Y-direction, if it is 0 (default) it will be detected automatically
  • +
  • $D->XSubGrids //Number of Sub-Grid intervals within one Grid interval in X-direction, if it is 0 (default) it will be detected automatically, if it is -1 then a logarithmic Sub-Grid will be drawn
  • +
  • $D->YSubGrids //Number of Sub-Grid intervals within one Grid interval in Y-direction, if it is 0 (default) it will be detected automatically, if it is -1 then a logarithmic Sub-Grid will be drawn
  • +
  • $D->Font //Text style for scale text (1..5), default=4
  • +
  • $D->BFont //Text style for bar and box text (1..5), default=5
  • +
+After calling $D->GetXGrid() / $D->GetYGrid() you can read: +
    +
  • $D->XGrid[0], $D->XGrid[1] and $D->XGrid[2] // min, delta and max of the X grid
  • +
  • $D->YGrid[0], $D->YGrid[1] and $D->YGrid[2] // min, delta and max of the Y grid
  • +
+For the display of data you can use the following methods: +
    +
  • $D->Bar($theLeft, $theTop, $theRight, $theBottom, $theDrawColor[, $theText[, $theTextColor[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]]]])
  • +
  • $D->Box($theLeft, $theTop, $theRight, $theBottom, $theDrawColor[, $theText[, $theTextColor[, $theBorderWidth[, $theBorderColor[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]]]]]])
  • +
  • $D->Dot($theX, $theY, $theSize, $theType, $theColor[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]])
  • +
  • $D->Pixel($theX, $theY, $theColor)
  • +
  • $D->Line($theX0, $theY0, $theX1, $theY1, $theColor[, $theSize[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]]])
  • +
  • $D->Area($theX0, $theY0, $theX1, $theY1, $theColor[, $theBase[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]]])
  • +
  • $D->Arrow($theX0, $theY0, $theX1, $theY1, $theColor[, $theSize[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]]])
  • +
  • $D->Pie($theXCenter, $theYCenter, $theOffset, $theRadius, $theAngle0, $theAngle1, $theColor[, $theTooltipText[, $theOnClickAction[, $theOnMouseoverAction[, $theOnMouseoutAction]]]])
  • +
+ +
+

ASP version - VBScript language

+You can use the following methods: +
    +
  • D=New Diagram 'Constructor
  • +
  • D.SetFrame theLeft, theTop, theRight, theBottom 'Screen
  • +
  • D.SetBorder theLeftX, theRightX, theBottomY, theTopY 'World
  • +
  • D.SetText theScaleX, theScaleY, theTitle 'Labels (optional)
  • +
  • D.ScreenX(theRealX) 'Coordinate transformation world->screen
  • +
  • D.ScreenY(theRealY) 'Coordinate transformation world->screen
  • +
  • D.RealX(theScreenX) 'Coordinate transformation screen->world
  • +
  • D.RealY(theScreenY) 'Coordinate transformation screen->world
  • +
  • D.GetXGrid 'returns array, which contains min, delta and max of the X grid
  • +
  • D.GetYGrid 'returns array, which contains min, delta and max of the Y grid
  • +
  • D.SetGridColor theGridColor, theSubGridColor 'Colors of X and Y grid lines
  • +
  • D.SetXGridColor theGridColor, theSubGridColor 'Colors of X grid lines
  • +
  • D.SetYGridColor theGridColor, theSubGridColor 'Colors of Y grid lines
  • +
  • D.Draw theDrawColor, theTextColor, isScaleText, theTooltipText, theEventActions 'Display
  • +
+Before drawing, you can set the following properties: +
    +
  • D.XScale ' 0 = no scale; 1 = numeric (default); 2, 3, ... = date/time; string = numeric+unit +
    "function FunctionName" = FunctionName(ScaleValue)
  • +
  • D.YScale ' 0 = no scale; 1 = numeric (default); 2, 3, ... = date/time; string = numeric+unit +
    "function FunctionName" = FunctionName(ScaleValue)
  • +
  • D.XScalePosition // "bottom" (default), "botom-left", "bottom-right", "top", "top-left", "top-right"
  • +
  • D.YScalePosition // "left" (default), "left-top", "left-bottom", "right", "right-top", "right-bottom"
  • +
  • D.XGridDelta 'Grid interval in X-direction, if it is 0 (default) it will be detected automatically
  • +
  • D.YGridDelta 'Grid interval in Y-direction, if it is 0 (default) it will be detected automatically
  • +
  • D.XSubGrids 'Number of Sub-Grid intervals within one Grid interval in X-direction, if it is 0 (default) it will be detected automatically, if it is -1 then a logarithmic Sub-Grid will be drawn
  • +
  • D.YSubGrids 'Number of Sub-Grid intervals within one Grid interval in Y-direction, if it is 0 (default) it will be detected automatically, if it is -1 then a logarithmic Sub-Grid will be drawn
  • +
  • D.Font 'Text style for scale text (1..5), default=4
  • +
  • D.BFont 'Text style bar and box text (1..5), default=5
  • +
+After calling D.GetXGrid / D.GetYGrid you can read: +
    +
  • D.XGrid(0), D.XGrid(1) and D.XGrid(2) ' min, delta and max of the X grid
  • +
  • D.YGrid(0), D.YGrid(1) and D.YGrid(2) ' min, delta and max of the Y grid
  • +
+For the display of data you can use the following methods: +
    +
  • D.Bar theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor, theTooltipText, theEventActions
  • +
  • D.Box theLeft, theTop, theRight, theBottom, theDrawColor, theText, theTextColor, theBorderWidth, theBorderColor, theTooltipText, theEventActions
  • +
  • D.Dot theX, theY, theSize, theType, theColor, theTooltipText, theEventActions
  • +
  • D.Pixel theX, theY, theColor
  • +
  • D.Line theX0, theY0, theX1, theY1, theColor, theSize, theTooltipText, theEventActions
  • +
  • D.Area theX0, theY0, theX1, theY1, theColor, theBase, theTooltipText, theEventActions
  • +
  • D.Arrow theX0, theY0, theX1, theY1, theColor, theSize, theTooltipText, theEventActions
  • +
  • D.Pie theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1, theColor, theTooltipText, theEventActions
  • +
+For theEventActions use either theOnClickAction or
+Array(theOnClickAction, theOnMouseoverAction, theOnMouseoutAction)
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/pi.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/pi.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/pie_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/pie_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/pie_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,69 @@ + + + +JavaScript Diagram Builder - The Pie object + + + + + +
+
+

JavaScript Diagram Builder - The Pie object

+
+The Pie object is used to display an filled arc on the screen. It is possible to hide, move and delete it after +it has been drawn. +
+ + +
+This diagram was generated by
+<SCRIPT Language="JavaScript">
+P=new Array();
+document.open();
+P[0]=new Pie(100,240,10,80,0*3.6,10*3.6,"#ff6060");
+P[1]=new Pie(100,240,0,80,10*3.6,40*3.6,"#ffa000");
+P[2]=new Pie(100,240,0,80,40*3.6,100*3.6,"#f6f600");
+new Bar(200,190,280,210,"#ff6060","Apples","#000000","", "void(0)","MouseOver(0)","MouseOut(0)");
+new Bar(200,230,280,250,"#ffa000","Oranges","#000000","", "void(0)","MouseOver(1)","MouseOut(1)");
+new Bar(200,270,280,290,"#f6f600","Bananas","#000000","", "void(0)","MouseOver(2)","MouseOut(2)");
+document.close();
+function MouseOver(i) { P[i].MoveTo("","",10); }
+function MouseOut(i) { P[i].MoveTo("","",0); }
+</SCRIPT> +
+
+

+You can use the following methods: +
    +
  • var P = new Pie(theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1, theColor[,
    +theTooltipText[, theOnClickAction[, theOnMouseoverAction[, theOnMouseoutAction]]]])

    +//Constructor and Display
  • +
  • P.SetColor(theColor) //Color
  • +
  • P.SetVisibility(isVisible) //Show or Hide
  • +
  • P.SetTitle(theTitle) //TooltipText
  • +
  • P.MoveTo(theXCenter, theYCenter, theOffset) //Move
  • +
  • P.ResizeTo(theXCenter, theYCenter, theOffset, theRadius, theAngle0, theAngle1) //Resize
  • +
  • P.Delete() //Delete DIV object of P from the document
  • +
  • delete P //Destructor
  • +

+
+ + + +
« The Arrow objectStatic example »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/pixel_object.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/pixel_object.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/pixel_object.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,102 @@ + + + +JavaScript Diagram Builder - The Pixel object + + + + + +
+
+

JavaScript Diagram Builder - The Pixel object

+
+The Pixel object is used to display a pixel on the screen, especially to draw it in a diagram area. In order to +find the appropriate screen position of a pixel, the diagram functions ScreenX, ScreenY, RealX and +RealY can be used. It is also possible, to move, hide and delete a pixel after it has been drawn. Take care +not to draw too many pixels, because this will slow down your webpage. +
+ +
+This diagram was generated by

+<SCRIPT Language="JavaScript">
+function MyXScale(xx)
+{ var vv=Math.round(xx*4/Math.PI);
+  if (vv==0) return(0);
+  if (vv==4) return("<img src=\"pi.gif\">");
+  if (vv==8) return("2 <img src=\"pi.gif\">");
+  if (vv%2==0) return(eval(vv/2)+"/2 <img src=\"pi.gif\">");
+  return(vv+"/4 <img src=\"pi.gif\">");
+}
+document.open();
+var D=new Diagram();
+D.SetFrame(80, 160, 540, 460);
+D.SetBorder(0, eval(2*Math.PI), -1, 1);
+D.SetText("", "", "<B>some functions</B>");
+D.XGridDelta=Math.PI/4;
+D.XScale="function MyXScale";
+D.YGridDelta=0.2;
+D.YSubGrids=2;
+D.SetGridColor("#FFFFFF", "#EEEEEE");
+D.Draw("#DDDDDD", "#000000", false);
+var i, j, x;
+for (i=80; i<=540; i++)
+{ x = D.RealX(i);
+  j= D.ScreenY(Math.sin(x));
+  new Pixel(i, j, "#FF0000");
+  j= D.ScreenY(Math.cos(x));
+  new Pixel(i, j, "#0000FF");
+}
+new Bar(560, 200, 680, 220, "#0000FF", "f(x)=cos(x)", "#FFFFFF");
+new Bar(560, 260, 680, 280, "#FF0000", "f(x)=sin(x)", "#000000");
+document.close();
+</SCRIPT> +

+You can use the following methods: +
    +
  • var P = new Pixel(theX, theY, theColor) //Constructor and Display
  • +
  • P.SetColor(theColor) //Color
  • +
  • P.SetVisibility(isVisible) //Show or Hide
  • +
  • P.MoveTo(theX, theY) //Move
  • +
  • P.Delete() //Delete DIV object of P from the document
  • +
  • delete P //Destructor
  • +

+
+ + + +
« The Dot objectThe Line object »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/q_000000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/q_000000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/q_0000ff.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/q_0000ff.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/q_ff0000.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/q_ff0000.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/relative_position.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/relative_position.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/relative_position.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,50 @@ + + + +JavaScript Diagram Builder - Relative Positionierung + + + + + +
+ +

JavaScript Diagram Builder - Relative Position

+By including the diagram code between <div style='position:relative; top:0px; height:220px'> and </div> +you can put a diagram to a relative position in a web page also without using of iframes (for instance after text 1 and before text 2). +The values for the vertical positions of the diagram objects are with regard to the covering div. Instead of height:220px +you should use the height, which is required by the diagram. In this way diagrams can be inserted directly between text blocks +of a web page. Test it by altering the width of your window and see how the diagram moves and does not overlap with the text. +This method does not work with the old browser Netscape 4.7, which however is almost no more used. +
+
+ +
+
+This diagram was generated by
+<div style='position:relative; top:0px; height:220px'>
+<SCRIPT Language="JavaScript">
+var D=new Diagram();
+D.SetFrame(70, 30, 380, 200);
+D.SetBorder(10, 50, 0, 4);
+D.Draw("#80FF80","#0000FF",false);
+for (var i=15; i<50; i+=5)
+  new Bar(D.ScreenX(i)-10, D.ScreenY(i%3+1), D.ScreenX(i)+10, D.ScreenY(0), "#00cccc");
+</SCRIPT>
+</div>
+
+ + + +
« Dynamic ExampleLogarithmic Scale Example »
+ + + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/showline.htm =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/showline.htm,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/showline.htm 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,54 @@ + + + + + + + + +
+
+Apples +Oranges +Bananas +
+ + + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/smile.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/smile.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/static_example.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/static_example.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/static_example.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,171 @@ + + + +JavaScript Diagram Builder - Static example + + + + + +
+
+

JavaScript Diagram Builder - Static Example

+
+The diagrams on this page are static in a sense, that after the objects are created, they are never changed. +Here are shown several date scales, which can be in the range from seconds up to years. +Unfortunately, there are many different date formats in the world (for instance day.month, day-month, +month/day). If you want to use another date format, then you can add it to the function _DateFormat() +in the file 'diagram.js'. +
+ +
+Code example for a diagram with date scale:

+<SCRIPT Language="JavaScript">
+D=new Diagram();
+...
+D.SetBorder(
+Date.UTC(2001,0,1,0,0,0), //date/time (left): year, month(0..11), day, hour, min, sec
+Date.UTC(2001,11,31,23,59,59), //date/time (right): year, month(0..11), day, hour, min, sec
+0, 1); //any y scale
+//change the scale type from default=1 into 2 or higher before drawing:
+D.XScale=2; //2,3,4=predefined date scales; 5,6,..=userdefined date scales
+...
+//get the screen position of a date/time for the display of bars, dots or pixels:
+var x=D.ScreenX(Date.UTC(2001,10,11,11,11,0));
+...
+</SCRIPT>
+
+ + + +
« The Pie objectDynamic Example »
+
+ + \ No newline at end of file Index: openacs-4/packages/diagram/www/resources/diagram/transparent.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/transparent.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/v_blue.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/v_blue.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/v_green.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/v_green.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/v_orange.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/v_orange.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/v_red.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/v_red.gif,v diff -u -N Binary files differ Index: openacs-4/packages/diagram/www/resources/diagram/zoom_line.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/diagram/www/resources/diagram/zoom_line.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/diagram/www/resources/diagram/zoom_line.html 10 Jan 2006 07:34:16 -0000 1.1 @@ -0,0 +1,87 @@ + + + +JavaScript Diagram Builder - The Line object + + + + + +
+ + + + \ No newline at end of file