This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
srand((double)microtime()*1000000);
$data = array();
// add random height bars:
for( $i=0; $i<10; $i++ )
$data[] = rand(2,9);
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( date("D M d Y") );
$bar = new OFC_Charts_Bar_3d();
$bar->set_values( $data );
$bar->colour = '#D54C78';
$x_axis = new OFC_Elements_Axis_X();
$x_axis->set_3d( 5 );
$x_axis->colour = '#909090';
$x_axis->set_labels( array(1,2,3,4,5,6,7,8,9,10) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $bar );
$chart->set_x_axis( $x_axis );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,48 @@
<?php
$data = array();
for( $i=0; $i<6.2; $i+=0.2 )
{
$tmp = sin($i) * 1.9;
$data[] = $tmp;
}
require_once('OFC/OFC_Chart.php');
$chart = new OFC_Chart();
$chart->set_title( new OFC_Elements_Title( 'Area Chart' ) );
//
// Make our area chart:
//
$area = new OFC_Charts_Area_Hollow();
// set the circle line width:
$area->set_width( 1 );
$area->set_values( $data );
// add the area object to the chart:
$chart->add_element( $area );
$y_axis = new OFC_Elements_Axis_Y();
$y_axis->set_range( -2, 2, 2 );
$y_axis->labels = null;
$y_axis->set_offset( false );
$x_axis = new OFC_Elements_Axis_X();
$x_axis->labels = $data;
$x_axis->set_steps( 2 );
$x_labels = new OFC_Elements_Axis_X_Label_Set();
$x_labels->set_steps( 4 );
$x_labels->set_vertical();
// Add the X Axis Labels to the X Axis
$x_axis->set_labels( $x_labels );
$chart->add_y_axis( $y_axis );
$chart->x_axis = $x_axis;
echo $chart->toPrettyString();

View File

@@ -0,0 +1,32 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( date("D M d Y") );
$bar = new OFC_Charts_Bar();
$bar->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $bar );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,68 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
// generate some random data
srand((double)microtime()*1000000);
$data_1 = array();
$data_2 = array();
$data_3 = array();
for( $i=0; $i<9; $i++ )
{
$data_1[] = rand(1,6);
$data_2[] = rand(7,13);
$data_3[] = rand(14,19);
}
$line_dot = new OFC_Charts_Line_Dot();
$line_dot->set_width( 4 );
$line_dot->set_colour( '#DFC329' );
$line_dot->set_dot_size( 5 );
$line_dot->set_values( $data_1 );
$line_hollow = new OFC_Charts_Line_Hollow();
$line_hollow->set_width( 1 );
$line_hollow->set_colour( '#6363AC' );
$line_hollow->set_dot_size( 5 );
$line_hollow->set_values( $data_2 );
$line = new OFC_Charts_Line();
$line->set_width( 1 );
$line->set_colour( '#5E4725' );
$line->set_dot_size( 5 );
$line->set_values( $data_3 );
$y = new OFC_Elements_Axis_Y();
$y->set_range( 0, 20, 5 );
$chart = new OFC_Chart();
$chart->set_title( new OFC_Elements_Title( 'Three lines example' ) );
$chart->set_y_axis( $y );
//
// here we add our data sets to the chart:
//
$chart->add_element( $line_dot );
$chart->add_element( $line_hollow );
$chart->add_element( $line );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,33 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( date("D M d Y") );
$line_dot = new OFC_Charts_Line();
$line_dot->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $line_dot );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,32 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( date("D M d Y") );
$bar = new OFC_Charts_Bar_Glass();
$bar->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $bar );
echo $chart->toString();

View File

