function End($flags = 0) { try { $req = new DATARequest(); $draw = $req->CreatePlotter(); $draw->Create(); $id = $draw->Save(); } catch (ADEIException $e) { $error = $e->getInfo(); try { if (!$draw) { if (!$req) { $req = new REQUEST(); } $draw = $req->CreateTextPlotter(); } // $draw->CreateMessage("Error", "No Data"); $draw->CreateMessage("Error", $error); $id = $draw->Save(); $error = false; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } } $res = DRAW::Display($id); $this->h->Write($res); }
if (isset($_GET["id"])) { $id = $_GET["id"]; } else { try { $req = new DATARequest(); $draw = $req->CreatePlotter(); $draw->Create(); $id = $draw->Save(); } catch (ADEIException $e) { $error = $e->getInfo(); try { if (!$draw) { if (!$req) { $req = new REQUEST(); } $draw = $req->CreateTextPlotter(); } // $draw->CreateMessage("Error", "No Data"); $draw->CreateMessage("Error", $error); $id = $draw->Save(); $error = false; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } } } if (!$error) { $res = DRAW::Display($id); if (!$res) { } }
$this->draw_sector($img, $ox, $oy, $a, $b, 180, $et, $object['color']); } } //写字啦啦啦 $fontx = 10; $fonty = 2 * $b + 10 + $v + $k * ($font + 4); $percent = round($object['value'] / $total / 100 * 10000) . "%"; $temp = $object['name'] . ":" . $object['value'] . "({$percent})"; $str = iconv('utf-8', 'utf-8', $temp); imagefilledrectangle($img, $fontx, $fonty, $fontx + $fw, $fonty + $fh, $object['color']); imagettftext($img, $font, 0, $fontx + $fw + 4, $fonty + $fh, $textColor, $this->font_used, $str); } imagepng($img); } } //测试语句 $img = imagecreatetruecolor(800, 800); $bk = imagecolorallocate($img, 255, 255, 255); $color = imagecolorallocate($img, 200, 100, 100); imagefill($img, 0, 0, $bk); header("Content-type:image/png"); $draw = new DRAW(); //var_dump($draw->draw_getDarkColor($img,0xffffff)); //var_dump($draw->draw_getexy(400,300,100)); //$draw->draw_arc($img,400,400,400,300,20,160,$color); //$draw->draw_sector($img,400,400,400,300,23,234,$color); $dataArray = array(array("name" => "江苏省", "value" => 12, "color" => 0x99ff00), array("name" => "安徽省", "value" => 32, "color" => 0xff6666), array("name" => "福建省", "value" => 11, "color" => 0x99ff), array("name" => "广东省", "value" => 43, "color" => 0xff99ff), array("name" => "广西省", "value" => 54, "color" => 0xffff99), array("name" => "河北省", "value" => 16, "color" => 0x99ffff), array("name" => "山东省", "value" => 10, "color" => 0xff3333), array("name" => "山西省", "value" => 92, "color" => 0x9999), array("name" => "陕西省", "value" => 42, "color" => 0xffff00)); //$draw->draw_sector3d($img,400,400,400,300,20,18,312,0x009999); $draw->drawPie($dataArray, 400, 300, 14); //imagefilledarc($img, 50, 50, 100, 50, 75, 360 , 0xffff00, IMG_ARC_PIE); //imagepng($img);
<?php require "../../adei.php"; $ADEI->RequireClass("draw"); header("Content-type: application/json"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Gaps //$_POST['props'] = "{\"db_server\": \"katrin\", \"db_name\": \"hauptspektrometer\", \"db_group\": \"0\", \"db_mask\": \"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56\", \"experiment\": \"0-0\", \"window\": \"1184572999-1185575717\", \"width\": 937, \"height\": 549, \"xmin\": \"1184544000\", \"xmax\": \"1185580800\", \"ymin\": 11.1085494014, \"ymax\": 856.067930927, \"x\": \"1185420556.4013840831\", \"y\": 28.041603139387917}"; //$_POST['props'] = "{\"db_server\": \"katrin\", \"db_name\": \"hauptspektrometer\", \"db_group\": \"0\", \"db_mask\": \"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56\", \"experiment\": \"0-0\", \"window\": \"1185369134-1185449256\", \"width\": 937, \"height\": 549, \"xmin\": \"1185368400\", \"xmax\": \"1185449400\", \"ymin\": 12.4924722853, \"ymax\": 856.057920634, \"x\": \"1185404368.85813148789\", \"y\": 36.15963917283864}"; // No gaps //$_POST['props'] = '{"db_server": "katrin", "db_name": "hauptspektrometer", "db_group": "0", "control_group": "0", "db_mask": "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56", "experiment": "0-0", "window": "0", "width": 854, "height": 719, "aggregation": null, "interpolate": null, "show_marks": null, "show_gaps": null, "virtual": null, "srctree": null, "pageid": null, "module": "graph", "format": null, "resample": null, "mask_mode": null, "custom": null, "xmin": "1183593600", "xmax": "1190332800", "ymin": 0, "ymax": 900, "x": "1185099906.9767441861", "y": 141.25560538116588}'; //$_POST['props'] = '{\"db_server\": \"autogen\", \"db_name\": \"minutely\", \"db_group\": \"default\", \"control_group\": \"default\", \"db_mask\": \"0,1,2,3,4,5,6\", \"experiment\": \"0-0\", \"window\": \"0\", \"width\": 1158, \"height\": 626, \"aggregation\": null, \"interpolate\": null, \"show_marks\": null, \"show_gaps\": null, \"virtual\": null, \"srctree\": null, \"pageid\": null, \"module\": \"graph\", \"run\": null, \"format\": null, \"resample\": null, \"mask_mode\": null, \"custom\": null, \"xmin\": \"1104537600\", \"xmax\": \"1262304000\", \"ymin\": [-10, -15], \"ymax\": [14, 15], \"x\": \"1130418728.48722986\", \"y\": null, \"xslt\": \"legend\", \"time_format\": \"text\"}'; // MEAN $_POST['props'] = '{\\"db_server\\": \\"virtual\\", \\"db_name\\": \\"autogen\\", \\"db_group\\": \\"autogen__minutely__extra\\", \\"control_group\\": \\"autogen__minutely__default\\", \\"db_mask\\": \\"0,1\\", \\"experiment\\": \\"0-0\\", \\"window\\": \\"0\\", \\"width\\": 893, \\"height\\": 626, \\"aggregation\\": null, \\"interpolate\\": null, \\"show_marks\\": null, \\"show_gaps\\": null, \\"virtual\\": \\"srctree\\", \\"srctree\\": \\"\\", \\"pageid\\": null, \\"module\\": \\"graph\\", \\"axis_range\\": null, \\"temperature_axis_range\\": null, \\"voltage_axis_range\\": null, \\"format\\": null, \\"resample\\": null, \\"mask_mode\\": null, \\"custom\\": null, \\"xmin\\": \\"1104537600\\", \\"xmax\\": \\"1105185600\\", \\"ymin\\": [-0.8], \\"ymax\\": [0.8], \\"x\\": \\"1104563105.535055350552\\", \\"y\\": [0.25], \\"xslt\\": \\"legend\\", \\"time_format\\": \\"text\\"}'; try { $draw = new DRAW(); $legend = $draw->Legend(); } catch (ADEIException $e) { $error = $e->getMessage(); } if ($error) { print_r($error); } else { print_r($legend); }