JpGraph サンプル

← 一覧に戻る
<?php // content="text/plain; charset=utf-8"
// Gantt example 30
// $Id: ganttex30.php,v 1.4 2003/05/30 20:12:43 aditus Exp $
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_gantt.php");

// Standard calls to create a new graph
$graph = new GanttGraph();

// Titles for chart
$graph->title->Set("General conversion plan");
$graph->subtitle->Set("(Revision: 2001-11-18)");

// For illustration we enable all headers.

// For the week we choose to show the start date of the week
// the default is to show week number (according to ISO 8601)

// Change the scale font

// Setup some data for the gantt bars
$data = array(
        array(0,"Group 1", "2001-10-29","2001-11-27",FF_FONT1,FS_BOLD,8),
        array(1,"  Label 2", "2001-11-8","2001-12-14"),
        array(2,"  Label 3", "2001-11-01","2001-11-8"),
        array(4,"Group 2", "2001-11-07","2001-12-19",FF_FONT1,FS_BOLD,8),
        array(5,"  Label 4", "2001-11-8","2001-12-19"),
        array(6,"  Label 5", "2001-11-01","2001-11-8")

for($i=0; $i<count($data); ++$i) {
        $bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3],"[50%]",0.5);
        if( count($data[$i])>4 )

        // If you like each bar can have a shadow
        // $bar->SetShadow(true,"darkgray");

        // For illustration lets make each bar be red with yellow diagonal stripes

        // To indicate progress each bar can have a smaller bar within
        // For illustrative purpose just set the progress to 50% for each bar

        // Each bar may also have optional left and right plot marks
        // As illustration lets put a filled circle with a number at the end
        // of each bar

        // Title for the mark

        // ... and add the bar to the gantt chart

// Create a milestone mark
$ms = new MileStone(7,"M5","2001-12-10","10/12");

// Create a vertical line to emphasize the milestone
$vl = new GanttVLine("2001-12-10 13:00","Phase 1","darkred");
$vl->SetDayOffset(0.5); // Center the line in the day

// Output the graph

// EOF
← 一覧に戻る