本文整理汇总了PHP中Data::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::getData方法的具体用法?PHP Data::getData怎么用?PHP Data::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::getData方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
function request()
{
$this->query = "SELECT news.id AS id, title, text, view, DATE_FORMAT(news.date,'%d.%m.%Y') AS date,author,users.login AS authorLogin FROM news JOIN users ON news.author = users.id WHERE type = 1 OR type = 2 ORDER BY id DESC";
$getData = parent::getData();
$result = self::requestData($getData, $this->db);
$this->dataCount = count($result);
return $result;
}
示例2: getLastItems
function getLastItems()
{
$this->query = "SELECT id,title FROM data ORDER BY date DESC, id DESC LIMIT 5";
$getData = parent::getData();
if (!$getData) {
throw new DataException("Ошибка базы данных", "Запрос на выборку данных из базы не прошел. Напишите об этом администратору, Klymstalker@yandex.ua");
}
$result = self::requestData($getData, $this->db);
return $result;
}
示例3: drawPolar
/**
* Draw a radar chart
* @param Image $Object
* @param Data $Values
* @param array $Format
*/
public function drawPolar(Image $Object, Data $Values, array $Format = array())
{
$this->pChartObject = $Object;
$FixedMax = isset($Format["FixedMax"]) ? $Format["FixedMax"] : VOID;
$AxisR = isset($Format["AxisR"]) ? $Format["AxisR"] : 60;
$AxisG = isset($Format["AxisG"]) ? $Format["AxisG"] : 60;
$AxisB = isset($Format["AxisB"]) ? $Format["AxisB"] : 60;
$AxisAlpha = isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 50;
$AxisRotation = isset($Format["AxisRotation"]) ? $Format["AxisRotation"] : -90;
$DrawTicks = isset($Format["DrawTicks"]) ? $Format["DrawTicks"] : true;
$TicksLength = isset($Format["TicksLength"]) ? $Format["TicksLength"] : 2;
$DrawAxisValues = isset($Format["DrawAxisValues"]) ? $Format["DrawAxisValues"] : true;
$AxisBoxRounded = isset($Format["AxisBoxRounded"]) ? $Format["AxisBoxRounded"] : true;
$AxisFontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->pChartObject->FontName;
$AxisFontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->pChartObject->FontSize;
$WriteValues = isset($Format["WriteValues"]) ? $Format["WriteValues"] : false;
$WriteValuesInBubble = isset($Format["WriteValuesInBubble"]) ? $Format["WriteValuesInBubble"] : true;
$ValueFontName = isset($Format["ValueFontName"]) ? $Format["ValueFontName"] : $this->pChartObject->FontName;
$ValueFontSize = isset($Format["ValueFontSize"]) ? $Format["ValueFontSize"] : $this->pChartObject->FontSize;
$ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : 4;
$OuterBubbleRadius = isset($Format["OuterBubbleRadius"]) ? $Format["OuterBubbleRadius"] : 2;
$OuterBubbleR = isset($Format["OuterBubbleR"]) ? $Format["OuterBubbleR"] : VOID;
$OuterBubbleG = isset($Format["OuterBubbleG"]) ? $Format["OuterBubbleG"] : VOID;
$OuterBubbleB = isset($Format["OuterBubbleB"]) ? $Format["OuterBubbleB"] : VOID;
$OuterBubbleAlpha = isset($Format["OuterBubbleAlpha"]) ? $Format["OuterBubbleAlpha"] : 100;
$InnerBubbleR = isset($Format["InnerBubbleR"]) ? $Format["InnerBubbleR"] : 255;
$InnerBubbleG = isset($Format["InnerBubbleG"]) ? $Format["InnerBubbleG"] : 255;
$InnerBubbleB = isset($Format["InnerBubbleB"]) ? $Format["InnerBubbleB"] : 255;
$InnerBubbleAlpha = isset($Format["InnerBubbleAlpha"]) ? $Format["InnerBubbleAlpha"] : 100;
$DrawBackground = isset($Format["DrawBackground"]) ? $Format["DrawBackground"] : true;
$BackgroundR = isset($Format["BackgroundR"]) ? $Format["BackgroundR"] : 255;
$BackgroundG = isset($Format["BackgroundG"]) ? $Format["BackgroundG"] : 255;
$BackgroundB = isset($Format["BackgroundB"]) ? $Format["BackgroundB"] : 255;
$BackgroundAlpha = isset($Format["BackgroundAlpha"]) ? $Format["BackgroundAlpha"] : 50;
$BackgroundGradient = isset($Format["BackgroundGradient"]) ? $Format["BackgroundGradient"] : null;
$AxisSteps = isset($Format["AxisSteps"]) ? $Format["AxisSteps"] : 20;
$SegmentHeight = isset($Format["SegmentHeight"]) ? $Format["SegmentHeight"] : SEGMENT_HEIGHT_AUTO;
$Segments = isset($Format["Segments"]) ? $Format["Segments"] : 4;
$WriteLabels = isset($Format["WriteLabels"]) ? $Format["WriteLabels"] : true;
$LabelsBackground = isset($Format["LabelsBackground"]) ? $Format["LabelsBackground"] : true;
$LabelsBGR = isset($Format["LabelsBGR"]) ? $Format["LabelsBGR"] : 255;
$LabelsBGG = isset($Format["LabelsBGR"]) ? $Format["LabelsBGG"] : 255;
$LabelsBGB = isset($Format["LabelsBGR"]) ? $Format["LabelsBGB"] : 255;
$LabelsBGAlpha = isset($Format["LabelsBGAlpha"]) ? $Format["LabelsBGAlpha"] : 50;
$LabelPos = isset($Format["LabelPos"]) ? $Format["LabelPos"] : RADAR_LABELS_ROTATED;
$LabelPadding = isset($Format["LabelPadding"]) ? $Format["LabelPadding"] : 4;
$DrawPoints = isset($Format["DrawPoints"]) ? $Format["DrawPoints"] : true;
$PointRadius = isset($Format["PointRadius"]) ? $Format["PointRadius"] : 4;
$PointSurrounding = isset($Format["PointRadius"]) ? $Format["PointRadius"] : -30;
$DrawLines = isset($Format["DrawLines"]) ? $Format["DrawLines"] : true;
$LineLoopStart = isset($Format["LineLoopStart"]) ? $Format["LineLoopStart"] : false;
$DrawPoly = isset($Format["DrawPoly"]) ? $Format["DrawPoly"] : false;
$PolyAlpha = isset($Format["PolyAlpha"]) ? $Format["PolyAlpha"] : null;
$FontSize = $Object->FontSize;
$X1 = $Object->GraphAreaX1;
$Y1 = $Object->GraphAreaY1;
$X2 = $Object->GraphAreaX2;
$Y2 = $Object->GraphAreaY2;
$RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
if ($AxisBoxRounded) {
$DrawAxisValues = true;
}
/* Cancel default tick length if ticks not enabled */
if ($DrawTicks == false) {
$TicksLength = 0;
}
/* Data Processing */
$Data = $Values->getData();
$Palette = $Values->getPalette();
/* Catch the number of required axis */
$LabelSerie = $Data["Abscissa"];
if ($LabelSerie) {
$Points = count($Data["Series"][$LabelSerie]["Data"]);
} else {
$Points = 0;
foreach ($Data["Series"] as $SerieName => $DataArray) {
if (count($DataArray["Data"]) > $Points) {
$Points = count($DataArray["Data"]);
}
}
}
/* Draw the axis */
$CenterX = ($X2 - $X1) / 2 + $X1;
$CenterY = ($Y2 - $Y1) / 2 + $Y1;
$EdgeHeight = min(($X2 - $X1) / 2, ($Y2 - $Y1) / 2);
if ($WriteLabels) {
$EdgeHeight = $EdgeHeight - $FontSize - $LabelPadding - $TicksLength;
}
/* Determine the scale if set to automatic */
if ($SegmentHeight == SEGMENT_HEIGHT_AUTO) {
if ($FixedMax != VOID) {
$Max = $FixedMax;
} else {
$Max = 0;
//.........这里部分代码省略.........
示例4: draw3DRing
/**
* Draw a 3D ring chart
* @param int $X
* @param int $Y
* @param array $Format
* @return int
*/
public function draw3DRing($X, $Y, array $Format = array())
{
$OuterRadius = isset($Format["OuterRadius"]) ? $Format["OuterRadius"] : 100;
$Precision = isset($Format["Precision"]) ? $Format["Precision"] : 0;
$InnerRadius = isset($Format["InnerRadius"]) ? $Format["InnerRadius"] : 30;
$SkewFactor = isset($Format["SkewFactor"]) ? $Format["SkewFactor"] : 0.6;
$SliceHeight = isset($Format["SliceHeight"]) ? $Format["SliceHeight"] : 10;
$DataGapAngle = isset($Format["DataGapAngle"]) ? $Format["DataGapAngle"] : 10;
$DataGapRadius = isset($Format["DataGapRadius"]) ? $Format["DataGapRadius"] : 10;
$Border = isset($Format["Border"]) ? $Format["Border"] : false;
$Shadow = isset($Format["Shadow"]) ? $Format["Shadow"] : false;
$DrawLabels = isset($Format["DrawLabels"]) ? $Format["DrawLabels"] : false;
$LabelStacked = isset($Format["LabelStacked"]) ? $Format["LabelStacked"] : false;
$LabelColor = isset($Format["LabelColor"]) ? $Format["LabelColor"] : PIE_LABEL_COLOR_MANUAL;
$LabelR = isset($Format["LabelR"]) ? $Format["LabelR"] : 0;
$LabelG = isset($Format["LabelG"]) ? $Format["LabelG"] : 0;
$LabelB = isset($Format["LabelB"]) ? $Format["LabelB"] : 0;
$LabelAlpha = isset($Format["LabelAlpha"]) ? $Format["LabelAlpha"] : 100;
$Cf = isset($Format["Cf"]) ? $Format["Cf"] : 20;
$WriteValues = isset($Format["WriteValues"]) ? $Format["WriteValues"] : PIE_VALUE_NATURAL;
$ValuePadding = isset($Format["ValuePadding"]) ? $Format["ValuePadding"] : $SliceHeight + 15;
$ValuePosition = isset($Format["ValuePosition"]) ? $Format["ValuePosition"] : PIE_VALUE_OUTSIDE;
$ValueSuffix = isset($Format["ValueSuffix"]) ? $Format["ValueSuffix"] : "";
$ValueR = isset($Format["ValueR"]) ? $Format["ValueR"] : 255;
$ValueG = isset($Format["ValueG"]) ? $Format["ValueG"] : 255;
$ValueB = isset($Format["ValueB"]) ? $Format["ValueB"] : 255;
$ValueAlpha = isset($Format["ValueAlpha"]) ? $Format["ValueAlpha"] : 100;
$RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : false;
/* Error correction for overlaying rounded corners */
if ($SkewFactor < 0.5) {
$SkewFactor = 0.5;
}
/* Data Processing */
$Data = $this->pDataObject->getData();
$Palette = $this->pDataObject->getPalette();
/* Do we have an abscissa serie defined? */
if ($Data["Abscissa"] == "") {
return PIE_NO_ABSCISSA;
}
/* Try to find the data serie */
$DataSerie = null;
foreach ($Data["Series"] as $SerieName => $SerieData) {
if ($SerieName != $Data["Abscissa"]) {
$DataSerie = $SerieName;
}
}
/* Do we have data to compute? */
if (!$DataSerie) {
return PIE_NO_DATASERIE;
}
/* Remove unused data */
list($Data, $Palette) = $this->clean0Values($Data, $Palette, $DataSerie, $Data["Abscissa"]);
/* Compute the pie sum */
$SerieSum = $this->pDataObject->getSum($DataSerie);
/* Do we have data to draw? */
if ($SerieSum == 0) {
return PIE_SUMISNULL;
}
/* Dump the real number of data to draw */
$Values = array();
foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value) {
if ($Value != 0) {
$Values[] = $Value;
}
}
/* Compute the wasted angular space between series */
if (count($Values) == 1) {
$WastedAngular = 0;
} else {
$WastedAngular = count($Values) * $DataGapAngle;
}
/* Compute the scale */
$ScaleFactor = (360 - $WastedAngular) / $SerieSum;
$RestoreShadow = $this->pChartObject->Shadow;
if ($this->pChartObject->Shadow) {
$this->pChartObject->Shadow = false;
}
/* Draw the polygon ring elements */
$Offset = 360;
$ID = count($Values) - 1;
$Values = array_reverse($Values);
$Slice = 0;
$Slices = array();
$SliceColors = array();
$Visible = array();
$SliceAngle = array();
foreach ($Values as $Key => $Value) {
if (!isset($Palette[$ID]["R"])) {
$Color = $this->pChartObject->getRandomColor();
$Palette[$ID] = $Color;
$this->pDataObject->savePalette($ID, $Color);
}
$Settings = array("R" => $Palette[$ID]["R"], "G" => $Palette[$ID]["G"], "B" => $Palette[$ID]["B"], "Alpha" => $Palette[$ID]["Alpha"]);
//.........这里部分代码省略.........
示例5: Data
<?php
header('Content-type: application/json');
require_once 'Data.php';
require_once 'setHttpCode.php';
try {
// Instantiate Data class
$data = new Data();
// $_GET superglobal is only used to read
// input parameters. It is not modified by
// Data.php and extraneous parameters will
// be ignored. All necessary parameters are
// validated before being used by the system.
$chartData = $data->getData($_GET);
echo json_encode($chartData);
} catch (Exception $e) {
$message = (string) $e->getMessage();
$code = (int) $e->getCode();
$header = setHttpCode($code);
// Set Header
header($header);
// Return JSON with display data
die(json_encode(array('message' => $message)));
}
示例6: request
function request()
{
$this->query = "SELECT * FROM categories";
return self::requestData(parent::getData());
}
示例7: getData
/**
* Get data.
*
* @param null|array $blocks Array of blocks (optional)
* @return array
*/
public function getData(array $blocks = null)
{
return $this->Data->getData($blocks);
}
示例8: getData
/**
* Get data.
*
* @param null|array $blocks Array of blocks (optional)
* @param string $vargaKey Varga key (optional)
* @return array
*/
public function getData(array $blocks = null, $vargaKey = Varga::KEY_D1)
{
return $this->Data->getData($blocks, $vargaKey);
}
示例9: writeLabel
/**
* Write labels
* @param string $SeriesName
* @param array $Indexes
* @param array $Format
*/
public function writeLabel($SeriesName, $Indexes, array $Format = array())
{
$OverrideTitle = isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : null;
$ForceLabels = isset($Format["ForceLabels"]) ? $Format["ForceLabels"] : null;
$DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
$DrawVerticalLine = isset($Format["DrawVerticalLine"]) ? $Format["DrawVerticalLine"] : false;
$VerticalLineR = isset($Format["VerticalLineR"]) ? $Format["VerticalLineR"] : 0;
$VerticalLineG = isset($Format["VerticalLineG"]) ? $Format["VerticalLineG"] : 0;
$VerticalLineB = isset($Format["VerticalLineB"]) ? $Format["VerticalLineB"] : 0;
$VerticalLineAlpha = isset($Format["VerticalLineAlpha"]) ? $Format["VerticalLineAlpha"] : 40;
$VerticalLineTicks = isset($Format["VerticalLineTicks"]) ? $Format["VerticalLineTicks"] : 2;
$Data = $this->DataSet->getData();
list($XMargin, $XDivs) = $this->scaleGetXSettings();
if (!is_array($Indexes)) {
$Index = $Indexes;
$Indexes = array();
$Indexes[] = $Index;
}
if (!is_array($SeriesName)) {
$SerieName = $SeriesName;
$SeriesName = array();
$SeriesName[] = $SerieName;
}
if ($ForceLabels != null && !is_array($ForceLabels)) {
$ForceLabel = $ForceLabels;
$ForceLabels = array();
$ForceLabels[] = $ForceLabel;
}
foreach ($Indexes as $Key => $Index) {
$Series = array();
if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT) {
if ($XDivs == 0) {
$XStep = ($this->GraphAreaX2 - $this->GraphAreaX1) / 4;
} else {
$XStep = ($this->GraphAreaX2 - $this->GraphAreaX1 - $XMargin * 2) / $XDivs;
}
$X = $this->GraphAreaX1 + $XMargin + $Index * $XStep;
if ($DrawVerticalLine) {
$this->drawLine($X, $this->GraphAreaY1 + $Data["YMargin"], $X, $this->GraphAreaY2 - $Data["YMargin"], array("R" => $VerticalLineR, "G" => $VerticalLineG, "B" => $VerticalLineB, "Alpha" => $VerticalLineAlpha, "Ticks" => $VerticalLineTicks));
}
$MinY = $this->GraphAreaY2;
foreach ($SeriesName as $iKey => $SerieName) {
if (isset($Data["Series"][$SerieName]["Data"][$Index])) {
$AxisID = $Data["Series"][$SerieName]["Axis"];
$XAxisMode = $Data["XAxisDisplay"];
$XAxisFormat = $Data["XAxisFormat"];
$XAxisUnit = $Data["XAxisUnit"];
$AxisMode = $Data["Axis"][$AxisID]["Display"];
$AxisFormat = $Data["Axis"][$AxisID]["Format"];
$AxisUnit = $Data["Axis"][$AxisID]["Unit"];
if (isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index])) {
$XLabel = $this->scaleFormat($Data["Series"][$Data["Abscissa"]]["Data"][$Index], $XAxisMode, $XAxisFormat, $XAxisUnit);
} else {
$XLabel = "";
}
if ($OverrideTitle != null) {
$Description = $OverrideTitle;
} elseif (count($SeriesName) == 1) {
$Description = $Data["Series"][$SerieName]["Description"] . " - " . $XLabel;
} elseif (isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index])) {
$Description = $XLabel;
}
$Serie = "";
$Serie["R"] = $Data["Series"][$SerieName]["Color"]["R"];
$Serie["G"] = $Data["Series"][$SerieName]["Color"]["G"];
$Serie["B"] = $Data["Series"][$SerieName]["Color"]["B"];
$Serie["Alpha"] = $Data["Series"][$SerieName]["Color"]["Alpha"];
if (count($SeriesName) == 1 && isset($Data["Series"][$SerieName]["XOffset"])) {
$SerieOffset = $Data["Series"][$SerieName]["XOffset"];
} else {
$SerieOffset = 0;
}
$Value = $Data["Series"][$SerieName]["Data"][$Index];
if ($Value == VOID) {
$Value = "NaN";
}
if ($ForceLabels != null) {
$Caption = isset($ForceLabels[$Key]) ? $ForceLabels[$Key] : "Not set";
} else {
$Caption = $this->scaleFormat($Value, $AxisMode, $AxisFormat, $AxisUnit);
}
if ($this->LastChartLayout == CHART_LAST_LAYOUT_STACKED) {
if ($Value >= 0) {
$LookFor = "+";
} else {
$LookFor = "-";
}
$Value = 0;
$Done = false;
foreach ($Data["Series"] as $Name => $SerieLookup) {
if ($SerieLookup["isDrawable"] == true && $Name != $Data["Abscissa"] && !$Done) {
if (isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID) {
if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+") {
$Value = $Value + $Data["Series"][$Name]["Data"][$Index];
//.........这里部分代码省略.........
示例10: drawSplitPath
/**
* Create the encoded string
* @param Image $Object
* @param Data $Values
* @param array $Format
*/
public function drawSplitPath(Image $Object, Data $Values, array $Format = array())
{
$this->pChartObject = $Object;
$Spacing = isset($Format["Spacing"]) ? $Format["Spacing"] : 20;
$TextPadding = isset($Format["TextPadding"]) ? $Format["TextPadding"] : 2;
$TextPos = isset($Format["TextPos"]) ? $Format["TextPos"] : TEXT_POS_TOP;
$Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
$Force = isset($Format["Force"]) ? $Format["Force"] : 70;
$Segments = isset($Format["Segments"]) ? $Format["Segments"] : 15;
$X1 = $Object->GraphAreaX1;
$Y1 = $Object->GraphAreaY1;
$X2 = $Object->GraphAreaX2;
$Y2 = $Object->GraphAreaY2;
/* Data Processing */
$Data = $Values->getData();
$Palette = $Values->getPalette();
$LabelSerie = $Data["Abscissa"];
$DataSerie = array();
foreach ($Data["Series"] as $SerieName => $Value) {
if ($SerieName != $LabelSerie && $DataSerie == "") {
$DataSerie = $SerieName;
}
}
$DataSerieSum = array_sum($Data["Series"][$DataSerie]["Data"]);
$DataSerieCount = count($Data["Series"][$DataSerie]["Data"]);
/* Scale Processing */
if ($TextPos == TEXT_POS_RIGHT) {
$YScale = ($Y2 - $Y1 - ($DataSerieCount + 1) * $Spacing) / $DataSerieSum;
} else {
$YScale = ($Y2 - $Y1 - $DataSerieCount * $Spacing) / $DataSerieSum;
}
$LeftHeight = $DataSerieSum * $YScale;
/* Re-compute graph width depending of the text mode choosen */
if ($TextPos == TEXT_POS_RIGHT) {
$MaxWidth = 0;
foreach ($Data["Series"][$LabelSerie]["Data"] as $Key => $Label) {
$Boundardies = $Object->getTextBox(0, 0, $Object->FontName, $Object->FontSize, 0, $Label);
if ($Boundardies[1]["X"] > $MaxWidth) {
$MaxWidth = $Boundardies[1]["X"] + $TextPadding * 2;
}
}
$X2 = $X2 - $MaxWidth;
}
/* Drawing */
$LeftY = ($Y2 - $Y1) / 2 + $Y1 - $LeftHeight / 2;
$RightY = $Y1;
foreach ($Data["Series"][$DataSerie]["Data"] as $Key => $Value) {
if (isset($Data["Series"][$LabelSerie]["Data"][$Key])) {
$Label = $Data["Series"][$LabelSerie]["Data"][$Key];
} else {
$Label = "-";
}
$LeftY1 = $LeftY;
$LeftY2 = $LeftY + $Value * $YScale;
$RightY1 = $RightY + $Spacing;
$RightY2 = $RightY + $Spacing + $Value * $YScale;
$Settings = array("R" => $Palette[$Key]["R"], "G" => $Palette[$Key]["G"], "B" => $Palette[$Key]["B"], "Alpha" => $Palette[$Key]["Alpha"], "NoDraw" => true, "Segments" => $Segments, "Surrounding" => $Surrounding);
$PolyGon = "";
$Angle = $Object->getAngle($X2, $RightY1, $X1, $LeftY1);
$VectorX1 = cos(deg2rad($Angle + 90)) * $Force + ($X2 - $X1) / 2 + $X1;
$VectorY1 = sin(deg2rad($Angle + 90)) * $Force + ($RightY1 - $LeftY1) / 2 + $LeftY1;
$VectorX2 = cos(deg2rad($Angle - 90)) * $Force + ($X2 - $X1) / 2 + $X1;
$VectorY2 = sin(deg2rad($Angle - 90)) * $Force + ($RightY1 - $LeftY1) / 2 + $LeftY1;
$Points = $Object->drawBezier($X1, $LeftY1, $X2, $RightY1, $VectorX1, $VectorY1, $VectorX2, $VectorY2, $Settings);
foreach ($Points as $Key => $Pos) {
$PolyGon[] = $Pos["X"];
$PolyGon[] = $Pos["Y"];
}
$Angle = $Object->getAngle($X2, $RightY2, $X1, $LeftY2);
$VectorX1 = cos(deg2rad($Angle + 90)) * $Force + ($X2 - $X1) / 2 + $X1;
$VectorY1 = sin(deg2rad($Angle + 90)) * $Force + ($RightY2 - $LeftY2) / 2 + $LeftY2;
$VectorX2 = cos(deg2rad($Angle - 90)) * $Force + ($X2 - $X1) / 2 + $X1;
$VectorY2 = sin(deg2rad($Angle - 90)) * $Force + ($RightY2 - $LeftY2) / 2 + $LeftY2;
$Points = $Object->drawBezier($X1, $LeftY2, $X2, $RightY2, $VectorX1, $VectorY1, $VectorX2, $VectorY2, $Settings);
$Points = array_reverse($Points);
foreach ($Points as $Key => $Pos) {
$PolyGon[] = $Pos["X"];
$PolyGon[] = $Pos["Y"];
}
$Object->drawPolygon($PolyGon, $Settings);
if ($TextPos == TEXT_POS_RIGHT) {
$Object->drawText($X2 + $TextPadding, ($RightY2 - $RightY1) / 2 + $RightY1, $Label, array("Align" => TEXT_ALIGN_MIDDLELEFT));
} else {
$Object->drawText($X2, $RightY1 - $TextPadding, $Label, array("Align" => TEXT_ALIGN_BOTTOMRIGHT));
}
$LeftY = $LeftY2;
$RightY = $RightY2;
}
}
示例11: writeBubbleLabel
public function writeBubbleLabel($SerieName, $SerieWeightName, $Points, $Format = "")
{
$DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX;
if (!is_array($Points)) {
$Point = $Points;
$Points = array();
$Points[] = $Point;
}
$Data = $this->pDataObject->getData();
if (!isset($Data["Series"][$SerieName]) || !isset($Data["Series"][$SerieWeightName])) {
return 0;
}
list($XMargin, $XDivs) = $this->pChartObject->scaleGetXSettings();
$AxisID = $Data["Series"][$SerieName]["Axis"];
$AxisMode = $Data["Axis"][$AxisID]["Display"];
$AxisFormat = $Data["Axis"][$AxisID]["Format"];
$AxisUnit = $Data["Axis"][$AxisID]["Unit"];
$XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin * 2) / $XDivs;
$X = $InitialX = $this->pChartObject->GraphAreaX1 + $XMargin;
$Y = $InitialY = $this->pChartObject->GraphAreaY1 + $XMargin;
$Color = array("R" => $Data["Series"][$SerieName]["Color"]["R"], "G" => $Data["Series"][$SerieName]["Color"]["G"], "B" => $Data["Series"][$SerieName]["Color"]["B"], "Alpha" => $Data["Series"][$SerieName]["Color"]["Alpha"]);
foreach ($Points as $Key => $Point) {
$Value = $Data["Series"][$SerieName]["Data"][$Point];
$PosArray = $this->pChartObject->scaleComputeY($Value, array("AxisID" => $AxisID));
if (isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Point])) {
$Abscissa = $Data["Series"][$Data["Abscissa"]]["Data"][$Point] . " : ";
} else {
$Abscissa = "";
}
$Value = $this->pChartObject->scaleFormat($Value, $AxisMode, $AxisFormat, $AxisUnit);
$Weight = $Data["Series"][$SerieWeightName]["Data"][$Point];
$Caption = $Abscissa . $Value . " / " . $Weight;
if (isset($Data["Series"][$SerieName]["Description"])) {
$Description = $Data["Series"][$SerieName]["Description"];
} else {
$Description = "No description";
}
$Series = "";
$Series[] = array("Format" => $Color, "Caption" => $Caption);
if ($Data["Orientation"] == SCALE_POS_LEFTRIGHT) {
if ($XDivs == 0) {
$XStep = 0;
} else {
$XStep = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $XMargin * 2) / $XDivs;
}
$X = floor($InitialX + $Point * $XStep);
$Y = floor($PosArray);
} else {
if ($XDivs == 0) {
$YStep = 0;
} else {
$YStep = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $XMargin * 2) / $XDivs;
}
$X = floor($PosArray);
$Y = floor($InitialY + $Point * $YStep);
}
if ($DrawPoint == LABEL_POINT_CIRCLE) {
$this->pChartObject->drawFilledCircle($X, $Y, 3, array("R" => 255, "G" => 255, "B" => 255, "BorderR" => 0, "BorderG" => 0, "BorderB" => 0));
} elseif ($DrawPoint == LABEL_POINT_BOX) {
$this->pChartObject->drawFilledRectangle($X - 2, $Y - 2, $X + 2, $Y + 2, array("R" => 255, "G" => 255, "B" => 255, "BorderR" => 0, "BorderG" => 0, "BorderB" => 0));
}
$this->pChartObject->drawLabelBox($X, $Y - 3, $Description, $Series, $Format);
}
}
示例12: testGetData
public function testGetData()
{
$wrappedData = new Data(array('wrapped' => array('sampleData' => $this->getSampleData())));
$data = $wrappedData->getData('wrapped.sampleData');
$this->runSampleDataTests($data);
$this->setExpectedException('RuntimeException');
$data = $wrappedData->getData('wrapped.sampleData.a');
}
示例13: getEnvironment
/**
* Get environment.
*
* @return array
*/
public function getEnvironment()
{
return $this->Data->getData();
}
示例14: foreach
<table>
<? foreach(Data::getData('students') as $student) { ?>
<tr>
<td><?php
echo $student['FirstName'];
?>
</td>
<td><?php
echo $student['LastName'];
?>
</td>
<td><?php
echo $student['BirthDate'];
?>
</td>
<td>
<a href="students.php?del_id=<?php
echo $student['StudentId'];
?>
">X</a>
</td>
</tr>
<? } ?>
</table>