Page 1 of 1

JPGraph problem

Posted: Wed Aug 30, 2006 12:03 pm
by pickle
Hi all,

Yes, I know there is a JPGraph forum, but I've not received any responses there, and I'd like this problem solved this week.

I'm making Gantt charts, and I'm having problems with the header & row text colours:
Image

Obviously, I don't want the text to be yellow, I want it to be black. The docs say I could change it with

Code: Select all

$graph->scale->day->SetFontColor('black')
That changes the colours for the hour headers though, not the day headers. However, when I use

Code: Select all

$graph->scale->day->SetBackgroundColor('black')
it applies to the right section. My code is below:

Code: Select all

$graph = new GanttGraph(700);

//border around the graph
$graph->SetBox(true,"black",1);

//which headers to display
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);

//how to split up the chart
$graph->scale->hour->SetIntervall("1:00");
		
//how to display the hours ([1-12][am|pm]
$graph->scale->hour->SetStyle(HOURSTYLE_HAMPM);
$graph->scale->hour->SetFontColor('black');

//how to display the day (Saturday 10 Jun)
$graph->scale->day->SetStyle(DAYSTYLE_LONGDAYDATE1);

//*****This works weird*****
$graph->scale->day->SetFontColor('black');

//background colour for the day
$graph->scale->day->SetBackgroundColor('lightblue');

//font to use for the scales
$graph->scale->day->SetFont(FF_ARIAL,FS_BOLD,10);
$graph->scale->hour->SetFont(FF_FONT0);

//width of vertical divider
$graph->scale->divider->SetWeight(1);

//width of horizontal divider
$graph->scale->dividerh->SetWeight(1);

//set the title field of the 'vehicles' column
$graph->scale->tableTitle->Set('Vehicles');
$graph->scale->tableTitle->setFont(FF_ARIAL,FS_BOLD);
$graph->scale->tableTitle->SetColor('white');
$graph->scale->SetTableTitleBackground('cornflowerblue');
$graph->scale->tableTitle->show(true);

$graph->scale->day->SetWeekendColor('white');

//remove the grey background on weekends
$graph->scale->UseWeekendBackground(false);

//remove the margins
$graph->SetMargin(0,0,0,0);


//commented out the part that adds the bars

//save the graph
$graph->Stroke('/path/to/image/directory/'.$curr_date.'.jpg');
Any help will be greatly appreciated.