📄 openflashchart.php
字号:
*/ function set_x_legend( $text, $size=-1, $colour='' ) { $this->x_legend = $this->esc( $text ); if( $size > -1 ) $this->x_legend_size = $size; if( strlen( $colour )>0 ) $this->x_legend_colour = $colour; } /** * Set the size of the x label ticks. * * @param size an int argument. * The size of the ticks in pixels. */ function set_x_tick_size( $size ) { if( $size > 0 ) $this->x_tick_size = $size; } /** * Set how often you would like to show a tick on the x axis. * * @param steps an int argument. * Show a tick ever $steps. */ function set_x_axis_steps( $steps ) { if ( $steps > 0 ) $this->x_axis_steps = $steps; } /** * Set the depth in pixels of the 3D X axis slab. * * @param size an int argument. * The depth in pixels of the 3D X axis. */ function set_x_axis_3d( $size ) { if( $size > 0 ) $this->x_axis_3d = intval($size); } /** * The private method of building the y legend output. */ function _set_y_legend( $text, $size, $colour ) { $tmp = $text; if( $size > -1 ) $tmp .= ','. $size; if( strlen( $colour )>0 ) $tmp .= ','. $colour; return $tmp; } /** * Set the parameters of the y legend. * * @param text a string argument. * The text of the y legend. * @param font_size an int argument. * The font size of the y legend text. * @param colour a string argument * The hex colour value of the font colour. */ function set_y_legend( $text, $size=-1, $colour='' ) { $this->y_legend = $this->_set_y_legend( $text, $size, $colour ); } /** * Set the parameters of the right y legend. * * @param text a string argument. * The text of the right y legend. * @param font_size an int argument. * The font size of the right y legend text. * @param colour a string argument * The hex value of the font colour. */ function set_y_right_legend( $text, $size=-1, $colour='' ) { $this->y_legend_right = $this->_set_y_legend( $text, $size, $colour ); } /** * Set the colour of the x axis line and grid. * * @param axis a string argument. * The hex colour value of the x axis line. * @param grid a string argument. * The hex colour value of the x axis grid. */ function x_axis_colour( $axis, $grid='' ) { $this->x_axis_colour = $axis; $this->x_grid_colour = $grid; } /** * Set the colour of the y axis line and grid. * * @param axis a string argument. * The hex colour value of the y axis line. * @param grid a string argument. * The hex colour value of the y axis grid. */ function y_axis_colour( $axis, $grid='' ) { $this->y_axis_colour = $axis; if( strlen( $grid ) > 0 ) $this->y_grid_colour = $grid; } /** * Set the colour of the right y axis line. * * @param colour a string argument. * The hex colour value of the right y axis line. */ function y_right_axis_colour( $colour ) { $this->y2_axis_colour = $colour; } /** * Draw a line without markers on values. * * @param width an int argument. * The width of the line in pixels. * @param colour a string argument. * The hex colour value of the line. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label * @param circles an int argument * Need to find out. */ function line( $width, $colour='', $text='', $size=-1, $circles=-1 ) { $type = 'line'. $this->next_line(); $description = ''; if( $width > 0 ) { $description .= $width; $description .= ','. $colour; } if( strlen( $text ) > 0 ) { $description.= ','. $text; $description .= ','. $size; } if( $circles > 0 ) $description .= ','. $circles; $this->lines[$type] = $description; } /** * Draw a line with solid dot markers on values. * * @param width an int argument. * The width of the line in pixels. * @param dot_size an int argument. * Size in pixels of the dot. * @param colour a string argument. * The hex colour value of the line. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function line_dot( $width, $dot_size, $colour, $text='', $font_size='' ) { $type = 'line_dot'. $this->next_line(); $description = "$width,$colour,$text"; if( strlen( $font_size ) > 0 ) $description .= ",$font_size,$dot_size"; $this->lines[$type] = $description; } /** * Draw a line with hollow dot markers on values. * * @param width an int argument. * The width of the line in pixels. * @param dot_size an int argument. * Size in pixels of the dot. * @param colour a string argument. * The hex colour value of the line. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function line_hollow( $width, $dot_size, $colour, $text='', $font_size='' ) { $type = 'line_hollow'. $this->next_line(); $description = "$width,$colour,$text"; if( strlen( $font_size ) > 0 ) $description .= ",$font_size,$dot_size"; $this->lines[$type] = $description; } /** * Draw an area chart. * * @param width an int argument. * The width of the line in pixels. * @param dot_size an int argument. * Size in pixels of the dot. * @param colour a string argument. * The hex colour value of the line. * @param alpha an int argument. * The percentage of transparency of the fill colour. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. * @param fill_colour a string argument. * The hex colour value of the fill colour. */ function area_hollow( $width, $dot_size, $colour, $alpha, $text='', $font_size='', $fill_colour='' ) { $type = 'area_hollow'. $this->next_line(); $description = "$width,$dot_size,$colour,$alpha"; if( strlen( $text ) > 0 ) $description .= ",$text,$font_size"; if( strlen( $fill_colour ) > 0 ) $description .= ','. $fill_colour; $this->lines[$type] = $description; } /** * Draw a bar chart. * * @param alpha an int argument. * The percentage of transparency of the bar colour. * @param colour a string argument. * The hex colour value of the line. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function bar( $alpha, $colour='', $text='', $size=-1 ) { $type = 'bar'. $this->next_line(); $description = $alpha .','. $colour .','. $text .','. $size; $this->lines[$type] = $description; } /** * Draw a bar chart with an outline. * * @param alpha an int argument. * The percentage of transparency of the bar colour. * @param colour a string argument. * The hex colour value of the line. * @param colour_outline a strng argument. * The hex colour value of the outline. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function bar_filled( $alpha, $colour, $colour_outline, $text='', $size=-1 ) { $type = 'filled_bar'. $this->next_line(); $description = "$alpha,$colour,$colour_outline,$text,$size"; $this->lines[$type] = $description; } function bar_sketch( $alpha, $offset, $colour, $colour_outline, $text='', $size=-1 ) { $type = 'bar_sketch'. $this->next_line(); $description = "$alpha,$offset,$colour,$colour_outline,$text,$size"; $this->lines[$type] = $description; } /** * Draw a 3D bar chart. * * @param alpha an int argument. * The percentage of transparency of the bar colour. * @param colour a string argument. * The hex colour value of the line. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function bar_3D( $alpha, $colour='', $text='', $size=-1 ) { $type = 'bar_3d'. $this->next_line(); $description = $alpha .','. $colour .','. $text .','. $size; $this->lines[$type] = $description; } /** * Draw a 3D bar chart that looks like glass. * * @param alpha an int argument. * The percentage of transparency of the bar colour. * @param colour a string argument. * The hex colour value of the line. * @param outline_colour a string argument. * The hex colour value of the outline. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function bar_glass( $alpha, $colour, $outline_colour, $text='', $size=-1 ) { $type = 'bar_glass'. $this->next_line(); $description = $alpha .','. $colour .','. $outline_colour .','. $text .','. $size; $this->lines[$type] = $description; } /** * Draw a faded bar chart. * * @param alpha an int argument. * The percentage of transparency of the bar colour. * @param colour a string argument. * The hex colour value of the line. * @param text a string argument. * The label of the line. * @param font_size an int argument. * Font size of the label. */ function bar_fade( $alpha, $colour='', $text='', $size=-1 ) { $type = 'bar_fade'. $this->next_line(); $description = $alpha .','. $colour .','. $text .','. $size; $this->lines[$type] = $description; } function candle( $data, $alpha, $line_width, $colour, $text='', $size=-1 ) { $type = 'candle'. $this->next_line(); $description = $alpha .','. $line_width .','. $colour .','. $text .','. $size; $this->lines[$type] = $description; $a = array(); foreach( $data as $can ) $a[] = $can->toString(); $this->data[] = implode(',',$a); } function hlc( $data, $alpha, $line_width, $colour, $text='', $size=-1 ) { $type = 'hlc'. $this->next_line(); $description = $alpha .','. $line_width .','. $colour .','. $text .','. $size; $this->lines[$type] = $description; $a = array(); foreach( $data as $can ) $a[] = $can->toString(); $this->data[] = implode(',',$a); } function scatter( $data, $line_width, $colour, $text='', $size=-1 ) { $type = 'scatter'. $this->next_line(); $description = $line_width .','. $colour .','. $text .','. $size; $this->lines[$type] = $description; $a = array(); foreach( $data as $can ) $a[] = $can->toString(); $this->data[] = implode(',',$a); } // // Patch by, Jeremy Miller (14th Nov, 2007) // /** * Draw a pie chart. * * @param alpha an int argument. * The percentage of transparency of the pie colour. * @param $style a string argument. * CSS style string * @param label_colour a string argument. * The hex colour value of the label. * @param gradient a boolean argument. * Use a gradient true or false. * @param border_size an int argument. * Size of the border in pixels. */ function pie( $alpha, $line_colour, $style, $gradient = true, $border_size = false ) { $this->pie = $alpha.','.$line_colour.','.$style; if( !$gradient ) { $this->pie .= ','.!$gradient; } if ($border_size) { if ($gradient === false) { $this->pie .= ','; } $this->pie .= ','.$border_size; } } /** * Set the values of the pie chart. * * @param values an array argument. * An array of the values for the pie chart. * @param labels an array argument. * An array of the labels for the pie pieces. * @param links an array argument. * An array of the links to the pie pieces. */ function pie_values( $values, $labels=array(), $links=array() ) { $this->pie_values = implode(',',$values); $this->pie_labels = implode(',',$labels); $this->pie_links = implode(",",$links); } /** * Set the pie slice colours. * * @param colours an array argument. * The hex colour values of the pie pieces. */ function pie_slice_colours( $colours ) { $this->pie_colours = implode(',',$colours); } /** * Render the output. */ function render() { $tmp = array(); //echo headers_sent() ?'yes':'no'; if( !headers_sent() ) header('content-type: text; charset: utf-8'); if($this->output_type == 'js') { $this->set_unique_id(); $tmp[] = '<div id="' . $this->unique_id . '"></div>'; $tmp[] = '<script type="text/javascript" src="' . $this->js_path . 'swfobject.js"></script>'; $tmp[] = '<script type="text/javascript">'; $tmp[] = 'var so = new SWFObject("' . $this->swf_path . 'open-flash-chart.swf", "ofc", "'. $this->width . '", "' . $this->height . '", "9", "#FFFFFF");'; $tmp[] = 'so.addVariable("variables","true");'; } if( strlen( $this->title ) > 0 ) { $values = $this->title; $values .= ','. $this->title_style; $tmp[] = $this->format_output('title',$values); } if( strlen( $this->x_legend ) > 0 ) { $values = $this->x_legend; $values .= ','. $this->x_legend_size; $values .= ','. $this->x_legend_colour; $tmp[] = $this->format_output('x_legend',$values); } if( strlen( $this->x_label_style ) > 0 ) $tmp[] = $this->format_output('x_label_style',$this->x_label_style); if( $this->x_tick_size > 0 ) $tmp[] = $this->format_output('x_ticks',$this->x_tick_size); if( $this->x_axis_steps > 0 ) $tmp[] = $this->format_output('x_axis_steps',$this->x_axis_steps); if( strlen( $this->x_axis_3d ) > 0 ) $tmp[] = $this->format_output('x_axis_3d',$this->x_axis_3d); if( strlen( $this->y_legend ) > 0 ) $tmp[] = $this->format_output('y_legend',$this->y_legend); if( strlen( $this->y_legend_right ) > 0 ) $tmp[] = $this->format_output('y2_legend',$this->y_legend_right); if( strlen( $this->y_label_style ) > 0 ) $tmp[] = $this->format_output('y_label_style',$this->y_label_style); $values = '5,10,'. $this->y_steps; $tmp[] = $this->format_output('y_ticks',$values); if( count( $this->lines ) == 0 && count($this->data_sets)==0 ) { $tmp[] = $this->format_output($this->line_default['type'],$this->line_default['values']); } else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -