) but I do recall a snippet that has the most amazing debug console. I just can’t remember which one it is. But it’s got tabs, and can tell you everything you need to set up the configuration and find any problems. Surely somebody else can remind me which one that is. Anyway, that might be a good example of how to provide debugging for just about anything. Although eForm doesn’t do so bad; it has lots of debugging information inserted into the class output if the &debug parameter is turned on. (it’s on for the contact form on my site, although I did hack it a bit to remove a couple of sensitive fields, if anybody’s interested in seeing it live - http://sottwell.com/contact.html ).
<?php
$snippetPath = $modx->config['base_path'] . 'assets/snippets/pChart/pChart/';
include_once($snippetPath.'pData.class');
include_once($snippetPath.'pChart.class');
// Dataset definition
$DataSet = new pData;
$DataSet->AddPoint(array(0,70,70,0,0,70,70,0,0,70),"Serie1");
$DataSet->AddPoint(array(0.5,2,4.5,8,12.5,18,24.5,32,40.5,50),"Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January","Serie1");
$DataSet->SetSerieName("February","Serie2");
// Initialise the graph
$Test = new pChart(700,230);
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->setGraphArea(50,30,585,200);
$Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
$Test->drawRoundedRectangle(5,5,695,225,5,230,230,230);
$Test->drawGraphArea(255,255,255,TRUE);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);
$Test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf",6);
$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);
// Set labels
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","2","Daily incomes",221,230,174);
$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie2","6","Production break",239,233,195);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->drawLegend(600,30,$DataSet->GetDataDescription(),255,255,255);
$Test->setFontProperties("Fonts/tahoma.ttf",10);
$Test->drawTitle(50,22,"Example 9",50,50,50,585);
$Test->Render("chart.png");
?>
« MODx Parse Error » MODx encountered the following error while attempting to parse the requested resource: « PHP Parse Error » PHP error debug Error: imageftbbox() [function.imageftbbox]: Could not find/open font Error type/ Nr.: Warning - 2 File: /Users/bmw/Sites/modx/assets/snippets/pChart/pChart/pChart.class Line: 447 Line 447 source: $Position = imageftbbox($this->FontSize,0,$this->FontName,$Value);
<?php
$snippetPath = $modx->config['base_path'] . 'assets/snippets/pChart/pChart/';
$fontPath = $modx->config['base_path'] . 'assets/snippets/pChart/Fonts/';
include_once($snippetPath.'pData.class');
include_once($snippetPath.'pChart.class');
// Dataset definition
$DataSet = new pData;
$DataSet->AddPoint(array(0,70,70,0,0,70,70,0,0,70),"Serie1");
$DataSet->AddPoint(array(0.5,2,4.5,8,12.5,18,24.5,32,40.5,50),"Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January","Serie1");
$DataSet->SetSerieName("February","Serie2");
// Initialise the graph
$Test = new pChart(700,230);
$Test->setFontProperties($fontPath . "tahoma.ttf",8);
$Test->setGraphArea(50,30,585,200);
$Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
$Test->drawRoundedRectangle(5,5,695,225,5,230,230,230);
$Test->drawGraphArea(255,255,255,TRUE);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);
$Test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$Test->setFontProperties($fontPath . "tahoma.ttf",6);
$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);
// Set labels
$Test->setFontProperties($fontPath . "tahoma.ttf",8);
$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","2","Daily incomes",221,230,174);
$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie2","6","Production break",239,233,195);
// Finish the graph
$Test->setFontProperties($fontPath . "tahoma.ttf",8);
$Test->drawLegend(600,30,$DataSet->GetDataDescription(),255,255,255);
$Test->setFontProperties($fontPath . "tahoma.ttf",10);
$Test->drawTitle(50,22,"Example 9",50,50,50,585);
$Test->Render("assets/images/charts/chart.png");
return '<img src="assets/images/charts/chart.png"/>';
?>