Private Functions | |
private int | _check_data |
Check the internal data to be displayed. | |
private int | _draw |
Plot the chart to the gd object Calls:. | |
private int | _set_colors |
specify my colors | |
private int | _draw_title |
draw the title for the chart | |
private int | _default_f_tick |
default tick conversion function This function is pointed to be $self->{f_x_tick} resp. | |
private int | _init (scalar x, scalar y) |
Initialize all default options here. | |
private int | _copy_data (scalar extern_ref) |
Copy external data via a reference to internal memory. | |
private int | _color_role_to_index (\list list_of_roles) |
private array | _color_spec_to_rgb (scalar role, scalar spec) |
Return an array (list of) rgb values for spec. | |
private int | _draw_sub_title () |
draw the sub-title for the chart | |
private int | _sort_data () |
sort the data nicely (mostly for the pareto charts and xy-plots) | |
private int | _find_x_scale () |
For a xy-plot do the same for the x values, as '_find_y_scale' does for the y values! | |
private int | _find_y_scale () |
find good values for the minimum and maximum y-value on the chart | |
private | _calcTickInterval (scalar dataset_min, scalar dataset_max, scalar flag_fixed_min, scalar flag_fixed_max, scalar minTicks, scalar maxTicks) |
Calculate the Interval between ticks in y direction. | |
private int | _calcXTickInterval (scalar min, scalar max, scalar minF, scalar maxF, scalar minTicks, scalar maxTicks) |
Calculate the Interval between ticks in x direction. | |
private int | _countTicks (scalar min, scalar max, scalar interval) |
Works out how many ticks would be displayed at that interval. | |
private int | _round2Tick (scalar input, scalar interval, scalar roundUP) |
Rounds up or down to the next tick of interval size. | |
private array | _sepFP (scalar num) |
Seperates a number into it's base 10 floating point exponent & mantisa. | |
private array | _find_y_range () |
Find minimum and maximum value of y data sets. | |
private array | _find_x_range () |
Find minimum and maximum value of x data sets. | |
private int | _plot () |
main sub that controls all the plotting of the actual chart | |
private int | _draw_legend () |
let the user know what all the pretty colors mean. | |
private int | _draw_bottom_legend () |
put the legend on the bottom of the chart | |
private int | _draw_right_legend () |
put the legend on the right of the chart | |
private int | _draw_top_legend () |
put the legend on top of the chart | |
private int | _draw_left_legend () |
put the legend on the left of the chart | |
private int | _draw_none_legend () |
no legend to draw. | |
private int | _draw_x_label () |
draw the label for the x-axis | |
private int | _draw_y_label () |
draw the label for the y-axis | |
private int | _draw_ticks () |
draw the ticks and tick labels | |
private int | _draw_x_number_ticks () |
draw the ticks and tick labels | |
private int | _draw_x_ticks () |
draw the x-ticks and their labels | |
private int | _draw_y_ticks () |
draw the y-ticks and their labels | |
private int | _grey_background () |
put a grey background on the plot of the data itself | |
private int | _draw_grid_lines () |
draw grid_lines | |
private int | _draw_x_grid_lines () |
draw grid_lines for x | |
private int | _draw_y_grid_lines () |
draw grid_lines for y | |
private int | _draw_y2_grid_lines () |
draw grid_lines for y | |
private int | _prepare_brush (scalar color, scalar type, scalar typeStyle) |
draw grid_lines for y | |
Public Class Methods | |
object | new () |
Standard normal constructor. Calls. | |
Public Object Methods | |
int | set (hash opts) |
Set all options. | |
hash | getopts () |
get all options | |
int | add_pt (list data) |
Graph API Add one dataset (as a list) to the dataref. | |
add_pt (\list data) | |
Graph API Add one dataset (as a reference to a list) to the dataref via. | |
retval | add_pt () |
int | add_dataset (list data) |
Graph API Add many datasets (implemented as a list) to the dataref,. | |
int | add_dataset (\list data) |
Graph API Add many datasets (implemented as a references to alist) to the dataref,. | |
Public Functions | |
int | add_datafile (scalar filename, scalar format) |
Graph API it's also possible to add a complete datafile Uses. | |
int | clear_data () |
Clear Graph API (by undefining 'dataref'. | |
arrayref | get_data () |
Get array of data of the last graph. | |
int | png (scalar file, scalar dataref) |
Produce the graph of options set in png format. | |
int | cgi_png (scalar dataref) |
Produce the graph of options set in png format to be directly written for CGI. | |
int | scalar_png (scalar dataref) |
Produce the graph of options set in png format to be directly written for CGI. | |
int | jpeg (scalar file, scalar dataref) |
Produce the graph of options set in JPG format to be directly. | |
int | cgi_jpeg (scalar dataref) |
Produce the graph of options set in JPG format to be directly for CGI. | |
int | scalar_jpeg (scalar dataref) |
Produce the graph of options set in JPG format to be directly. | |
int | make_gd (scalar dataref) |
Produce the graph of options set in GD format to be directly. | |
imagemap_dump () | |
get the information to turn the chart into an imagemap | |
minimum (list array) | |
determine minimum of an array of values | |
maximum (list array) | |
determine maximum of an array of values | |
arccos (scalar a) | |
Function arccos(a). | |
arcsin (scalar a) | |
Function arcsin(a). | |
true (scalar b) | |
determine true value of argument | |
false (scalar b) | |
determine false value of argument |
Base class from which all other classes are derived. This class provides all functions which are common for all classes
object Chart::Base::new | ( | ) |
int Chart::Base::set | ( | hash | opts | ) |
Set all options.
[in] | %opts | Hash of options to the Chart |
Reimplemented in Chart::Composite, and Chart::Direction.
hash Chart::Base::getopts | ( | ) |
get all options
int Chart::Base::add_pt | ( | list | data | ) |
Graph API
Add one dataset (as a list) to the dataref.
@data | Dataset to add |
Chart::Base::add_pt | ( | \list | data | ) |
Graph API
Add one dataset (as a reference to a list) to the dataref via.
for ( 0 .. $data ) { push $self->{'dataref'}->[$_] }, $data[$_]; }
\@data | Dataset to add |
int Chart::Base::add_dataset | ( | list | data | ) |
Graph API
Add many datasets (implemented as a list) to the dataref,.
@data | Dataset (list) to add |
Reimplemented in Chart::Direction.
int Chart::Base::add_dataset | ( | \list | data | ) |
Graph API
Add many datasets (implemented as a references to alist) to the dataref,.
\@data | Dataset (reference to a list) to add |
int Chart::Base::add_datafile | ( | scalar | filename, | |
scalar | format | |||
) |
Graph API
it's also possible to add a complete datafile
Uses.
[in] | $filename | Name of file which contents is to be added |
[in] | $format | 'pt' or 'set' to distiguish between function add_pt() in case of 'pt' or function add_dataset() in case of 'set' |
int Chart::Base::clear_data | ( | ) |
Clear Graph API (by undefining 'dataref'.
arrayref Chart::Base::get_data | ( | ) |
Get array of data of the last graph.
int Chart::Base::png | ( | scalar | file, | |
scalar | dataref | |||
) |
Produce the graph of options set in png format.
called after the options are set, this method invokes all my private methods to actually draw the chart and plot the data
[in] | $file | Name of file to write graph to |
[in] | $dataref | Reference to external data space |
int Chart::Base::cgi_png | ( | scalar | dataref | ) |
Produce the graph of options set in png format to be directly written for CGI.
called after the options are set, this method invokes all my private methods to actually draw the chart and plot the data
$dataref |
int Chart::Base::scalar_png | ( | scalar | dataref | ) |
Produce the graph of options set in png format to be directly written for CGI.
Called after the options are set,
this method invokes all my private methods to actually draw the chart and plot the data
$dataref | Reference to the data to be plotted |
int Chart::Base::jpeg | ( | scalar | file, | |
scalar | dataref | |||
) |
Produce the graph of options set in JPG format to be directly.
called after the options are set, this method invokes all my private methods to actually draw the chart and plot the data
$file | Name of file to write graph into | |
$dataref |
int Chart::Base::cgi_jpeg | ( | scalar | dataref | ) |
Produce the graph of options set in JPG format to be directly for CGI.
called after the options are set, this method invokes all my private methods to actually draw the chart and plot the data
$dataref |
int Chart::Base::scalar_jpeg | ( | scalar | dataref | ) |
Produce the graph of options set in JPG format to be directly.
called after the options are set, this method invokes all my private methods to actually draw the chart and plot the data
$dataref |
int Chart::Base::make_gd | ( | scalar | dataref | ) |
Produce the graph of options set in GD format to be directly.
called after the options are set, this method invokes all my private methods to actually draw the chart and plot the data
$dataref |
Chart::Base::imagemap_dump | ( | ) |
get the information to turn the chart into an imagemap
Reimplemented in Chart::Composite.
Chart::Base::minimum | ( | list | array | ) |
determine minimum of an array of values
@array | List of numerical values |
Chart::Base::maximum | ( | list | array | ) |
determine maximum of an array of values
@array | List of numerical values |
Chart::Base::arccos | ( | scalar | a | ) |
Function arccos(a).
$a | Value |
Chart::Base::arcsin | ( | scalar | a | ) |
Function arcsin(a).
$a | Value |
Chart::Base::true | ( | scalar | b | ) |
determine true value of argument
[in] | $b | Bool value to check for true |
Chart::Base::false | ( | scalar | b | ) |
determine false value of argument
[in] | $b | Bool value to check for true |
private int Chart::Base::_init | ( | scalar | x, | |
scalar | y | |||
) |
Initialize all default options here.
[in] | $x | Width of the final image in pixels (Default: 400) |
[in] | $y | Height of the final image in pixels (Default: 300) |
private int Chart::Base::_copy_data | ( | scalar | extern_ref | ) |
Copy external data via a reference to internal memory.
Remember the external reference.
Therefore, this function can anly be called once!
$extern_ref | Reference to external data space |
private int Chart::Base::_color_role_to_index | ( | \list | list_of_roles | ) |
\@list_of_roles | List of roles |
private array Chart::Base::_color_spec_to_rgb | ( | scalar | role, | |
scalar | spec | |||
) |
Return an array (list of) rgb values for spec.
[in] | $role | name of a role |
[in] | $spec | [r,g,b] or name |
private int Chart::Base::_draw_sub_title | ( | ) |
draw the sub-title for the chart
private int Chart::Base::_sort_data | ( | ) |
sort the data nicely (mostly for the pareto charts and xy-plots)
private int Chart::Base::_find_x_scale | ( | ) |
For a xy-plot do the same for the x values, as '_find_y_scale' does for the y values!
private int Chart::Base::_find_y_scale | ( | ) |
find good values for the minimum and maximum y-value on the chart
This Sub calculates correct values for the following class local variables, if they have not been set by the user.
max_val, min_val: The maximum and minimum values for the y axis.
y_ticks: The number of ticks to plot on the y scale, including the end points. e.g. If the scale runs from 0 to 50, with ticks every 10, y_ticks will have the value of 6.
y_tick_labels: An array of strings, each is a label for the y axis.
y_tick_labels_length: The length to allow for B tick labels. (How long is the longest?)
Reimplemented in Chart::Direction, and Chart::HorizontalBars.
private Chart::Base::_calcTickInterval | ( | scalar | dataset_min, | |
scalar | dataset_max, | |||
scalar | flag_fixed_min, | |||
scalar | flag_fixed_max, | |||
scalar | minTicks, | |||
scalar | maxTicks | |||
) |
Calculate the Interval between ticks in y direction.
Calculate the Interval between ticks in y direction and compare the number of ticks to the user's given values min_y_ticks, max_y_ticks.
[in] | $dataset_min | Minimal value in y direction |
[in] | $dataset_max | Maximal value in y direction |
[in] | $flag_fixed_min | Indicator whether the dataset_min value is fixed |
[in] | $flag_fixed_max | Indicator whether the dataset_max value is fixed |
[in] | $minTicks | Minimal number of ticks wanted |
[in] | $maxTicks | Maximal number of ticks wanted |
Reimplemented in Chart::Direction.
private int Chart::Base::_calcXTickInterval | ( | scalar | min, | |
scalar | max, | |||
scalar | minF, | |||
scalar | maxF, | |||
scalar | minTicks, | |||
scalar | maxTicks | |||
) |
Calculate the Interval between ticks in x direction.
Calculate the Interval between ticks in x direction and compare the number of ticks to the user's given values minTicks, maxTicks.
[in] | $min | Minimal value of dataset in x direction |
[in] | $max | Maximal value of dataset in x direction |
[in] | $minF | Inddicator if those min value is fixed |
[in] | $maxF | Inddicator if those max value is fixed |
[in] | $minTicks | Minimal number of tick in x direction |
[in] | $maxTicks | Maximal number of tick in x direction |
private int Chart::Base::_countTicks | ( | scalar | min, | |
scalar | max, | |||
scalar | interval | |||
) |
Works out how many ticks would be displayed at that interval.
$min | Minimal value | |
$max | Maximal value | |
$interval | value |
private int Chart::Base::_round2Tick | ( | scalar | input, | |
scalar | interval, | |||
scalar | roundUP | |||
) |
Rounds up or down to the next tick of interval size.
$roundUP can be +1 or -1 to indicate if rounding should be up or down.
written by David Pottage of Tao Group.
$input | ||
$interval | ||
$roundUP |
private array Chart::Base::_sepFP | ( | scalar | num | ) |
Seperates a number into it's base 10 floating point exponent & mantisa.
written by David Pottage of Tao Group.
$num | Floating point number |
private array Chart::Base::_find_y_range | ( | ) |
Find minimum and maximum value of y data sets.
Reimplemented in Chart::Direction, Chart::ErrorBars, and Chart::Mountain.
private array Chart::Base::_find_x_range | ( | ) |
Find minimum and maximum value of x data sets.
private int Chart::Base::_plot | ( | ) |
main sub that controls all the plotting of the actual chart
private int Chart::Base::_draw_legend | ( | ) |
let the user know what all the pretty colors mean.
The user define the position of the legend by setting option 'legend' to 'top', 'bottom', 'left', 'right' or 'none'. The legend is positioned at the defined place, respectively.
Reimplemented in Chart::Composite, Chart::Direction, and Chart::ErrorBars.
private int Chart::Base::_draw_bottom_legend | ( | ) |
private int Chart::Base::_draw_right_legend | ( | ) |
private int Chart::Base::_draw_top_legend | ( | ) |
private int Chart::Base::_draw_left_legend | ( | ) |
private int Chart::Base::_draw_none_legend | ( | ) |
no legend to draw.
Just return in this case. This routine may be overwritten by subclasses.
Reimplemented in Chart::Composite.
private int Chart::Base::_draw_x_label | ( | ) |
draw the label for the x-axis
Get font for labels
Get the color of x_label or text
Get size of font
and write x-Label
private int Chart::Base::_draw_y_label | ( | ) |
draw the label for the y-axis
private int Chart::Base::_draw_ticks | ( | ) |
private int Chart::Base::_draw_x_number_ticks | ( | ) |
draw the ticks and tick labels
private int Chart::Base::_draw_x_ticks | ( | ) |
draw the x-ticks and their labels
Reimplemented in Chart::Composite, Chart::Direction, Chart::HorizontalBars, and Chart::HorizontalBars.
private int Chart::Base::_draw_y_ticks | ( | ) |
draw the y-ticks and their labels
Reimplemented in Chart::Composite, Chart::Direction, and Chart::HorizontalBars.
private int Chart::Base::_grey_background | ( | ) |
put a grey background on the plot of the data itself
private int Chart::Base::_draw_grid_lines | ( | ) |
draw grid_lines
private int Chart::Base::_draw_x_grid_lines | ( | ) |
draw grid_lines for x
private int Chart::Base::_draw_y_grid_lines | ( | ) |
private int Chart::Base::_draw_y2_grid_lines | ( | ) |
private int Chart::Base::_prepare_brush | ( | scalar | color, | |
scalar | type, | |||
scalar | typeStyle | |||
) |
draw grid_lines for y
set the gdBrush object to trick GD into drawing fat lines & points of interesting shapes Needed by "Lines", "Points" and "LinesPoints" All hacked up by Richard Dice <rdice@pobox.com> Sunday 16 May 1999
$color | ||
$type | ||
$typeStyle |
private int Chart::Base::_check_data |
Check the internal data to be displayed.
Make sure the data isn't really weird and collect some basic info about it
Not logical data is 'carp'ed.
Reimplemented in Chart::Composite, and Chart::StackedBars.
private int Chart::Base::_draw |
private int Chart::Base::_set_colors |
specify my colors
private int Chart::Base::_draw_title |
draw the title for the chart
The title was defined by the user in set('title' => ....)
The user may define some title lines by separating them via character '\n';
The used font is taken from 'title_font';
The used color is calculated by function '_color_role_to_index' based on 'title' or 'text'
private int Chart::Base::_default_f_tick |
default tick conversion function This function is pointed to be $self->{f_x_tick} resp.
$self->{f_y_tick} if the user does not provide another function