Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. var data = [6];
  2. data.push([10, Math.round(Math.random() * 100)]);
  3.  
  4. $('#jqChart').jqChart({
  5. title: { text: 'Change Series' },
  6. border: { strokeStyle: '#6ba851' },
  7. background: background,
  8. legend: { visible: false },
  9. axes: [
  10. {
  11. type: 'none',
  12. location: 'bottom',
  13. minimum: 0,
  14. maximum: 6
  15. },
  16. {
  17. type: 'linear',
  18. location: 'left',
  19. minimum: 0,
  20. maximum: 100
  21. }
  22. ],
  23. series: [
  24. {
  25. type: 'line',
  26. data: CallWebMethod() //REPLACING THIS WITH "data" WORKS
  27. }
  28. ]
  29. });
  30. }
  31.  
  32.  
  33.  
  34.  
  35.  
  36. function CallWebMethod() {
  37.  
  38. $.ajax({
  39. type: "POST",
  40. url: "Default4.aspx/CallWebMethod",
  41. data: '{name: "" }',
  42. contentType: "application/json; charset=utf-8",
  43. dataType: "json",
  44. async: true,
  45. success: OnSuccess,
  46. failure: function (response) {
  47. alert(response.d);
  48. }
  49. });
  50. }
  51.  
  52. function OnSuccess(response) {
  53. return response.d;
  54. }
  55.  
  56. **[System.Web.Services.WebMethod]
  57. public static List<MyGenericType<dynamic>> CallWebMethod(string name)
  58. {
  59. List<MyGenericType<dynamic>> myList = new List<MyGenericType<dynamic>>();
  60. myList.Add(new MyGenericType<dynamic>() { x = 10, y = 20 });
  61. myList.Add(new MyGenericType<dynamic>() { x = 10, y = 20 });
  62. myList.Add(new MyGenericType<dynamic>() { x = 10, y = 20 });
  63. return myList;
  64.  
  65. }**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement