Guest User

Untitled

a guest
Feb 18th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <cfsavecontent variable="htmlhead">
  2.  
  3. <script language="javascript" type="text/javascript" src="/includes/js/jquery.flot.min.js"></script>
  4.  
  5. <script type="text/javascript">
  6.  
  7. $(document).ready( function() {
  8.  
  9. // Setup flot
  10. var options = {
  11. xaxis: { mode: "time" }
  12. };
  13.  
  14. var chart = $("#chart");
  15.  
  16. $.plot(chart, [], options);
  17.  
  18. // Bind select
  19. $("#series").change( function() {
  20.  
  21. requestData($(this).val());
  22. });
  23.  
  24. // Send request
  25. function requestData(series) {
  26.  
  27. $.ajax({
  28. url: "/index.cfm?event=client.reports.getinventoryjson",
  29. method: "GET",
  30. data: {"series": series},
  31. dataType: "json",
  32. success: onData
  33. });
  34. }
  35.  
  36. // Handle response
  37. function onData(series) {
  38.  
  39. $(series[0]["data"]).each( function() {
  40. $(this)[0] *= 1;
  41. $(this)[1] *= 1;
  42. });
  43.  
  44. $.plot(chart, [series], options);
  45. }
  46.  
  47. $("#series").trigger("change");
  48. });
  49.  
  50. </script>
  51.  
  52. </cfsavecontent>
  53.  
  54. <cfhtmlhead text="#htmlhead#" />
  55.  
  56.  
  57. <select id="series">
  58. <option value="a">Series A</option>
  59. <option value="b">Series B</option>
  60. </select>
  61.  
  62. <div id="chart" style="height:300px;width:600px;" />
Add Comment
Please, Sign In to add comment