本文整理汇总了PHP中pData::addPoint方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::addPoint方法的具体用法?PHP pData::addPoint怎么用?PHP pData::addPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::addPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()));
}
示例2: testRemoveSeries
public function testRemoveSeries()
{
$data = new pData();
$data->addPoint(array(1, 2), 'testseries1');
$data->addPoint(array(3, 4), 'testseries2');
$data->addSeries('testseries1');
$data->addSeries('testseries2');
$this->assertEquals(array('Position' => 'Name', 'Format' => array('X' => 'number', 'Y' => 'number'), 'Unit' => array('X' => null, 'Y' => null), 'Values' => array('testseries1', 'testseries2')), $data->getDataDescription());
$data->removeSeries('testseries1');
$this->assertEquals(array('Position' => 'Name', 'Format' => array('X' => 'number', 'Y' => 'number'), 'Unit' => array('X' => null, 'Y' => null), 'Values' => array(1 => 'testseries2')), $data->getDataDescription());
}
示例3: testAddPoint
public function testAddPoint()
{
$data = new pData();
$data->addPoint(1);
$this->assertEquals(array(0 => array('Series1' => 1, 'Name' => 0)), $data->getData());
$data->addPoints(array(2, 3, 4));
$this->assertEquals(array(0 => array('Series1' => 1, 'Name' => 0), 1 => array('Series1' => 2, 'Name' => 1), 2 => array('Series1' => 3, 'Name' => 2), 3 => array('Series1' => 4, 'Name' => 3)), $data->getData());
}