Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4557144
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:28:01+00:00 2026-05-21T17:28:01+00:00

Am using pchart to create charts for a zend framework application . My problem

  • 0

Am using pchart to create charts for a zend framework application. My problem is that i cant get the application to display the chart as each time am getting the above named error. I have looked at the various solutions related to the problem but i its still not working. Is there anything that am missing here? Please refer to the code

{

    require 'pChart2.1.1/pChart2.1.1/class/pData.class.php'; 
    require 'pChart2.1.1/pChart2.1.1/class/pDraw.class.php';
    require 'pChart2.1.1/pChart2.1.1/class/pImage.class.php';
    require 'pChart2.1.1/pChart2.1.1/class/pPie.class.php';


   // action body
    $users = new Application_Model_DbTable_Users();
    $users = $users->listAll();

    $id=$this->_getParam('id');

    if($id)
    {
            $this->_helper->viewRenderer->setNoRender(true);
            $this->_helper->layout()->disableLayout();
            $response=$this->getResponse();
            $response->clearBody('top_menu');
            $response->clearAllHeaders();

    if ($id == 'pdf') {
                  }


        //request is a chart

        if($id=='chart')
        {
            ob_start();

            $departments=new Application_Model_DbTable_Departments();

            $departments=$departments->fetchAll();

            $departments->toArray();

            $department_id="";
            $department_name="";

            foreach ($departments as $departments) {
                $department_id[]=$departments['department_id'];
                $department_name[]=$departments['department_name'];



                /* pData object creation */
               $MyData = new pData();
                /* Data definition */
                $MyData->addPoints(array(20, 30, 25, 10), "Value");
                    /* Labels definition */
                $MyData->addPoints($department_name, "Legend");
                $MyData->setAbscissa("Legend");
                /* Create the pChart object */
                $myPicture = new pImage(500, 500, $MyData);
                /* Draw a gradient background */
                $myPicture->drawGradientArea(0, 0, 500, 500, 
                DIRECTION_HORIZONTAL, 
                array("StartR" => 220, "StartG" => 220, "StartB" => 220, 
                "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
                /* Add a border to the picture */
                $myPicture->drawRectangle(0, 0, 400, 400, 
                array("R" => 0, "G" => 0, "B" => 0));
                /* Create the pPie object */
                $PieChart = new pPie($myPicture, $MyData);
                /* Enable shadow computing */
                $myPicture->setShadow(FALSE);
                /* Set the default font properties */
                $myPicture->setFontProperties(
                array(
                "FontName" => "pChart2.1.1/pChart2.1.1/fonts/Forgotte.ttf", 
                "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
                /* Draw a splitted pie chart */
                $PieChart->draw3DPie(200, 150, 
                array("Radius" => 100, "DrawLabels" => TRUE, 
                "DataGapAngle" => 10, "DataGapRadius" => 6, "Border" => TRUE));
                /* Render the picture (choose the best way) */

                header ("Content-type: image/png" );
                $myPicture->Stroke("pie.png");

                exit;


            }


        }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T17:28:02+00:00Added an answer on May 21, 2026 at 5:28 pm

    There is almost certainly something being output either before or after the image content. Easiest thing to do would be to temporarily comment out your header("Content-type: image/png"); line and view the chart image in a browser. You’ll see a load of binary data (the image) – look for anything before or after it that looks out of place (e.g. PHP error message, some HTML, possibly white space).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using pChart PHP component for chart drawing. What is happening is that
I am using the pChart class library to display .png Image on the browser.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active
I want to create and then open a txt file using the ShellExecute command.
I am using ShellExecute to run external application How can i tell when the
I have an application that connects via a DSN to an Oracle database. If
How do I check if another application is busy? I have a program that
Using online interfaces to a version control system is a nice way to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.