JpGraph charts Library: examples and tips

JpGraph charts Library: examples and tips

Last updated:

Fill Colours

  • you must call setFillColor() and setColor() after adding a Plot to a Graph object:

    $graph = new Graph(300,200);
    $graph->SetScale('textlin');
    $bp1 = new BarPlot(array(10,20,30,40));
    $graph->Add($bp1);
    $bp1->SetColor('green');
    $bp1->SetFillColor('green');
    

Legends

(Legend class):

  • font size and number of columns

    $graph->legend->font_size = 10; //set font-size
    $graph->legend->setColumns(4);//set number of columns
    

Titles

  • to set a Graph Title:

    $graph->title->Set('Your new Title');