I would like to draw something like this with JPGraph:
I've tried it but I got something like this:
Problems:
- The first problem is that I can't set min & max for range on Y-asix. (this sometimes works and I don't know why)
- And I don't know how to set colors for line that crossed the horizontal lines.
Is this possible with JPGraph?
Here is my code:
<?php
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
require_once 'jpgraph/jpgraph_plotline.php';
$graph = new Graph(600,300);
$graph->SetMargin(40, 10, 10, 0);
$graph->SetScale("textlin");
$theme_class=new UniversalTheme();
$graph->SetTheme($theme_class);
$sline = new PlotLine(HORIZONTAL,30,'red');
$graph->Add($sline);
$sline = new PlotLine(HORIZONTAL,70,'red');
$graph->Add($sline);
$graph->SetScale('intlin',0,100);
$line = new LinePlot(json_decode(file_get_contents("http://data.brown.sk/data.json",true)));
$line->SetWeight(1);
$line->SetLegend("test");
$graph->Add($line);
$graph->img->SetAntiAliasing(true);
$graph->title->hide();
$graph->xaxis->Hide();
$graph->xgrid->SetLineStyle("solid");
$graph->xgrid->SetColor('#E3E3E3');
$graph->legend->hide();
$graph->Stroke();
?>