本文整理匯總了PHP中Image_Graph_Plot::_done方法的典型用法代碼示例。如果您正苦於以下問題:PHP Image_Graph_Plot::_done方法的具體用法?PHP Image_Graph_Plot::_done怎麽用?PHP Image_Graph_Plot::_done使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Image_Graph_Plot
的用法示例。
在下文中一共展示了Image_Graph_Plot::_done方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reset
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
if (!is_array($this->_dataset)) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
reset($this->_dataset);
if ($this->_multiType == 'stacked100pct') {
$total = $this->_getTotals();
}
$p1 = false;
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
$numPoints = 0;
while ($point = $dataset->_next()) {
if ($this->_multiType == 'stacked' || $this->_multiType == 'stacked100pct') {
$x = $point['X'];
if (!isset($current[$x])) {
$current[$x] = 0;
}
if ($this->_multiType == 'stacked') {
$py = $current[$x] + $point['Y'];
} else {
$py = 100 * ($current[$x] + $point['Y']) / $total['TOTAL_Y'][$x];
}
$current[$x] += $point['Y'];
$point['Y'] = $py;
}
if ($point['Y'] === null) {
if ($numPoints > 1) {
$this->_getLineStyle($key);
$this->_canvas->polygon(array('connect' => false, 'map_vertices' => true));
}
$numPoints = 0;
} else {
$p2['X'] = $this->_pointX($point);
$p2['Y'] = $this->_pointY($point);
$this->_canvas->addVertex($this->_mergeData($point, array('x' => $p2['X'], 'y' => $p2['Y'])));
$numPoints++;
}
}
if ($numPoints > 1) {
$this->_getLineStyle($key);
$this->_canvas->polygon(array('connect' => false, 'map_vertices' => true));
}
}
unset($keys);
$this->_drawMarker();
$this->_canvas->endGroup();
return true;
}
示例2: _done
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (Image_Graph_Plot::_done() === false) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$this->_drawMarker();
$this->_canvas->endGroup();
return true;
}
示例3: while
/**
* Output the plot
* @access private
*/
function _done()
{
parent::_done();
$p1 = false;
$this->_dataset->_reset();
while ($point = $this->_dataset->_next()) {
$p2['X'] = $this->_parent->_pointX($point);
$p2['Y'] = $this->_parent->_pointY($point);
if ($p1) {
ImageLine($this->_canvas(), $p1['X'], $p1['Y'], $p2['X'], $p2['Y'], $this->_getLineStyle());
}
$p1 = $p2;
}
$this->_drawMarker();
}
示例4: _done
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (Image_Graph_Plot::_done() === false) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
$data = array();
while ($point = $dataset->_next()) {
$data[] = array('X' => $this->_pointX($point), 'Y' => $this->_pointY($point));
}
$regression = Image_Graph_Tool::calculateLinearRegression($data);
$this->_getLineStyle($key);
$this->_canvas->line(array('x0' => $this->_left, 'y0' => $this->_left * $regression['slope'] + $regression['intersection'], 'x1' => $this->_right, 'y1' => $this->_right * $regression['slope'] + $regression['intersection']));
}
$this->_canvas->endGroup();
return true;
}
示例5: array
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
if (!is_array($this->_dataset)) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$this->_clip(true);
if ($this->_multiType == 'stacked100pct') {
$total = $this->_getTotals();
}
$current = array();
$number = 0;
$width = floor(0.8 * $this->_parent->_labelDistance(IMAGE_GRAPH_AXIS_X) / 2);
$lastClosed = false;
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
while ($data = $dataset->_next()) {
if ($this->_parent->_horizontal) {
$point['X'] = $data['X'];
//$y = $data['Y'];
if (isset($data['Y']['open'])) {
$point['Y'] = $data['Y']['open'];
} else {
$point['Y'] = $lastClosed;
}
$y = $this->_pointY($point);
$x_open = $this->_pointX($point);
$lastClosed = $point['Y'] = $data['Y']['close'];
$x_close = $this->_pointX($point);
$point['Y'] = $data['Y']['min'];
$x_min = $this->_pointX($point);
$point['Y'] = $data['Y']['max'];
$x_max = $this->_pointX($point);
if ($data['Y']['close'] < $data['Y']['open']) {
$ID = 'red';
} else {
$ID = 'green';
}
$this->_drawCandleStickH($y, $width, $x_min, $x_open, $x_close, $x_max, $ID);
} else {
$point['X'] = $data['X'];
//$y = $data['Y'];
if (isset($data['Y']['open'])) {
$point['Y'] = $data['Y']['open'];
} else {
$point['Y'] = $lastClosed;
}
$x = $this->_pointX($point);
$y_open = $this->_pointY($point);
$lastClosed = $point['Y'] = $data['Y']['close'];
$y_close = $this->_pointY($point);
$point['Y'] = $data['Y']['min'];
$y_min = $this->_pointY($point);
$point['Y'] = $data['Y']['max'];
$y_max = $this->_pointY($point);
if ($data['Y']['close'] < $data['Y']['open']) {
$ID = 'red';
} else {
$ID = 'green';
}
$this->_drawCandleStickV($x, $width, $y_min, $y_open, $y_close, $y_max, $ID);
}
}
}
unset($keys);
$this->_drawMarker();
$this->_clip(false);
$this->_canvas->endGroup($this->_title);
return true;
}
示例6: array
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
if (!is_array($this->_dataset)) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
if ($this->_multiType == 'stacked100pct') {
$total = $this->_getTotals();
}
$current = array();
$number = 0;
$width = floor(0.5 * $this->_parent->_labelDistance(IMAGE_GRAPH_AXIS_X) / 2);
if ($this->_whiskerSize !== false) {
$r = $this->_whiskerSize;
} else {
$r = min(5, $width / 10);
}
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
while ($data = $dataset->_next()) {
if ($this->_parent->_horizontal) {
$point['X'] = $data['X'];
$y = $data['Y'];
$min = min($y);
$max = max($y);
$q1 = $dataset->_median($y, 'first');
$med = $dataset->_median($y, 'second');
$q3 = $dataset->_median($y, 'third');
$point['Y'] = $min;
$y = $this->_pointY($point);
$x_min = $this->_pointX($point);
$point['Y'] = $max;
$x_max = $this->_pointX($point);
$point['Y'] = $q1;
$x_q1 = $this->_pointX($point);
$point['Y'] = $med;
$x_med = $this->_pointX($point);
$point['Y'] = $q3;
$x_q3 = $this->_pointX($point);
$this->_drawBoxWhiskerH($y, $width, $r, $x_min, $x_q1, $x_med, $x_q3, $x_max, $key);
} else {
$point['X'] = $data['X'];
$y = $data['Y'];
$min = min($y);
$max = max($y);
$q1 = $dataset->_median($y, 'first');
$med = $dataset->_median($y, 'second');
$q3 = $dataset->_median($y, 'third');
$point['Y'] = $min;
$x = $this->_pointX($point);
$y_min = $this->_pointY($point);
$point['Y'] = $max;
$y_max = $this->_pointY($point);
$point['Y'] = $q1;
$y_q1 = $this->_pointY($point);
$point['Y'] = $med;
$y_med = $this->_pointY($point);
$point['Y'] = $q3;
$y_q3 = $this->_pointY($point);
$this->_drawBoxWhiskerV($x, $width, $r, $y_min, $y_q1, $y_med, $y_q3, $y_max, $key);
}
}
}
unset($keys);
$this->_drawMarker();
$this->_canvas->endGroup();
return true;
}
示例7: elseif
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
if (!is_array($this->_dataset)) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$this->_clip(true);
if ($this->_width == 'auto') {
$width = $this->_parent->_labelDistance(IMAGE_GRAPH_AXIS_X) / 2;
} elseif ($this->_width['unit'] == '%') {
$width = $this->_width['width'] * $this->width() / 200;
} elseif ($this->_width['unit'] == 'px') {
$width = $this->_width['width'] / 2;
}
if ($this->_multiType == 'stacked100pct') {
$total = $this->_getTotals();
}
$minYaxis = $this->_parent->_getMinimum($this->_axisY);
$maxYaxis = $this->_parent->_getMaximum($this->_axisY);
$number = 0;
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
while ($point = $dataset->_next()) {
if ($this->_parent->_horizontal) {
$y1 = $this->_pointY($point) - $width;
$y2 = $this->_pointY($point) + $width;
if ($y2 - $this->_space > $y1 + $this->_space) {
/*
* Take bar spacing into account _only_ if the space doesn't
* turn the bar "inside-out", i.e. if the actual bar width
* is smaller than the space between the bars
*/
$y2 -= $this->_space;
$y1 += $this->_space;
}
} else {
$x1 = $this->_pointX($point) - $width;
$x2 = $this->_pointX($point) + $width;
if ($x2 - $this->_space > $x1 + $this->_space) {
/*
* Take bar spacing into account _only_ if the space doesn't
* turn the bar "inside-out", i.e. if the actual bar width
* is smaller than the space between the bars
*/
$x2 -= $this->_space;
$x1 += $this->_space;
}
}
if ($this->_multiType == 'stacked' || $this->_multiType == 'stacked100pct') {
$x = $point['X'];
if ($point['Y'] >= 0) {
if (!isset($current[$x])) {
$current[$x] = 0;
}
if ($this->_multiType == 'stacked') {
$p0 = array('X' => $point['X'], 'Y' => $current[$x]);
$p1 = array('X' => $point['X'], 'Y' => $current[$x] + $point['Y']);
} else {
$p0 = array('X' => $point['X'], 'Y' => 100 * $current[$x] / $total['TOTAL_Y'][$x]);
$p1 = array('X' => $point['X'], 'Y' => 100 * ($current[$x] + $point['Y']) / $total['TOTAL_Y'][$x]);
}
$current[$x] += $point['Y'];
} else {
if (!isset($currentNegative[$x])) {
$currentNegative[$x] = 0;
}
$p0 = array('X' => $point['X'], 'Y' => $currentNegative[$x]);
$p1 = array('X' => $point['X'], 'Y' => $currentNegative[$x] + $point['Y']);
$currentNegative[$x] += $point['Y'];
}
} else {
if (count($this->_dataset) > 1) {
$w = 2 * ($width - $this->_space) / count($this->_dataset);
if ($this->_parent->_horizontal) {
$y2 = ($y1 = ($y1 + $y2) / 2 - ($width - $this->_space) + $number * $w) + $w;
} else {
$x2 = ($x1 = ($x1 + $x2) / 2 - ($width - $this->_space) + $number * $w) + $w;
}
}
$p0 = array('X' => $point['X'], 'Y' => 0);
$p1 = $point;
}
if (($minY = min($p0['Y'], $p1['Y'])) < $maxYaxis && ($maxY = max($p0['Y'], $p1['Y'])) > $minYaxis) {
$p0['Y'] = $minY;
$p1['Y'] = $maxY;
if ($p0['Y'] < $minYaxis) {
$p0['Y'] = '#min_pos#';
}
if ($p1['Y'] > $maxYaxis) {
//.........這裏部分代碼省略.........
示例8: array
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$base = array();
if ($this->_multiType == 'stacked') {
reset($this->_dataset);
$key = key($this->_dataset);
$dataset =& $this->_dataset[$key];
$first = $dataset->first();
$point = array('X' => $first['X'], 'Y' => '#min_pos#');
$base[] = array();
$base[] = $this->_pointY($point);
$first = $this->_pointX($point);
$base[] = $first;
$last = $dataset->last();
$point = array('X' => $last['X'], 'Y' => '#min_pos#');
$base[] = array();
$base[] = $this->_pointY($point);
$base[] = $this->_pointX($point);
$current = array();
}
$minYaxis = $this->_parent->_getMinimum($this->_axisY);
$maxYaxis = $this->_parent->_getMaximum($this->_axisY);
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
if ($this->_multiType == 'stacked') {
$plotarea = array_reverse($base);
$base = array();
while ($point = $dataset->_next()) {
$x = $point['X'];
$p = $point;
if (isset($current[$x])) {
$p['Y'] += $current[$x];
} else {
$current[$x] = 0;
}
$x1 = $this->_pointX($p);
$y1 = $this->_pointY($p);
$plotarea[] = $x1;
$plotarea[] = $y1;
$plotarea[] = $point;
$base[] = array();
$base[] = $y1;
$base[] = $x1;
$current[$x] += $point['Y'];
}
} else {
$first = true;
$plotarea = array();
while ($point = $dataset->_next()) {
if ($first) {
$firstPoint = array('X' => $point['X'], 'Y' => '#min_pos#');
$plotarea[] = $this->_pointX($firstPoint);
$plotarea[] = $this->_pointY($firstPoint);
$plotarea[] = array();
}
$plotarea[] = $this->_pointX($point);
$plotarea[] = $this->_pointY($point);
$plotarea[] = $point;
$lastPoint = $point;
$first = false;
}
$endPoint['X'] = $lastPoint['X'];
$endPoint['Y'] = '#min_pos#';
$plotarea[] = $this->_pointX($endPoint);
$plotarea[] = $this->_pointY($endPoint);
$plotarea[] = array();
}
reset($plotarea);
while (list(, $x) = each($plotarea)) {
list(, $y) = each($plotarea);
list(, $data) = each($plotarea);
$this->_canvas->addVertex($this->_mergeData($data, array('x' => $x, 'y' => $y)));
}
$this->_getFillStyle($key);
$this->_getLineStyle($key);
$this->_canvas->polygon(array('connect' => true, 'map_vertices' => true));
}
unset($keys);
$this->_drawMarker();
$this->_canvas->endGroup();
return true;
}
示例9: array
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
if (!is_array($this->_dataset)) {
return false;
}
$current = array();
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
$upperBand = array();
$lowerBand = array();
while ($data = $dataset->_next()) {
if ($this->_parent->_horizontal) {
$point['X'] = $data['X'];
$point['Y'] = $data['Y']['high'];
$y = $this->_pointY($point);
$x_high = $this->_pointX($point);
$point['Y'] = $data['Y']['low'];
$x_low = $this->_pointX($point);
$data = array('X' => $x_high, 'Y' => $y);
if (isset($point['data'])) {
$data['data'] = $point['data'];
} else {
$data['data'] = array();
}
$upperBand[] = $data;
$data = array('X' => $x_low, 'Y' => $y);
if (isset($point['data'])) {
$data['data'] = $point['data'];
} else {
$data['data'] = array();
}
$lowerBand[] = $data;
} else {
$point['X'] = $data['X'];
$y = $data['Y'];
$point['Y'] = $data['Y']['high'];
$x = $this->_pointX($point);
$y_high = $this->_pointY($point);
$point['Y'] = $data['Y']['low'];
$y_low = $this->_pointY($point);
$data = array('X' => $x, 'Y' => $y_high);
if (isset($point['data'])) {
$data['data'] = $point['data'];
} else {
$data['data'] = array();
}
$upperBand[] = $data;
$data = array('X' => $x, 'Y' => $y_low);
if (isset($point['data'])) {
$data['data'] = $point['data'];
} else {
$data['data'] = array();
}
$lowerBand[] = $data;
}
}
$lowerBand = array_reverse($lowerBand);
foreach ($lowerBand as $point) {
$this->_canvas->addVertex($this->_mergeData($point['data'], array('x' => $point['X'], 'y' => $point['Y'])));
}
foreach ($upperBand as $point) {
$this->_canvas->addVertex($this->_mergeData($point['data'], array('x' => $point['X'], 'y' => $point['Y'])));
}
unset($upperBand);
unset($lowerBand);
$this->_getLineStyle($key);
$this->_getFillStyle($key);
$this->_canvas->polygon(array('connect' => true, 'map_vertices' => true));
}
unset($keys);
$this->_drawMarker();
$this->_canvas->endGroup();
return true;
}
示例10: foreach
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$this->_clip(true);
if (is_a($this->_parent, 'Image_Graph_Plotarea_Radar')) {
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$maxY = $dataset->maximumY();
$count = $dataset->count();
$dataset->_reset();
while ($point = $dataset->_next()) {
$this->_canvas->addVertex(array('x' => $this->_pointX($point), 'y' => $this->_pointY($point)));
}
$this->_getFillStyle($key);
$this->_getLineStyle($key);
$this->_canvas->polygon(array('connect' => true));
}
unset($keys);
}
$this->_drawMarker();
$this->_clip(false);
$this->_canvas->endGroup();
return parent::_done();
}
示例11: array
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
if (!is_array($this->_dataset)) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$this->_clip(true);
if ($this->_multiType == 'stacked100pct') {
$total = $this->_getTotals();
}
$current = array();
$number = 0;
$minYaxis = $this->_parent->_getMinimum($this->_axisY);
$maxYaxis = $this->_parent->_getMaximum($this->_axisY);
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
while ($point = $dataset->_next()) {
$x0 = $this->_pointX($point);
if ($this->_multiType == 'stacked' || $this->_multiType == 'stacked100pct') {
$x = $point['X'];
if ($point['Y'] >= 0) {
if (!isset($current[$x])) {
$current[$x] = 0;
}
if ($this->_multiType == 'stacked') {
$p0 = array('X' => $point['X'], 'Y' => $current[$x]);
$p1 = array('X' => $point['X'], 'Y' => $current[$x] + $point['Y']);
} else {
$p0 = array('X' => $point['X'], 'Y' => 100 * $current[$x] / $total['TOTAL_Y'][$x]);
$p1 = array('X' => $point['X'], 'Y' => 100 * ($current[$x] + $point['Y']) / $total['TOTAL_Y'][$x]);
}
$current[$x] += $point['Y'];
} else {
if (!isset($currentNegative[$x])) {
$currentNegative[$x] = 0;
}
$p0 = array('X' => $point['X'], 'Y' => $currentNegative[$x]);
$p1 = array('X' => $point['X'], 'Y' => $currentNegative[$x] + $point['Y']);
$currentNegative[$x] += $point['Y'];
}
} else {
$p0 = array('X' => $point['X'], 'Y' => 0);
$p1 = $point;
}
if (($minY = min($p0['Y'], $p1['Y'])) < $maxYaxis && ($maxY = max($p0['Y'], $p1['Y'])) > $minYaxis) {
$p0['Y'] = $minY;
$p1['Y'] = $maxY;
if ($p0['Y'] < $minYaxis) {
$p0['Y'] = '#min_pos#';
}
if ($p1['Y'] > $maxYaxis) {
$p1['Y'] = '#max_neg#';
}
$x1 = $this->_pointX($p0);
$y1 = $this->_pointY($p0);
$x2 = $this->_pointX($p1);
$y2 = $this->_pointY($p1);
if ($this->_multiType == 'normal') {
$offset = 5 * $number;
$x1 += $offset;
$x2 += $offset;
}
$ID = $point['ID'];
if ($ID === false && count($this->_dataset) > 1) {
$ID = $key;
}
$this->_getLineStyle($key);
$this->_canvas->line($this->_mergeData($point, array('x0' => $x1, 'y0' => $y1, 'x1' => $x2, 'y1' => $y2)));
}
}
$number++;
}
unset($keys);
$this->_clip(false);
$this->_drawMarker();
$this->_canvas->endGroup();
return true;
}
示例12: _done
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (Image_Graph_Plot::_done() === false) {
return false;
}
$this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
$this->_clip(true);
if ($this->_multiType == 'stacked100pct') {
$total = $this->_getTotals();
}
if ($this->_parent->_horizontal) {
$width = $this->height() / ($this->_maximumX() + 2) / 2;
} else {
$width = $this->width() / ($this->_maximumX() + 2) / 2;
}
reset($this->_dataset);
$key = key($this->_dataset);
$dataset =& $this->_dataset[$key];
$first = $dataset->first();
$last = $dataset->last();
$point = array('X' => $first['X'], 'Y' => '#min_pos#');
$firstY = $this->_pointY($point) + ($this->_parent->_horizontal ? $width : 0);
$base[] = $firstY;
$firstX = $this->_pointX($point) - ($this->_parent->_horizontal ? 0 : $width);
$base[] = $firstX;
$point = array('X' => $last['X'], 'Y' => '#min_pos#');
$base[] = $this->_pointY($point) - ($this->_parent->_horizontal ? $width : 0);
$base[] = $this->_pointX($point) + ($this->_parent->_horizontal ? 0 : $width);
$first = $this->_parent->_horizontal ? $firstY : $firstX;
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$dataset->_reset();
$polygon = array_reverse($base);
unset($base);
$last = $first;
while ($point = $dataset->_next()) {
$x = $point['X'];
$p = $point;
if (!isset($current[$x])) {
$current[$x] = 0;
}
if ($this->_multiType == 'stacked100pct') {
$p['Y'] = 100 * ($current[$x] + $point['Y']) / $total['TOTAL_Y'][$x];
} else {
$p['Y'] += $current[$x];
}
$current[$x] += $point['Y'];
$point = $p;
if ($this->_parent->_horizontal) {
$x0 = $this->_pointX($point);
$y0 = $last;
$x1 = $this->_pointX($point);
$last = $y1 = $this->_pointY($point) - $width;
} else {
$x0 = $last;
$y0 = $this->_pointY($point);
$last = $x1 = $this->_pointX($point) + $width;
$y1 = $this->_pointY($point);
}
$polygon[] = $x0;
$base[] = $y0;
$polygon[] = $y0;
$base[] = $x0;
$polygon[] = $x1;
$base[] = $y1;
$polygon[] = $y1;
$base[] = $x1;
}
while (list(, $x) = each($polygon)) {
list(, $y) = each($polygon);
$this->_canvas->addVertex(array('x' => $x, 'y' => $y));
}
$this->_getFillStyle($key);
$this->_getLineStyle($key);
$this->_canvas->polygon(array('connect' => true));
}
unset($keys);
$this->_drawMarker();
$this->_clip(false);
$this->_canvas->endGroup();
return true;
}
示例13: foreach
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
$number = 0;
$keys = array_keys($this->_dataset);
foreach ($keys as $key) {
$dataset =& $this->_dataset[$key];
$totalY = 0;
$dataset->_reset();
while ($point = $dataset->_next()) {
$totalY += $point['Y'];
}
$centerX = (int) (($this->_left + $this->_right) / 2);
$centerY = (int) (($this->_top + $this->_bottom) / 2);
$diameter = $this->_getDiameter();
if ($this->_angleDirection < 0) {
$currentY = $totalY;
} else {
$currentY = 0;
//rand(0, 100)*$totalY/100;
}
$dataset->_reset();
if (count($this->_dataset) == 1) {
$radius0 = false;
$radius1 = $diameter / 2;
} else {
$dr = $diameter / (2 * count($this->_dataset));
$radius0 = $number * $dr + ($number > 0 ? $this->_radius : 0);
$radius1 = ($number + 1) * $dr;
}
$the_rest = 0;
while ($point = $dataset->_next()) {
if ($this->_restGroupLimit !== false && $point['Y'] <= $this->_restGroupLimit) {
$the_rest += $point['Y'];
} else {
$angle1 = 360 * ($currentY / $totalY) + $this->_startingAngle;
$currentY += $this->_angleDirection * $point['Y'];
$angle2 = 360 * ($currentY / $totalY) + $this->_startingAngle;
$x = $point['X'];
$id = $point['ID'];
$dX = 0;
$dY = 0;
$explodeRadius = 0;
if (is_array($this->_explode) && isset($this->_explode[$x])) {
$explodeRadius = $this->_explode[$x];
} elseif (is_numeric($this->_explode)) {
$explodeRadius = $this->_explode;
}
if ($explodeRadius > 0) {
$dX = $explodeRadius * cos(deg2rad(($angle1 + $angle2) / 2));
$dY = $explodeRadius * sin(deg2rad(($angle1 + $angle2) / 2));
}
$ID = $point['ID'];
$this->_getFillStyle($ID);
$this->_getLineStyle($ID);
$this->_canvas->pieslice($this->_mergeData($point, array('x' => $centerX + $dX, 'y' => $centerY + $dY, 'rx' => $radius1, 'ry' => $radius1, 'v1' => $angle1, 'v2' => $angle2, 'srx' => $radius0, 'sry' => $radius0)));
}
}
if ($the_rest > 0) {
$angle1 = 360 * ($currentY / $totalY) + $this->_startingAngle;
$currentY += $this->_angleDirection * $the_rest;
$angle2 = 360 * ($currentY / $totalY) + $this->_startingAngle;
$x = 'rest';
$id = 'rest';
$dX = 0;
$dY = 0;
$explodeRadius = 0;
if (is_array($this->_explode) && isset($this->_explode[$x])) {
$explodeRadius = $this->_explode[$x];
} elseif (is_numeric($this->_explode)) {
$explodeRadius = $this->_explode;
}
if ($explodeRadius > 0) {
$dX = $explodeRadius * cos(deg2rad(($angle1 + $angle2) / 2));
$dY = $explodeRadius * sin(deg2rad(($angle1 + $angle2) / 2));
}
$ID = $id;
$this->_getFillStyle($ID);
$this->_getLineStyle($ID);
$this->_canvas->pieslice($this->_mergeData($point, array('x' => $centerX + $dX, 'y' => $centerY + $dY, 'rx' => $radius1, 'ry' => $radius1, 'v1' => $angle1, 'v2' => $angle2, 'srx' => $radius0, 'sry' => $radius0)));
}
$number++;
}
unset($keys);
$this->_drawMarker();
return true;
}
示例14:
/**
* Output the plot
*
* @return bool Was the output 'good' (true) or 'bad' (false).
* @access private
*/
function _done()
{
if (parent::_done() === false) {
return false;
}
$this->_initialize();
$this->_drawRange();
$this->_drawAxis();
$this->_drawArrow();
$this->_drawMarker();
return true;
}
示例15: while
/**
* Output the plot
* @access private
*/
function _done()
{
parent::_done();
if ($this->_dataset) {
if (!$this->_xValueWidth) {
$width = ($this->width() / ($this->_dataset->count() + 2)) / 2;
}
$this->_dataset->_reset();
while ($point = $this->_dataset->_next()) {
if (!$this->_xValueWidth) {
$x1 = $this->_parent->_pointX($point) - $width + $this->_space;
$x2 = $this->_parent->_pointX($point) + $width - $this->_space;
} else {
$x1 = $this->_parent->_pointX($point['X'] - $this->_xValueWidth / 2) + $this->_space;
$x2 = $this->_parent->_pointX($point['X'] + $this->_xValueWidth / 2) - $this->_space;
}
$y1 = $this->_parent->_pointY(0);
$y2 = $this->_parent->_pointY($point);
ImageFilledRectangle($this->_canvas(), min($x1, $x2), min($y1, $y2), max($x1, $x2), max($y1, $y2), $this->_getFillStyle());
ImageRectangle($this->_canvas(), min($x1, $x2), min($y1, $y2), max($x1, $x2), max($y1, $y2), $this->_getLineStyle());
}
$this->_drawMarker();
}
}