Display element values ​​on a bar chart in Jpgraph

I am using jpgraph bar chart. Everything works fine, but there is one thing that I could not understand. I need to display the value of each bar at the top of this column (column), but it looks like I'm missing out on something I can't do.

I tried using the following:

$bplot->value->Show(); 

But still it won’t work! Any help POSSIBLE is much appreciated!

+4
source share
3 answers

This is an old question, but since I had the same problem and solved it, I am posting this answer as a future reference.

My problem was in the order of the called methods. You MUST call Show after adding the schedule to the schedule. 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 this helps someone.

+8
source

Call the Show () method after adding a chart to the chart.

 $graph->Add($plot); $plot->value->Show(); 
+2
source

This example shows that this can be done, and it gives a complete example of how to disable it:

http://enacit1.epfl.ch/php/jpgraph/docs/html/exframes/frame_example20.1.html

I would be happy to take a look at your code and troubleshoot if you need more help.

+1
source

Source: https://habr.com/ru/post/1499056/


All Articles