c# - How to display Model data with google charts? -


using net core 2 mvc, how can pass data model view display google charts?

i have model/class statistics.cs data. have second class called statistic.cs statistic , third class called statisticdisplays.cs sets new list. here files:

statistic.cs

using system; using system.collections.generic; using system.text;  namespace corefrontenddev.code.statistics {     public class statistic     {           public statistic()         {             datapoints = new list<sdatapoint>();         }          public string statistickey { get; set; }          public string statistictitle { get; set; }         public string statisticdescription { get; set; }          public enum edisplaytype         {             bar = 1,             line =2,             pie = 3         }          public edisplaytype displaytype { get; set; }           public struct sdatapoint         {             public decimal value { get; set; }             public string text { get; set; }         }          public list<sdatapoint> datapoints { get; set; }          public int sortorder { get; set; }     } } 

statisticdisplay.cs

using system; using system.collections.generic; using system.text;  namespace corefrontenddev.code.statistics {     public class statisticdisplay     {          public statisticdisplay()         {             statistics = new list<statistic>();         }          //grouped statistics         public list<statistic> statistics { get; set; }          public int sortorder { get; set; }     } } 

statistics.cs - data is

using system; using system.collections.generic; using system.text;  namespace corefrontenddev.code.statistics {     public class statistic     {          public statistic()         {             datapoints = new list<sdatapoint>();         }          public string statistickey { get; set; }          public string statistictitle { get; set; }         public string statisticdescription { get; set; }          public enum edisplaytype         {             bar = 1,             line =2,             pie = 3         }          public edisplaytype displaytype { get; set; }           public struct sdatapoint         {             public decimal value { get; set; }             public string text { get; set; }         }          public list<sdatapoint> datapoints { get; set; }          public int sortorder { get; set; }     } } 

homecontroller.cs

public iactionresult charts()         {             var stats = statistics.gettestinstance();             return view(stats);         } 

charts.cshtml

@model corefrontenddev.code.statistics.statistics    @{     viewdata["title"] = "charts";     layout = "~/views/shared/_layout.cshtml"; } @section headercontent {    }  @section bodyabovemaincontent{     <div class="jumbotron">         <div class="container">             <ul>                 @html.displayfor(m => m.statisticdisplays)              </ul>           </div>     </div>  } 

statisticdisplay.cshtml

@model corefrontenddev.code.statistics.statisticdisplay  <li>     @html.displayfor(m => m.statistics) </li> 

statistic.cshtml

@model corefrontenddev.code.statistics.statistic  <li>     @model.statisticdescription </li> <br /> <li>     @model.statistictitle </li> 

can me figure out how pass data correctly , integrate google charts api? don't understand here because .net core mvc c# new me.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -