From 8b8b972fa84f6400326f700bd9434e2f257e16d9 Mon Sep 17 00:00:00 2001 From: Refik Hadzialic Date: Tue, 9 Aug 2011 18:53:51 +0200 Subject: Libraries and start code for the output results image --- .../pChart2.1.2/examples/sandbox/script/render.php | 891 +++++++++++++++++++++ .../examples/sandbox/script/session.php | 24 + 2 files changed, 915 insertions(+) create mode 100644 notFinishedCode/pChart2.1.2/examples/sandbox/script/render.php create mode 100644 notFinishedCode/pChart2.1.2/examples/sandbox/script/session.php (limited to 'notFinishedCode/pChart2.1.2/examples/sandbox/script') diff --git a/notFinishedCode/pChart2.1.2/examples/sandbox/script/render.php b/notFinishedCode/pChart2.1.2/examples/sandbox/script/render.php new file mode 100644 index 0000000..d281d86 --- /dev/null +++ b/notFinishedCode/pChart2.1.2/examples/sandbox/script/render.php @@ -0,0 +1,891 @@ +loadPalette("../../../palettes/".$p_template.".color",TRUE); + + $Axis = ""; + if ( $d_serie1_enabled == "true" ) + { + $data0 = stripTail($data0); + $Values = preg_split("/!/",right($data0,strlen($data0)-1)); + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = VOID; } $myData->addPoints($Value,"Serie1"); } + + $myData->setSerieDescription("Serie1",$d_serie1_name); + $myData->setSerieOnAxis("Serie1",$d_serie1_axis); + $Axis[$d_serie1_axis] = TRUE; + + if ( $Mode == "Source" ) + { + $Data = ""; + foreach($Values as $key => $Value) + { if ( $Value == "" || $Value == VOID ) { $Value = "VOID"; } $Data = $Data.",".toString($Value); } + $Data = right($Data,strlen($Data)-1); + + echo '$myData->addPoints(array('.$Data.'),"Serie1");'."\r\n"; + echo '$myData->setSerieDescription("Serie1","'.$d_serie1_name.'");'."\r\n"; + echo '$myData->setSerieOnAxis("Serie1",'.$d_serie1_axis.');'."\r\n\r\n"; + + $Axis[$d_serie1_axis] = TRUE; + } + } + + if ( $d_serie2_enabled == "true" ) + { + $data1 = stripTail($data1); + $Values = preg_split("/!/",right($data1,strlen($data1)-1)); + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = VOID; } $myData->addPoints($Value,"Serie2"); } + + $myData->setSerieDescription("Serie2",$d_serie2_name); + $myData->setSerieOnAxis("Serie2",$d_serie2_axis); + $Axis[$d_serie2_axis] = TRUE; + + if ( $Mode == "Source" ) + { + $Data = ""; + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = "VOID"; } $Data = $Data.",".toString($Value); } + $Data = right($Data,strlen($Data)-1); + + echo '$myData->addPoints(array('.$Data.'),"Serie2");'."\r\n"; + echo '$myData->setSerieDescription("Serie2","'.$d_serie2_name.'");'."\r\n"; + echo '$myData->setSerieOnAxis("Serie2",'.$d_serie2_axis.');'."\r\n\r\n"; + + $Axis[$d_serie2_axis] = TRUE; + } + } + + if ( $d_serie3_enabled == "true" ) + { + $data2 = stripTail($data2); + $Values = preg_split("/!/",right($data2,strlen($data2)-1)); + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = VOID; } $myData->addPoints($Value,"Serie3"); } + + $myData->setSerieDescription("Serie3",$d_serie3_name); + $myData->setSerieOnAxis("Serie3",$d_serie3_axis); + $Axis[$d_serie3_axis] = TRUE; + + if ( $Mode == "Source" ) + { + $Data = ""; + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = "VOID"; } $Data = $Data.",".toString($Value); } + $Data = right($Data,strlen($Data)-1); + + echo '$myData->addPoints(array('.$Data.'),"Serie3");'."\r\n"; + echo '$myData->setSerieDescription("Serie3","'.$d_serie3_name.'");'."\r\n"; + echo '$myData->setSerieOnAxis("Serie3",'.$d_serie3_axis.');'."\r\n\r\n"; + + $Axis[$d_serie3_axis] = TRUE; + } + } + + if ( $d_absissa_enabled == "true" ) + { + $absissa = stripTail($absissa); + $Values = preg_split("/!/",right($absissa,strlen($absissa)-1)); + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = VOID; } $myData->addPoints($Value,"Absissa"); } + + $myData->setAbscissa("Absissa"); + + if ( $Mode == "Source" ) + { + $Data = ""; + foreach($Values as $key => $Value) + { if ( $Value == "" ) { $Value = "VOID"; } $Data = $Data.",".toString($Value); } + $Data = right($Data,strlen($Data)-1); + + echo '$myData->addPoints(array('.$Data.'),"Absissa");'."\r\n"; + echo '$myData->setAbscissa("Absissa");'."\r\n\r\n"; + } + } + + if ( isset($Axis[0]) ) + { + if ( $d_axis0_position == "left" ) { $myData->setAxisPosition(0,AXIS_POSITION_LEFT); } else { $myData->setAxisPosition(0,AXIS_POSITION_RIGHT); } + $myData->setAxisName(0,$d_axis0_name); + $myData->setAxisUnit(0,$d_axis0_unit); + + if ( $d_axis0_format == "AXIS_FORMAT_METRIC" ) { $myData->setAxisDisplay(0,680004); } + if ( $d_axis0_format == "AXIS_FORMAT_CURRENCY" ) { $myData->setAxisDisplay(0,680005,"$"); } + + if ( $Mode == "Source" ) + { + if ( $d_axis0_position == "left" ) { echo '$myData->setAxisPosition(0,AXIS_POSITION_LEFT);'."\r\n"; } else { echo '$myData->setAxisPosition(0,AXIS_POSITION_RIGHT);'."\r\n"; } + echo '$myData->setAxisName(0,"'.$d_axis0_name.'");'."\r\n"; + echo '$myData->setAxisUnit(0,"'.$d_axis0_unit.'");'."\r\n\r\n"; + } + } + + if ( isset($Axis[1]) ) + { + if ( $d_axis1_position == "left" ) { $myData->setAxisPosition(1,AXIS_POSITION_LEFT); } else { $myData->setAxisPosition(1,AXIS_POSITION_RIGHT); } + $myData->setAxisName(1,$d_axis1_name); + $myData->setAxisUnit(1,$d_axis1_unit); + + if ( $Mode == "Source" ) + { + if ( $d_axis1_position == "left" ) { echo '$myData->setAxisPosition(1,AXIS_POSITION_LEFT);'."\r\n"; } else { echo '$myData->setAxisPosition(1,AXIS_POSITION_RIGHT);'."\r\n"; } + echo '$myData->setAxisName(1,"'.$d_axis1_name.'");'."\r\n"; + echo '$myData->setAxisUnit(1,"'.$d_axis1_unit.'");'."\r\n\r\n"; + } + } + + if ( isset($Axis[2]) ) + { + if ( $d_axis2_position == "left" ) { $myData->setAxisPosition(2,AXIS_POSITION_LEFT); } else { $myData->setAxisPosition(2,AXIS_POSITION_RIGHT); } + $myData->setAxisName(2,$d_axis2_name); + $myData->setAxisUnit(2,$d_axis2_unit); + + if ( $Mode == "Source" ) + { + if ( $d_axis2_position == "left" ) { echo '$myData->setAxisPosition(2,AXIS_POSITION_LEFT);'."\r\n"; } else { echo '$myData->setAxisPosition(2,AXIS_POSITION_RIGHT);'."\r\n"; } + echo '$myData->setAxisName(2,"'.$d_axis2_name.'");'."\r\n"; + echo '$myData->setAxisUnit(2,"'.$d_axis2_unit.'");'."\r\n\r\n"; + } + } + + if ( $d_normalize_enabled == "true" ) + { + if ( $Mode == "Render" ) + $myData->normalize(100); + else + echo '$myData->normalize(100);'."\r\n"; + } + + if ( $Mode == "Render" ) + { + if ( $g_transparent == "true" ) + $myPicture = new pImage($g_width,$g_height,$myData,TRUE); + else + $myPicture = new pImage($g_width,$g_height,$myData); + } + else + { + $myPicture = new pImage($g_width,$g_height,$myData); + if ( $g_transparent == "true" ) + echo '$myPicture = new pImage('.$g_width.','.$g_height.',$myData,TRUE);'."\r\n"; + else + echo '$myPicture = new pImage('.$g_width.','.$g_height.',$myData);'."\r\n"; + } + + if ( $g_aa == "false" ) + { + if ( $Mode == "Render" ) + $myPicture->Antialias = FALSE; + else + echo '$myPicture->Antialias = FALSE;'."\r\n"; + } + + if ( $g_solid_enabled == "true" ) + { + list($R,$G,$B) = extractColors($g_solid_color); + $Settings = array("R"=>$R,"G"=>$G,"B"=>$B); + + if ( $g_solid_dashed == "true" ) { $Settings["Dash"] = TRUE; $Settings["DashR"]=$R+20; $Settings["DashG"]=$G+20; $Settings["DashB"]=$B+20; } + + if ( $Mode == "Render" ) + $myPicture->drawFilledRectangle(0,0,$g_width,$g_height,$Settings); + else + { + echo dumpArray("Settings",$Settings); + echo '$myPicture->drawFilledRectangle(0,0,'.$g_width.','.$g_height.',$Settings);'."\r\n\r\n"; + } + } + + if ( $g_gradient_enabled == "true" ) + { + list($StartR,$StartG,$StartB) = extractColors($g_gradient_start); + list($EndR,$EndG,$EndB) = extractColors($g_gradient_end); + + $Settings = array("StartR"=>$StartR,"StartG"=>$StartG,"StartB"=>$StartB,"EndR"=>$EndR,"EndG"=>$EndG,"EndB"=>$EndB,"Alpha"=>$g_gradient_alpha); + + if ( $Mode == "Render" ) + { + if ( $g_gradient_direction == "vertical" ) + $myPicture->drawGradientArea(0,0,$g_width,$g_height,DIRECTION_VERTICAL,$Settings); + else + $myPicture->drawGradientArea(0,0,$g_width,$g_height,DIRECTION_HORIZONTAL,$Settings); + } + else + { + echo dumpArray("Settings",$Settings); + + if ( $g_gradient_direction == "vertical" ) + echo '$myPicture->drawGradientArea(0,0,'.$g_width.','.$g_height.',DIRECTION_VERTICAL,$Settings);'."\r\n\r\n"; + else + echo '$myPicture->drawGradientArea(0,0,'.$g_width.','.$g_height.',DIRECTION_HORIZONTAL,$Settings);'."\r\n\r\n"; + } + } + + if ( $Mode == "Render" ) + { + if ( $g_border == "true" ) { $myPicture->drawRectangle(0,0,$g_width-1,$g_height-1,array("R"=>0,"G"=>0,"B"=>0)); } + if ( $g_shadow == "true" ) { $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>20)); } + } + else + { + if ( $g_border == "true" ) { echo '$myPicture->drawRectangle(0,0,'.($g_width-1).','.($g_height-1).',array("R"=>0,"G"=>0,"B"=>0));'."\r\n\r\n"; } + if ( $g_shadow == "true" ) { echo '$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>20));'."\r\n\r\n"; } + } + + if ( $g_title_enabled == "true" ) + { + if ( $Mode == "Render" ) + $myPicture->setFontProperties(array("FontName"=>"../../../fonts/".$g_title_font,"FontSize"=>$g_title_font_size)); + else + echo '$myPicture->setFontProperties(array("FontName"=>"fonts/'.$g_title_font.'","FontSize"=>'.$g_title_font_size.'));'."\r\n"; + + list($R,$G,$B) = extractColors($g_title_color); + + $TextSettings = array("Align"=>getTextAlignCode($g_title_align),"R"=>$R,"G"=>$G,"B"=>$B); + if ( $g_title_box == "true" ) { $TextSettings["DrawBox"] = TRUE; $TextSettings["BoxAlpha"] = 30; } + + if ( $Mode == "Render" ) + $myPicture->drawText($g_title_x,$g_title_y,$g_title,$TextSettings); + else + { + echo dumpArray("TextSettings",$TextSettings); + echo '$myPicture->drawText('.$g_title_x.','.$g_title_y.',"'.$g_title.'",$TextSettings);'."\r\n\r\n"; + } + } + + /* Scale section */ + if ( $Mode == "Render" ) + { if ( $g_shadow == "true" ) { $myPicture->setShadow(FALSE); } } + else + { if ( $g_shadow == "true" ) { echo '$myPicture->setShadow(FALSE);'."\r\n"; } } + + if ( $Mode == "Render" ) + $myPicture->setGraphArea($s_x,$s_y,$s_x+$s_width,$s_y+$s_height); + else + echo '$myPicture->setGraphArea('.$s_x.','.$s_y.','.($s_x+$s_width).','.($s_y+$s_height).');'."\r\n"; + + list($R,$G,$B) = extractColors($s_font_color); + if ( $Mode == "Render" ) + $myPicture->setFontProperties(array("R"=>$R,"G"=>$G,"B"=>$B,"FontName"=>"../../../fonts/".$s_font,"FontSize"=>$s_font_size)); + else + echo '$myPicture->setFontProperties(array("R"=>'.$R.',"G"=>'.$G.',"B"=>'.$B.',"FontName"=>"fonts/'.$s_font.'","FontSize"=>'.$s_font_size.'));'."\r\n\r\n"; + + /* Scale specific parameters -------------------------------------------------------------------------------- */ + list($GridR,$GridG,$GridB) = extractColors($s_grid_color); + list($TickR,$TickG,$TickB) = extractColors($s_ticks_color); + list($SubTickR,$SubTickG,$SubTickB) = extractColors($s_subticks_color); + + if ( $s_direction == "SCALE_POS_LEFTRIGHT" ) { $Pos = 690101; } else { $Pos = 690102; } + if ( $s_x_labeling == "LABELING_ALL") { $Labeling = 691011; } else { $Labeling = 691012; } + if ( $s_mode == "SCALE_MODE_FLOATING" ) { $iMode = 690201; } + if ( $s_mode == "SCALE_MODE_START0" ) { $iMode = 690202; } + if ( $s_mode == "SCALE_MODE_ADDALL" ) { $iMode = 690203; } + if ( $s_mode == "SCALE_MODE_ADDALL_START0" ) { $iMode = 690204; } + + $Settings = array("Pos"=>$Pos,"Mode"=>$iMode,"LabelingMethod"=>$Labeling,"GridR"=>$GridR,"GridG"=>$GridG,"GridB"=>$GridB,"GridAlpha"=>$s_grid_alpha,"TickR"=>$TickR,"TickG"=>$TickG,"TickB"=>$TickB,"TickAlpha"=>$s_ticks_alpha,"LabelRotation"=>$s_x_label_rotation); + + if ( $s_x_skip != 0 ) { $Settings["LabelSkip"] = $s_x_skip; } + if ( $s_cycle_enabled == "true" ) { $Settings["CycleBackground"] = TRUE; } + if ( $s_arrows_enabled == "true" ) { $Settings["DrawArrows"] = TRUE; } + if ( $s_grid_x_enabled == "true" ) { $Settings["DrawXLines"] = TRUE; } else { $Settings["DrawXLines"] = 0; } + if ( $s_subticks_enabled == "true" ) + { $Settings["DrawSubTicks"] = TRUE; $Settings["SubTickR"] = $SubTickR; $Settings["SubTickG"] = $SubTickG; $Settings["SubTickB"] = $SubTickB; $Settings["SubTickAlpha"] = $s_subticks_alpha;} + if ( $s_automargin_enabled == "false" ) + { $Settings["XMargin"] = $s_x_margin; $Settings["YMargin"] = $s_y_margin; } + + if ( $Mode == "Render" ) + { + if ( $s_grid_y_enabled == "true" ) { $Settings["DrawYLines"] = ALL; } else { $Settings["DrawYLines"] = NONE; } + $myPicture->drawScale($Settings); + } + else + { + if ( $s_grid_y_enabled == "true" ) { $Settings["DrawYLines"] = "ALL"; } else { $Settings["DrawYLines"] = "NONE"; } + echo dumpArray("Settings",$Settings); + echo '$myPicture->drawScale($Settings);'."\r\n\r\n"; + } + /* ---------------------------------------------------------------------------------------------------------- */ + + if ( $Mode == "Render" ) + { if ( $g_shadow == "true" ) { $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>10)); } } + else + { if ( $g_shadow == "true" ) { echo '$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>10));'."\r\n\r\n"; } } + + /* Chart specific parameters -------------------------------------------------------------------------------- */ + if ( $c_display_values == "true" ) { $Config = array("DisplayValues"=>TRUE); } else { $Config = ""; } + + if ( $c_family == "plot" ) + { + $Config["PlotSize"] = $c_plot_size; + if ( $c_border_enabled == "true" ) { $Config["PlotBorder"] = TRUE; $Config["BorderSize"] = $c_border_size; } + + if ( $Mode == "Render" ) + $myPicture->drawPlotChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawPlotChart($Config);'."\r\n"; + } + } + + if ( $c_family == "line" ) + { + if ( $c_break == "true" ) + { + list($BreakR,$BreakG,$BreakB) = extractColors($c_break_color); + + $Config["BreakVoid"] = 0; + $Config["BreakR"] = $BreakR; + $Config["BreakG"] = $BreakG; + $Config["BreakB"] = $BreakB; + } + + if ( $Mode == "Render" ) + $myPicture->drawLineChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawLineChart($Config);'."\r\n"; + } + } + + if ( $c_family == "step" ) + { + if ( $c_break == "true" ) + { + list($BreakR,$BreakG,$BreakB) = extractColors($c_break_color); + + $Config["BreakVoid"] = 0; + $Config["BreakR"] = $BreakR; + $Config["BreakG"] = $BreakG; + $Config["BreakB"] = $BreakB; + } + + if ( $Mode == "Render" ) + $myPicture->drawStepChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawStepChart($Config);'."\r\n"; + } + } + + if ( $c_family == "spline" ) + { + if ( $c_break == "true" ) + { + list($BreakR,$BreakG,$BreakB) = extractColors($c_break_color); + + $Config["BreakVoid"] = 0; + $Config["BreakR"] = $BreakR; + $Config["BreakG"] = $BreakG; + $Config["BreakB"] = $BreakB; + } + + if ( $Mode == "Render" ) + $myPicture->drawSplineChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawSplineChart($Config);'."\r\n"; + } + } + + if ( $c_family == "bar" ) + { + if ( $c_bar_rounded == "true" ) { $Config["Rounded"] = TRUE; } + if ( $c_bar_gradient == "true" ) { $Config["Gradient"] = TRUE; } + if ( $c_around_zero1 == "true" ) { $Config["AroundZero"] = TRUE; } + + if ( $Mode == "Render" ) + $myPicture->drawBarChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawBarChart($Config);'."\r\n"; + } + } + + if ( $c_family == "area" ) + { + if ( $c_forced_transparency == "true" ) { $Config["ForceTransparency"] = $c_transparency; } + if ( $c_around_zero2 == "true" ) { $Config["AroundZero"] = TRUE; } + + if ( $Mode == "Render" ) + $myPicture->drawAreaChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawAreaChart($Config);'."\r\n"; + } + } + + if ( $c_family == "fstep" ) + { + if ( $c_forced_transparency == "true" ) { $Config["ForceTransparency"] = $c_transparency; } + if ( $c_around_zero2 == "true" ) { $Config["AroundZero"] = TRUE; } else { $Config["AroundZero"] = FALSE; } + + if ( $Mode == "Render" ) + $myPicture->drawFilledStepChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawFilledStepChart($Config);'."\r\n"; + } + } + + if ( $c_family == "fspline" ) + { + if ( $c_forced_transparency == "true" ) { $Config["ForceTransparency"] = $c_transparency; } + if ( $c_around_zero2 == "true" ) { $Config["AroundZero"] = TRUE; } + + if ( $Mode == "Render" ) + $myPicture->drawFilledSplineChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawFilledSplineChart($Config);'."\r\n"; + } + } + + if ( $c_family == "sbar" ) + { + if ( $c_bar_rounded == "true" ) { $Config["Rounded"] = TRUE; } + if ( $c_bar_gradient == "true" ) { $Config["Gradient"] = TRUE; } + if ( $c_around_zero1 == "true" ) { $Config["AroundZero"] = TRUE; } + + if ( $Mode == "Render" ) + $myPicture->drawStackedBarChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawStackedBarChart($Config);'."\r\n"; + } + } + + if ( $c_family == "sarea" ) + { + if ( $c_forced_transparency == "true" ) { $Config["ForceTransparency"] = $c_transparency; } + if ( $c_around_zero2 == "true" ) { $Config["AroundZero"] = TRUE; } + + if ( $Mode == "Render" ) + $myPicture->drawStackedAreaChart($Config); + else + { + echo dumpArray("Config",$Config); + echo '$myPicture->drawStackedAreaChart($Config);'."\r\n"; + } + } + + if ( $t_enabled == "true" ) + { + list($R,$G,$B) = extractColors($t_color); + + $Config = ""; + $Config["R"] = $R; $Config["G"] = $G; $Config["B"] = $B; + $Config["Alpha"] = $t_alpha; + + if ( isset($myData->Data["Axis"][$t_axis]) ) { $Config["AxisID"] = $t_axis; } + + if ( $t_ticks == "true" ) { $Config["Ticks"] = 4; } else { $Config["Ticks"] = 0; } + + if ( $t_caption_enabled == "true" ) + { + $Config["WriteCaption"] = TRUE; + $Config["Caption"] = $t_caption; + if ( $t_box == "true" ) { $Config["DrawBox"] = TRUE; } + } + + if ( $Mode == "Render" ) + $myPicture->drawThreshold($t_value,$Config); + else + { + $Config["Caption"] = chr(34).$t_caption.chr(34); + + echo "\r\n"; + echo dumpArray("Config",$Config); + echo '$myPicture->drawThreshold('.$t_value.',$Config);'."\r\n"; + } + } + + if ( $l_enabled == "true" ) + { + list($R,$G,$B) = extractColors($l_font_color); + + $Config = ""; + $Config["FontR"] = $R; $Config["FontG"] = $G; $Config["FontB"] = $B; + $Config["FontName"] = "../../../fonts/".$l_font; + $Config["FontSize"] = $l_font_size; + $Config["Margin"] = $l_margin; + $Config["Alpha"] = $l_alpha; + $Config["BoxSize"] = $l_box_size; + + if ( $l_format == "LEGEND_NOBORDER" ) { $Config["Style"] = 690800; } + if ( $l_format == "LEGEND_BOX" ) { $Config["Style"] = 690801; } + if ( $l_format == "LEGEND_ROUND" ) { $Config["Style"] = 690802; } + + if ( $l_orientation == "LEGEND_VERTICAL" ) { $Config["Mode"] = 690901; } + if ( $l_orientation == "LEGEND_HORIZONTAL" ) { $Config["Mode"] = 690902; } + + if ( $l_family == "LEGEND_FAMILY_CIRCLE" ) { $Config["Family"] = 691052; } + if ( $l_family == "LEGEND_FAMILY_LINE" ) { $Config["Family"] = 691053; } + + $Size = $myPicture->getLegendSize($Config); + if ( $l_position == "CORNER_TOP_RIGHT" ) + { $l_y = $l_margin + 10; $l_x = $g_width - $Size["Width"] - 10 + $l_margin; } + if ( $l_position == "CORNER_BOTTOM_RIGHT" ) + { $l_y = $g_height - $Size["Height"] - 10 + $l_margin; $l_x = $g_width - $Size["Width"] - 10 + $l_margin; } + + if ( $Mode == "Render" ) + $myPicture->drawLegend($l_x,$l_y,$Config); + else + { + $Config["FontName"] = chr(34)."fonts/".$l_font.chr(34); + + echo "\r\n"; + echo dumpArray("Config",$Config); + echo '$myPicture->drawLegend('.$l_x.','.$l_y.',$Config);'."\r\n"; + } + } + + if ( $sl_enabled == "true" ) + { + $Config = ""; + $Config["CaptionMargin"] = 10; + $Config["CaptionWidth"] = 10; + + if ( $sl_shaded == "true" ) { $Config["ShadedSlopeBox"] = TRUE; } + if ( $sl_caption_enabled != "true" ) { $Config["Caption"] = FALSE; } + if ( $sl_caption_line == "true" ) { $Config["CaptionLine"] =TRUE; } + + if ( $Mode == "Render" ) + $myPicture->drawDerivative($Config); + else + { + echo "\r\n"; + echo dumpArray("Config",$Config); + echo '$myPicture->drawDerivative($Config);'."\r\n"; + } + } + + if ( $Mode == "Render" ) + $myPicture->stroke(); + else + echo "\r\n".'$myPicture->stroke();'."\r\n?>"; + + function extractColors($Hexa) + { + if ( strlen($Hexa) != 6 ) { return(array(0,0,0)); } + + $R = hexdec(left($Hexa,2)); + $G = hexdec(mid($Hexa,3,2)); + $B = hexdec(right($Hexa,2)); + + return(array($R,$G,$B)); + } + + function getTextAlignCode($Mode) + { + if ( $Mode == "TEXT_ALIGN_TOPLEFT" ) { return(690401); } + if ( $Mode == "TEXT_ALIGN_TOPMIDDLE" ) { return(690402); } + if ( $Mode == "TEXT_ALIGN_TOPRIGHT" ) { return(690403); } + if ( $Mode == "TEXT_ALIGN_MIDDLELEFT" ) { return(690404); } + if ( $Mode == "TEXT_ALIGN_MIDDLEMIDDLE" ) { return(690405); } + if ( $Mode == "TEXT_ALIGN_MIDDLERIGHT" ) { return(690406); } + if ( $Mode == "TEXT_ALIGN_BOTTOMLEFT" ) { return(690407); } + if ( $Mode == "TEXT_ALIGN_BOTTOMMIDDLE" ) { return(690408); } + if ( $Mode == "TEXT_ALIGN_BOTTOMRIGHT" ) { return(690409); } + } + + function dumpArray($Name,$Values) + { + if ( $Values == "" ) { return('$'.$Name.' = "";'."\r\n"); } + + $Result = '$'.$Name." = array("; + foreach ($Values as $Key => $Value) + { $Result = $Result.chr(34).$Key.chr(34)."=>".translate($Value).", "; } + + $Result = left($Result,strlen($Result)-2).");\r\n"; + + return($Result); + } + + function translate($Value) + { + global $Constants; + + if ( isset($Constants[$Value])) + return($Constants[$Value]); + else + return($Value); + } + + + function stripTail($Values) + { + $Values = preg_split("/!/",right($Values,strlen($Values)-1)); + + $Temp = ""; $Result = ""; + foreach($Values as $Key => $Value) + { + if ( $Value == "" ) + { $Temp[] = VOID; } + else + { + if ( $Temp != "" && $Result != "" ) + { $Result = array_merge($Result,$Temp); } + elseif( $Temp != "" && $Result == "" ) + { $Result = $Temp; } + + $Result[] = $Value; + $Temp = ""; + } + } + + $Serialized = "!"; foreach($Result as $Key => $Value) { $Serialized = $Serialized.$Value."!"; } + $Serialized = left($Serialized,strlen($Serialized)-1); + + return($Serialized); + } + + function readConstantFile() + { + $FileName = "../includes/constants.txt"; + + $handle = @fopen($FileName, "r"); + if ($handle) + { + $Result = ""; + while (($buffer = fgets($handle, 4096)) !== false) + { + $Values = preg_split("/,/",$buffer); + $Result[$Values[0]] = $Values[1]; + } + fclose($handle); + return($Result); + } + else + { return(array("VOID"=>"0.12345")); } + } + + function toString($Value) + { + if ( is_numeric($Value) || $Value == "VOID") + return($Value); + else + return(chr(34).$Value.chr(34)); + } + + function left($value,$NbChar) + { return substr($value,0,$NbChar); } + + function right($value,$NbChar) + { return substr($value,strlen($value)-$NbChar,$NbChar); } + + function mid($value,$Depart,$NbChar) + { return substr($value,$Depart-1,$NbChar); } +?> \ No newline at end of file diff --git a/notFinishedCode/pChart2.1.2/examples/sandbox/script/session.php b/notFinishedCode/pChart2.1.2/examples/sandbox/script/session.php new file mode 100644 index 0000000..697f9dd --- /dev/null +++ b/notFinishedCode/pChart2.1.2/examples/sandbox/script/session.php @@ -0,0 +1,24 @@ + $Value) + { $_SESSION[$Key] = $Value; } + + print_r($_SESSION); + + usleep(200000); +?> \ No newline at end of file -- cgit v1.2.3-55-g7522