Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:28:11+00:00 2026-06-13T03:28:11+00:00

I have been trying to resolve this but just couldn’t get it right. I

  • 0

I have been trying to resolve this but just couldn’t get it right. I have the following php code that gets some data which are stored in interval of milliseconds, from mysql and send to the client side for jqplot to draw the graph.

    <?php
    $unit = $_GET["units"];

    $sq="SELECT su_id FROM Station_stat
    WHERE su_id in ($unit) GROUP BY su_id";

    $res = mysql_query($sq);
    $first=true;
    echo "Label=";
    echo "[";
    while($row = mysql_fetch_array($res)){
        if ($first != true)
          echo ",";
          echo "{label:\"SUID ".$row['su_id']."\"}";
        $first = false;
      }
    echo "];";


    $sql="SELECT su_id FROM Station_stat
    WHERE su_id in ($unit) GROUP BY su_id";

    $result = mysql_query($sql);
    $first=true;
    echo "s1=";
    echo "[";
    while($row = mysql_fetch_array($result)){
    $suid = explode(",", $row['su_id']);

    if ($first != true)
    echo ",";
    $first = false;

    $count=count($suid);
    $i=0;
    while($i<$count)
      {
      getsuId($suid[$i]);
      ++$i;
      }
    }
    echo "];";

    function getsuId($suid){

    $start = $_GET["start"];
    $stop = $_GET["stop"];

    $qt=mysql_query("select TIMESTAMP(d_time), bs_rssi from Station_stat WHERE su_id ='".$suid."' and d_time BETWEEN '".$start."' and '".$stop."' GROUP BY d_time");

    $first=true;
    echo "[";
    while($row = mysql_fetch_array($qt)){
        if ($first != true)
          echo ",";
          echo "[\"".$row['TIMESTAMP(d_time)']."\",".$row['bs_rssi']."]";
          $first = false;
      }
    echo "]";
    }

    mysql_close();
    ?>

And below is the function that is sending and receiving data to and from the php script on the click of a button.

    function display() {
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    } else {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
    eval(xmlhttp.responseText);
    drawPlot();
      }
    }
    var units = document.getElementById('suid').value;
    var stat = document.getElementById('start').value;
    var stop = document.getElementById('stop').value;
    var query = "?units=" + units ;
      query +=  "&start=" + start ;
      query +=  "&stop=" + stop;
    xmlhttp.open("GET","../chart.php" + query , true);
    xmlhttp.send();
    }

    function drawPlot() {
    var start = $("#start").val();
    plot1 = $.jqplot("chart1", s1, {
    //title: "Aera Chart",
    series: Label, 
    axes: { 
        xaxis: { 
             renderer:$.jqplot.DateAxisRenderer, 
             min: start,
             tickInterval: '2 minute',
             tickRenderer: $.jqplot.CanvasAxisTickRenderer,
             tickOptions: {
                    formatString: '%Y-%m-%d %H:%M:%S',
                    angle: -55
                    }
             },
        yaxis: {
             label: "[RSSI] ",
             tickOptions:{formatString:'%d '}
        }

        }, 
     cursor:{
              show: true, 
              zoom: true
     },
     legend: { show: true }
     });
     plot1.redraw();
     }

Problems I have with it now are:

(1) It takes time (like 20-30seconds) to render the graph.

(2) Whenever I drag to zoom, then the page just wouldn’t respond.

Please I will appreciate your help. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:28:12+00:00Added an answer on June 13, 2026 at 3:28 am

    After taking some days off this project I finally realized that I made a mistake in the Ajax function code pasted up there. I declared one of the parameters to be sent to the serverside as “stat”, but when adding it to others I added “start”.

        var stat = document.getElementById('start').value;
        query +=  "&start=" + start ;
    

    After editing that line, I could see the jqplot responding faster to load graph.
    Thank you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have been trying to figure this out but i just can't.... for some
I've been trying to use Dart's noSuchMethod() , but this code noSuchMethod(InvocationMirror invocation) {
I have been trying to get around this error for a day now and
I have been trying this: @Transactional(isolation=Isolation.SERIALIZABLE, rollbackFor={Exception.class}, propagation=Propagation.REQUIRES_NEW) on my service methods, but spring
Have been trying to encrypt an xml file to a string so that I
I have been trying to serialize a list that contains arrays and lists. I
I have been trying to figure out the best practices to write test-friendly code,
I have a unit test which contains the following line of code Site.objects.get(name=UnitTest).delete() and
I have been trying to parse Java exceptions that appear in a log for
I've been trying to get a registration-free .NET based COM DLL to work, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.