title: Pass Json Data To MVC Razor View
body: <p>I'm using JQuery Flot Charts <a href="http://www.flotcharts.org/" rel="nofollow">http://www.flotcharts.org/</a> within my MVC 5 application. I wish to create horizontal bar charts, and this tutorial is helpful <a href="http://www.jqueryflottutorial.com/how-to-make-jquery-flot-horizontal-bar-chart.html" rel="nofollow">http://www.jqueryflottutorial.com/how-to-make-jquery-flot-horizontal-bar-chart.html</a></p>
  
  <p>The following 3 lines of code pass in the data that the chart plugin uses to create the chart</p>
  
  <pre><code>var rawData = [[1582.3, 0], [28.95, 1], [1603, 2], [774, 3], [1245, 4], [85, 5], [1025, 6]];
  var dataSet = [{ label: "Precious Metal Price", data: rawData, color: "#E8E800" }];
  var ticks = [[0, "Gold"], [1, "Silver"], [2, "Platinum"], [3, "Palldium"], [4, "Rhodium"], [5, "Ruthenium"], [6, "Iridium"]];
  </code></pre>
  
  <p>My charts however, can not use hard coded values like this above, and instead the data passed into my chart needs to be dynamic. I can pass data into the <code>rowData</code> variable using an Ajax call in my MVC Razor View which calls a Controller Action which returns Json (see below).</p>
  
  <pre><code>$.ajax({
              type: "GET",
              contentType: 'application/json; charset=utf-8',
              dataType: 'json',
              url: '/Statistics/GetTestData/',
              error: function () {
                  alert("An error occurred.");
              },
              success: function (data) {
  
              var rawData = [data];
              }
  
  });
  </code></pre>
  
  <p>My problem is how can I also pass the data from my Controller Action into the <code>ticks</code> variable? </p>
  
  <p>I suppose what I need to know is, can I return from my Controller Action two sets of data, one for the <code>rawData</code> variable in the format of </p>
  
  <pre><code>[[1582.3, 0], [28.95, 1], [1603, 2], [774, 3], [1245, 4], [85, 5], [1025, 6]]
  </code></pre>
  
  <p>and, secondly for the <code>ticks</code> variable in the format of</p>
  
  <pre><code>[[0, "Gold"], [1, "Silver"], [2, "Platinum"], [3, "Palldium"], [4, "Rhodium"], [5, "Ruthenium"], [6, "Iridium"]]
  </code></pre>
  
  <p>Hopefully this makes sense. </p>
  
  <p>Any feedback or advice would be greatly appreciated.</p>
  
  <p>Thanks.</p>