Displaying Data on Google Chart Using SQL Database in MVC Application

前端 未结 1 385
别跟我提以往
别跟我提以往 2021-01-29 06:20

I want to create the google chart below but i want to use datetime values from an existing sql database instead of these hard coded values. How do I do this?

Controller

相关标签:
1条回答
  • 2021-01-29 06:36

    You're almost there! Now you will have to spit out a string in your razor code that will be mixed into your google stat code.

    You'll achieve that by passing in your row information in for instance a Viewbag. So in your controller you will put this in your controller :

    ViewBag.FootballTeams =  "{ c: [{ v: 'Baltimore Ravens' " etc.
    

    And in your razor :

    rows: [
       @Html.Raw(ViewBag.FootballTeams)
    ]
    
    0 讨论(0)
提交回复
热议问题