6

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!

user198003
  • 11,029
  • 28
  • 94
  • 152

2 Answers2

3

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");
sean
  • 59
  • 3
1

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);

Evgeny
  • 665
  • 4
  • 14