@@ -0,0 +1,45 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( "Our New House Schedule" );
$hbar = new OFC_Charts_Bar_Horizontal();
$hbar->append_value( new OFC_Charts_Bar_Horizontal_Value(0,4) );
$hbar->append_value( new OFC_Charts_Bar_Horizontal_Value(4,8) );
$hbar->append_value( new OFC_Charts_Bar_Horizontal_Value(8,11) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $hbar );
$chart->add_y_axis( new OFC_Elements_Axis_Y() );
$x = new OFC_Elements_Axis_X();
$x->set_offset( false );
$x->set_labels_from_array( array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
$chart->set_x_axis( $x );
$y = new OFC_Elements_Axis_Y();
$y->set_offset( true );
$y->set_labels( array( "Make garden look sexy","Paint house","Move into house" ) );
$chart->add_y_axis( $y );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,69 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$data_1 = array();
$data_2 = array();
$data_3 = array();
for( $i=0; $i<6.2; $i+=0.2 )
{
$data_1[] = (sin($i) * 1.9) + 7;
$data_2[] = (sin($i) * 1.9) + 10;
$data_3[] = (sin($i) * 1.9) + 4;
// just show to two decimal places
// in our labels:
//$labels[] = number_format($tmp,2);
}
$title = new OFC_Elements_Title( date("D M d Y") );
$line_1 = new OFC_Charts_Line_Dot();
$line_1->set_values( $data_1 );
$line_1->set_halo_size( 0 );
$line_1->set_width( 2 );
$line_1->set_dot_size( 4 );
$line_2 = new OFC_Charts_Line_Dot();
$line_2->set_values( $data_2 );
$line_2->set_halo_size( 1 );
$line_2->set_width( 1 );
$line_2->set_dot_size( 4 );
$line_3 = new OFC_Charts_Line_Dot();
$line_3->set_values( $data_3 );
$line_3->set_halo_size( 1 );
$line_3->set_width( 6 );
$line_3->set_dot_size( 4 );
$y = new OFC_Elements_Axis_Y();
$y->set_range( 0, 15, 5 );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $line_1 );
$chart->add_element( $line_2 );
$chart->add_element( $line_3 );
$chart->set_y_axis( $y );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,69 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$data_1 = array();
$data_2 = array();
$data_3 = array();
for( $i=0; $i<6.2; $i+=0.2 )
{
$data_1[] = (sin($i) * 1.9) + 7;
$data_2[] = (sin($i) * 1.9) + 10;
$data_3[] = (sin($i) * 1.9) + 4;
// just show to two decimal places
// in our labels:
//$labels[] = number_format($tmp,2);
}
$title = new OFC_Elements_Title( date("D M d Y") );
$line_1 = new OFC_Charts_Line_Hollow();
$line_1->set_values( $data_1 );
$line_1->set_halo_size( 0 );
$line_1->set_width( 2 );
$line_1->set_dot_size( 5 );
$line_2 = new OFC_Charts_Line_Hollow();
$line_2->set_values( $data_2 );
$line_2->set_halo_size( 1 );
$line_2->set_width( 1 );
$line_2->set_dot_size( 4 );
$line_3 = new OFC_Charts_Line_Hollow();
$line_3->set_values( $data_3 );
$line_3->set_halo_size( 1 );
$line_3->set_width( 6 );
$line_3->set_dot_size( 4 );
$y = new OFC_Elements_Axis_Y();
$y->set_range( 0, 15, 5 );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $line_1 );
$chart->add_element( $line_2 );
$chart->add_element( $line_3 );
$chart->set_y_axis( $y );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,37 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( 'Area Chart' );
$pie = new OFC_Charts_Pie();
$pie->set_start_angle( 35 );
$pie->set_animate( true );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $pie );
$chart->x_axis = null;
echo $chart->toPrettyString();

View File

@@ -0,0 +1,63 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$chart = new OFC_Chart();
$title = new OFC_Elements_Title( date("D M d Y") );
$chart->set_title( $title );
$scatter = new OFC_Charts_Scatter( '#FFD600', 10 );
$scatter->set_values(
array(
new OFC_Charts_Scatter_Value( 0, 0 )
)
);
$chart->add_element( $scatter );
//
// plot a circle
//
$s2 = new OFC_Charts_Scatter( '#D600FF', 3 );
$v = array();
for( $i=0; $i<360; $i+=5 )
{
$v[] = new OFC_Charts_Scatter_Value(
number_format(sin(deg2rad($i)), 2, '.', ''),
number_format(cos(deg2rad($i)), 2, '.', '') );
}
$s2->set_values( $v );
$chart->add_element( $s2 );
$x = new OFC_Elements_Axis_X();
$x->set_range( -2, 2 );
$chart->set_x_axis( $x );
$y = new OFC_Elements_Axis_Y();
$y->set_range( -2, 2 );
$chart->add_y_axis( $y );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,33 @@
<?php
/**
* PHP Integration of Open Flash Chart
* Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( date("D M d Y") );
$title->set_style( '{color: #567300; font-size: 14px}' );
$bar = new OFC_Charts_Bar_Sketch( '#81AC00', '#567300', 5 );
$bar->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $bar );
echo $chart->toPrettyString();

View File

@@ -0,0 +1,25 @@
<?php
require_once('OFC/OFC_Chart.php');
$title = new OFC_Elements_Title( date("D M d Y") );
$bar_stack = new OFC_Charts_Bar_Stack();
$bar_stack->append_stack( array( 2.5, 5 ) );
$bar_stack->append_stack( array( 7.5 ) );
$bar_stack->append_stack( array( 5, new OFC_Charts_Bar_Stack_Value(5, '#ff0000') ) );
$bar_stack->append_stack( array( 2, 2, 2, 2, new OFC_Charts_Bar_Stack_Value(2, '#ff00ff') ) );
$y = new OFC_Elements_Axis_Y();
$y->set_range( 0, 14, 7 );
$x = new OFC_Elements_Axis_X();
$x->set_labels( array( 'a', 'b', 'c', 'd' ) );
$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $bar_stack );
$chart->set_x_axis( $x );
$chart->add_y_axis( $y );
echo $chart->toPrettyString();