javascript - How to connect charts timeline with mysql and to show other info in a DIV -


here code:

<?php $host="localhost"; //replace hostname $username="******"; //replace username $password="******"; //replace password $db_name="******"; //replace database $con=mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db");  $sql = "select ac,flt,start,end schedule"; //replace emp_info table name  $result = mysql_query($sql) or die(mysql_error());   ?>  <html> <head> <title>graphical display - skai</title>  <!-- mobile devices android , iphone --> <meta content="true" name="handheldfriendly" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />  <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript" src="graph/timeline.js"></script> <link rel="stylesheet" type="text/css" href="graph/timeline.css">  <style type="text/css">         /* styles page */     html, body {         font: 10pt arial;     }      #mytimeline {     }      #new {         position: absolute;         left: 25px;         top: 8px;          text-transform: uppercase;         color: white;         font-weight: bold;         font-size: 10px;         text-decoration: none;     }          /* custom styles timeline */     div.timeline-frame {         border-color: #5d99c3;          border-radius: 5px;         -moz-border-radius: 5px; /* firefox 3.6 , older */     }     div.timeline-axis {         border-color: #5d99c3;         background-color: #5d99c3;         filter: progid:dximagetransform.microsoft.gradient(startcolorstr='#5d99c3', endcolorstr='#3a6da0'); /* ie */         background: -webkit-gradient(linear, left top, left bottom, from(#5d99c3), to(#3a6da0)); /* webkit browsers */         background: -moz-linear-gradient(top,  #5d99c3,  #3a6da0); /* firefox 3.6+ */     }     div.timeline-axis-grid {     }     div.timeline-groups-axis {         border-color: #5d99c3;     }     div.timeline-axis-text {         color: white;     }     div.timeline-groups-text {         color: #4d4d4d;     }     div.timeline-event {         color: #000;         max-height:50px;         height:25px     }     div.timeline-event-content {     font-size:11px;     }  </style>  <script type="text/javascript">     var timeline = undefined;     var data = undefined;      google.load("visualization", "1");          google.setonloadcallback(drawvisualization);         function drawvisualization() {             var data = new google.visualization.datatable();             data.addcolumn('string', 'group');             data.addcolumn('string', 'content');             data.addcolumn('datetime', 'start');             data.addcolumn('datetime', 'end');             data.addrows([  <?php  while($row = mysql_fetch_array($result)){ echo "['". $row['ac']. "','<span onclick=\"javascript:showdiv()\">". $row['flt']. "</span>',  new date( ". $row['start']. " ),  new date( ". $row['end']." )], "; }   ?>                            ]);         // specify options         var options = {             width:  "100%",             height: "99%",             layout: "box",             axisontop: true,             eventmargin: 15,                    // minimal margin between events             eventmarginaxis: 0,                 // minimal margin beteen events , axis             "min": new date('2013-06-01'),        // lower limit of visible range             "max": new date('2013-06-01'),        // upper limit of visible range             editable: false,             shownavigation: true,             overlappinggridlines: true         };          // instantiate our timeline object.         timeline = new links.timeline(document.getelementbyid('mytimeline'));          // draw our timeline created data , options         timeline.draw(data, options);          // set customized visible range         var start = new date(now.gettime() - 4 * 60 * 60 * 1000);         var end = new date(now.gettime() + 8 * 60 * 60 * 1000);         timeline.setvisiblechartrange(start, end);     }   </script>   <script>      <script type="text/javascript">         function showdiv() {             div = document.getelementbyid('tow');             div.style.display = "block";         }     </script> </head>  <body onresize="timeline.redraw();" style="background:#f9f8f6">  <div id="mytimeline"  style="background:#fff;min-width:900px;height:500px;"></div>  <div id="tow" style="display:none;position:absolute;top:20%;left:30%;;width:200px;height:350px;background:#837e7c;padding:30px;color:#fff;">  <?php echo $row['ac']; ?>here should result shown  </div>   </body> </html> 

i trying display information in chart time line, example (http://almende.github.io/chap-links-library/js/timeline/examples/example01_basis.html)

now instead of inserting events manually have connect mysql , working fine.

what not able when click on event want show information event in div, in case (div id="tow")

remove unused tag before javascript showdiv()


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -