add label to specific datapoint in linechart

289 Views Asked by At

I have a datlin line chart,

x = unix timestamps
y = values between 30 and 90

For a specific timestamp, I want to add a marker with a comment to the graph, to explain why there is such a break in the graph.

Can you point me to the right class or method?

1

There are 1 best solutions below

2
On

You can only place textboxes at positions relative to the image dimensions in jpgraph.

See http://jpgraph.net/download/manuals/classref/Text.html


Try callback as an alternative...

The best you can do is place labels at x,y graph coordinates as shown here:

http://artfuladvection.com/resource/img/plotT2.png

Try this:

function xyCallback($yval) {
  global $datax, $idx;
  return "Your Text String Here" . $youcanalsoaddvars;
}

$graph = new Graph(...);
$graph->SetScale("intlin");
$p1 = new LinePlot($datay,$datax);
$p1->value->SetFormatCallback('xyCallback');
$p1->value->Show();