JPGraph problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

JPGraph problem

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply