📄 openflashchart.php
字号:
{ foreach( $this->lines as $type=>$description ) $tmp[] = $this->format_output($type,$description); } $num = 1; foreach( $this->data as $data ) { if( $num==1 ) { $tmp[] = $this->format_output( 'values', $data); } else { $tmp[] = $this->format_output('values_'. $num, $data); } $num++; } $num = 1; foreach( $this->links as $link ) { if( $num==1 ) { $tmp[] = $this->format_output( 'links', $link); } else { $tmp[] = $this->format_output('links_'. $num, $link); } $num++; } if( count( $this->y2_lines ) > 0 ) { $tmp[] = $this->format_output('y2_lines',implode( ',', $this->y2_lines )); // // Should this be an option? I think so... // $tmp[] = $this->format_output('show_y2','true'); } if( count( $this->x_labels ) > 0 ) $tmp[] = $this->format_output('x_labels',implode(',',$this->x_labels)); else { if( strlen($this->x_min) > 0 ) $tmp[] = $this->format_output('x_min',$this->x_min); if( strlen($this->x_max) > 0 ) $tmp[] = $this->format_output('x_max',$this->x_max); } $tmp[] = $this->format_output('y_min',$this->y_min); $tmp[] = $this->format_output('y_max',$this->y_max); if( strlen($this->y2_min) > 0 ) $tmp[] = $this->format_output('y2_min',$this->y2_min); if( strlen($this->y2_max) > 0 ) $tmp[] = $this->format_output('y2_max',$this->y2_max); if( strlen( $this->bg_colour ) > 0 ) $tmp[] = $this->format_output('bg_colour',$this->bg_colour); if( strlen( $this->bg_image ) > 0 ) { $tmp[] = $this->format_output('bg_image',$this->bg_image); $tmp[] = $this->format_output('bg_image_x',$this->bg_image_x); $tmp[] = $this->format_output('bg_image_y',$this->bg_image_y); } if( strlen( $this->x_axis_colour ) > 0 ) { $tmp[] = $this->format_output('x_axis_colour',$this->x_axis_colour); $tmp[] = $this->format_output('x_grid_colour',$this->x_grid_colour); } if( strlen( $this->y_axis_colour ) > 0 ) $tmp[] = $this->format_output('y_axis_colour',$this->y_axis_colour); if( strlen( $this->y_grid_colour ) > 0 ) $tmp[] = $this->format_output('y_grid_colour',$this->y_grid_colour); if( strlen( $this->y2_axis_colour ) > 0 ) $tmp[] = $this->format_output('y2_axis_colour',$this->y2_axis_colour); if( strlen( $this->x_offset ) > 0 ) $tmp[] = $this->format_output('x_offset',$this->x_offset); if( strlen( $this->inner_bg_colour ) > 0 ) { $values = $this->inner_bg_colour; if( strlen( $this->inner_bg_colour_2 ) > 0 ) { $values .= ','. $this->inner_bg_colour_2; $values .= ','. $this->inner_bg_angle; } $tmp[] = $this->format_output('inner_background',$values); } if( strlen( $this->pie ) > 0 ) { $tmp[] = $this->format_output('pie',$this->pie); $tmp[] = $this->format_output('values',$this->pie_values); $tmp[] = $this->format_output('pie_labels',$this->pie_labels); $tmp[] = $this->format_output('colours',$this->pie_colours); $tmp[] = $this->format_output('links',$this->pie_links); } if( strlen( $this->tool_tip ) > 0 ) $tmp[] = $this->format_output('tool_tip',$this->tool_tip); if( strlen( $this->y_format ) > 0 ) $tmp[] = $this->format_output('y_format',$this->y_format); if( strlen( $this->num_decimals ) > 0 ) $tmp[] = $this->format_output('num_decimals',$this->num_decimals); if( strlen( $this->is_fixed_num_decimals_forced ) > 0 ) $tmp[] = $this->format_output('is_fixed_num_decimals_forced',$this->is_fixed_num_decimals_forced); if( strlen( $this->is_decimal_separator_comma ) > 0 ) $tmp[] = $this->format_output('is_decimal_separator_comma',$this->is_decimal_separator_comma); if( strlen( $this->is_thousand_separator_disabled ) > 0 ) $tmp[] = $this->format_output('is_thousand_separator_disabled',$this->is_thousand_separator_disabled); $count = 1; foreach( $this->data_sets as $set ) { $tmp[] = $set->toString( $this->output_type, $count>1?'_'.$count:'' ); $count++; } if($this->output_type == 'js') { $tmp[] = 'so.write("' . $this->unique_id . '");'; $tmp[] = '</script>'; } return implode("\r\n",$tmp); }}class line{ var $line_width; var $colour; var $_key; var $key; var $key_size; // hold the data var $data; // extra tool tip info: var $tips; function line( $line_width, $colour ) { $this->var = 'line'; $this->line_width = $line_width; $this->colour = $colour; $this->data = array(); $this->links = array(); $this->tips = array(); $this->_key = false; } function key( $key, $size ) { $this->_key = true; $this->key = graph::esc( $key ); $this->key_size = $size; } function add( $data ) { $this->data[] = $data; } function add_link( $data, $link ) { $this->data[] = $data; $this->links[] = graph::esc( $link ); } function add_data_tip( $data, $tip ) { $this->data[] = $data; $this->tips[] = graph::esc( $tip ); } function add_data_link_tip( $data, $link, $tip ) { $this->data[] = $data; $this->links[] = graph::esc( $link ); $this->tips[] = graph::esc( $tip ); } // return the variables for this chart function _get_variable_list() { $values = array(); $values[] = $this->line_width; $values[] = $this->colour; if( $this->_key ) { $values[] = $this->key; $values[] = $this->key_size; } return $values; } function toString( $output_type, $set_num ) { $values = implode( ',', $this->_get_variable_list() ); $tmp = array(); if( $output_type == 'js' ) { $tmp[] = 'so.addVariable("'. $this->var.$set_num .'","'. $values . '");'; $tmp[] = 'so.addVariable("values'. $set_num .'","'. implode( ',', $this->data ) .'");'; if( count( $this->links ) > 0 ) $tmp[] = 'so.addVariable("links'. $set_num .'","'. implode( ',', $this->links ) .'");'; if( count( $this->tips ) > 0 ) $tmp[] = 'so.addVariable("tool_tips_set'. $set_num .'","'. implode( ',', $this->tips ) .'");'; } else { $tmp[] = '&'. $this->var. $set_num .'='. $values .'&'; $tmp[] = '&values'. $set_num .'='. implode( ',', $this->data ) .'&'; if( count( $this->links ) > 0 ) $tmp[] = '&links'. $set_num .'='. implode( ',', $this->links ) .'&'; if( count( $this->tips ) > 0 ) $tmp[] = '&tool_tips_set'. $set_num .'='. implode( ',', $this->tips ) .'&'; } return implode( "\r\n", $tmp ); }}class line_hollow extends line{ var $dot_size; function line_hollow( $line_width, $dot_size, $colour ) { parent::line( $line_width, $colour ); $this->var = 'line_hollow'; $this->dot_size = $dot_size; } // return the variables for this chart function _get_variable_list() { $values = array(); $values[] = $this->line_width; $values[] = $this->colour; if( $this->_key ) { $values[] = $this->key; $values[] = $this->key_size; } else { $values[] = ''; $values[] = ''; } $values[] = $this->dot_size; return $values; }}class line_dot extends line_hollow{ function line_dot( $line_width, $dot_size, $colour ) { parent::line_hollow( $line_width, $dot_size,$colour ); $this->var = 'line_dot'; }}class bar{ var $colour; var $alpha; var $data; var $links; var $_key; var $key; var $key_size; var $var; // extra tool tip info: var $tips; function bar( $alpha, $colour ) { $this->var = 'bar'; $this->alpha = $alpha; $this->colour = $colour; $this->data = array(); $this->links = array(); $this->tips = array(); $this->_key = false; } function key( $key, $size ) { $this->_key = true; $this->key = graph::esc( $key ); $this->key_size = $size; } function add( $data ) { $this->data[] = $data; } function add_link( $data, $link ) { $this->data[] = $data; $this->links[] = graph::esc( $link ); } function add_data_tip( $data, $tip ) { $this->data[] = $data; $this->tips[] = graph::esc( $tip ); } // return the variables for this // bar chart function _get_variable_list() { $values = array(); $values[] = $this->alpha; $values[] = $this->colour; if( $this->_key ) { $values[] = $this->key; $values[] = $this->key_size; } return $values; } function toString( $output_type, $set_num ) { $values = implode( ',', $this->_get_variable_list() ); $tmp = array(); if( $output_type == 'js' ) { $tmp[] = 'so.addVariable("'. $this->var.$set_num .'","'. $values . '");'; $tmp[] = 'so.addVariable("values'. $set_num .'","'. implode( ',', $this->data ) .'");'; if( count( $this->links ) > 0 ) $tmp[] = 'so.addVariable("links'. $set_num .'","'. implode( ',', $this->links ) .'");'; if( count( $this->tips ) > 0 ) $tmp[] = 'so.addVariable("tool_tips_set'. $set_num .'","'. implode( ',', $this->tips ) .'");'; } else { $tmp[] = '&'. $this->var. $set_num .'='. $values .'&'; $tmp[] = '&values'. $set_num .'='. implode( ',', $this->data ) .'&'; if( count( $this->links ) > 0 ) $tmp[] = '&links'. $set_num .'='. implode( ',', $this->links ) .'&'; if( count( $this->tips ) > 0 ) $tmp[] = '&tool_tips_set'. $set_num .'='. implode( ',', $this->tips ) .'&'; } return implode( "\r\n", $tmp ); } }class bar_3d extends bar{ function bar_3d( $alpha, $colour ) { parent::bar( $alpha, $colour ); $this->var = 'bar_3d'; }}class bar_fade extends bar{ function bar_fade( $alpha, $colour ) { parent::bar( $alpha, $colour ); $this->var = 'bar_fade'; }}class bar_outline extends bar{ var $outline_colour; function bar_outline( $alpha, $colour, $outline_colour ) { parent::bar( $alpha, $colour ); $this->var = 'filled_bar'; $this->outline_colour = $outline_colour; } // override the base method function _get_variable_list() { $values = array(); $values[] = $this->alpha; $values[] = $this->colour; $values[] = $this->outline_colour; if( $this->_key ) { $values[] = $this->key; $values[] = $this->key_size; } return $values; }}class bar_glass extends bar_outline{ function bar_glass( $alpha, $colour, $outline_colour ) { parent::bar_outline( $alpha, $colour, $outline_colour ); $this->var = 'bar_glass'; }}//// this has an outline colour and a 'jiggle' parameter// called offset//class bar_sketch extends bar_outline{ var $offset; function bar_sketch( $alpha, $offset, $colour, $outline_colour ) { parent::bar_outline( $alpha, $colour, $outline_colour ); $this->var = 'bar_sketch'; $this->offset = $offset; } // override the base method function _get_variable_list() { $values = array(); $values[] = $this->alpha; $values[] = $this->offset; $values[] = $this->colour; $values[] = $this->outline_colour; if( $this->_key ) { $values[] = $this->key; $values[] = $this->key_size; } return $values; }}class candle{ var $out; function candle( $high, $open, $close, $low ) { $this->out = array(); $this->out[] = $high; $this->out[] = $open; $this->out[] = $close; $this->out[] = $low; } function toString() { return '['. implode( ',', $this->out ) .']'; }}class hlc{ var $out; function hlc( $high, $low, $close ) { $this->out = array(); $this->out[] = $high; $this->out[] = $low; $this->out[] = $close; } function toString() { return '['. implode( ',', $this->out ) .']'; }}class point{ var $out; function point( $x, $y, $size_px ) { $this->out = array(); $this->out[] = $x; $this->out[] = $y; $this->out[] = $size_px; } function toString() { return '['. implode( ',', $this->out ) .']'; }}// PIWIK SPECIAL ALIAS HACK - when updating Open Flash Chart, leave this line unchangedclass graph extends Piwik_Visualization_OpenFlashChart {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -