RCHART for Php, User Guide

Copyright 2005, J4L Components (http://www.java4less.com)
Go bak to contents


Gaugechart configuration

This is a complete example of a gaugechart with 2 subgauges:

Parameters
Description
Equivalent php class/property

YLABEL_COLOR=#FFFFFF
Y2AXIS=TRUE
YAXIS=TRUE
XSCALE_MIN=0
YSCALE_MIN=0
Y2SCALE_MIN=0
XSCALE_MAX=100
YSCALE_MAX=25
Y2SCALE_MAX=15
XAXIS_START_WITH_BIG_TICK=TRUE
YAXIS_START_WITH_BIG_TICK=TRUE
Y2AXIS_START_WITH_BIG_TICK=TRUE
YAXIS_STYLE=2.0|#FFFFFF|NORMAL
YAXIS_FONT_COLOR=#FFFFFF
XAXIS_INTEGER=TRUE
YAXIS_INTEGER=TRUE
LEGEND_FILL=0xffffff
LEGEND_BORDER=0.2|#000000|NORMAL
SERIE_1=gauge
SERIE_2=gauge2
SERIE_3=gauge3
SERIE_TYPE_1=GAUGE
SERIE_TYPE_2=GAUGE
SERIE_TYPE_3=GAUGE
SERIE_DATA_1=33|15|5
GAUGE_NEEDLE_1=Needle1
GAUGE_NEEDLE_2=Needle2
GAUGE_NEEDLE_3=needle3
GAUGE_NEEDLE_STYLE_1=#FF0000
GAUGE_NEEDLE_STYLE_2=#000000
GAUGE_NEEDLE_STYLE_3=#FFFF00
SERIE_NEEDLE_STYLE_1=3.0|#FF0000|NORMAL
SERIE_NEEDLE_STYLE_2=3.0|#000000|NORMAL
SERIE_NEEDLE_STYLE_3=3.0|#FFFF00|NORMAL
SERIE_NEEDLE_LENTGH_1=70
GAUGE_RADIUS=0.8
GAUGE_BORDER=2.0|#000000|NORMAL
GAUGE_AXIS1_LABEL_MARGIN=20
GAUGE_MAX_ZONE=90
GAUGE_MIN_ZONE=10
GAUGE_MAXMIN_ZONE_WIDTH=45
GAUGE_MAXMIN_ZONE_MARGIN=4
GAUGE_BACK=#0000FF
GAUGE1_ENABLE=TRUE
GAUGE1_BACK=#FFC800
GAUGE2_ENABLE=TRUE
GAUGE2_BACK=CYAN
LEGEND_MARGIN=0.3




X scale is the one of the main gauge




Y scale is the one of the orange gauge
Y2 scale is the one of the cyan gauge
All scales have a big tick at possition 0




Do not paint decimal point



The gauge has 3 needles





Values to plot



Style of the needles









Define possition, size and color of the
read and green areas (max, min)



Activate first subgauge

Activate second subgauge



$gaugePlotter->subGauge2->axis1=& $Y2Axis;
$gaugePlotter->subGauge1->axis1=& $YAxis;















$gaugePlotter=new GaugePlotter()
$serie=new GaugeDataSerie($values,$styles);




see values in constructor of new GaugeDataSerie;
$legend->addItem("Needle 1",$fstyle);


see styles in constructor of new GaugeDataSerie;


$serie->needleStyle


$serie->needleLength
$gaugePlotter->radiusModifier


$gaugePlotter->maxZone
$gaugePlotter->minZone
$gaugePlotter->maxminZoneWidth
$gaugePlotter->maxminZoneMargin

$gaugePlotter->subGauge1=new GaugePlotter();

$gaugePlotter->subGauge2=new GaugePlotter();

The subgauges are enabled with:

In this case the last (or last two) value of the SERIE_DATA_1 parameter will be used in the subgauge1 (and/or subgauge2). In this example, the value 15 is used for subgauge1 and the value 5 for the subgauge 2.

Parameters of the gauge marked with (*) can be used to defined the subgauges by adding "1" or "2" to the "GAUGE" word in the parameter's name. For example: GAUGE1_BORDER,GAUGE1_BASE,GAUGE2_BORDER,GAUGE2_BASE and so on.

Parameters
Description
Equivalent Php class/property

YAXIS=FALSE
GAUGE1_ENABLE=FALSE
GAUGE2_ENABLE=FALSE

remove second scale
remove first subgauge
remove second subgauge

$gaugePlotter->axis2=null;
$gaugePlotter->subGauge1=null;
$gaugePlotter->subGauge2=null;

 

Gaugechart needs at least 1 scale, defined using the XAXIS* parameters. You can define a second scale for the gauge using the YAXIS* parameters. However, if you have defined subgauges, the YAXIS* scale will be used for subgauge1 and the Y2AXIS* scale parameters will be used for subgauge2.

Parameters
Description
Equivalent phclass/property

YAXIS=TRUE
YSCALE_MAX=25
YSCALE_MIN=0

Creates second scale (the one in white)
Define maximum value
Define minimum value

$gaugePlotter->axis2=& YAxis;
$gaugePlotter->axis2->scale->max
$gaugePlotter->axis2->scale->min

The following parameters are used to configure the green and red areas:

Parameters
Description
Equivalent Php class/property

GAUGE_MAX_ZONE=80
GAUGE_MAX_ZONE_COLOR=#ffc800
GAUGE_MIN_ZONE=20
GAUGE_MIN_ZONE_COLOR=CYAN

Orange area starts at pos. 80
Color of max. zone is Orange
Cyan area ends at pos. 20
Color of min. zone is cyan

$gaugePlotter->maxZone
$gaugePlotter->maxZoneColor
$gaugePlotter->minZone
$gaugePlotter->minZoneColor

You can also change the size of the circle at the base of the needle.

GAUGE_BASE (*): Size of the circle painted as needle base (% of the radius). Default is 6 which mean 6% of the size of the gauge

Parameters
Description
Equivalent Php class/property

GAUGE_BASE=12

Size of the red circle at the base

$guagePlotter->needleBase

You can change the width of the areas that mark the max and min zones:

GAUGE_MAXMIN_ZONE_WIDTH(*): Width in pixels of the ring for the max and min zones. Default is 50.

Parameters
Description
Equivalent Php class/property

GAUGE_MAXMIN_ZONE_WIDTH=15

width in pixels of the orange and cyan areas (default is 50).

$gaugePlotter->maxminZoneWidth=15;

You can change the margin of the areas that mark the max and min zones:

GAUGE_MAXMIN_ZONE_MARGIN(*):Margin, in pixels (distance to border) of the min/max area. Default is 5.

Parameters
Description
Equivalent Php class/property

GAUGE_MAXMIN_ZONE_MARGIN=0

Cero means, the area starts at the border.

$gaugePlotter->maxminZoneMargin=50;

The following parameters are used to change the start and end possition (angles) of the gauge:

Parameters
Description
Equivalent php class/property

GAUGE_START_ANGLE=10
GAUGE_END_ANGLE=170

Scale starts at angle 10 and ends at angle 170

$gaugePlotter->startAngle=10;
$gaugePlotter->endAngle=170;

In order to change the possition of the labels of the scale you must use:

Parameters
Description
Equivalent Php class/property

GAUGE_AXIS1_LABEL_MARGIN=7
GAUGE_AXIS2_LABEL_MARGIN=5


Possition of the white labels are 5 pixels outside the scale.

$gaugePlotter->axis1LabelMargin
$gaugePlotter->axis2LabelMargin

These parameters are used to change the possition of the scale:

Parameters
Description
Equivalent Php class/property

GAUGE_AXIS1_MARGIN=-4
GAUGE_AXIS2_MARGIN=20
GAUGE_AXIS1_LABEL_MARGIN=7
GAUGE_AXIS2_LABEL_MARGIN=5

Ticks start 4 pixels outside the gauge.
Ticks start 20 pixels inside the gauge.
Labels are 7 pixels outside the scale..

$gaugePlotter->axis1Margin
$gaugePlotter->axis2Margin
$gaugePlotter->axis1LabelMargin
$gaugePlotter->axis2LabelMargin

The size of the gauge and subgauges can be defined with:

Parameters
Description
Equivalent Php class/property

GAUGE_BORDER=0.2|#FF0000|NORMAL
GAUGE_RADIUS=0.6

Red border of the gauge (also GAUGE1_BORDER, GAUGE2_BORDER)
Size of the gauge

$gaugePlotter->border
$gaugePlotter->radiusModifier

Parameters
Description
Equivalent Php class/property

GAUGE_SUBGAUGE_SIZE=40

Size of the subgauges

$gaugePlotter->subGaugeSize=40;


A gauge can contain up to 2 subgauges. In order to activate the subgauges you must set GAUGE2_ENABLE:

Parameters
Description
Equivalent Php class/property

GAUGE2_ENABLE=TRUE
GAUGE2_START_ANGLE=0
GAUGE2_END_ANGLE=180
GAUGE2_BACK=#00FFFF
LEGEND_MARGIN=0.3

Activate subgauge 2
Subgauge is a semicircle (angle 0-180)