pathToImageCache = $pathImageCache; } protected function chechIfExists($nom) { if(file_exists($this->pathToImageCache.$nom)) return (true); return (false); } /** * Permet de connaitre les valeur par default pour les différents graphique. * Enter description here ... */ protected function getDefault() { /** * Paramétres par default Graphique XY **/ $default = new stdClass(); $default->XY->width = 400; $default->XY->height = 250; $default->XY->setPlotArea = array(80, 10, 280, 200); $default->XY->yAxisWidth = 2; $default->XY->xAxisWidth = 2; $default->XY->legendeParams = array(80, 10, false, "times.ttf", 9); $default->XY->colorLegende = 0xff0000; $default->XY->setLabelStep = 10; /** * Paramétres par default Graphique PieChart **/ $default->PieChart->width = 660; $default->PieChart->height = 243; $default->PieChart->title->police = "timesbi.ttf"; $default->PieChart->title->size = 15; $default->PieChart->Xround = round($default->PieChart->width / 2); $default->PieChart->Yround = round($default->PieChart->height / 2); $default->PieChart->radius = 90; $default->PieChart->setRoundedCorners = 5; $default->PieChart->setLineColor = array(SameAsMainColor, 0x000000); $default->PieChart->setStartAngle = 135; $default->PieChart->setLabelFormat = "<*block,valign=absmiddle*>{label} <*font=".$default->PieChart->title->police.",size=0*>({percent|0}%)"; $default->PieChart->set3D = 20; $default->PieChart->getHTMLImageMap = array("", "", "name='{label}' title='{label}
{value|0} K.Euros' class='detailsgraphique'"); $default->PieChart->makeSession = "chart1"; /** * Paramétres par default Graphique FinanceChart **/ $default->financeChart->width = 640; $default->financeChart->title = "Graphique financié"; $default->financeChart->addSlowStochastic = array(75, 14, 3, 0x006060, 0x606000); $default->financeChart->addMainChart = 240; $default->financeChart->addSimpleMovingAvg = array(array(10, 0x663300), array(20, 0x9900ff)); $default->financeChart->addCandleStick = array(array(0x00ff00, 0xff000)); $default->financeChart->addDonchianChannel = array(array(20, 0x9999ff, 0xc06666ff)); $default->financeChart->addVolBars = array(array(75, 0x99ff99, 0xff9999, 0x808080)); $default->financeChart->addMACD = array(array(75, 26, 12, 9, 0x0000ff, 0xff00ff, 0x008000)); $default->financeChart->getHTMLImageMap = array("", "", "name='' title='{value|0} K.Euros' class='detailsgraphique'"); /** * Paramêtres par default Graphique Radar */ $default->radarChart->width = 480; $default->radarChart->height = 320; $default->radarChart->setPlotArea = array(80, 10, 280, 200); $default->radarChart->dataColor = 0x9999ff; return ($default); } public function getValueDefault($type) { print_r(self::getDefault()->$type); } /** * $parametres->nom = le nom final de l'image exemple : "552152365-C-actif.png" * $parametres->width = la largeur de l'image. * $parametres->height = la hauteur de l'image. * $parametres->plotArea = "exemple" : array(55, 10, 280, 200) doit être un tableau. * $parametres->TitleY = array("Keuros"); Les titre sur les coté du graphique. * $parametres->TitleX = array("Années"); Les titres sur les coté du graphique. * $parametres->yAxisWidth = 2; * $parametres->xAxisWidth = 2; * $parametres->legendeParams = array(50, 10, false, "times.ttf", 9); les paramètres des legendes doit être un tableau ! * $parametres->colorLegende = la couleur du texte de la legende, 0xff0000 par default. * $parametres->LineLayer = array("Entreprise", "Secteur"); * - les legendes des courbes du graphique. * - (sachant que chaque legende est assigner a un tableau de valeur). * - Le tableau des datas doit être dans le meme ordre que l'ordre des titres ! IMPORTANT ! * $parametres->setLabelStep = 10 par default. * $parametres->labelsY = Les labels en Y exemple les dates (2008, 2004, 2003, 2002, 2001); * $parametres->labelsX = Les labels en X exemple les chiffre (20K, 30K, 50K) * - En laissant vide ces champs le système les créras automatiquement. * * @param stdClass $parametres * @param bool $default */ public function GraphiqueLineXY($parametres, $default = false) { $addStepLineLayerTab = array(); $i = 0; if(!self::chechIfExists($parametres->nom)) { $chart = new XYChart(((!$default)?$parametres->width:self::getDefault()->XY->width), ((!$default)?$parametres->height:self::getDefault()->XY->height), (isset($parametres->bgColor))?$parametres->bgColor:BackgroundColor, (isset($parametres->edgeColor))?$parametres->edgeColor:Transparent, (isset($parametres->raisedEffect))?$parametres->raisedEffect:0); (isset($parametres->addTitle))?call_user_func_array(array($chart, 'addTitle'), $parametres->addTitle):EOF; if(isset($parametres->addText)) foreach ($parametres->addText as $addText)call_user_func_array(array($chart, 'addText'), $addText); call_user_func_array(array($chart, 'setPlotArea'), (!$default)?$parametres->setPlotArea:self::getDefault()->XY->setPlotArea); if(isset($parametres->TitlesY)) foreach ($parametres->TitlesY as $titleY) call_user_func_array(array($chart->yAxis, 'setTitle'), $titleY); if(isset($parametres->TitlesX)) foreach ($parametres->TitlesX as $titleX) call_user_func_array(array($chart->xAxis, 'setTitle'), $titleX); $chart->yAxis->setWidth(((!$default)?$parametres->yAxisWidth:self::getDefault()->XY->yAxisWidth)); $chart->xAxis->setWidth(((!$default)?$parametres->xAxisWidth:self::getDefault()->XY->xAxisWidth)); $legendObj = call_user_func_array(array($chart, 'addLegend'), ((!$default)?$parametres->legendeParams:self::getDefault()->XY->legendeParams)); $legendObj->setBackground(Transparent); if(isset($parametres->addStepLineLayer)) { foreach($parametres->addStepLineLayer as $reference => $addStepLineLayer) { $Layer = $chart->addStepLineLayer($addStepLineLayer[0], (isset($parametres->dashLineColor))? (($parametres->dashLineColor == $reference)?$chart->dashLineColor($addStepLineLayer[1], DashLine):$addStepLineLayer[1]):$addStepLineLayer[1],$addStepLineLayer[2]); $Layer->setXData($addStepLineLayer[3]); $Layer->setLineWidth(2); $addStepLineLayerTab[$reference] = $Layer;} } if (isset($parametres->addInterLineLayer)) { foreach($parametres->addInterLineLayer as $references => $addInterLineLayer){ $reference = explode(':', $references); $chart->addInterLineLayer($addStepLineLayerTab[$reference[0]]->getLine(0), $addStepLineLayerTab[$reference[1]]->getLine(0), $addInterLineLayer[0], $addInterLineLayer[1]);} } if(isset($parametres->LineLayer)) { foreach ($parametres->LineLayer as $lineLayer) { $chart->addLineLayer($parametres->datas[$i],((isset($parametres->colorLegende->$lineLayer))?$parametres->colorLegende->$lineLayer:self::getDefault()->XY->colorLegende), $lineLayer); $i++;} $chart->yAxis->setLabels($parametres->labelsY); $chart->yAxis->setLabelStep(((!$default)?$parametres->setLabelStep:self::getDefault()->XY->setLabelStep)); $chart->xAxis->setLabels($parametres->labelsX);} $chart->makeChart($this->pathToImageCache.$parametres->nom);} return ($this->pathToImageCache.$parametres->nom); } /** * $parametres->nom = le nom final de l'image exemple : "552152365-C-actif.png" * $parametres->width = largeur de l'image du graphique * $parametres->height = la hauteur de l'images du graphique * $parametres->title->texte = le texte de l'image du graphique ex : actif pour la période de... * $parametres->title->police = la police utilisé ex : timesbi.ttf * $parametres->title->size = la taille de la police pour le titre du graphique * $parametres->setPieSize = array(round(width/2), round(height/2), radius); * - La largeur / 2 arrondie * - La hauteur divisé par 2 arrondie * - Le radius. ex: (90) * $parametres->setRoundedCorners = une valeur ex : 5 * $parametres->setLineColor = array(SameAsMainColor, 0x000000). * $parametres->setStartAngle = 135 (angle du camanbert par default). * $parametres->setLabelFormat = "html..." le code de formatage de la ligne * - exemple : <*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*> * $parametres->setData = array($data, $labels) les données et les labels correspondants. * $parametres->set3D = 20 (permet de definir la profondeur 3d.). * $parametres->makeSession = "chart1" les nom de la session. * $parametres->getHTMLImageMap = array("", "", "name='{label}' title='{label}
{value|0} K.Euros' class='detailsgraphique'"); * - Les parametres pour les area comment formater chaque tootltip. * * Cette méthode retourne une stdClass() avec les parametres imageMap et chartID. * * @param stdClass $parametres * @param bool $default */ public function GraphiquePieChart($parametres, $default = false) { $return = new stdClass(); $pieChart = new PieChart(((!$default)?$parametres->width:self::getDefault()->PieChart->width), ((!$default)?$parametres->height:self::getDefault()->PieChart->height)); $pieChart->addTitle($parametres->title->texte, (!$default)?$parametres->title->police:self::getDefault()->PieChart->title->police, (!$default)?$parametres->title->size:self::getDefault()->PieChart->title->size); $pieChart->setPieSize((!$default)?$parametres->Xround:self::getDefault()->PieChart->Xround, (!$default)?$parametres->Yround:self::getDefault()->PieChart->Yround, (!$default)?$parametres->radius:self::getDefault()->PieChart->radius); $pieChart->setLabelLayout(SideLayout); $style = $pieChart->setLabelStyle(); $style->setBackground(SameAsMainColor, Transparent, softLighting()); $style->setRoundedCorners((!$default)?$parametres->setRoundedCorners:self::getDefault()->PieChart->setRoundedCorners); $pieChart->setLineColor((!$default)?$parametres->setLineColor[0]:self::getDefault()->PieChart->setLineColor[0], (!$default)?$parametres->setLineColor[1]:self::getDefault()->PieChart->setLineColor[1]); $pieChart->setStartAngle((!$default)?$parametres->setStartAngle:self::getDefault()->PieChart->setStartAngle); $pieChart->setLabelFormat((!$default)?$parametres->setLabelFormat:self::getDefault()->PieChart->setLabelFormat); $pieChart->setData($parametres->datas, $parametres->labels); $pieChart->set3D((!$default)?$parametres->set3D:self::getDefault()->PieChart->set3D); $makeSession = (!$default)?$parametres->makeSession:self::getDefault()->PieChart->makeSession; $return->chartID = $pieChart->makeSession($makeSession); $return->imageMap = $pieChart->getHTMLImageMap((!$default)?$parametres->getHTMLImageMap[0]:self::getDefault()->PieChart->getHTMLImageMap[0], (!$default)?$parametres->getHTMLImageMap[1]:self::getDefault()->PieChart->getHTMLImageMap[1], (!$default)?$parametres->getHTMLImageMap[2]:self::getDefault()->PieChart->getHTMLImageMap[2]); $pieChart->makeChart($this->pathToImageCache.$parametres->nom); return ($return); } /** * $parametres->nom = le nom final de l'image exemple : "552152365-C-actif.png" * $parametres->width = largeur de l'image du graphique * $parametres->title = titre du graphique * $parametres->timeStamps = $timeStamps; * $parametres->highData = les données les plus hautes pour l'action * $parametres->lowData = les données les plus basses pour l'action * $parametres->openData = l'ouverture des données * $parametres->closeData = les fermeture des données. * $parametres->volData = $volData; * $parametres->extraDays = $extraDays; * $parametres->addMainChart = $addMainChart; ex : 5 * $parametres->addSlowStochastic = array(75, 14, 3, 0x006060, 0x606000); * $parametres->addSimpleMovingAvg = array(array(10, 0x663300), array(20, 0x9900ff)); * $parametres->addCandleStick = array(array(0x00ff00, 0xff000)); * $parametres->addDonchianChannel = array(array(20, 0x9999ff, 0xc06666ff)); * $parametres->addVolBars = array(array(75, 0x99ff99, 0xff9999, 0x808080)); * $parametres->addMACD = array(array(75, 26, 12, 9, 0x0000ff, 0xff00ff, 0x008000)); * $parametres->makeSession = nom dans le session ID unique (sert pour le mappage des areas); * * Cette méthode retourne une stdClass() avec les parametres imageMap et chartIDRL. * * @param stdClass $parametres * @param bool $default */ public function GraphiqueFinance($parametres, $default = false) { $return = new stdClass(); $financeChart = new FinanceChart((!$default)?$parametres->width:self::getDefault()->financeChart->width); call_user_func_array(array($financeChart, 'addTitle'), (!$default)?$parametres->title:self::getDefault()->financeChart->title); $financeChart->setData($parametres->timeStamps, $parametres->highData, $parametres->lowData, $parametres->openData, $parametres->closeData, $parametres->volData, $parametres->extraDays); $financeChart->addSlowStochastic((!$default)?$parametres->addSlowStochastic[0]:self::getDefault()->financeChart->addSlowStochastic[0], (!$default)?$parametres->addSlowStochastic[1]:self::getDefault()->financeChart->addSlowStochastic[1], (!$default)?$parametres->addSlowStochastic[2]:self::getDefault()->financeChart->addSlowStochastic[2], (!$default)?$parametres->addSlowStochastic[3]:self::getDefault()->financeChart->addSlowStochastic[3], (!$default)?$parametres->addSlowStochastic[4]:self::getDefault()->financeChart->addSlowStochastic[4]); $financeChart->addMainChart((!$default)?$parametres->financeChart->addMainChart:self::getDefault()->financeChart->addMainChart); foreach ((!$default)?$parametres->addSimpleMovingAvg:self::getDefault()->financeChart->addSimpleMovingAvg as $addSimpleMovingAvg) $financeChart->addSimpleMovingAvg($addSimpleMovingAvg[0], $addSimpleMovingAvg[1]); foreach ((!$default)?$parametres->addCandleStick:self::getDefault()->financeChart->addCandleStick as $addCandleStick) $financeChart->addCandleStick($addCandleStick[0], $addCandleStick[1]); foreach ((!$default)?$parametres->addDonchianChannel:self::getDefault()->financeChart->addDonchianChannel as $addDonchianChannel) $financeChart->addDonchianChannel($addDonchianChannel[0], $addDonchianChannel[1], $addDonchianChannel[2]); foreach ((!$default)?$parametres->addVolBars:self::getDefault()->financeChart->addVolBars as $addVolBars) $financeChart->addVolBars($addVolBars[0], $addVolBars[1], $addVolBars[2], $addVolBars[3]); foreach ((!$default)?$parametres->addMACD:self::getDefault()->financeChart->addMACD as $addMACD) $financeChart->addMACD($addMACD[0], $addMACD[1], $addMACD[2], $addMACD[3], $addMACD[4], $addMACD[5],$addMACD[6]); $makeSession = (!$default)?$parametres->makeSession:self::getDefault()->financeChart->makeSession; $return->chartID = $financeChart->makeSession($makeSession); $return->imageMap = $financeChart->getHTMLImageMap((!$default)?$parametres->getHTMLImageMap[0]:self::getDefault()->financeChart->getHTMLImageMap[0], (!$default)?$parametres->getHTMLImageMap[1]:self::getDefault()->financeChart->getHTMLImageMap[1], (!$default)?$parametres->getHTMLImageMap[2]:self::getDefault()->financeChart->getHTMLImageMap[2]); $financeChart->makeChart($this->pathToImageCache.$parametres->nom); return ($return); } /** * Classe permettant de générer des graphique de type radar : * Structure de données : * * $struct = new stdClass(); * $struct->datas = les données * $struct->labels = les labels pour le graphique * $struct->dataColor = la couleur pour les toiles du radar. * * @param unknown_type $parametres * @param unknown_type $default */ public function GraphiqueRadar($parametres, $default = false) { if(!self::chechIfExists($parametres->nom)) { $data = $parametres->datas; $labels = $parametres->labels; $chart = new PolarChart((!$default)?$parametres->width:self::getDefault()->radarChart->width, (!$default)?$parametres->height:self::getDefault()->radarChart->height); call_user_func_array(array($chart, 'setPlotArea'), (!$default)?$parametres->setPlotArea:self::getDefault()->radarChart->setPlotArea); call_user_func_array(array($chart, 'addTitle'), (!$default)?$parametres->title:self::getDefault()->radarChart->title); $chart->addAreaLayer($parametres->datas, $parametres->dataColor); $chart->angularAxis->setLabels($parametres->labels); call_user_func_array(array($chart->angularAxis, 'setLabelStyle'), (!$default)?$parametres->labelStyle:self::getDefault()->radarChart->labelStyle); $chart->makeChart($this->pathToImageCache.$parametres->nom); } return ($this->pathToImageCache.$parametres->nom); } /** * Graphique d'analyse complete pour la dirigeance. * En cours de devellopement. * * @param unknown_type $parametres */ public function GraphiqueAnalyse($parametres) { if(!self::chechIfExists($parametres->nom)){ $chart = new XYChart($parametres->width, $parametres->height); call_user_func_array(array($chart, 'addTitle'), $parametres->addTitle); foreach ($parametres->addText as $addText)call_user_func_array(array($chart, 'addText'), $addText); call_user_func_array(array($chart, 'setPlotArea'), $parametres->setPlotArea); } } }