title: HighChart in ASP.NET MVC with Database connection
body: <p>I am very new to ASP.NET MVC and I attempting to display data from a database into a Highchart using Visual Studio 2015. I have the following code in my controller to get the data from the database:</p>
  
  <pre><code>namespace HelloWorld.Controllers
  {
      public class SecondlyReadingDatasController : ApiController
      {
  
          private cloudsqlEntities db = new cloudsqlEntities();
  
          // GET: api/SecondlyReadingDatas
          public IQueryable&lt;SecondlyReading&gt; GetSecondlyReadings()
          {
              SecondlyReading sec = db.SecondlyReadings.First();
              return db.SecondlyReadings;
          }
  </code></pre>
  
  <p>This is my model:</p>
  
  <pre><code>namespace HelloWorld.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class SecondlyReading
      {
          public int Id { get; set; }
          public int ChannelID { get; set; }
          public string TimeStamp { get; set; }
          public double RMSVoltage { get; set; }
          public double Frequency { get; set; }
          public double RMSCurrent { get; set; }
          public double RealPower { get; set; }
          public double ReactivePower { get; set; }
          public double ApparentPower { get; set; }
          public double PowerFactor { get; set; }
          public string DeviceId { get; set; }
      }
  }
  </code></pre>
  
  <p>I can get data in json format when I key in /api/SecondlyReadingDatas into my browser, however, my objective is to have that data to be plot into a line graph using high chart. I do know that something like the following code needs to be implemented to view the data in a line graph:</p>
  
  
  
  
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $.ajax({
    url: 'http://localhost/TestWebsite/api/SecondlyReadingDatas',
    success: function(singleSeries) {
      Highcharts.chart('container', {
        series: [singleSeries]
      });
    }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I have also installed DotNet.HighChart in my project:</p>
  
  <p><a href="https://i.stack.imgur.com/NKt4m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NKt4m.jpg" alt="enter image description here"></a></p>
  
  <p>I have 2 main questions:</p>
  
  <ul>
  <li>Is there a difference downloading the Highchart library from the
  website, which will then be referenced in Visual Studio and
  installing DotNet.HighChart in Visual Studio itself?</li>
  <li>In which file do I place the <code>&lt;script type="text/javascript"&gt;</code> ?
  Model, controller, or _Layout.cshtml?</li>
  </ul>