15 if (!defined(
'IN_PEEL')) {
36 $this->data_sets = array();
39 $this->data = array();
40 $this->links = array();
43 $this->js_path =
$GLOBALS[
'wwwroot'].
'/lib/js/';
45 $this->x_labels = array();
52 $this->title_style =
'';
57 $this->x_tick_size = -1;
64 $this->x_axis_3d =
'';
65 $this->x_grid_colour =
'';
66 $this->x_axis_steps = 1;
68 $this->y_grid_colour =
'';
69 $this->y2_axis_colour =
'';
72 $this->x_label_style =
'';
73 $this->y_label_style =
'';
74 $this->y_label_style_right =
'';
79 $this->x_legend_size = 20;
80 $this->x_legend_colour =
'#000000';
83 $this->y_legend_right =
'';
87 $this->lines = array();
88 $this->line_default[
'type'] =
'line';
89 $this->line_default[
'values'] =
'3,#87421F';
90 $this->js_line_default =
'so.addVariable("line","3,#87421F");';
92 $this->bg_colour =
'#FBFAFB';
95 $this->inner_bg_colour =
'';
96 $this->inner_bg_colour_2 =
'';
97 $this->inner_bg_angle =
'';
102 $this->pie_colours =
'';
103 $this->pie_labels =
'';
104 $this->pie_links =
'';
106 $this->tool_tip =
'';
110 $this->y2_lines = array();
114 $this->num_decimals=
'';
115 $this->is_fixed_num_decimals_forced=
'';
116 $this->is_decimal_separator_comma=
'';
117 $this->is_thousand_separator_disabled=
'';
119 $this->output_type =
'';
137 $this->
unique_id = uniqid(mt_rand(),
true);
156 $this->js_path = $path;
167 $this->swf_path = $path;
178 $this->output_type = $type;
187 if( count( $this->lines ) > 0 )
188 $line_num =
'_'. (count( $this->lines )+1);
200 $tmp = str_replace(
',',
'#comma#', $text );
202 return urlencode( $tmp );
210 if($this->output_type ==
'js')
212 $tmp =
'so.addVariable("'. $function .
'","'. $values .
'");';
216 $tmp =
'&'. $function .
'='. $values .
'&';
232 $this->
title = $this->
esc( $title );
233 if( strlen( $style ) > 0 )
234 $this->title_style = $style;
245 $this->width = $width;
256 $this->height = $height;
273 $this->y_format = $val;
278 $this->num_decimals = $val;
283 $this->is_fixed_num_decimals_forced = $val?
'true':
'false';
288 $this->is_decimal_separator_comma = $val?
'true':
'false';
293 $this->is_thousand_separator_disabled = $val?
'true':
'false';
303 $this->data[] = implode(
',',$a);
310 $this->links[] = implode(
',',$links);
316 $this->x_offset = $val?
'true':
'false';
335 $this->tool_tip = $this->
esc( $tip );
347 foreach( $a as $item )
348 $tmp[] = $this->
esc( $item );
349 $this->x_labels = $tmp;
370 $this->x_label_style = $size;
372 if( strlen( $colour ) > 0 )
373 $this->x_label_style .=
','. $colour;
375 if( $orientation > -1 )
376 $this->x_label_style .=
','. $orientation;
379 $this->x_label_style .=
','. $step;
381 if( strlen( $grid_colour ) > 0 )
382 $this->x_label_style .=
','. $grid_colour;
392 $this->bg_colour = $colour;
406 $this->bg_image =
$url;
407 $this->bg_image_x = $x;
408 $this->bg_image_y = $y;
418 $this->y2_lines[] = $data_number;
432 $this->inner_bg_colour = $col;
434 if( strlen($col2) > 0 )
435 $this->inner_bg_colour_2 = $col2;
438 $this->inner_bg_angle = $angle;
448 if( strlen( $colour ) > 0 )
449 $tmp .=
','. $colour;
481 $this->x_max = floatval( $max );
486 $this->x_min = floatval( $min );
497 $this->y_max = floatval( $max );
508 $this->y_min = floatval( $min );
519 $this->y2_max = floatval($max);
530 $this->y2_min = floatval($min);
541 $this->y_steps = intval( $val );
546 $this->
title = $this->
esc( $title );
547 if( strlen( $style ) > 0 )
548 $this->title_style = $style;
563 $this->x_legend = $this->
esc( $text );
565 $this->x_legend_size = $size;
567 if( strlen( $colour )>0 )
568 $this->x_legend_colour = $colour;
580 $this->x_tick_size = $size;
592 $this->x_axis_steps = $steps;
604 $this->x_axis_3d = intval($size);
617 if( strlen( $colour )>0 )
618 $tmp .=
','. $colour;
635 $this->y_legend = $this->
_set_y_legend( $text, $size, $colour );
650 $this->y_legend_right = $this->
_set_y_legend( $text, $size, $colour );
664 $this->x_grid_colour = $grid;
679 if( strlen( $grid ) > 0 )
680 $this->y_grid_colour = $grid;
691 $this->y2_axis_colour = $colour;
708 function line( $width, $colour=
'', $text=
'', $size=-1, $circles=-1 )
715 $description .= $width;
716 $description .=
','. $colour;
719 if( strlen( $text ) > 0 )
721 $description.=
','. $text;
722 $description .=
','. $size;
726 $description .=
','. $circles;
728 $this->lines[$type] = $description;
749 $description =
"$width,$colour,$text";
752 $description .=
",$font_size,$dot_size";
754 $this->lines[$type] = $description;
773 $type =
'line_hollow'. $this->
next_line();
775 $description =
"$width,$colour,$text";
778 $description .=
",$font_size,$dot_size";
780 $this->lines[$type] = $description;
803 $type =
'area_hollow'. $this->
next_line();
805 $description =
"$width,$dot_size,$colour,$alpha";
807 if( strlen( $text ) > 0 )
808 $description .=
",$text,$font_size";
810 if( strlen( $fill_colour ) > 0 )
811 $description .=
','. $fill_colour;
813 $this->lines[$type] = $description;
828 function bar( $alpha, $colour=
'', $text=
'', $size=-1 )
832 $description = $alpha .
','. $colour .
','. $text .
','. $size;
834 $this->lines[$type] = $description;
851 function bar_filled( $alpha, $colour, $colour_outline, $text=
'', $size=-1 )
853 $type =
'filled_bar'. $this->
next_line();
855 $description =
"$alpha,$colour,$colour_outline,$text,$size";
857 $this->lines[$type] = $description;
860 function bar_sketch( $alpha, $offset, $colour, $colour_outline, $text=
'', $size=-1 )
862 $type =
'bar_sketch'. $this->
next_line();
864 $description =
"$alpha,$offset,$colour,$colour_outline,$text,$size";
866 $this->lines[$type] = $description;
881 function bar_3D( $alpha, $colour=
'', $text=
'', $size=-1 )
885 $description = $alpha .
','. $colour .
','. $text .
','. $size;
887 $this->lines[$type] = $description;
904 function bar_glass( $alpha, $colour, $outline_colour, $text=
'', $size=-1 )
908 $description = $alpha .
','. $colour .
','. $outline_colour .
','. $text .
','. $size;
910 $this->lines[$type] = $description;
925 function bar_fade( $alpha, $colour=
'', $text=
'', $size=-1 )
929 $description = $alpha .
','. $colour .
','. $text .
','. $size;
931 $this->lines[$type] = $description;
934 function candle(
$data, $alpha, $line_width, $colour, $text=
'', $size=-1 )
938 $description = $alpha .
','. $line_width .
','. $colour .
','. $text .
','. $size;
940 $this->lines[$type] = $description;
943 foreach(
$data as $can )
944 $a[] = $can->toString();
946 $this->data[] = implode(
',',$a);
949 function hlc(
$data, $alpha, $line_width, $colour, $text=
'', $size=-1 )
953 $description = $alpha .
','. $line_width .
','. $colour .
','. $text .
','. $size;
955 $this->lines[$type] = $description;
958 foreach(
$data as $can )
959 $a[] = $can->toString();
961 $this->data[] = implode(
',',$a);
968 $description = $line_width .
','. $colour .
','. $text .
','. $size;
970 $this->lines[$type] = $description;
973 foreach(
$data as $can )
974 $a[] = $can->toString();
976 $this->data[] = implode(
',',$a);
997 function pie( $alpha, $line_colour, $style, $gradient =
true, $border_size =
false )
999 $this->
pie = $alpha.
','.$line_colour.
','.$style;
1002 $this->
pie .=
','.!$gradient;
1006 if ($gradient ===
false)
1010 $this->
pie .=
','.$border_size;
1027 $this->pie_labels = implode(
',',$labels);
1028 $this->pie_links = implode(
",",$links);
1039 $this->pie_colours = implode(
',',$colours);
1051 if( !headers_sent() )
1052 header(
'content-type: text; charset: utf-8');
1054 if($this->output_type ==
'js')
1058 $tmp[] =
'<div id="' . $this->
unique_id .
'"></div>';
1059 $tmp[] =
'<script src="' . $this->js_path .
'swfobject.js"></script>';
1060 $tmp[] =
'<script>';
1061 $tmp[] =
'var so = new SWFObject("' . $this->swf_path .
'open-flash-chart.swf", "ofc", "'. $this->width .
'", "' . $this->height .
'", "9", "#FFFFFF");';
1062 $tmp[] =
'so.addVariable("wmode", "transparent");';
1063 $tmp[] =
'so.addVariable("variables","true");';
1066 if( strlen( $this->
title ) > 0 )
1068 $values = $this->title;
1069 $values .=
','. $this->title_style;
1073 if( strlen( $this->x_legend ) > 0 )
1075 $values = $this->x_legend;
1076 $values .=
','. $this->x_legend_size;
1077 $values .=
','. $this->x_legend_colour;
1081 if( strlen( $this->x_label_style ) > 0 )
1082 $tmp[] = $this->
format_output(
'x_label_style',$this->x_label_style);
1084 if( $this->x_tick_size > 0 )
1085 $tmp[] = $this->
format_output(
'x_ticks',$this->x_tick_size);
1087 if( $this->x_axis_steps > 0 )
1088 $tmp[] = $this->
format_output(
'x_axis_steps',$this->x_axis_steps);
1090 if( strlen( $this->x_axis_3d ) > 0 )
1091 $tmp[] = $this->
format_output(
'x_axis_3d',$this->x_axis_3d);
1093 if( strlen( $this->y_legend ) > 0 )
1096 if( strlen( $this->y_legend_right ) > 0 )
1097 $tmp[] = $this->
format_output(
'y2_legend',$this->y_legend_right);
1099 if( strlen( $this->y_label_style ) > 0 )
1100 $tmp[] = $this->
format_output(
'y_label_style',$this->y_label_style);
1102 $values =
'5,10,'. $this->y_steps;
1105 if( count( $this->lines ) == 0 && count($this->data_sets)==0 )
1107 $tmp[] = $this->
format_output($this->line_default[
'type'],$this->line_default[
'values']);
1111 foreach( $this->lines as $type=>$description )
1116 foreach( $this->data as
$data )
1131 foreach( $this->links as $link )
1145 if( count( $this->y2_lines ) > 0 )
1147 $tmp[] = $this->
format_output(
'y2_lines',implode(
',', $this->y2_lines ));
1154 if( count( $this->x_labels ) > 0 )
1155 $tmp[] = $this->
format_output(
'x_labels',implode(
',',$this->x_labels));
1158 if( strlen($this->x_min) > 0 )
1161 if( strlen($this->x_max) > 0 )
1168 if( strlen($this->y2_min) > 0 )
1171 if( strlen($this->y2_max) > 0 )
1174 if( strlen( $this->bg_colour ) > 0 )
1175 $tmp[] = $this->
format_output(
'bg_colour',$this->bg_colour);
1177 if( strlen( $this->bg_image ) > 0 )
1180 $tmp[] = $this->
format_output(
'bg_image_x',$this->bg_image_x);
1181 $tmp[] = $this->
format_output(
'bg_image_y',$this->bg_image_y);
1187 $tmp[] = $this->
format_output(
'x_grid_colour',$this->x_grid_colour);
1193 if( strlen( $this->y_grid_colour ) > 0 )
1194 $tmp[] = $this->
format_output(
'y_grid_colour',$this->y_grid_colour);
1196 if( strlen( $this->y2_axis_colour ) > 0 )
1197 $tmp[] = $this->
format_output(
'y2_axis_colour',$this->y2_axis_colour);
1199 if( strlen( $this->x_offset ) > 0 )
1202 if( strlen( $this->inner_bg_colour ) > 0 )
1204 $values = $this->inner_bg_colour;
1205 if( strlen( $this->inner_bg_colour_2 ) > 0 )
1207 $values .=
','. $this->inner_bg_colour_2;
1208 $values .=
','. $this->inner_bg_angle;
1213 if( strlen( $this->
pie ) > 0 )
1217 $tmp[] = $this->
format_output(
'pie_labels',$this->pie_labels);
1218 $tmp[] = $this->
format_output(
'colours',$this->pie_colours);
1222 if( strlen( $this->tool_tip ) > 0 )
1227 if( strlen( $this->y_format ) > 0 )
1230 if( strlen( $this->num_decimals ) > 0 )
1231 $tmp[] = $this->
format_output(
'num_decimals',$this->num_decimals);
1233 if( strlen( $this->is_fixed_num_decimals_forced ) > 0 )
1234 $tmp[] = $this->
format_output(
'is_fixed_num_decimals_forced',$this->is_fixed_num_decimals_forced);
1236 if( strlen( $this->is_decimal_separator_comma ) > 0 )
1237 $tmp[] = $this->
format_output(
'is_decimal_separator_comma',$this->is_decimal_separator_comma);
1239 if( strlen( $this->is_thousand_separator_disabled ) > 0 )
1240 $tmp[] = $this->
format_output(
'is_thousand_separator_disabled',$this->is_thousand_separator_disabled);
1244 foreach( $this->data_sets as $set )
1246 $tmp[] = $set->toString( $this->output_type, $count>1?
'_'.$count:
'' );
1250 if($this->output_type ==
'js')
1252 $tmp[] =
'so.write("' . $this->
unique_id .
'");';
1253 $tmp[] =
'</script>';
1256 return implode(
"\r\n",$tmp);
1281 function line( $line_width, $colour )
1283 $this->var =
'line';
1287 $this->data = array();
1288 $this->links = array();
1289 $this->tips = array();
1290 $this->_key =
false;
1298 $this->key_size = $size;
1303 $this->data[] =
$data;
1308 $this->data[] =
$data;
1314 $this->data[] =
$data;
1320 $this->data[] =
$data;
1347 if( $output_type ==
'js' )
1349 $tmp[] =
'so.addVariable("'. $this->var.$set_num .
'","'. $values .
'");';
1351 $tmp[] =
'so.addVariable("values'. $set_num .
'","'. implode(
',', $this->data ) .
'");';
1353 if( count( $this->links ) > 0 )
1354 $tmp[] =
'so.addVariable("links'. $set_num .
'","'. implode(
',', $this->links ) .
'");';
1356 if( count( $this->tips ) > 0 )
1357 $tmp[] =
'so.addVariable("tool_tips_set'. $set_num .
'","'. implode(
',', $this->tips ) .
'");';
1362 $tmp[] =
'&'. $this->var. $set_num .
'='. $values .
'&';
1363 $tmp[] =
'&values'. $set_num .
'='. implode(
',', $this->data ) .
'&';
1365 if( count( $this->links ) > 0 )
1366 $tmp[] =
'&links'. $set_num .
'='. implode(
',', $this->links ) .
'&';
1368 if( count( $this->tips ) > 0 )
1369 $tmp[] =
'&tool_tips_set'. $set_num .
'='. implode(
',', $this->tips ) .
'&';
1372 return implode(
"\r\n", $tmp );
1392 $this->var =
'line_hollow';
1433 $this->var =
'line_dot';
1459 function bar( $alpha, $colour )
1465 $this->data = array();
1466 $this->links = array();
1467 $this->tips = array();
1468 $this->_key =
false;
1475 $this->key_size = $size;
1480 $this->data[] =
$data;
1485 $this->data[] =
$data;
1491 $this->data[] =
$data;
1518 if( $output_type ==
'js' )
1520 $tmp[] =
'so.addVariable("'. $this->var.$set_num .
'","'. $values .
'");';
1522 $tmp[] =
'so.addVariable("values'. $set_num .
'","'. implode(
',', $this->data ) .
'");';
1524 if( count( $this->links ) > 0 )
1525 $tmp[] =
'so.addVariable("links'. $set_num .
'","'. implode(
',', $this->links ) .
'");';
1527 if( count( $this->tips ) > 0 )
1528 $tmp[] =
'so.addVariable("tool_tips_set'. $set_num .
'","'. implode(
',', $this->tips ) .
'");';
1533 $tmp[] =
'&'. $this->var. $set_num .
'='. $values .
'&';
1534 $tmp[] =
'&values'. $set_num .
'='. implode(
',', $this->data ) .
'&';
1536 if( count( $this->links ) > 0 )
1537 $tmp[] =
'&links'. $set_num .
'='. implode(
',', $this->links ) .
'&';
1539 if( count( $this->tips ) > 0 )
1540 $tmp[] =
'&tool_tips_set'. $set_num .
'='. implode(
',', $this->tips ) .
'&';
1543 return implode(
"\r\n", $tmp );
1562 $this->var =
'bar_3d';
1580 $this->var =
'bar_fade';
1600 $this->var =
'filled_bar';
1643 $this->var =
'bar_glass';
1664 $this->var =
'bar_sketch';
1700 function candle( $high, $open, $close, $low )
1702 $this->out = array();
1703 $this->out[] = $high;
1704 $this->out[] = $open;
1705 $this->out[] = $close;
1706 $this->out[] = $low;
1711 return '['. implode(
',', $this->out ) .
']';
1728 function hlc( $high, $low, $close )
1730 $this->out = array();
1731 $this->out[] = $high;
1732 $this->out[] = $low;
1733 $this->out[] = $close;
1738 return '['. implode(
',', $this->out ) .
']';
1757 $this->out = array();
1760 $this->out[] = $size_px;
1765 return '['. implode(
',', $this->out ) .
']';
set_is_decimal_separator_comma($val)
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
set_y_label_style($size, $colour='')
Set the look and feel of the y axis labels.
toString($output_type, $set_num)
set_y_max($max)
Set the maximum value of the y axis.
bar_glass($alpha, $colour, $outline_colour)
bar_glass::bar_glass()
line_hollow($width, $dot_size, $colour, $text='', $font_size='')
Draw a line with hollow dot markers on values.
set_x_tick_size($size)
Set the size of the x label ticks.
scatter($data, $line_width, $colour, $text='', $size=-1)
y_label_steps($val)
Show the y label on every $step label.
set_y_right_min($min)
Set the minimum value of the right y axis.
set_base($base='js/')
Set the base path of the swfobject.
set_tool_tip($tip)
Set the tooltip to be displayed on each chart item.
unique_id()
Création d'un mot de passe crypté
bar($alpha, $colour='', $text='', $size=-1)
Draw a bar chart.
bar_sketch($alpha, $offset, $colour, $colour_outline, $text='', $size=-1)
line_dot($width, $dot_size, $colour, $text='', $font_size='')
Draw a line with solid dot markers on values.
get_unique_id()
Get the flash object ID for the last rendered object.
y_axis_colour($axis, $grid='')
Set the colour of the y axis line and grid.
set_is_thousand_separator_disabled($val)
set_y_right_legend($text, $size=-1, $colour='')
Set the parameters of the right y legend.
set_x_labels($a)
Set the x axis labels.
set_x_legend($text, $size=-1, $colour='')
Set the parameters of the x legend.
set_y_right_label_style($size, $colour='')
Set the look and feel of the right y axis labels.
_set_y_legend($text, $size, $colour)
The private method of building the y legend output.
candle($data, $alpha, $line_width, $colour, $text='', $size=-1)
set_y_legend($text, $size=-1, $colour='')
Set the parameters of the y legend.
format_output($function, $values)
Format the text to the type of output.
set_y_right_max($max)
Set the maximum value of the right y axis.
line_hollow($line_width, $dot_size, $colour)
bar_fade($alpha, $colour)
bar_fade($alpha, $colour='', $text='', $size=-1)
Draw a faded bar chart.
set_x_axis_steps($steps)
Set how often you would like to show a tick on the x axis.
pie_slice_colours($colours)
Set the pie slice colours.
next_line()
returns the next line label for multiple lines.
candle($high, $open, $close, $low)
set_unique_id()
Set the unique_id to use for the flash object id.
set_width($width)
Set the width of the chart.
bar_outline($alpha, $colour, $outline_colour)
graph()
Constructer for the open_flash_chart_api Sets our default variables.
set_title($title, $style='')
Set the text and style of the title.
bar_3D($alpha, $colour='', $text='', $size=-1)
Draw a 3D bar chart.
bar_filled($alpha, $colour, $colour_outline, $text='', $size=-1)
Draw a bar chart with an outline.
set_x_axis_3d($size)
Set the depth in pixels of the 3D X axis slab.
set_bg_image($url, $x='center', $y='center')
Set a background image.
set_x_label_style($size, $colour='', $orientation=0, $step=-1, $grid_colour='')
Set the look and feel of the x axis labels.
pie_values($values, $labels=array(), $links=array())
Set the values of the pie chart.
y_right_axis_colour($colour)
Set the colour of the right y axis line.
add_data_tip($data, $tip)
add_data_link_tip($data, $link, $tip)
$GLOBALS['page_columns_count']
set_height($height)
Set the height of the chart.
set_swf_path($path)
Set the base path for the open-flash-chart.swf.
set_bg_colour($colour)
Set the background colour.
attach_to_y_right_axis($data_number)
Attach a set of data (a line, area or bar chart) to the right Y axis.
line($line_width, $colour)
set_js_path($path)
Set the base path for the swfobject.js.
bar_glass($alpha, $colour, $outline_colour, $text='', $size=-1)
Draw a 3D bar chart that looks like glass.
_set_y_label_style($size, $colour)
Internal function to build the y label style for y and y2.
area_hollow($width, $dot_size, $colour, $alpha, $text='', $font_size='', $fill_colour='')
Draw an area chart.
render()
Render the output.
x_axis_colour($axis, $grid='')
Set the colour of the x axis line and grid.
set_data($a)
Set the data for the chart.
line_dot($line_width, $dot_size, $colour)
line($width, $colour='', $text='', $size=-1, $circles=-1)
Draw a line without markers on values.
pie($alpha, $line_colour, $style, $gradient=true, $border_size=false)
Draw a pie chart.
bar_sketch($alpha, $offset, $colour, $outline_colour)
set_is_fixed_num_decimals_forced($val)
add_data_tip($data, $tip)
toString($output_type, $set_num)
set_y_min($min)
Set the minimum value of the y axis.
set_inner_background($col, $col2='', $angle=-1)
Set the background colour of the grid portion of the chart.
hlc($data, $alpha, $line_width, $colour, $text='', $size=-1)
set_output_type($type)
Set the type of output data.