Documentation:

Back
phpchartPlus Documentation
Tsiavos Chris <[email protected]>
Date: 18-Feb-2005
License: GPL
3.3.1 Using the NullCache Strategy
To use the NullCache Strategy you have to follow 3 steps
1. Include the appropriate file
2. Initialize the NullCache Strategy class
3. Strategize the phpchartPlus instance with the NullCache Strategy instance
code portion from file: "Examples/example.php"
include("../Sources/phpchartPlus.php");
include("../Sources/NullCache_Strategy.php");
include("../Sources/TXTData_Strategy.php");
include("../Sources/PHPConfig_Strategy.php");
               
$ConfigParams=array("ImageWidth"=>420,
                    "ImageHeight"=>300,
                    "ImageOutputType"=>"png",
                    "ChartTitle"=>"Web Servers Usage",
                    "ChartType"=>"Bar",
                    "ChartUseBlending"=>"Yes",
                    "ChartUseAntialias"=>"Yes",
                    "ChartHmargin"=>30,
                    "ChartVmargin"=>30,
                    "ChartUseStatus"=>"Yes",
                    "ImageColor_Start"=>"DimGray",
                    "ImageColor_Finish"=>"DimGray",
                    "ImageColor_Alpha"=>0,
                    "ChartColor_Start"=>"DimGray",
                    "ChartColor_Finish"=>"FloralWhite",
                    "ChartColor_Alpha"=>0,
                    "FontColor"=>"White",
                    "FontWidth"=>3,
                    "FontHeight"=>3,
                    "FontFileLocation"=>"../Fonts/ActionMan.ttf",
                    "FontSize"=>9,
                    "LegendColors"=>
                     array("DarkRed,Yellow","Black,DarkGreen"),
                    "LegendColors_Alpha"=>array(0,0),
                    "GridNum"=>4,
                    "GridMinValue"=>0,
                    "GridMaxValue"=>100,
                    "GridColor"=>"Black");
 
$DataParams=array("filename"=>"../Data/ChartData.txt");
 
$DataStrategy=new TXTData_Strategy();
$ConfigStrategy=new PHPConfig_Strategy();
$CacheStrategy=new NullCache_Strategy();  
$im=new phpchartPlus();
     
try 
   {
     $im->DataParser_->strategize($DataStrategy,$DataParams);
     $im->DataParser_->parse();
   }
   catch (DataParser_Exception $e) 
   {
     print $e->getMessage();
     exit();
   }
   catch (DataStrategy_Exception $f) 
   {
     print $f->getMessage();
     exit();
   }
   
try
   {
     $im->ConfigParser_->strategize($ConfigStrategy);
     $im->ConfigParser_->parse($ConfigParams);
   }
   catch (ConfigParser_Exception $e) 
   {
     print $e->getMessage();
     exit();
   }
   catch (ConfigStrategy_Exception $f) 
   {
     print $f->getMessage();
     exit();
   }
   
try
   { 
     $im->get_Instance(); 
   }
   catch (ImageSupport_Exception $e)
   {
     print $e->getMessage();
     exit();
   }
   catch (FontSupport_Exception $f)
   {
     print $f->getMessage();
     exit();
   }
   
$im->Chart_->set_CachingStrategy($CacheStrategy); 
$im->Chart_->draw_Chart();
 

 
Hosted by www.Geocities.ws

1