Welcome Guest, Not a member yet? Register   Sign In
Integrating jpgraph in codeignator
#1

[eluser]Unknown[/eluser]
Hi All,

I am new to codeignator, As per my requirement i need to integrate jpgraphs in my codeignator project. I followed the below link for integrate jpgraph. But i am not able to understand below mentioned steps.

http://codeigniter.com/wiki/JP_Graph/

Installation
Setup

1) Download JpGraph (I used version 2.14 for PHP5) and copy the contents of the “src” folder to the “system/plugins/jpgraph” directory.

"I downloaded jpgraph. But here i did not found any system/plugins in jpgraph folder"

2) Create a directory “temp” in your document root (same directory as your index.php) to store the generated charts. Make sure this directory is writable by Apache.
3) If you use mod_rewrite, add the “temp” directory to your .htaccess exclusion list. My .htaccess file now looks like the following
" I did not understand step2 and step3"

So please give me a clear procedure for integrating jpgraph in codeignator.
As it a quick project. So please send the replay ASAP.

Thanks and Regards
Shankar.
#2

[eluser]Rahat Bashir[/eluser]
Hello,
I am trying to use JpGraph with Codeigniter following the instruction given above, but it producing error. I need a way out. It would be great if someone could help.
Here is what I have done:

I have put all the contents of src folder into application/libraries/jpgraph/

My jpgraph library class location is
Code:
application/libraries/jpgraph.php

class Jpgraph {
    public function grouped_bars(){
        require_once ('jpgraph/jpgraph.php');
        require_once ('jpgraph/jpgraph_bar.php');

        $datay1=array(35,160,0,0,0,0);
        $datay2=array(35,190,190,190,190,190);
        $datay3=array(20,70,70,140,230,260);

        $graph = new Graph(450,200,'auto');    
        $graph->SetScale("textlin");
        $graph->SetShadow();
        $graph->img->SetMargin(40,30,40,40);
        $graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());

        $graph->xaxis->title->Set('Year 2002');
        $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

        $graph->title->Set('Group bar plot');
        $graph->title->SetFont(FF_FONT1,FS_BOLD);

        $bplot1 = new BarPlot($datay1);
        $bplot2 = new BarPlot($datay2);
        $bplot3 = new BarPlot($datay3);

        $bplot1->SetFillColor("orange");
        $bplot2->SetFillColor("brown");
        $bplot3->SetFillColor("darkgreen");

        $bplot1->SetShadow();
        $bplot2->SetShadow();
        $bplot3->SetShadow();

        $bplot1->SetShadow();
        $bplot2->SetShadow();
        $bplot3->SetShadow();

        $gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
        $gbarplot->SetWidth(0.6);
        $graph->Add($gbarplot);
//        return $graph;
        return $graph->Stroke();
    }
}

My Controller:
Code:
class Six_Months_Trend extends MY_Controller
{
    function __construct() {
        parent::__construct();
    }
    
    public function index() {
        $this->load->library('jpgraph');
        $bar_graph = $this->jpgraph->grouped_bars();
        echo $bar_graph;
    }
}

The output in the view is:

�PNG IHDR���v� nIDATx���h���Ou댆�-X�:��C�C��nu�,Tk��W7baPh�G���Z��6N�ݐխ�nԢ��c��W �c�ڒ-�@F���|�ol~,�w/w�=����}�Iz�~�.�T,,,(�R]awPވQ!F@�bD�Q!F@d�� ��i�RJ��U���V�(r0�E�:bt]ϼ��2�Qvة�bFd�S�Ƞ.[�FQ�1�Z�9뙱��v�_�'{w;�@Ŭ���bN����„EST��Vɒ��TV�-��9�F��ly�;cK�NI� 6b6����M�&���0E����e�ã�V��F�-�L����Ҩ�����k����>J���k��d(!FQ �N�B�Rf� �lD�Q!F@�bD�Q!F@�bD�Q!F@�bD�Q!F@�bDL|2�7�|��G�b������N�߯�J�R�P(������n�Ǔ��db6:11������?��㯿�z���������J&b����n���+/\�PWW�.F"���f��"�H�"����z�������+�x���F)U[[�����Zr�� V��\��>;;;66��[o���Ƕ�.@6�n���_w�u---�h4��盙�QJMOO�|�Ep%1�gϞ�����}����ׯOGFF�����hSSS�"������ۻ��:;;��]�v���`0�H���&����Ep����[�����(���.sx�� B��1 "�(�� B��1 "�(�� b�ByPb��"�ܷ���N�a6 "�(�� B��1 "�(�� B��1 "�(�� �{��s�{���Q!F@�bD�Q!F@�bDL���ԩS~�a,khhx�W���R�T* E�Q�������x��L�F�9��k����[o�u����b8���6�(�+���������k��6��Φ��H�������H$R������:t���1};����(�jkk��x�b�X,���X��7I��7����'O����z�j�J\¹bt�&�L�R�eh&sg;�?����>��7ި��JW|>��̌Rjzz���(�+���O>��СC�����822�L&GGG;��� �L���۷O)���+���]u�U�`0 ����q�;v�H�(g�,{��ˉ��ʺ�ˢ���X�r��`"Fu]�.z<����b��J�� D�Q!F@�bD�Q!F@�bD�QY��FQ��/�ؿ�������1 "�(�� B��1 "�(��Q��^�H�s��Y��[����(�� B��1 "�(�� B��1 "�(�� B��1 "&.M�iZ��F1�J�B�h4���=O�"���٨�����������Jҝ�H$�����z�@$)PW�^o4����(�jkk��x�b�s�� Gw���]�3����_�g���W�߿���6�[����K"���s�#�T�.rI�_|�E*�},��U��Z��ҝz��733�������|��J�mllI&����MMM��J&bT;Ӵ�k��J�`0�H$Z[[�D[[[�"���c�ٯvRJy<����b��J�� D�Q!F@�bD�Q��͠0�厄����u�V7���?��Q!F@�bD�Q!F@�bD�Q!F@�bD�Qq��:F��,��|S� �}���b�F@�bD�Q!F@��g�`�1bD�Q!F@ĒM�R}}}�=�X___*��bpKb4WWW_�’�D"���^�7D"+���XXXX�nݺ�����sss۶m�^fjjj����X�m/����@�Y�S���fff�R���>�ϊ!�!,����Ƒ��d29::���d����h0L$����D���͊!�!,9����"�(�� B��1 "n�QM��n�Z����MNN�NNN:��KConfused挦i�O�����ȗc�\^���4���t]���%����۶�D'N��馛t]�뮻���<�.��h&M�6o����nL14M;p��O>���������^6=�ݽ�SYY��MNNVVVf�(�0>>��ѱe˖ҷ����ܷ�~���s�ԩ.�������m۶������F�Q���G�ю��G���---���[��-,s& �o��Y��"�����sQ�F�������dv�ޕ.&沧���.Zy�b�cI��A�T���w +g&f�>���z�&�ȩp=J���P�e���R�<Ť� (0Ģ_/f�|�_K#������$\IEND�B`�




Theme © iAndrew 2016 - Forum software by © MyBB