I am using PChart to create linear charts. Everything goes well beside the quality of the actual lines drawn.
Of course, antialiasing is not turned off, and even explicitly turned on.
Here is an example of the actual image, which looks quite ugly with all these steps.
Is there a way to make the lines drawn smoother, without stepping?
The code used:
public function linearTwoAxis($data, $fileName, $startColor = 0)
{
$pData = new \pData();
$i = 0;
foreach ($data as $key => $row)
{
$serie = $this->translator->trans("pages.reportDefault.$key");
$pData->addPoints($row, $serie);
$pData->setSerieOnAxis($serie, $i);
$pData->setSerieWeight($serie, 1);
$pData->setAxisName($i, $serie);
$pData->setPalette($serie, $this->colors[$startColor++]);
$pData->setAxisDisplay($i, AXIS_FORMAT_METRIC);
$i++;
}
$monthNames = array_keys($row);
$pData->setAxisPosition(1, AXIS_POSITION_RIGHT);
$pData->addPoints($monthNames, "Labels");
$pData->setAbscissa("Labels");
$pChart = new \pImage(750, 200, $pData);
$pChart->setFontProperties(array(
"FontName" => $this->fonts_dir . "arial.ttf",
"FontSize" => 8)
);
$pChart->setGraphArea(50, 10, 700, 150);
$pChart->Antialias = TRUE;
$pChart->drawScale(["Mode" => SCALE_MODE_START0]);
$pChart->drawLineChart();
$pChart->drawLegend(325,180,array("Style"=>LEGEND_BOX,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>30,"Family"=>LEGEND_FAMILY_LINE,"Alpha" => 0));
$pChart->render($this->target_dir . $fileName);
return $this->target_dirname . $fileName;
}
$pData->setSerieWeight($serie, 1);
? – Dodecasyllable