本文整理汇总了PHP中pChart::setLineStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::setLineStyle方法的具体用法?PHP pChart::setLineStyle怎么用?PHP pChart::setLineStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::setLineStyle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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) {
示例3: testDrawArea
public function testDrawArea()
{
// Dataset definition
$DataSet = new pData();
$DataSet->addPoints(array(10, 9.4, 7.7, 5, 1.7, -1.7, -5, -7.7, -9.4, -10, -9.4, -7.7, -5, -1.8, 1.7), "Serie1");
$DataSet->addPoints(array(0, 3.4, 6.4, 8.699999999999999, 9.800000000000001, 9.800000000000001, 8.699999999999999, 6.4, 3.4, 0, -3.4, -6.4, -8.6, -9.800000000000001, -9.9), "Serie2");
$DataSet->addPoints(array(7.1, 9.1, 10, 9.699999999999999, 8.199999999999999, 5.7, 2.6, -0.9, -4.2, -7.1, -9.1, -10, -9.699999999999999, -8.199999999999999, -5.8), "Serie3");
$DataSet->addPoints(array("Jan", "Jan", "Jan", "Feb", "Feb", "Feb", "Mar", "Mar", "Mar", "Apr", "Apr", "Apr", "May", "May", "May"), "Serie4");
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries("Serie4");
$DataSet->SetSeriesName("Max Average", "Serie1");
$DataSet->SetSeriesName("Min Average", "Serie2");
$DataSet->SetSeriesName("Temperature", "Serie3");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetXAxisName("Month of the year");
// Initialise the graph
$canvas = new TestCanvas();
$Test = new pChart(700, 230, $canvas);
$Test->reportWarnings("GD");
$Test->setFixedScale(-12, 12, 5);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 30, 570, 185);
$canvas->drawFilledRoundedRectangle(new Point(7, 7), new Point(693, 223), 5, new Color(240), 1, 0, ShadowProperties::NoShadow());
$backgroundStyle = new BackgroundStyle(new Color(255), TRUE);
$Test->drawGraphBackground($backgroundStyle);
$scaleStyle = new ScaleStyle(SCALE_NORMAL, new Color(150));
$Test->drawScale($DataSet, $scaleStyle, 0, 2, TRUE, 3);
$Test->drawGrid(new GridStyle(4, TRUE, new Color(230), 50));
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
// Draw the area
$DataSet->RemoveSeries("Serie4");
$Test->drawArea($DataSet->GetData(), "Serie1", "Serie2", new Color(239, 238, 227), 50);
$DataSet->RemoveSeries("Serie3");
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
// Draw the line graph
$Test->setLineStyle(1, 6);
$DataSet->RemoveAllSeries();
$DataSet->AddSeries("Serie3");
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, new Color(255));
// Write values on Serie3
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3");
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(590, 90, $DataSet->GetDataDescription(), new Color(255));
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "example 15", new Color(50), 585);
// Add an image
$Test->drawFromPNG(dirname(__FILE__) . "/../Sample/logo.png", 584, 35);
$this->assertEquals('53b34d556af518230b7556e19349bd94', md5($canvas->getActionLog()));
}
示例4: dump
$Test->setFontPropertiesDir("{$pChart_dir}/Fonts");
// Add an image
$Test->drawFromPNG($background, 0, 0);
$Test->reportWarnings("GD");
$Test->setFixedScale($min_y_value, $max_y_value, 5);
$Test->setFontProperties("{$pChart_dir}/Fonts/tahoma.ttf", 14);
$Test->setGraphArea($area_margin_left, 20, $width - 30, $height - 55);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 255, 255, 255, TRUE, 0, 2, TRUE, 1);
$Test->drawGrid(4, TRUE, 233, 218, 213, 0);
//画网格
// Draw the area
$Test->drawArea($DataSet->GetData(), "Serie3", "Serie4", 239, 238, 227, 40);
$DataSet->RemoveSerie("Serie4");
// Draw the line graph
$Test->setColorPalette(0, 255, 237, 237);
$Test->setLineStyle(2, 0);
//设置虚线的宽度
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->setColorPalette(0, 243, 247, 252);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 5, 3, 255, 255, 255);
// $Test->setFontProperties("{$pChart_dir}/Fonts/simfang.ttf",14);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3");
// $Test->Render("example15.png");
$Test->Stroke();
function dump($data)
{
echo "<pre>";
print_r($data);
echo "</pre>";
exit;
}
示例5:
$Test->setGraphArea(65, 30, 570, 185);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE, 3);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the area
$DataSet->RemoveSerie("Serie4");
$Test->drawArea($DataSet->GetData(), "Serie1", "Serie2", 239, 238, 227, 50);
$DataSet->RemoveSerie("Serie3");
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
// Draw the line graph
$Test->setLineStyle(1, 6);
$DataSet->RemoveAllSeries();
$DataSet->AddSerie("Serie3");
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Write values on Serie3
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3");
// Finish the graph
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(590, 90, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("../Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "example 15", 50, 50, 50, 585);
// Add an image
$Test->drawFromPNG("../Sample/logo.png", 584, 35);
// Render the chart
示例6: generateGraphImage
protected function generateGraphImage($finalData, $hourflag, $title = 'Sticky Charts', $x_axis_format = 'date')
{
$path = $this->config->item('csv_upload_path');
if (!empty($finalData['data'])) {
$DataSet = new pData();
$in = 0;
foreach ($finalData['data'] as $seriesData) {
$in++;
$seriesIndex = 'Serie' . $in;
$DataSet->AddPoint($seriesData['data'], $seriesIndex);
$DataSet->SetSerieName($seriesData['name'], $seriesIndex);
$DataSet->AddSerie($seriesIndex);
}
$xAxisArray = array();
$in++;
$seriesIndex = 'Serie' . $in;
$catCount = count($finalData['cat']);
if ($catCount <= 10) {
$DataSet->SetXAxisFormat($x_axis_format);
}
foreach ($finalData['cat'] as $catD) {
if ($catCount > 10) {
$xAxisArray[] = '';
} else {
$xAxisArray[] = strtotime($catD);
}
}
$DataSet->SetYAxisFormat("number");
$DataSet->AddPoint($xAxisArray, $seriesIndex);
$DataSet->SetAbsciseLabelSerie($seriesIndex);
$DataSet->SetYAxisName($finalData['y_title']);
$DataSet->SetXAxisName($finalData['x_title']);
// Initialise the graph
$Test = new pChart(985, 458);
$Test->drawBackground(247, 226, 180);
$Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
$Test->setGraphArea(40, 30, 950, 400);
$Test->drawGraphArea(109, 110, 114, false);
$Test->drawGrid(4, false, 0, 0, 0, 50);
$Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 6);
// Draw the line graph
if ($title == 'Violation Report') {
//!$hourflag &&
$sCount = count($finalData['data']);
if ($sCount > 0) {
for ($m = 0; $m < $sCount; $m++) {
$color = Color_handler::get_next($m);
$rgb = $color->get_rgb();
$Test->setColorPalette($m, $rgb['r'], $rgb['g'], $rgb['b']);
}
}
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 0, 0, 0, TRUE, 0, 0, TRUE);
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
} else {
$sCount = count($finalData['data']);
if ($sCount > 0) {
for ($m = 0; $m < $sCount; $m++) {
$color = Color_handler::get_next($m % 3);
$rgb = $color->get_rgb();
$Test->setColorPalette($m, $rgb['r'], $rgb['g'], $rgb['b']);
}
}
$Test->setLineStyle(2);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 0, 0, 0, TRUE, 0, 2);
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 2);
}
// Finish the graph
$Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
$Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 10);
$imgName = uniqid('graph_') . '.png';
$Test->Render($path . $imgName);
return upload_to_amazon_graphImage($imgName, $path);
}
}
示例7: pChart
$DataSet->SetYAxisName("Test Marker");
$DataSet->SetYAxisUnit("µm");
// Initialise the graph
$Test = new pChart(380, 400);
$Test->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
// Graph area setup
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
$Test->setGraphArea(110, 180, 350, 360);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 213, 217, 221, TRUE, 0, 2, TRUE);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 5);
// Draw the title
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Title = " Average growth size for selected\r\n DNA samples ";
$Test->setLineStyle(2);
$Test->drawLine(51, -2, 51, 402, 0, 0, 0);
$Test->setLineStyle(1);
$Test->drawTextBox(0, 0, 50, 400, $Title, 90, 255, 255, 255, ALIGN_BOTTOM_CENTER, TRUE, 0, 0, 0, 30);
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
// Draw the bar graph
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
// Second chart
$DataSet->SetXAxisName("");
$Test->clearScale();
$Test->setGraphArea(110, 20, 350, 140);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 213, 217, 221, TRUE, 0, 2);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 5);
// Draw the line chart
示例8: grapher
/**
* This function draw the graphic to be displayed on the user view as an image
*
* @param array $sql_result
* @param string $start_date
* @param string $end_date
* @param string $type
* @author Jorge Frisancho Jibaja
* @version OCT-22- 2010
* @return string
*/
function grapher($sql_result, $start_date, $end_date, $type = "") {
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
if (empty($start_date)) { $start_date =""; }
if (empty($end_date)) { $end_date =""; }
if ($type == ""){ $type = 'day'; }
$main_year = $main_month_year = $main_day = array();
// get last 8 days/months
$last_days = 5;
$last_months = 3;
for ($i = $last_days; $i >= 0; $i--) {
$main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)] = 0;
}
for ($i = $last_months; $i >= 0; $i--) {
$main_month_year[date ('m-Y', mktime () - $i * 30 * 3600 * 24)] = 0;
}
$i = 0;
if (is_array($sql_result) && count($sql_result) > 0) {
foreach ($sql_result as $key => $data) {
//creating the main array
$main_month_year[date('m-Y', $data['login'])] += float_format(($data['logout'] - $data['login']) / 60, 0);
$main_day[date('d-m-Y', $data['login'])] += float_format(($data['logout'] - $data['login']) / 60, 0);
if ($i > 500) {
break;
}
$i++;
}
switch ($type) {
case 'day':
$main_date = $main_day;
break;
case 'month':
$main_date = $main_month_year;
break;
case 'year':
$main_date = $main_year;
break;
}
// the nice graphics :D
$labels = array_keys($main_date);
if (count($main_date) == 1) {
$labels = $labels[0];
$main_date = $main_date[$labels];
}
$data_set = new pData();
$data_set->AddPoint($main_date, 'Q');
if (count($main_date)!= 1) {
$data_set->AddPoint($labels, 'Date');
}
$data_set->AddAllSeries();
$data_set->RemoveSerie('Date');
$data_set->SetAbsciseLabelSerie('Date');
$data_set->SetYAxisName(get_lang('Minutes', ''));
$graph_id = api_get_user_id().'AccessDetails'.api_get_course_id().$start_date.$end_date.$type;
$data_set->AddAllSeries();
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
// echo 'in cache';
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
} else {
// if the image does not exist in the archive/ folder
// Initialise the graph
$test = new pChart(760, 230);
//which schema of color will be used
$quant_resources = count($data[0]) - 1;
// Adding the color schemma
$test->loadColorPalette(api_get_path(LIBRARY_PATH).'pchart/palette/default.txt');
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(70, 30, 680, 200);
$test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$test->drawGraphArea(255, 255, 255, TRUE);
$test->drawScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 0);
$test->drawGrid(4, TRUE, 230, 230, 230, 50);
$test->setLineStyle(2);
//.........这里部分代码省略.........
示例9:
}
//---------------------------- drawScale
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), $scale, 80, 80, 80, TRUE, 0, 2);
//---------------------------- Grid
if ($_GET['grid'] == '0') {
//
} else {
$Test->drawGrid(1, TRUE, 230, 230, 230, 50);
}
//---------------------------- Set linestyle
if ($_GET['line']) {
$line = $_GET['line'];
} else {
$line = 1;
}
$Test->setLineStyle($line, 0);
//---------------------------- Set pointsstyle
if ($_GET['point']) {
$point = $_GET['point'];
} else {
$point = 1;
}
//---------------------------- Set custom RGB colors of channels 1-9
if ($p != '' && $c1r != 0) {
$Test->setColorPalette(0, $c1r, $c1g, $c1b);
}
if ($p2 != '' && $c2r != 0) {
$Test->setColorPalette(1, $c2r, $c2g, $c2b);
}
if ($p3 != '' && $c3r != 0) {
$Test->setColorPalette(2, $c3r, $c3g, $c3b);