//Set titles $title = "Income by category / all history"; $graph2->SetYTitle('Amount (Euro)'); $graph2->SetYTickIncrement(round($max_income / 10, -3)); foreach ($categ_income as $category) { $legends[] = $category['name']; $colors[] = $category['color']; } $legends[] = "prev,asap"; $colors[] = "orchid"; $legends[] = "unknown"; $colors[] = "peru"; //print_r($data_income); $data = $data_income; $graph2->SetDataValues($data); $graph2->SetPlotAreaWorld(null, null, null, getRoundMax($max_income)); //$graph2->plot_min_y = getRoundMin($min); //$graph2->plot_max_y = getRoundMax($max_income); } else { //Set titles $title = "Outgo by category / all history"; $graph2->SetYTitle('Amount (-Euro)'); $graph2->SetYTickIncrement(round($min_outgo / -10, -3)); foreach ($categ_outgo as $category) { $legends[] = $category['name']; $colors[] = $category['color']; } $legends[] = "prev,asap"; $colors[] = "orchid"; $legends[] = "unknown"; $colors[] = "peru";
} //Set titles $title = utf8_decode(_("Outgo by category / all history")); $graph2->SetYTitle('-€'); foreach ($categ_outgo as $category) { $legends[] = utf8_decode($category['name']); $colors[] = $category['color']; } $legends[] = "prev,asap"; $colors[] = "orchid"; $legends[] = "unknown"; $colors[] = "peru"; $data = $data_outgo; $graph2->SetDataValues($data); if (abs($min_outgo) > 0) { $graph2->SetPlotAreaWorld(null, null, null, getRoundMax(abs($min_outgo))); $range = abs($min_outgo); if ($range != 0 and abs($range) > 1000) { $ratioy = 1000 * $height / $range; // $ratioy = nb of pixels per 1000 euro if ($ratioy > 20) { $graph2->SetYTickIncrement(1000); } else { if ($ratioy > 9) { $graph2->SetYTickIncrement(2500); } else { if ($ratioy > 5) { $graph2->SetYTickIncrement(5000); } else { if ($ratioy > 2) { $graph2->SetYTickIncrement(10000);