I'm trying to add a simple horizontal line (or a band) to my graph and for some reasons, it doesn't show anything.
I used the lines:
$graph->AddLine(new PlotLine(HORIZONTAL,0,"black",2));
or
$graph->AddBand(new PlotBand(HORIZONTAL,BAND_RDIAG,0, "max", "red", 2));
...as shown here https://jpgraph.net/download/manuals/classref/Graph.html
Is there anything else I should do? Is there a specific place where I should put it?
I put them just after the $graph->Add($lineplot);
Thanks for your help
First of all, you need to include (require) the jpgraph_plotline.php file, such as:
Then, before the line
$graph->Stroke();, add the code for plotting the line, such as:So, the whole code will be like:
In this way, the plot line will be added on the line chart (as below - a green line at y position 5, width :10)
Just do the same for PlotBand, if you wish.
Enjoy...