JPGraph输出图像质量

时间:2014-07-02 04:26:27

标签: php jpgraph

我使用JPgraph生成动态图像。但我发现图像的质量非常好。它根本不光滑。你能建议吗?

在这种情况下,我使用样条线生成50个点,然后用于线绘图。使用散点图我刚刚显示了标记。

<?php

require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
require_once ('jpgraph/jpgraph_plotline.php');
require_once ('jpgraph/jpgraph_regstat.php');
require_once ('jpgraph/jpgraph_scatter.php');

$attr_data = array('1', 
            '2',
            '3',
            '4',
            '5',
            '6',
            '7',
            '8',
            '9',
            '10',
            '11',
            '12',
            '13',
            '14',
            '15');
$current_data = array(100, 105, 98, 95, 100, 80, 110, 100, 88, 88, 95, 80, 75, 83, 100);
$cumulative_data = array(105, 110, 72, 92, 105, 85, 100, 90, 78, 98, 70, 85, 80, 80, 90);


$graph = new Graph(650, 700, 'auto');
$graph->SetScale('intlin');


$graph->Set90AndMargin(500,15,40,50);
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->graph_theme = null;

$xdata = array(0, 1, 2, 3, 4, 5, 6,7, 8, 9, 10, 11, 12, 13, 14);

$graph->xaxis->SetTickLabels($attr_data);
$graph->xaxis->SetLabelAlign('right','center');
$graph->xaxis->scale->ticks->Set(1, 0);

$spline = new Spline($xdata, $cumulative_data);
list($newx2,$newy2) = $spline->Get(100);

$p2 = new LinePlot($newy2, $newx2);
$graph->Add($p2);

$p2->SetColor("#DCDCDC");
$p2->SetLegend('Cumulative 6 months results');
$p2->SetWeight(1);
$p2->SetCenter();
$spline = new Spline($xdata, $current_data);

list($newx,$newy) = $spline->Get(100);

$p1 = new LinePlot($newy, $newx);
$graph->Add($p1);
$p1->SetWeight(1);
$p1->SetColor("#235893");
$p1->SetLegend('Current report results');
$p1->SetCenter();

$splot2 = new ScatterPlot($cumulative_data, $xdata);
$graph->Add($splot2);

$splot = new ScatterPlot($current_data, $xdata);
$graph->Add($splot);

$splot2->mark->SetType(MARK_IMG,'green.gif',0.5);
$splot->mark->SetType(MARK_IMG,'blue.gif',0.5);

$line = new PlotLine(HORIZONTAL,88,"#EF6F66", 1);
$line->SetLegend('Benchmark');
$graph->AddLine($line);

$graph->legend->SetAbsPos(100, 695, "left", "bottom");
$graph->legend->SetColumns(3);
$graph->legend->SetFillColor('white');
$graph->legend->SetShadow(false);
$graph->legend->SetFrameWeight(1);
$graph->legend->SetMarkAbsSize(8);

$contentType = 'image/png';
$graph->Stroke(); // _IMG_HANDLER

0 个答案:

没有答案