Changeset 528


Ignore:
Timestamp:
06/27/08 15:53:43 (13 years ago)
Author:
ramonb
Message:

job_monarch/chart.php:

  • make pie more pretteh
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/chart.php

    r527 r528  
    2222}
    2323
    24 #print_r( $values );
    25 #print_r( $legend );
    26 
    27 // Standard inclusions     
     24// Include pChart libs
     25//
    2826include("./lib/pchart/pData.class"); 
    2927include("./lib/pchart/pChart.class"); 
    3028
    31 // Dataset definition   
     29// Dataset definition
     30//
    3231$DataSet = new pData; 
    33 $DataSet->AddPoint($values,"Serie1"); 
    34 $DataSet->AddPoint($legend,"Serie2"); 
     32$DataSet->AddPoint( $values, "Pie slices" ); 
     33$DataSet->AddPoint( $legend, "Legend" ); 
    3534$DataSet->AddAllSeries(); 
    36 $DataSet->SetAbsciseLabelSerie("Serie2"); 
     35$DataSet->SetAbsciseLabelSerie( "Legend" ); 
    3736
    3837// Initialise the graph 
    39 $Test = new pChart(380,200); 
    40 $Test->drawFilledRoundedRectangle(7,7,373,193,5,240,240,240); 
    41 $Test->drawRoundedRectangle(5,5,375,195,5,230,230,230); 
     38$myChart = new pChart(380,200); 
     39$myChart->drawFilledRoundedRectangle(7,7,373,193,5,240,240,240); 
     40$myChart->drawRoundedRectangle(5,5,375,195,5,230,230,230); 
    4241
    43 // Draw the pie chart 
    44 $Test->setFontProperties("./lib/pchart/tahoma.ttf",8); 
    45 $Test->drawPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),150,90,110,TRUE,TRUE,50,20,20); 
    46 $Test->drawPieLegend(310,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250); 
     42// Font for slice percentages & legend text
     43//
     44$myChart->setFontProperties( "./lib/pchart/tahoma.ttf", 8 ); 
    4745
    48 $Test->drawTitle(60,22,$title,50,50,50,585);
     46// Draw the pie slices and percentages text
     47//
     48$myChart->drawPieGraph( $DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, TRUE, TRUE, 50, 20, 20 ); 
    4949
    50 $Test->Stroke();
     50// Draw legend text
     51//
     52$myChart->drawPieLegend( 280, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250 ); 
     53
     54// Font for title: a little bigger
     55//
     56$myChart->setFontProperties( "./lib/pchart/tahoma.ttf", 12 ); 
     57
     58// Draw title text
     59//
     60$myChart->drawTitle( 0, 5, $title, 50, 50, 50, 380, 20 );
     61
     62// Draw complete graph embedded inline: output the png
     63//
     64$myChart->Stroke();
    5165?>
Note: See TracChangeset for help on using the changeset viewer.