Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
this is html file

XML
<!DOCTYPE html PUBLIC "-//W3C//DTD X<code></code>HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="js/modernizr-2.5.3.min.js"></script>
<script language="javascript" src="jquery/jquery-1.9.0.min.js"></script>
<script language="javascript">
$(document).ready(function(){
    $("#sub").click(function(){
        var str="";
        $("input[type=checkbox]:Checked").each(function(){
            a = $(this).val();
            str=str+a+"#";
        })
        str1=str.substr(0,str.length-1);
        alert(str);
        $.ajax({
             type: "POST",
             url: "chart-multiple.php",
             data:{str1:str1},
             success: function(data){
                alert(data);
                $("#chart-table").empty();
                $("#chart-table").append(data);
             }
         });

       });
});
</script>
</head>

<body>
<form id="frm1">
<input type="checkbox" id="ins1" value="SHC-I-01" />SHC-I-01
<input type="checkbox" id="ins2" value="SHC-I-02" />SHC-I-02
<a href="#" name="sub" id="sub">Generate</a>
<!--<input type="submit" name="submit" value="Generate" id="submit"/>-->
<table id="chart-table">

</table>
</form>

</body>
</html>


chart-multiple.php file this is.

PHP
<?php
    //include "libchart/classes/libchart.php";
    include("dbconnection.php");
    require_once ('src/jpgraph.php');
    require_once ('src/jpgraph_line.php');
    $ins_instalid=$_REQUEST['str1'];
    $strarray=explode('#',$ins_instalid);
    $sel_date = mysql_query("select distinct ReadingDate from trn_1");
    while($row_date=mysql_fetch_array($sel_date)){
        $date[] = $row_date['ReadingDate'];
    }
    $i=0;
    $j=0;
    foreach($strarray as $col){
        $sql = mysql_query("select * from trn_1 where InstallInstrumentId='$col'");
        while($row=mysql_fetch_array($sql)){
            $x = $row["ReadingDate"];
            if(in_array($x,$date,true))
            {
                $data[$i][$j] = $row["CumulativeChange"];

            }
            $j++;
        }
        $i++;
    }
    
    $graph = new Graph(400,600);
    $graph->SetScale("textlin");

    $theme_class=new UniversalTheme;

    $graph->SetTheme($theme_class);
    $graph->img->SetAntiAliasing(false);
    $graph->title->Set('Filled Y-grid');
    $graph->SetBox(false);

    $graph->img->SetAntiAliasing();

    $graph->yaxis->HideZeroLabel();
    $graph->yaxis->HideLine(false);
    $graph->yaxis->HideTicks(false,false);

    $graph->xgrid->Show();
    $graph->xgrid->SetLineStyle("solid");
    $graph->xaxis->SetTickLabels($date);
    $graph->xgrid->SetColor('#E3E3E3');
    
    $p1 = new LinePlot($data);
    $graph->Add($p1);
    $p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
    $p1->mark->SetColor('#6495ED');
    $p1->SetLegend('Line1');
    $graph->legend->SetFrameWeight(1);
    $graph->Stroke();
    

?>


