pChart - Is possible to combine a stacked bar chart and a regular bar chart? -
i'm trying use pchart create combo chart, using 3 series. 2 series stacked bar , remaining series bar chart. i'm trying achieve put stacked bar column regular bar on side (like total bar). there way achieve this? know pchart has option combo charts, seems works nice when combine different kinds of charts, bar , line example. when try combine similar graphs, bar , stacked bar, seem overwrite each other. pchart documentation isn't clear on subject (or i'm missing there). code:
$mydata = new pdata(); $mydata->addpoints(array(0,97,149,167),"previous"); $mydata->addpoints(array(97,52,18,10),"current"); $mydata->addpoints(array(97,149,167,177),"total"); $mydata->setaxisname(0,"quantity"); $mydata->addpoints(array('1','2','3','4'),"period"); $mydata->setseriedescription("period","period"); $mydata->setabscissa("period"); $mydata->setabscissaname("period"); $mychart = new pimage(975,520,$mydata); $mychart->setfontproperties(array("fontname"=>"pchart/fonts/verdana.ttf","fontsize"=>11)); $mychart->setgrapharea(270,100,940,390); $mychart->drawfilledrectangle(270,100,940,390,array("r"=>255,"g"=>255,"b"=>255,"surrounding"=>-200,"alpha"=>10)); $mychart->drawscale(array('cyclebackground'=>true,'mode'=>scale_mode_start0,'factors'=>array(20),"pos"=>scale_pos_topbottom,"drawsubticks"=>false,"gridr"=>128,"gridg"=>128,"gridb"=>128,"gridalpha"=>20)); $mychart->setshadow(true,array("x"=>1,"y"=>1,"r"=>0,"g"=>0,"b"=>0,"alpha"=>10)); $mychart->setfontproperties(array("fontname"=>"pchart/fonts/verdana.ttf","fontsize"=>11)); $mydata->setseriedrawable("total",false); $mychart->drawstackedbarchart(array("displayvalues"=>true,"displaycolor"=>display_auto,"rounded"=>true,"surrounding"=>60)); $mydata->setseriedrawable("previous",false); $mydata->setseriedrawable("current",false); $mydata->setseriedrawable("total",true); $mychart->drawbarchart(array("displaypos"=>label_pos_inside,"displayvalues"=>true,"displaycolor"=>display_auto,"rounded"=>true,"surrounding"=>60)); $mychart->setshadow(false); $mydata->setseriedrawable("previous",true); $mydata->setseriedrawable("current",true); $mychart->drawlegend(30,20,array("alpha"=>20,"mode"=>legend_vertical)); $mychart->render("graph.png");
thanks help.
Comments
Post a Comment