title: JSON for jqPlot
body: <p>I would like to use jqPlot usinge data from server side coming in JSON, like described in this example: <a href="http://www.jqplot.com/tests/data-renderers.php">http://www.jqplot.com/tests/data-renderers.php</a></p>
  
  <p>My code is nearly the same like the example:</p>
  
  <pre><code>function myGraph(jsonurl) {
  
    var ajaxDataRenderer = function(url, plot, options) {
      var ret = null;
      $.ajax({
        // have to use synchronous here, else the function
        // will return before the data is fetched
        async: false,
        url: url,
        dataType:"json",
        success: function(data) {
          ret=data;
          console.warn(data);
        }
      });
      return ret;
    };
  
  
  
  var plot1 = $.jqplot('chartdiv', jsonurl, {
        title: 'myTitle',
        dataRenderer: ajaxDataRenderer,
        dataRendererOptions: {  unusedOptionalUrl: jsonurl    },
        series: [{
            label: 'myLabel',
            neighborThreshold: -1
        }],
        axes: {
            xaxis: {
                renderer: $.jqplot.DateAxisRenderer,
              //  min:'August 1, 2010 16:00:00',
                tickInterval: '2 months',
                tickOptions:{formatString:'%Y-%m-%d.%H:%M:%S'}
            },
            yaxis: {
                tickOptions:{formatString:'$%.2f'}
            }
        },
    });
  </code></pre>
  
  <p>On server side i'm using PHP (and Yii). The webpage returns an array, which is encoded to JSON by using <code>CJSON::encode($resultArray);</code> (this Yii function passed trough to the PHP JSON encode function).
  The Results from the PHP script lookes like that:</p>
  
  <pre><code>{"2011-04-25 14:46:40":2,"2011-04-26 14:46:40":3,"2011-04-27 14:46:40":5}
  </code></pre>
  
  <p>The Ajax request on client side resolved something like this (output from <code>console.info();</code> )</p>
  
  <pre><code>Object { 2011-04-25 14:46:40=2,  2011-04-26 14:46:40=3, ...}
  </code></pre>
  
  <p>Probably, jqPlot expect the following format:</p>
  
  <pre><code>[[["2011-04-25 14:46:40":0],["2011-04-26 14:46:40",3],["2011-04-27 14:46:40",0]]]
  </code></pre>
  
  <p>All the time i get the <code>error uncaught exception: [object Object]</code>
  What is wrong?
  Is there a way to convert the object for to the typical array form?</p>
  
  <p>Thank you</p>