i want to draw multiple line graph in one line chart.. Iam using jgpgraph. I try this code. But graph did not come properly. Please help me. i got output but output is coming some symbols
Posted
Updated 8-Jul-13 23:38pm
v7
Comments
Sudhakar Shinde 9-Jul-13 3:57am    
Did not come properly is not enough info to give you solution.You need to check which part of the program giving you any error. Debug and let us know the exact error.
Dhivya Chennai 9-Jul-13 4:22am    
MY output is coming like this.....
�PNG  IHDR�d'�� *IDATx��Mh�ǟbG1� K��K�Ű sX�\�a����!`��-�l��9��y����1��\F$��ќLrX&��Yd̎Xg #��P%�[U�կ���4�f����������j�����}��b�>����6��>�U!8���>��+ %D*��������Q�jE��u�nDX[Y� jP�9����j;����a�a"�n�!%�j��Y�F�_�,���������cX�",�-vJ���?a�N1݈��0Z�I�]���xu-7%�󉊗ư�ֵk�^w ae�c��}� ՝I��%�.���e0P�je9�4�e�����cXy�aI��J���"�U���ޢ��5��u` +L�+��{Q}�E�V ����#i���Lgc�+m�%jyT �6����C��GR\a���7� ~2�˂im�:a�Ia�kyT ���ԣ���#��d,�7��X�A��)���%b�H3^��l��0�1�<�}I�Xv� T�[��%��%�p �/�* P X���T�2@���� ,@e�`* P�.X�g}�/ ��m�!O�E���Yffd�O�7Ȝ�]�([��@�������t������wʺ<�׭��Ԓ�^�-'��r����+OgJ�q��#z3'8�w(h-b�5�3j�6U�ߨ{/�Hے��)��e�?�Sz��ʉ?I-����M�&/q!�Z�h�� � �XױR! V�ъ�yCi'�Ш�p|VO�q,3�az�v��e����2�TÖ��TJe�W8;~���/s���q�®�� 7�u������ԩ���' ����3*��#T}FȨ?��'|4M�eh��c9��0}f�J�W� ��1�����z�/�k�v:��h�Vz�Z�gBF�Pt��)S��^�����M+��:ϧ�+���b�Hڷ����{��'��œ�wl8�l�>pᘌ$gd�pB��Z8�&��[6��Ă�4s�.;W��U��T͋����\uñ�5����r<~���7�s������!�v�W_-�̉�!�D���9�)�Sh����zkgٜ��*�e���e���}OS�U�b��kˆ I��@���_�I%X/�v:w}��?'�t��7n�=�d����:� �8@�'(����~ �����FD����ٜ����w{��]�`�cXd��V��`2����z�tx��="�v����ށ2;�5͠X��R�.����y@�«���fs�noM&{KKo�ju:q�(X V8��_�Z�'���N�)�� D4|<����W��c#XRx5N�Cb��g�3D���u��El�S�d9�夞[������f�Ɍ�p���bm��b��H�V���:u0��l��wls��7GM�c��j$"j�Ev��Cv����,U� ���e�+Fb� �+1�ND�?��c����:�������z�|��3�<�f>'�VS��Z6�� %�8��{��$���P0(ʎT��dP�κĴ����cs�5���-��VeYʗ�vT#���H<�A�W��������D�q�Ν��LqXV&�����t���S��+��ZV���Ĵ,U �| �])�N8�v6/��� ��R��6u����.lG[�Q�=Q��vQr� �o�q����;OF��n/4��n�߯��_�s�^�oG��s��>Q���9�sH��J���m�Z��lQ�s+�p��CMP�M�iQ���)U�"&�`u�}^�� *��!�3��I�}��V����"��6�Z6Tа�)�I�3�����[�e;=u���'����Z&ú�m���px%����%S���4S��U�2�g{�jo%����Js�.Q�̧9y� ���Ø �_e0�WZ��^�Y�}����ȹp�+m��^^8�מe?�3�/p��b��T&�%�c��CX����I�4�Px���:>��ڙ5A���sB� �0�4bsa�R�FI�J�]�|�ۨ�OD��*X���^���6HG'��z}c2�k�~~�� g���(�������`�3�Kh�<� R����=��������rj˯fB��J��0z%tJth4����d����Y� (��%[��,^��U�t*�}�����8�� � ���D� �5m�o'p^/X�+1��iC�5+����ST��/X��lm'�@�`����ϊj ���� �މ��gWV|rd�lW]n�v�Y�'F�n�X���������F��1|i6x���;6?1�0ֹ`J�v]N ��Yv�Wk�@zL�5��>n#�Z[{>�����e����2k��r� ^��� ܓ&���3S�i�{����]�t���|2���3S������F�������8��>�ɂ� S&�b�^�����㗜� D�h�i����яkL?�����0%����w��vv�f�b�mo�d�Ev���Kp������$Ӄ)�ZZ:��?l6G�wI�L�F�]a���i� L9_��]b�h '�?_��Z�qw�4?����fapd�?�"���o�����;;�n����N������a=�w��\�L�� �?U9�T�2Ȃ�6}���d ��`=�7�w��L�]B@e�`* P X���T�2@���� ,@e�`* P X���T�2@���� ,@e�`* P X���T�2��q��*W�\�u�V�� ºz�jA�����͛333źf",�������^]]-�03# ���zQ��LkT��-i࢝F�rIEND�B`�
OriginalGriff 9-Jul-13 5:30am    
That is a code dump, nothing more.
Do you really expect us to wade through that pile to try and work out what you might be having a problem with?
No. Not going to happen. Edit your question, and replace that with just the relevant code fragment. Help us to help you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900