Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. @model HeathAppDesign.Model.ChartModel
  2. @{
  3. ViewBag.Title = "Index";
  4. }
  5. <h2>
  6. Index</h2>
  7.  
  8. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  9.  
  10.  
  11. <script type="text/javascript">
  12. $(document).ready(function () {
  13. $('#ChartTypes').change(function () {
  14.  
  15.  
  16. var selectedID = $(this).val();
  17. $.ajax({
  18. url: '/charts/GetChart/4',
  19. type: 'GET',
  20. success: function (result) {
  21. debugger;
  22. var res = JSON.stringify(result);
  23. $('#div-Graph').append(res);
  24. alert($('#div-Graph').html());
  25. }
  26. });
  27.  
  28. });
  29. });
  30. </script>
  31. <div>
  32.  
  33.  
  34. <select id="ChartTypes">
  35. <option id="Chart1" value="0">Projected Annual Cost per Member</option>
  36. <option id="Chart2" value="1">Projected Annual Cost to Employer by Plan</option>
  37. <option id="Chart3" value="2">Total Projected Cost</option>
  38. <option id="Chart4" value="3">Renewal Year PMPM Cost</option>
  39. <option id="Chart5" value="4">Paid Or Allowed Ratio by Plan</option>
  40. <option id="Chart6" value="5">Impact of Plan Design Changes on 2017 Costs</option>
  41. <option id="Chart7" value="6">5 Year Projected Plan Change Impact</option>
  42. <option id="Chart8" value="7">Impact of Trend Over Time</option>
  43. </select>
  44. <div id="div-Graph">
  45.  
  46. </div>
  47. </div>
  48.  
  49. @model IEnumerable<HeathAppDesign.Model.ChartModel>
  50.  
  51.  
  52. <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  53. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  54.  
  55. <script type="text/javascript">
  56. google.load("visualization", "1", { packages: ["corechart"] });
  57.  
  58.  
  59. </script>
  60. <script type="text/javascript">
  61. $(function () {
  62.  
  63. chartsdata = '@Model'
  64. alert(chartsdata);
  65. google.charts.load('current', { 'packages': ['bar'] });
  66. google.charts.setOnLoadCallback(drawStuff);
  67.  
  68. function drawStuff() {
  69. var data = new google.visualization.DataTable();
  70.  
  71. data.addColumn('string', '');
  72. data.addColumn('number', '');
  73.  
  74. for (var i = 0; i < chartsdata.length; i++) {
  75. data.addRow([chartsdata[i].XCoordinates, chartsdata[i].YCoordinates]);
  76. }
  77.  
  78. var options = {
  79. title: 'Paid/Allowed Ratio by Plan',
  80. width: 500,
  81. legend: { position: 'none' },
  82. trendlines: { 0: {} },
  83. bars: 'vertical', // Required for Material Bar Charts
  84. vAxis: { viewWindow: { min: 90, max: 100 }, gridlines: { count: 11} },
  85.  
  86. bar: { groupWidth: "20%" }
  87. };
  88.  
  89. var chart = new google.charts.Bar(document.getElementById('chartdiv'));
  90. chart.draw(data, options);
  91. };
  92.  
  93.  
  94. });
  95.  
  96. </script>
  97. <h2>
  98. Chart5</h2>
  99. <div id="chartdiv" style="width: 600px; height: 350px; margin: 0 auto;">
  100. </div>
  101.  
  102. [HttpGet]
  103. public ActionResult GetChart(int id)
  104. {
  105. return PartialView("_PaidOrAllowedRatio",
  106. objChartService.GetChartCoordinates(ChartTypes.PaidOrAllowedRatioByPlan));
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement