$min_x = $x_axis[0]; $pts = array(); $pts[] = array('x' => 0, 'y' => $origin_y); /* for ($i = 0; $i < count($data[$j]); $i++) { $pts[] = array('x' => ($i * $gap), 'y' => ($height - $data[$j][$i]/$max*$height) + $origin_y); } */ //print_r($data[$headings[$j]]); foreach ($data[$headings[$j]] as $k => $v) { $pts[] = array('x' => ($k - $x_axis[0]) * $gap, 'y' => $height - $v / $max * $height + $origin_y); } $pts[] = array('x' => (count($x_axis) - 1) * $gap, 'y' => $origin_y + $height); $pts[] = array('x' => 0, 'y' => $origin_y + $height); $pts[] = array('x' => 0, 'y' => $origin_y); $port->DrawPolygon($pts, array(228, 228, 228)); // function DrawText ($pt, $text, $fontsize = 0.1, $align = 'left') $fontsize = 20; $port->DrawText(array('x' => count($x_axis) * $gap + $fontsize / 2, 'y' => $origin_y + $fontsize), $headings[$j], $fontsize); } // time scale $ticks = array(1864, 1900, 1950, 2000, 1923, 2015); foreach ($ticks as $tick) { $port->DrawLine(array('x' => ($tick - $x_axis[0]) * $gap, 'y' => 0), array('x' => ($tick - $x_axis[0]) * $gap, 'y' => (count($headings) - 1) * $height)); $fontsize = 20; $port->DrawText(array('x' => ($tick - $x_axis[0]) * $gap, 'y' => (count($headings) - 1) * $height + $fontsize), $tick, $fontsize); } echo $port->GetOutput();