title: Creating jqplot graph using php
body: <p>I'm not really good at English sorry.</p>
  <p>I don't know how to pass values to jqplot application.</p>
  <p>the php webpage shows
  [{&quot;PER&quot;:&quot;23&quot;},{&quot;PER&quot;:&quot;47&quot;},{&quot;PER&quot;:&quot;86&quot;},{&quot;PER&quot;:&quot;25&quot;},{&quot;PER&quot;:&quot;74&quot;}]
  which came from mysql server.</p>
  <p>the table has one column and values are 23, 47, 86, 25, 74</p>
  <p>this is the php code.</p>
  <pre><code>&lt;?php
  mysql_connect(&quot;localhost&quot;,&quot;root&quot;,&quot;autoset&quot;);
  mysql_select_db(&quot;test&quot;);
  
  $q=mysql_query(&quot;SELECT PER FROM Evaluation&quot;);
  while($e=mysql_fetch_assoc($q))
      $output[]=$e;
  
  print(json_encode($output)); 
  
  mysql_close();
  
  ?&gt;
  </code></pre>
  <p>this is html sample file.</p>
  <pre><code>       $(document).ready(function(){
          
          var ajaxDataRenderer = function(url, plot) {
              var ret = null;
              $.ajax({
                  // have to use synchronous here, else returns before data is fetched
                  async: false,
                  url: url,
                  dataType:'json',
                  success: function(data) {
                      ret = data;
                  }
              });
              return ret;
          };
       
          var jsonurl =&quot;http://127.0.0.1/index.php&quot;; //&quot;../report/jsondata.txt&quot;;
  
          plot1 = $.jqplot(&quot;chart2&quot;, jsonurl, {
              title: 'AJAX JSON Data Renderer',
              dataRenderer: ajaxDataRenderer,
      
              animate: true,
              animateReplot: true,
              cursor: {
                show: true,
                zoom: true,
                looseZoom: true,
                showTooltip: false,
   
              },
              series:[   
                {
                  label:'a',
                  color: '#FF0000',
                  rendererOptions: {
                    animation: {
                      speed: 2000
                    }
                  }
                },
                {
                    label:'b',
                    color: '#0000FF',
                    rendererOptions: {
                      animation: {
                        speed: 2000
                      }
                    }
                  }
              ],
              
              
              axesDefaults: {
                pad: 0
              },
              axes: {
                xaxis: {
                  label: &quot;Period&quot;,
                  renderer: $.jqplot.CategoryAxisRenderer,
                  labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
  
                },
                yaxis: {
                  label: &quot;PER&quot;,
                  tickOptions: {
                    formatString: &quot;%d&quot;
                  },
                  rendererOptions: {
                    //forceTickAt0: true
                  }
                },
                y2axis: {
                  tickOptions: {
                    formatString: &quot;%d&quot;
                  },
                  rendererOptions: {
                    alignTicks: true
                    //forceTickAt0: true
                  }
                }
              },
              
              
              highlighter: {
                show: true,
                showLabel: true, 
                tooltipAxes: 'y',
                sizeAdjust: 7.5 , tooltipLocation : 'ne'
              },
              
              
              legend: {
                show: true,
                location: 'sw',
                placement: 'outside'
              }  
            });
      });
  </code></pre>
  <p>when I used</p>
  <pre><code>var jsonurl =&quot;../report/jsondata.txt&quot;; it worked. 
  </code></pre>
  <p>jsondata.txt included [[ 23, 47, 86, 25, 74 ]].</p>
  <p>but when I used the other one it doesn't. I want to get values from server.
  I guess there are problems passing values.</p>
  <p>please help specifically T.T</p>
  <p>thanks!</p>
  <p><strong>EDIT</strong></p>
  <p>this is the table. the contents have only one table. I want to pass PER's values.</p>
  <blockquote>
  <p><strong>ENTERPRISE PERIOD EPS STOCKPRICE PER</strong></p>
  <p>232          232   23    432      <strong>23</strong></p>
  <p>236           56   65    43       <strong>47</strong></p>
  <p>574           53   45    75       <strong>86</strong></p>
  <p>453           45   45    265      <strong>25</strong></p>
  <p>46            63   67    45       <strong>74</strong></p>
  </blockquote>
  <p>I just made values temporarily to test.</p>