javascript - Google Chart Tools populated from database -
i've made site using c# , asp.net mvc using ef code first approach. want populate google chart data sql database. watched pluralsight video explaining this, using php , need use c#. have database table event has 2 properties 1 represent total tickets available , represent number still available. want make chart showing total available , number left.
this view far
@model site.models.event @{ viewbag.title = "details"; } <head> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <title> title </title> <script type="text/javascript"> // load visualization api , piechart package. google.charts.load('current', { 'packages': ['corechart'] }); // set callback run when google visualization api loaded. google.charts.setonloadcallback(drawchart); function drawchart() { var chart, data; var serverdata = $.ajax({ url: 'data.json', type: 'json', context: document.getelementbyid('chart'), success: function (serverdata) { data = new google.visualization.datatable(serverdata); chart = new google.visualization.combochart(this); chart.draw(data, { width: 400, height: 240 }); } }); } </script> </head> <body> <div id="chart" style="height: 500px; width: 900px;"></div> </body>
if can me code need write in controller return data database, assume needs json result, , how use appreciate it.
Comments
Post a Comment