Chart::Direction Class Reference

- Main Page
- Related Pages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

List of all members
Chart::Direction Class Reference

Direction class derived class for Chart to implement direction charts. More...

Inheritance diagram for Chart::Direction:
[legend]
Collaboration diagram for Chart::Direction:
[legend]

## Public Object Methods
Todo: calculate the width of the labels
int | set (hash opts)
| Set all options.
int | add_dataset (list data)
| Add many datasets to the dataref.

## Protected Object Methods
protected retval | _calcTickInterval ()

## Private Functions
private | _draw_data
| finally get around to plotting the data for direction charts
private int | _find_y_scale ()
| we use the find_y_scale methode to determine the labels of the circles and the amount of them
private | _calcTickInterval (scalar dataset_min, scalar dataset_max, scalar flag_fixed_min, scalar flag_fixed_max, scalar minTicks, scalar maxTicks)
| Calculates the ticks for direction in normalised units.
private int | _draw_y_ticks ()
| draw the circles and the axes
private int | _draw_x_ticks ()
| We don't need x ticks, it's all done in _draw_y_ticks.
private int | _prepare_brush (scalar color, scalar type)
| set the gdBrush object to trick GD into drawing fat lines
private int | _draw_legend ()
| let them know what all the pretty colors mean
private array | _find_y_range ()
| Find minimum and maximum value of y data sets.

## Additional Inherited Members
Public Member Functions inherited from Chart::Base
object | new ()
| Standard normal constructor. Calls.
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.
int | add_dataset (\\\list data)
| Graph API Add many datasets (implemented as a references to alist) to the dataref,.
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 returned.
int | jpeg (scalar file, scalar dataref)
| Produce the graph of options set in JPG format to be directly plotted.
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 returned.
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 arg)
| determine true value of argument
| false (scalar arg)
| determine false value of argument
| modulo (scalar a, scalar b)
| Calculate float($a % $b) as the internal operator '' does only calculate in integers.
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 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 | _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_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_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 | _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 role)
| prepare brush
Public Attributes inherited from Chart::Base
Hash | named_colors
| RGB values of named colors.
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 | _color_role_to_index
| return a (list of) color index(es) corresponding to the (list of) role(s)
private int | _brushStyles_of_roles
| return a (list of) brushStyles corresponding to the (list of) role(s)
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 float | _xyRatio
| Get ratio width_x/width_y.
private float | _xPixelInReal
| Get width of one Pixel in real coordinates in x-direction.
private float | _yPixelInReal
| Get width of one Pixel in real coordinates in y-direction.

## Detailed Description

Direction class derived class for Chart to implement direction charts.

## Member Function Documentation

private Chart::Direction::_calcTickInterval | ( | scalar | dataset_min,
|  | scalar | dataset_max,
|  | scalar | flag_fixed_min,
|  | scalar | flag_fixed_max,
|  | scalar | minTicks,
|  | scalar | maxTicks
| ) |  |

Calculates the ticks for direction in normalised units.

Calculate the Interval between ticks in y direction and compare the number of ticks to the user given values min_y_ticks, max_y_ticks

Parameters

  [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

Returns
  $tickInterval, $tickCount, $pMin, $pMax

Reimplemented from Chart::Base.

private int Chart::Direction::_draw_legend | ( |  | ) |

let them know what all the pretty colors mean

Returns
  status

Overwrite corresponding function of Base

Reimplemented from Chart::Base.

private int Chart::Direction::_draw_x_ticks | ( |  | ) |

We don't need x ticks, it's all done in _draw_y_ticks.

Returns
  status

Overwrites the corresponding function in Base

Reimplemented from Chart::Base.

private int Chart::Direction::_draw_y_ticks | ( |  | ) |

draw the circles and the axes

Overwrites _draw_y_ticks() of Base class

Returns
  status

Reimplemented from Chart::Base.

private array Chart::Direction::_find_y_range | ( |  | ) |

Find minimum and maximum value of y data sets.

Returns
  ( min, max, flag_all_integers )

Overwrites corresponding Base function

Reimplemented from Chart::Base.

private int Chart::Direction::_find_y_scale | ( |  | ) |

we use the find_y_scale methode to determine the labels of the circles and the amount of them

Returns
  status

This function is an overwrite to the same function found in the base class Chart::Base

Reimplemented from Chart::Base.

private int Chart::Direction::_prepare_brush | ( | scalar | color,
|  | scalar | type
| ) |  |

set the gdBrush object to trick GD into drawing fat lines

Parameters

  [in] | color | Color to be used
  [in] | type | Type of line

Returns
  status

int Chart::Direction::add_dataset | ( | list | data | ) |

Add many datasets to the dataref.

Graph API
Overwrite Base method

Parameters

  @data | Dataset to add

Reimplemented from Chart::Base.

int Chart::Direction::set | ( | hash | opts | ) |

Set all options.

Parameters

  [in] | %opts | Hash of options to the Chart

Returns
  ok or croak

main method for customizing the chart, lets users specify values for different parameters
dont check the number of points in the added datasets in a polarplot
overwrite Base method

Reimplemented from Chart::Base.

The documentation for this class was generated from the following file:

- Chart/Direction.pm