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 9184719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:07:18+00:00 2026-06-17T19:07:18+00:00

Please I have been trying this but seems difficult. I am trying to make

  • 0

Please I have been trying this but seems difficult. I am trying to make the number of y-axis depend on the user selection. There are 3 sections for user to select from, namely:

  1. Time range for the plot
  2. ID to plot, which will be taken from database
  3. Field to search in the database

If the user selects 2 ID and 2 Field, then I should have 4 different lines on the plot. Which means that:

number of lines = number of ID selected * number of Field selected

With that I know I will get same number for the labels in the legend and also for the number of y-axis to be displayed.

For the example I gave, it should be something like:

  • Field_1-ID_1
  • Field_2-ID_1
  • Field_1-ID_2
  • Field_2-ID_2

for the legend label and the y-axis to be produced, but it all depends on the user selection.

Thank you for your attention.

  • 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-17T19:07:19+00:00Added an answer on June 17, 2026 at 7:07 pm

    I finally found a way to resolve this by generating from the php side, the elements for the series property in the jqplot in its expected format i.e.

    series:[{label:Field_1-ID_1,yaxis:'yaxis'},{label:Field_1-ID_2,yaxis:'y2axis'},{label:Field_2-ID_1,yaxis:'y3axis'},{label:Field_2-ID_2,yaxis:'y4axis'}]
    

    If anyone is interested in how it is done, please check the code below:

    $con = mysql_connect($hostname, $username, $password);
    if (!$con)
    {
     die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db($database, $con);
    
    $unit = mysql_real_escape_string($_GET["units"]);//ID selected by user, e.g.(ID_1,ID_2)
    $stat = mysql_real_escape_string($_GET["start"]);//start time
    $stop = mysql_real_escape_string($_GET["stop"]);//stop time
    $field1 = mysql_real_escape_string($_GET["fieldlist"]);//Field selected by user, e.g.(Field_1,Field_2)
    
    $first=true;
    echo "Label=";
    echo "[";
    
    $field = explode(",", $field1);
    $count=count($field);
    $i=0;$j=1;
    while($i<$count)
    { 
      $sq="SELECT su_id FROM Station_stat
      WHERE su_id in ($unit) GROUP BY su_id";
    
      $res = mysql_query($sq);
    
      while($row = mysql_fetch_array($res)){
      if ($first != true )
        {
            echo ",";
            echo "{label:\"$field[$i] ".$row['su_id']."\",yaxis:\"y".++$j."axis\"}";
        }
      else
          echo "{label:\"$field[$i] ".$row['su_id']."\",yaxis:\"yaxis\"}";
          $first = false;
     }
    ++$i;
    }
    echo "];";
    

    The output of that php is like:

    Label=[{label:Field_1-ID_1,yaxis:'yaxis'},{label:Field_1-ID_2,yaxis:'y2axis'},{label:Field_2-ID_1,yaxis:'y3axis'},{label:Field_2-ID_2,yaxis:'y4axis'}];
    

    Then in the jqplot function, I set series to be Label:

    series:Label
    
    • 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 out how to do this and it seems
I have been trying various implementations to make this work, and have searched StackOverflow
I have been searching but unable to find a proper list. Can someone please
Please help! I have been grappling with this error for days and I cannot
The title may have been confusing, but please let me explain: Currently when I
I know similiar questions have been asked before, but please bear with me as
I am not sure how I should size this, I have been trying to
I have been trying to figure out what kind of timestamp takes this form:
I have been trying to figure out this issue I am having with PHP
I've been searching for this for a few days now, but nothing seems to

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.