I am using jpgraph bar chart. It all works fine but there is one thing I could not really figure it out. I need to display the value of each bar on the top of that bar (column) but it seems like I am missing something that I cant do it.
I have tried using the following:
$bplot->value->Show();
But yet it does not work! Any help is GREATLY appreciated!
It is an old question, but as I had the same problem and I solved it, I'm posting this answer as a future reference.
My problem was the order of the invoked methods. You MUST call Show
after addnig the plot to the graph. As an example:
$graph = new \Graph($width, $height);
[... init graph ...]
$plot = new \BarPlot($datay);
$graph->Add($plot);
$plot->value->Show();
$plot->value->SetColor("black","darkred");
$plot->value->SetFormat('%01.2f');
I hope it helps someone.
Call the Show() method after you've added the plot to the graph.
$graph->Add($plot);
$plot->value->Show();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With