6
votes

Can you help me how to set weight of solid line on JpGraph?

Line is created with

// Create the first line
$p1 = new LinePlot($datay1);
$p1->SetStyle('solid');
$p1->SetWeight('20');
$p1->SetColor("#6495ED");
$p1->SetLegend('Line 1');
$graph->Add($p1);

With this code, line weight is 1.

But if line is defined as

$p1->SetStyle('dotted');

... weight of the line is 20px.

Can you tell me what I'm doing wrong in line definition. I need bolder solid line...

Thank you in advance!

2
it is kinda bug, have had the same issue, it still exists even in "newer" versionDaniel W.

2 Answers

3
votes

I had similar problem, resolved by using $p1->SetStyle('solid') AFTER adding the lineplot to the graph:

    $p1 = new LinePlot($min_values);
    $graph->Add($p1);
    $p1->SetWeight(3); 
    $p1->SetColor("blue");
    $p1->SetLegend("Minimum Values");
    $p1->SetStyle("solid");
0
votes

According to JPGraph documentation:

Lines will ignore any width and only have a single line-width of approximately=1. It is not possible to set the line width when anti-alias is used.

So, just use $graph->img->SetAntiAliasing(false);