title: create jquery array from c# object MVC
body: <p>I have model with dates and value, which I need to inject into the page so the Jquery can render the chart correctly.</p>
  
  <p>Any suggestions?
  I want to bind json from the controller to the chart script below to map year, int value.
  <a href="http://www.jqplot.com/docs/files/usage-txt.html" rel="nofollow">http://www.jqplot.com/docs/files/usage-txt.html</a></p>
  
  <pre><code>var line1 = [
        ['2014-01-01 12:00PM', 0], 
        ['2015-01-01 12:00PM', 242171], 
        ['2016-01-01 12:00PM', 392455], 
        ['2017-01-01 12:00PM', 498840], 
        ['2018-01-01 12:00PM', 577278], 
        ['2019-01-01 12:00PM', 635715], 
        ['2020-01-01 12:00PM', 678891], 
        ['2021-01-01 12:00PM', 709949], 
        ['2022-01-01 12:00PM', 731114], 
        ['2023-01-01 12:00PM', 744040], 
        ['2024-01-01 12:00PM', 750000]
   ];
  </code></pre>
  
  <p>Got my answer:
  For Json reposne of {"2014":345234,"2015":530800,"2016":640193,"2017":701163,"2018":727528}</p>
  
  <pre><code>    $(document).ready(function () {                
          $.getJSON("quote/GetChartLine", function (data) {
              var arr = [];
              //Data would be your array
              for (var i in data) {
                  arr.push([i, data[i]]);
              }                
          var line1 = [[[1, 2], [3, 5.12], [5, 13.1], [7, 33.6], [9, 85.9], [11, 219.9]]];                
          var plot1 = $.jqplot('chart1', [arr], {
              title: 'Earnings Vs Investment',
              axes: {
                  xaxis: {
                      renderer: $.jqplot.DateAxisRenderer,
                      tickOptions: {
                          formatString: '%b %Y'
                      }
                  },
                  yaxis: {
                      tickOptions: {
                          formatString: 'Rs %.2f'
                      }
                  }
              },
              highlighter: {
                  show: true,
                  sizeAdjust: 7.5
              },
              cursor: {
                  show: false
              },
  
              series: [{ lineWidth: 3, color: 'green', markerOptions: { color: 'green' } }, { lineWidth: 3, color: 'maroon', markerOptions: { color: 'maroon' } }]
          });
          });
      });
  </code></pre>