<!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>
<?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(); ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)