<?php
/*
FUSIONCHARTS FREE API PHP CLASS
Author : Infosoft Global Pvt. Ltd.
version : FREE
Company : Infosoft Global Pvt. Ltd.
FusionCharts Class easily handles All FusionCharts XML Structures like
graph, categories, dataset, set, Trend Lines, [vline, styles (for Future)] etc.
It�s easy to use, it binds data into FusionCharts XML Structures
*/
include_once('FusionCharts.php');
class FusionCharts{
var $chartType; # Chart Friendly Name
var $chartID; # ID of the Chart for JS interactivity(optional)
var $SWFFile; # Name of the required FusionCharts SWF file
var $SWFPath; # relative path of FusionCharts SWF files
var $width; # FusionCharts width
var $height; # FusionCharts height
# attribute Delimiter
var $del;
# Chart XML string
var $strXML;
# Chart Series Types : 1 => single series, 2=> multi-series, 5=>Gantt (
# For Future Use : 3=> scatter and bubble, 4=> MSStacked
var $seriesType;
# Charts Atribute array
var $chartParams = array(); #List of Chart Parameters
var $chartParamsCounter; #Number of Chart parameters
var $categoriesParam; # Categories Parameter Setting
var $categoryNames = array(); # Category array for storing Category set
var $categoryNamesCounter; # Category array counter
var $dataset = array(); # dataset array
var $datasetParam = array(); # dataset parameter setting array
var $datasetCounter; # dataset array counter
var $setCounter; # set array counter
# trendLines array
var $trendLines = array(); # trendLines array
var $tLineCounter; # trendLines array counter
#chart messages
var $chartMSG;
var $chartSWF = array(); # Charts SWF array
var $arr_FCColors = array(); # Color Set to be applied to dataplots
#############============ For Gantt Chart ============================
# Gantt categories
var $GT_categories = array();
var $GT_categories_Counter;
var $GT_categoriesParam = array();
var $GT_subcategories_Counter;
# Gantt processes
var $GT_processes = array();
var $GT_processes_Counter;
var $GT_processes_Param;
# Gantt Tasks
var $GT_Tasks = array();
var $GT_Tasks_Counter;
var $GT_Tasks_Param;
# Gantt Connectors
var $GT_Connectors = array();
var $GT_Connectors_Counter;
var $GT_Connectors_Param;
# Gantt Milestones
var $GT_Milestones = array();
var $GT_Milestones_Counter;
var $GT_Milestones_Param;
# Gantt datatable
var $GT_datatable = array();
var $GT_datatable_Counter;
var $GT_datatableParam;
var $GT_dataColumnParam = array();
var $GT_subdatatable_Counter;
#------- For Futute Use (start)----------------
# Gantt legend
var $GT_legend = array();
var $GT_legend_Counter;
var $GT_legend_Param;
#------- For Futute Use (end)----------------
# JS Constrator
var $debugMode;
var $registerWithJS;
var $bgColor;
var $scaleMode;
var $lang;
#############============ For Future Use (start)============================
# dataset for MSStackedColumn2D
var $MSSDataset = array(); # dataset array for MSStackedColumn2D
var $MSSDatasetParams = array(); # MSSDataset parameter setting
var $MSSDatasetCounter; # MSSDataset array counter
var $MSSSubDatasetCounter; # ms sub dataset array counter
var $MSSSetCounter; # msset array counter
# lineset
var $lineSet = array(); # lineSet array
var $lineSetParam = array(); # lineSet Parameter setting array
var $lineCounter; # line array counter
var $lineSetCounter; # lineset array counter
var $lineIDCounter; # lineID counter;
# vtrendLines array
var $vtrendLines = array(); # vtrendLines array
var $vtLineCounter; # vtrendLines array counter
# style array
var $styles = array(); # styles array
var $styleDefCounter; # define counter
var $styleAppCounter; # apply counter
#############============ For Future Use (end)============================
# FusionCharts Constructor, its take 4 Parameters.
# when we create object of FusionCharts, then Constructor will auto run and initialize
# chats array parameter like chartType, width, height, chartsID
function FusionCharts($chartType,$width,$height,$chartID=""){
# Setting All Charts Array
$this->setChartArrays();
#initialise colorList
$this->colorInit();
# Setting Chart name
$this->chartType=strtolower($chartType);
# Getting Charts Series Type
$this->getSeriesType();
# Setting Charts Width and Height
$this->width=$width;
$this->height=$height;
# Setting ChartID, Defult is Charts Name
if ($chartID==""){
$chartCounter=@$_SESSION['chartcount'];
if($chartCounter<=0 || $chartCounter==NULL){
$chartCounter=1;
}
$this->chartID=$chartType . $chartCounter;
$_SESSION['chartcount']=++$chartCounter;
}else{
$this->chartID=$chartID;
}
# Setting Defult Parameter Delimiter to ';'
$this->del=";";
# Setting Default SWF Path
$this->SWFPath="";
$this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0] . ".swf";
# Initialize categoriesParam
$this->categoriesParam="";
$this->categoryNamesCounter=1;
# Creating Category Array
$this->createCategory($this->categoryNamesCounter);
# Initialize Dataset Variables
$this->datasetCounter=0;
$this->setCounter= 0;
if($this->seriesType>1){
$this->setCounter++;
}
# Initialize MSSDataset Variables
if($this->seriesType==4){
$this->MSSDatasetCounter=0;
$this->MSSSubDatasetCounter=0;
$this->MSSSetCounter=0;
$this->lineCounter=0;
$this->lineSetCounter=0;
$this->lineIDCounter=0;
}
# vTrendLines Array inisialize
if($this->seriesType==3){
$this->vtLineCounter=1;
$this->createvTrendLines($this->vtLineCounter);
}
# TrendLines Array inisialize
$this->tLineCounter=1;
$this->createTrendLines($this->tLineCounter);
# Styles Array inisialize
$this->styleDefCounter=1;
$this->styleAppCounter=1;
$this->createStyles("definition");
$this->createSubStyles("definition","style");
$this->createSubStylesParam("definition","style",$this->styleDefCounter);
$this->GT_categories_Counter=0;
$this->GT_subcategories_Counter=0;
$this->GT_processes_Counter=0;
$this->GT_processes_Param="";
$this->GT_Tasks_Counter=0;
$this->GT_Tasks_Param="";
# Gantt Connectors
$this->GT_Connectors_Counter=0;
$this->GT_Connectors_Param="";
# Gantt datatable
$this->GT_datatable_Counter=0;
$this->GT_datatableParam="";
$this->GT_subdatatable_Counter=0;
# Gantt legend
$this->GT_legend_Counter=0;
$this->GT_legend_Param="";
# JS Constractor
$this->debugMode=false;
$this->registerWithJS=false;
$this->bgColor="";
$this->scaleMode="";
$this->lang="";
$this->chartMSG="";
# XML store Variables
$this->strXML="";
}
##------------ PUBLIC FUNCTIONS ----------------------------------------------------------------
# Setting Parameter Delimiter, Defult Parameter Separator is ";"
function setParamDelimiter($strDel){
$this->del=$strDel;
}
# Setting path of SWF file. file name like FCF_Column3D.swf. where FCF_ is common for all SWF file
function setSWFPath($SWFPath){
评论8
最新资源