SetYMin and AccBarPlot

60 views
Skip to first unread message

Gros Bedos

unread,
Dec 2, 2020, 11:15:26 AM12/2/20
to JpGraph
Hi,

I have read and test this two examples : horizbarex4.php and bargradex5.php
They set the SetYMin on BarPlot, and it's working fine.
(with SetYMin, you can begin the Y axis at a number of your choice)

I'm trying to have the same behaviour on AccBarPlot without success.

I have test a lot of things :
- SetYMin on each BarPlot before (and after) add them to AccBarPlot.
- SetYMin on the first BarPlot before (and after) add them to AccBarPlot.
- SetYMin on the AccBarPlot. (which  extends BarPlot classe)

But none of  this work.

Someone know how to do that ?

Best regards

w1djm...@gmail.com

unread,
Dec 3, 2020, 7:23:42 AM12/3/20
to JpGraph
Please post an example that shows it failing complete with data so we can reproduce the problem and try to help you get it fixed.

Gros Bedos

unread,
Dec 4, 2020, 2:27:30 AM12/4/20
to JpGraph
Hi,

Thanks for your support.
It's working whith simple BarPlot, with GroupBarPlot too, but with AccBarPlot no.
You can test with this code :

<?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');

// data
$dataOk = array(85);
$dataWarn = array(5);
$dataCrit = array(5);
$dataUnk = array(5);

setlocale (LC_ALL, 'et_EE.ISO-8859-1');

$graph = new Graph(600,600,"auto");
$graph->clearTheme();
$graph->SetScale("textint");

// Create the bar plots
$b1plot = new BarPlot($dataOk);
$b1plot->SetFillColor("green");

$b2plot = new BarPlot($dataWarn);
$b2plot->SetFillColor("orange");

$b3plot = new BarPlot($dataCrit);
$b3plot->SetFillColor("red");

$b4plot = new BarPlot($dataUnk);
$b4plot->SetFillColor("blue");

// I have tried with just the first, all at 50, and like that..
//$b1plot->SetYMin(50); // not working, begin at 0
//$b2plot->SetYMin(85);
//$b3plot->SetYMin(90);
//$b4plot->SetYMin(95);

// Create the grouped bar plot
$gbplot = new AccBarPlot(array($b1plot,$b2plot,$b3plot,$b4plot));
$gbplot->SetYMin(50); // not working, begin at 0
$graph->Add($gbplot);

$graph->title->Set("Test");

$graph->Stroke();
?>

Best regards

w1djm...@gmail.com

unread,
Dec 6, 2020, 7:26:55 AM12/6/20
to JpGraph
Sorry that I can't help more right now. Apparently JPGraph and PHP 8 aren't getting along well (see my post about it moments ago). I can't really go back to PHP 7 at this point so hopefully someone else will be able to help for now.
Reply all
Reply to author
Forward
0 new messages