title: JQPlot - Uncaught exception: No plot target specified
body: <p>I'm trying to use jqplot with mvc4.
  'im trying to get data for plot in the controller like the following:</p>
  
  <p>Controller.cs</p>
  
  <pre><code>        public ActionResult DrawChart(FormCollection fc)
          {
              if (fc["start"] != null &amp;&amp; (fc["end"] != null))
              {
                  string start = fc.GetValue("start").AttemptedValue;
                  string end = fc.GetValue("end").AttemptedValue;
                  string connstring = "Data Source=DB.world;User ID=USER;Password=mypass;";
                  using (OracleConnection conn = new OracleConnection(connstring))
                  {
                      conn.Open();
                      string sql = "select to_char(dpr_ts, 'DD.MM.YYYY'), dpr_close from dpr@price where dpr_qot_id=2029543939 and dpr_ts&gt;='" + start + "' and  dpr_ts&lt;='" + end + "'";
                          //"select dpr_close, dpr_ts from dpr@price where dpr_qot_id=2029543939";// and dpr_ts&gt;='01.08.2012' and  dpr_ts&lt;='15.11.2012'";
                      using (OracleCommand comm = new OracleCommand(sql, conn))
                      {
                          using (OracleDataReader rdr = comm.ExecuteReader())
                          {
  
  
                              var arr1 = new object[1];
                              var arr2 = new object[rdr.RowSize];
                              var ctr = 0;
  
                              while (rdr.Read())
                              {
  
                                  arr2[ctr++] = new object[] {  rdr.GetOracleString(0).Value, rdr.GetOracleDecimal(1).Value,};
                                  arr1[0] = arr2;
  
                              }
                              var json = new JavaScriptSerializer().Serialize(arr1);
                              //Json(arr1);
                                  ViewBag.ChartData = json;
                              Console.WriteLine(ViewBag.ChartData);
                          }
                      }
  
                      conn.Dispose();
                      conn.Close();
                  }
              }
              return RedirectToAction("Index");
          }
  </code></pre>
  
  <p>Here some code of Index.cshtml </p>
  
  <pre><code>&lt;script lang="javascript" type="text/javascript"&gt;
      $(document).ready(function () {
  
  
          var chartData = $.parseJSON("@ViewBag.ChartData");
          var chartData = eval("@ViewBag.ChartData");
          var line1 = eval("@ViewBag.ChartData");
          var plot1 = $.jqplot('chart1', line1, {
              title: 'Default Date Axis',
              axes: { xaxis: { renderer: $.jqplot.DateAxisRenderer } },
              series: [{ lineWidth: 4, markerOptions: { style: 'square' } }]
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>When I debug controller I'm getting this sample output for <code>var json</code>: </p>
  
  <p><code>[[[\"03.09.2012\",3.1790],[\"04.09.2012\",3.16],[\"05.09.2012\",3.17],[\"06.09.2012\",3.25],[\"07.09.2012\",3.2610],[\"10.09.2012\",3.2010],[\"11.09.2012\",3.1620],[\"12.09.2012\",3.22],[\"13.09.2012\",3.2190],[\"14.09.2012\",3.26],[\"17.09.2012\",3.2790],[\"18.09.2012\",3.2490],[\"19.09.2012\",3.2620],[\"20.09.2012\",3.2610],[\"21.09.2012\",3.2610],[\"24.09.2012\",3.2410],[\"25.09.2012\",3.25],[\"26.09.2012\",3.22],[\"27.09.2012\",3.1840],[\"28.09.2012\",3.2290],[\"01.10.2012\",3.25],[\"02.10.2012\",3.27],[\"03.10.2012\",3.2310],[\"04.10.2012\",3.2580],[\"05.10.2012\",3.32],[\"08.10.2012\",3.30],[\"09.10.2012\",3.28],[\"10.10.2012\",3.25],[\"11.10.2012\",3.2790],[\"12.10.2012\",3.2490],[\"15.10.2012\",3.24],[\"16.10.2012\",3.2750],[\"17.10.2012\",3.36],[\"18.10.2012\",3.3610],[\"19.10.2012\",3.3990],[\"22.10.2012\",3.37],[\"23.10.2012\",3.32],[\"24.10.2012\",3.3290],[\"25.10.2012\",3.3310],[\"26.10.2012\",3.3720],[\"29.10.2012\",3.3810],[\"30.10.2012\",3.3690],[\"31.10.2012\",3.4290],[\"01.11.2012\",3.45],[\"20.11.2012\",3.21],[\"21.11.2012\",3.29],[\"22.11.2012\",3.31],[\"23.11.2012\",3.35],[\"26.11.2012\",3.36],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]]</code>  </p>
  
  <p>VS Debugger doesnt stop in Index.cshtml in line <code>var line1 = eval("@ViewBag.ChartData");</code>.
  While debugging Javascript with firebug I'm getting <code>line1</code>  as <code>undefined</code>.</p>
  
  <p>What am I doing wrong? I'd expect, that <code>ViewBag.ChartData = json;</code> would cause, that <code>line1</code> will be filled with value from <code>json</code>.</p>