I'm upgrading a very old codebase from JpGraph/2.3 to 4.2.0. The biggest issue is that legend colours no longer match graph colours:
$good = new BarPlot([10, 12, 11, 9]);
$good->SetLegend('Good');
$good->SetFillGradient('#089B81', '#089B81:1.2', GRAD_LEFT_REFLECTION);
$bad = new BarPlot([4, 5, 2, 8]);
$bad->SetLegend('Bad');
$bad->SetFillGradient('#9B0829', '#9B0829:1.2', GRAD_LEFT_REFLECTION);
$both = new AccBarPlot([$good, $bad]);
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textlin');
$graph->Add($both);
$graph->Stroke();
Apparently, legend colours are now hard-coded in themes (PHP classes that extend the Theme
abstract class).
Is there a way to either set legend colours manually or make it automatic as in version 2? I have several plots that use different colours and writing a theme for each colour combination looks like overkill.