pChart Bar Charts set color depending on threshold -
good day i'm new pcharts, works great! i'm trying create bar chart 2 thresholds , display different bar colors. setting thresholds done , works well. set standard palette set color , bars exceed specified second threshold should different color. data consists of times file imported in theory, if possible, bars exceeding 2nd limit should red or pink or whatever. possible? if so, start fiddling? have tried overidecolors if statement seems not work well. info helpful. thanks
ok, here code. know there might better or cleaner ways of doing works:
/*palette per bar*/ $thold = strtotime("09:30:00"); foreach ($lastdate $over) { if ($over < $thold) { $color = array("r"=>0,"g"=>204,"b"=>204); $palette[] = $color; } else { $color2 = array("r"=>224,"g"=>46,"b"=>117); $palette[] = $color2; } }
hope helps
Comments
Post a Comment