本文整理汇总了PHP中pChart::drawFromJPG方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawFromJPG方法的具体用法?PHP pChart::drawFromJPG怎么用?PHP pChart::drawFromJPG使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::drawFromJPG方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cartesianChart
//.........这里部分代码省略.........
$xdata .= $settings['XAxisUnit'];
$Position = imageftbbox($FontSize, 0, $FontName, $xdata);
$TextWidth = $Position[2] - $Position[0];
$TextHeightX = $Position[1] - $Position[7];
$WXmax = $TextWidth > $WXmax ? $TextWidth : $WXmax;
}
}
if ($settings['XAngle'] > 0) {
$sin = abs(sin(deg2rad($settings['XAngle'])));
$cos = abs(cos(deg2rad($settings['XAngle'])));
$HXmax = $WXmax * $sin + $TextHeightX * $cos;
} else {
$HXmax = $TextHeightX;
}
//on Y axis...
if ($settings['YAxisFormat'] == 'time') {
$ydata = "99:99:99";
$Position = imageftbbox($FontSize, 0, $FontName, $ydata);
$WYmax = $Position[2] - $Position[0];
$TextHeightY = $Position[1] - $Position[7];
} elseif ($settings['YAxisFormat'] == 'date') {
$ydata = "99/99/9999";
$Position = imageftbbox($FontSize, 0, $FontName, $ydata);
$WYmax = $Position[2] - $Position[0];
$TextHeightY = $Position[1] - $Position[7];
} else {
$WYmax = 0;
foreach ($y as $ydata) {
$ydata .= $settings['YAxisUnit'];
//echo $ydata."<br>";
$Position = imageftbbox($FontSize, 0, $FontName, $ydata);
$TextWidth = $Position[2] - $Position[0];
$TextHeightY = $Position[1] - $Position[7];
$WYmax = $TextWidth > $WYmax ? $TextWidth : $WYmax;
}
}
$Test->setGraphArea($WYmax + $TextHeightY + 35, 20, $w - 25, $h - $HXmax - $TextHeightX - $TextboxHeight - 20);
//$Test->setGraphArea(60,20,$w-25,($settings['XAngle']==0)?$h-70:$h-100);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 213, 217, 221, TRUE, $settings['XAngle'], 0, TRUE);
$Test->drawGraphAreaGradient($settings['BGR'], $settings['BGG'], $settings['BGB'], $settings['Decay2']);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// This will put the picture "logo.png" with transparency
if (strlen($settings['Logo'])) {
$XLogo = $WYmax + $TextHeightY + 35 + $settings['XLogo'];
$YLogo = 20 + $settings['XLogo'];
$logo = $settings['Logo'];
//Fing extension of logo : png,gif or jpg
if ($this->_findexts($logo) == "png") {
echo "png!";
$Test->drawFromPNG($logo, $XLogo, $YLogo, $settings['LogoTransparency']);
} elseif ($this->_findexts($logo) == "gif") {
echo "gif!";
$Test->drawFromGIF($logo, $XLogo, $YLogo, $settings['LogoTransparency']);
} elseif ($this->_findexts($logo) == "jpg") {
echo "jpg";
$Test->drawFromJPG($logo, $XLogo, $YLogo, $settings['LogoTransparency']);
}
}
$Test->setColorPalette(0, $settings['DataR'], $settings['DataG'], $settings['DataB']);
if ($type == "bar") {
// Draw the bar chart
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
} elseif ($type == "line") {
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 0, -1, -1, -1, TRUE);
} elseif ($type == "cubic") {
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
if ($settings['Filled'] == 'yes') {
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
}
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 0, -1, -1, -1, TRUE);
}
// Draw the textbox
if (strlen($settings['Textbox'])) {
$Test->setFontProperties($TextboxFontName, $TextboxFontSize);
$Test->drawTextBox(0, $h - $TextboxHeight, $w, $h, $settings['Textbox'], 0, 255, 255, 255, ALIGN_CENTER, TRUE, 0, 0, 0, 30);
}
// Draw the legend
if (strlen($settings['Legend'])) {
$LegendFontSize = $settings['LegendFontSize'];
$LegendFontName = $this->_ext_path . "/fonts/" . $settings['LegendFontName'];
$Position = imageftbbox($LegendFontSize, 0, $LegendFontName, $settings['Legend']);
$LegendW = $Position[2] - $Position[0] + 40;
$Test->setFontProperties($LegendFontName, $LegendFontSize);
$Test->drawLegend($w - $LegendW, 10, $DataSet->GetDataDescription(), $settings['LBR'], $settings['LBG'], $settings['LBB'], 52, 58, 82, $settings['LR'], $settings['LG'], $settings['LB'], TRUE);
}
// Render the picture
$Test->addBorder(2);
if (strlen($imgname)) {
//custom image name
$imgname = $this->_img_path . "/" . $imgname;
} else {
$this->obj->load->helper('string');
$imgname = $this->_img_path . "/{$type}-" . random_string('alnum', 16) . ".png";
}
$Test->Render($imgname);
return array("name" => '/' . $imgname, "w" => $w + 4, "h" => $h + 4);
}