thenature4u Posted July 30, 2008 Share Posted July 30, 2008 Here is my code, <?php require_once("ChartDirector/lib/phpchartdir.php"); $MarksArray['0']='12'; $MarksArray['1']='23'; $MarksArray['2']='32'; $MarksArray['3']='23'; $MarksArray['4']='34'; $MarksArray['5']='45'; $MarksArray['6']='54'; $MarksArray['7']='34'; $MarksArray['8']='23'; $MarksArray['9']='23'; $MarksArray['10']='12'; $MarksArray['11']='11'; $MarksArray['12']='23'; $MarksArray['13']='1'; $MarksArray['14']='2'; $MarksArray['15']='3'; $MarksArray['16']='2'; $MarksArray['17']='12'; $labels = array("0","1", "2", "3", "4","5", "6", "7", "8", "9","10", "11", "12", "13", "14","15", "16", "17"); # Create a XYChart object of size 400 x 240 pixels $c = new XYChart(400, 240); # Add a title to the chart using 10 pt Arial font $c->addTitle("Monthly Bar Graph Report", "", 10); # Set the plot area at (50, 25) and of size 320 x 180. Use two alternative background # colors (0xffffc0 and 0xffffe0) $c->setPlotArea(50, 25, 900, 150, 0xffffc0, 0xffffe0); # Add a legend box at (55, 18) using horizontal layout. Use 8 pt Arial font, with # transparent background $legendObj = $c->addLegend(55, 18, false, "", ; $legendObj->setBackground(Transparent); # Add a title to the y-axis $c->xAxis->setTitle("Number Of Candidates"); # Reserve 20 pixels at the top of the y-axis for the legend box $c->yAxis->setTopMargin(20); //$c->yAxis->setLabelFormat("{value}"); # Set the x axis labels $c->xAxis->setLabels($labels); # Add a multi-bar layer with 3 data sets and 3 pixels 3D depth $layer = $c->addBarLayer2(Side, 3); $layer->addDataSet($MarksArray, 0xff8080, "Marks"); //$layer->addDataSet($data1, 0x80ff80, "Clicks ($count_clicks)"); //$layer->setDataLabelFormat("{value|0}"); $layer->setAggregateLabelStyle(); # output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?> Thanks in advance, Quote Link to comment https://forums.phpfreaks.com/topic/117313-the-image-bk06_bargraphphp-cannot-be-displayed-because-it-contains-errors/ Share on other sites More sharing options...
GingerRobot Posted July 30, 2008 Share Posted July 30, 2008 1.) Please, use or tags around your code. 2.) Unless you've defined constants in that included file, PNG would be undefined. Depending on your error settings, there might be a notice being issued which could cause the problem. 3.) I don't think you should be printing the output. I would assume that makeChart2 uses the imagepng() function to output the image. 4.) Comment out the header() function and the imagepng() function. You should get error message(s) that'll help identify the problem. Quote Link to comment https://forums.phpfreaks.com/topic/117313-the-image-bk06_bargraphphp-cannot-be-displayed-because-it-contains-errors/#findComment-603468 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.