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.Legend#
+ @elements.label;noquote@
+ |
+ + 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: + +
+
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. +
+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.
+
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. +
+CSVIn order to make this builder easier to be extended the Javascript specific +parts have to be removed: +
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.
+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.
+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: +
+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. + |
« The Line object | +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. + |
« The Area object | +The Pie 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. + |
« The Diagram object | +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 "". + |
« The Bar object | +The Dot object » | +
+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. + |
+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 Example | +PHP & ASP » | +
"+l+" |
"+l+" |
"+l+" |
"+l+" |
"+l+" |
"+l+" |
"+l+" |
"+l+" |
"+this.title+" |
"+this.title+" |
"+this.title+" |
"+this.title+" |
"+tt+" |
"+tt+" |
"+tt+" |
"+tt+" |
"+tt+" |
"+tt+" |
"+tt+" |
"+tt+" |
+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. + |
« Introduction | +The Bar 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. + |
« The Box object | +The Pixel object » | +
+LT Diagram Builder - Download+ |
+Download of v. 3.3
|
« PHP & ASP | +Lutz Tautenhahn © 2001-2005 |
+
+JavaScript Diagram Builder - Dynamic example+ |
++ - * / ( )+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.
+
« Static Example | +Iframe Example » | +
« Dynamic Example | +Relative Position » | +
+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:
|
Lutz Tautenhahn © 2001-2005 |
+The Diagram 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. + |
« The Pixel object | +The Area object » | +
+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. + |
« Relative Position | +Browser Support » | +
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 |
« Browser Support | ++ + | +Download » | +
+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: + + +
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: +
+ ASP version - VBScript language+You can use the following methods: +
+Array(theOnClickAction, theOnMouseoverAction, theOnMouseoutAction) + |
+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. + |
« The Arrow object | +Static example » | +
+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. + |
« The Dot object | +The Line object » | +
« Dynamic Example | +Logarithmic Scale 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'. + |
« The Pie object | +Dynamic Example » | +