本文整理汇总了PHP中Chart::addData方法的典型用法代码示例。如果您正苦于以下问题:PHP Chart::addData方法的具体用法?PHP Chart::addData怎么用?PHP Chart::addData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chart
的用法示例。
在下文中一共展示了Chart::addData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Chart
<?php
require '../lib/Chart.php';
$chart = new Chart('lc', 500, 200);
$chart->setScale(0, 100);
$line = new ChartData(array(10, 12, 15, 20, 22, 50, 60, 63, 58, 75, 67, 80));
$chart->addData($line);
$y_axis = new ChartAxis('y');
$chart->addAxis($y_axis);
$x_axis = new ChartAxis('x');
$chart->addAxis($x_axis);
if (isset($_GET['debug'])) {
var_dump($chart->getQuery());
echo $chart->validate();
echo $chart->toHtml();
} else {
header('Content-Type: image/png');
echo $chart;
}
示例2: array
<?php
require '../lib/Chart.php';
require '../lib/markers/ChartTextMarker.php';
$values = array();
for ($i = 0; $i <= 10; $i += 1) {
$values[] = rand(20, 80);
}
$chart = new Chart('bvs', 500, 200);
$chart->setScale(0, 100);
$data = new ChartData($values);
$chart->addData($data);
$marker = new ChartTextMarker();
$marker->setData($data);
$chart->addMarker($marker);
header('Content-Type: image/png');
echo $chart;
示例3: array
<?php
require '../lib/Chart.php';
require '../lib/markers/ChartLineMarker.php';
require '../lib/markers/ChartShapeMarker.php';
$values = array(array(), array(), array());
for ($i = 0; $i <= 10; $i += 1) {
$v = rand(20, 80);
$values[0][] = $v;
$values[1][] = rand(0, 20);
$values[2][] = $v + rand(-10, 10);
}
$chart = new Chart('bvs', 500, 200);
$chart->setScale(0, 100);
$data0 = new ChartData($values[0]);
$chart->addData($data0);
$data1 = new ChartData($values[1]);
$data1->setColor(array('FFC6A5', 'FFFF42', 'DEF3BD', '00A5C6', 'DEBDDE'));
$chart->addData($data1);
$marker = new ChartLineMarker();
$marker->setData($data0);
$marker->setSize(5);
$marker->setPoints(5);
$chart->addMarker($marker);
$marker = new ChartLineMarker();
$marker->setData($data0);
$marker->setColor('6699cc');
$marker->setSize(5);
$marker->setPoints(0, 5);
$marker->setZOrder(-0.5);
$chart->addMarker($marker);
示例4: array
<?php
require '../lib/Chart.php';
$values = array();
for ($i = 0; $i <= 10; $i += 1) {
$values[] = rand(10, 100);
}
$chart = new Chart('bvs', 500, 200);
$chart->addData(new ChartData($values));
$y_axis = new ChartAxis('y');
$chart->addAxis($y_axis);
header('Content-Type: image/png');
echo $chart;
示例5: round
$cos[] = round(cos($i * M_PI / 180), 2);
}
$chart = new Chart('lc', 500, 200);
$chart->setGridLines(25, 50, 1, 1);
$chart->setMargin(30, 50);
$chart->setLegendSize(100, 10);
$chart->setFill('333333');
$chart->setFill('444444', Chart::CHART_AREA);
$chart->setTitle('Sinus & Cosinus');
$chart->setTitleColor('FFFFFF');
$chart->setTitleSize(18);
$sin = new ChartData($sin);
$sin->setLegend('Sinus');
$sin->setThickness(2);
$sin->setColor('D1F2A5');
$chart->addData($sin);
$cos = new ChartData($cos);
$cos->setLegend('Cosinus');
$cos->setThickness(2);
$cos->setColor('F56991');
$chart->addData($cos);
$y_axis = new ChartAxis('y');
$y_axis->setDrawLine(false);
$y_axis->setRange(-1, 1);
$y_axis->setLabelColor('ffffff');
$chart->addAxis($y_axis);
$x_axis = new ChartAxis('x');
$x_axis->setDrawLine(false);
$x_axis->setRange(0, 360);
$x_axis->setLabels(array(0, 90, 180, 270, 360));
$x_axis->setLabelColor('ffffff');