Thursday, 21 October 2010

jpGraph - cannot change line colour (or color)

Using jpGraph, an excellent package for plotting graphs from database data via PHP, I hit a problem: setting
had no result. Nor did
Eventually, I sent off an enquiry to jpGraph - and back came a very prompt reply (from the Far East):

in version 3.5.0b1, methods to change designs of each plot should be used after $graph->add($plot) method.
This is really counter-intuitive. But it works.

So it goes like this

$bplot = new BarPlot($data1y);
// NOW change properties of the plot - these work ONLY after calling Add()
$bplot->SetFillGradient('#FFAAAA:0.7', '#FFAAAA:1.2', GRAD_VER);    

There is a note in the documentation included as part of the package, at:



Konstantin Galileyev said...

Thank you!

eyeman said...

Thank you. This really helped me out.

Thailandian said...

Thank you. I just wish I had found your very useful post much earlier!

I've bookmarked your blog on the strength of this, and will keep it in mind whenever I run into problems - thanks again.

Russell Cox said...

Thanks. Their included example files have it wrong, so this helped heaps :)

Michael Röhrig said...

Thank you, found a solution via google at stackoverflow and then here. Began doubting my own sanity.

Sajid Hussain said...

thanks :)

Unknown said...

Super helpful, many thanks