Welcome Guest, Not a member yet? Register   Sign In
codeigniter pchart integration
#11

[eluser]xorman[/eluser]
i meant without you. i guess you knew that.
cheers
#12

[eluser]Richievc[/eluser]
[quote author="lemathieu" date="1308854543"]Hi Xorman!

Ok, fine! I've just made an example for codeigniter 1.7.2. If you like, it is attached to this reply.

Lemathieu[/quote]

This is a great post was look for something Like this one question tho will this work wth version 2.0.2 of codeignitor
#13

[eluser]cool248[/eluser]
[quote author="lemathieu" date="1308840143"]Hi Xorman!

Ok, fine! I've just made an example for codeigniter 1.7.2. If you like, it is attached to this reply.

Lemathieu[/quote]

hi lemathieu,

i can't download.

can you please help me with it..

i need it..

i am building a application and i want to integrate codeIgniter 1.7.2 with pChart the latest one (2.1.3).

so far i am doing good until the code reaches this part

Code:
$myPicture->setGraphArea(500, 60, 670, 190);

here is the overall code

Code:
$this->load->library("pChart2.1.3/class/pData.php");
   $this->load->library("pChart2.1.3/class/pDraw.php");
                
                
                
                  $MyData =& $this->pdata;
                  $MyData->addPoints(array(1, -2, -1, 2, 1, 0), "Probe 1");
        $MyData->addPoints(array(1, -2, -3, 2, 1, 8), "Probe 2");
        $MyData->addPoints(array(2, 4, 2, 0, 4, 2), "Probe 3");
        $MyData->setSerieTicks("Probe 2", 4);
        $MyData->setAxisName(0, "Temperatures");
        $MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
        $MyData->setSerieDescription("Labels", "Months");
        $MyData->setAbscissa("Labels");
        
      
        
        /* Create the pChart object */
        
        $params = array("DataSet"=>$MyData,"Xsize"=>700,"Ysize"=>230);//this is the params of the constructor
        
        
      
        
        $this->load->library("pChart2.1.3/class/pImage.php",$params);
        
       $myPicture =& $this->pimage; //same way
    
      
        
        /* Draw the background */
        $Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190,
            "DashG" => 203, "DashB" => 107);
        $myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);

        /* Overlay with a gradient */
        $Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1,
            "EndG" => 138, "EndB" => 68, "Alpha" => 50);
        $myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
        $myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" =>
            0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50,
            "Alpha" => 80));

        /* Add a border to the picture */
        $myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));

        /* Write the picture title */
        $myPicture->setFontProperties(array("FontName" => "fonts/Silkscreen.ttf",
            "FontSize" => 6));
        $myPicture->drawText(10, 13,
            "drawStackedAreaChart() - draw a stacked area chart", array("R" => 255, "G" =>
            255, "B" => 255));

        /* Write the chart title */
        $myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf",
            "FontSize" => 11));
        $myPicture->drawText(250, 55, "Average temperature", array("FontSize" => 20,
            "Align" => TEXT_ALIGN_BOTTOMMIDDLE));

        /* Draw the scale and the 1st chart */
      here=>>>   $myPicture->setGraphArea(60, 60, 450, 190);
        $myPicture->drawFilledRectangle(60, 60, 450, 190, array("R" => 255, "G" => 255,
            "B" => 255, "Surrounding" => -200, "Alpha" => 10));
        $myPicture->drawScale(array("DrawSubTicks" => true, "Mode" => SCALE_MODE_ADDALL));
        $myPicture->setFontProperties(array("FontName" => "fonts/pf_arma_five.ttf",
            "FontSize" => 6));
        $myPicture->setShadow(false);
        $myPicture->drawStackedAreaChart(array("DisplayValues" => true, "DisplayColor" =>
            DISPLAY_AUTO, "Surrounding" => 20));

        /* Draw the scale and the 2nd chart */
        $myPicture->setGraphArea(500, 60, 670, 190);
        $myPicture->drawFilledRectangle(500, 60, 670, 190, array("R" => 255, "G" => 255,
            "B" => 255, "Surrounding" => -200, "Alpha" => 10));
        $myPicture->drawScale(array("Pos" => SCALE_POS_TOPBOTTOM, "Mode" =>
            SCALE_MODE_ADDALL, "DrawSubTicks" => true));
        $myPicture->setShadow(false);
        $myPicture->drawBarChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"Rounded"=>TRUE,"Surrounding"=>30));

        /* Write the chart legend */
        $myPicture->drawLegend(510, 205, array("Style" => LEGEND_NOBORDER, "Mode" =>
            LEGEND_HORIZONTAL));

        /* Render the picture (choose the best way) */
        $myPicture->autoOutput("images/p.png");


here is the error..


Quote:A PHP Error was encountered

Severity: Warning

Message: Attempt to modify property of non-object

Filename: class/PImage.php

Line Number: 135


Quote:Fatal error: Call to a member function getData() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/excel2/application/libraries/pChart2.1.3/class/PDraw.php on line 1815



Thank you
#14

[eluser]Unknown[/eluser]
thanks buddy
#15

[eluser]cbaldinu[/eluser]
Hi, i was attempting to do the same thing, but with no success. Can anyone tell me how to integrate pChart into CodeIgniter?

Thanks to all,

Cristian Baldinu




Theme © iAndrew 2016 - Forum software by © MyBB