本文整理汇总了PHP中pChart::drawXYGraph方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawXYGraph方法的具体用法?PHP pChart::drawXYGraph怎么用?PHP pChart::drawXYGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::drawXYGraph方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawChart
function drawChart($title, $DataSet, $names, $colors, $legend = false)
{
// Initialise the graph
$Chart = new pChart(1300, 750);
$Chart->setFontProperties("Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 25, 1200, 725);
$Chart->drawGraphArea(255, 255, 255, TRUE);
$Chart->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "ally", "allx", 150, 150, 150, TRUE, 45);
$Chart->setLineStyle(4);
// Draw the 0 line
$Chart->setFontProperties("Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
foreach ($colors as $idx => $color) {
$Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
}
$i = 0;
foreach ($names as $name) {
$Chart->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $name . "y", $name . "x", $i);
$i++;
}
if ($legend) {
$Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Finish the graph
$Chart->setFontProperties("Fonts/tahoma.ttf", 10);
// $Chart->drawTitle(60,22,$title,50,50,50,530);
$Chart->Stroke();
}
示例2: testXYChart
/**
* Based on Example24.php
*/
public function testXYChart()
{
// Dataset definition
$DataSet = new pData();
// Compute the points
for ($i = 0; $i <= 360; $i = $i + 10) {
$DataSet->addPoint(cos($i * 3.14 / 180) * 80 + $i, "Serie1");
$DataSet->addPoint(sin($i * 3.14 / 180) * 80 + $i, "Serie2");
}
$DataSet->setSeriesName("Trigonometric function", "Serie1");
$DataSet->addSeries("Serie1");
$DataSet->addSeries("Serie2");
$DataSet->SetXAxisName("X Axis");
$DataSet->SetYAxisName("Y Axis");
// Initialise the graph
$canvas = new TestCanvas();
$Test = new pChart(300, 300, $canvas);
$Test->drawBackgroundGradient(new Color(0), -100);
// Prepare the graph area
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(55, 30, 270, 230);
$scaleStyle = new ScaleStyle(SCALE_NORMAL, new Color(213, 217, 221));
$Test->drawXYScale($DataSet, $scaleStyle, "Serie1", "Serie2", 45);
$backgroundStyle = new BackgroundStyle(new Color(213, 217, 221), FALSE, new Color(30), -50);
$Test->drawGraphBackground($backgroundStyle);
$Test->drawGrid(new GridStyle(4, TRUE, new Color(230), 20));
// Draw the chart
$Test->setShadowProperties(2, 2, new Color(0), 60, 4);
$Test->drawXYGraph($DataSet->GetData(), "Serie1", "Serie2", 0);
$Test->clearShadow();
// Draw the title
$Title = "Drawing X versus Y charts trigonometric functions ";
$Test->drawTextBox(new Point(0, 280), new Point(300, 300), $Title, 0, new Color(255), ALIGN_RIGHT, ShadowProperties::FromSettings(1, 1, new Color(0), 100, 0), new Color(0), 30);
// Draw the legend
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
$DataSet->removeSeries("Serie2");
$Test->drawLegend(160, 5, $DataSet->GetDataDescription(), new Color(0), new Color(0), new Color(255), FALSE);
file_put_contents(dirname(__FILE__) . '/action_logs/testXYChart', $canvas->getActionLog());
$this->assertEquals('3c45517b3d9549198ffffaac276ad353', md5($canvas->getActionLog()));
}
示例3: make
//.........这里部分代码省略.........
$left_margin += 2 * $h;
$plot->setGraphArea($left_margin, 2 * $h, $width - $h, $height - 2 * $h);
$background = $this->plot->property('background');
if (!$background) {
$background = array('R' => 255, 'G' => 255, 'B' => 255);
} else {
$background = html_color_to_RGB($background);
}
$plot->drawGraphArea($background['R'], $background['G'], $background['B']);
// pick the largest scale
$plot->drawXYScale($data->GetData(), $data->GetDataDescription(), 'Serie' . $max_col, 'Serie' . $x_column, 0, 0, 0, TRUE, 0, 0);
$line_no = 0;
$colors = array();
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
$style = $this->plot->line_style($name, 'style');
$line_color = $this->plot->line_style($name, 'color');
if (!$line_color) {
$colors[$name] = array('R' => 0, 'G' => 0, 'B' => 0);
} else {
$colors[$name] = html_color_to_RGB($line_color);
}
$plot->setColorPalette($line_no, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
if (!$style || $style == 'line' || $style == 'both') {
$line_width = $this->plot->line_style($name, 'width');
if (!$line_width) {
$line_width = 1;
}
$dot_size = $this->plot->line_style($name, 'dot-size');
if (!$dot_size) {
$dot_size = 0;
}
$plot->setLineStyle($line_width, $dot_size);
$plot->drawXYGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no);
}
if ($style == 'point' || $style == 'both') {
$radius = $this->plot->line_style($name, 'radius');
if (!$radius) {
$radius = 5;
}
$plot->drawXYPlotGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no, $radius, $radius - 2);
}
$line_no++;
}
$title = $this->plot->property('title');
foreach ($columns as $column) {
$data->removeSerie('Serie' . $column);
}
$in_legend = array();
$description = $data->GetDataDescription();
$description['Description'] = array();
$palette_id = 0;
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
if (in_array($name, $in_legend)) {
continue;
}
$in_legend[] = $name;
$description['Description']['Serie' . $column] = $name;
$plot->setColorPalette($palette_id, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
++$palette_id;
}
$legend_box_size = $plot->getLegendBoxSize($description);
$legend_position = $this->plot->property('legend-position');
if (!$legend_position) {
$legend_position = 'top-left';
示例4: pChart
for ($i = 0; $i <= 360; $i = $i + 10) {
$DataSet->AddPoint(cos($i * 3.14 / 180) * 80 + $i, "Serie1");
$DataSet->AddPoint(sin($i * 3.14 / 180) * 80 + $i, "Serie2");
}
$DataSet->SetSerieName("Trigonometric function", "Serie1");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetXAxisName("X Axis");
$DataSet->SetYAxisName("Y Axis");
// Initialise the graph
$Test = new pChart(300, 300);
$Test->drawGraphAreaGradient(0, 0, 0, -100, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(55, 30, 270, 230);
$Test->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 213, 217, 221, TRUE, 45);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawGraphAreaGradient(30, 30, 30, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the chart
$Test->setShadowProperties(2, 2, 0, 0, 0, 60, 4);
$Test->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 0);
$Test->clearShadow();
// Draw the title
$Title = "Drawing X versus Y charts trigonometric functions ";
$Test->drawTextBox(0, 280, 300, 300, $Title, 0, 255, 255, 255, ALIGN_RIGHT, TRUE, 0, 0, 0, 30);
// Draw the legend
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
$DataSet->RemoveSerie("Serie2");
$Test->drawLegend(160, 5, $DataSet->GetDataDescription(), 0, 0, 0, 0, 0, 0, 255, 255, 255, FALSE);
$Test->Stroke("example24.png");