Guest User

Untitled

a guest
Nov 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Test</title>
  6. <script src="jquery-3.2.1.js" type="text/javascript"></script>
  7. <script src="highstock.js" type="text/javascript"></script>
  8. <script src="exporting.js" type="text/javascript"></script>
  9.  
  10. <script type="text/javascript">
  11.  
  12. $(document).ready(function() {
  13.  
  14. var c = [];
  15. var d = [];
  16. var options = {
  17. chart: {
  18. backgroundColor: '#FCFFC5',
  19. renderTo: 'chart',
  20. defaultSeriesType: 'line'
  21. },
  22. plotOptions: {
  23. line: {
  24. zones: [{
  25. value: 18, // Values up to 10 (not including) ...
  26. color: 'red' // ... have the color blue.
  27. },{
  28. value: 22, // Values up to 10 (not including) .
  29. color: 'yellow' // ... have the color blue.
  30. },{
  31. value: 27, // Values up to 10 (not including) ...
  32. color: 'lightgreen' // ... have the color blue.
  33. },{
  34. value: 32, // Values up to 10 (not including) ...
  35. color: 'yellow' // ... have the color blue.
  36. },{
  37. color: 'red' // Values from 10 (including) and up have the color red
  38. }]
  39. }
  40. },
  41.  
  42. title: {
  43. text: 'Water temp(°C)'
  44. },
  45. rangeSelector: {
  46. enabled: true,
  47. buttons: [
  48. {
  49. type: 'minute',
  50. count: 5,
  51. text: '5m'
  52. }, {
  53. type: 'day',
  54. count: 1,
  55. text: 'day'
  56. }, {
  57. type: 'month',
  58. count: 1,
  59. text: 'month'
  60. }, {
  61. type: 'year',
  62. count: 1,
  63. text: 'year'
  64. }, {
  65. type: 'all',
  66. text: 'All'
  67. }
  68. ],
  69. allButtonsEnabled: true
  70. },
  71. xAxis: {
  72. title: {
  73. text: 'Date Measurement'
  74. },
  75. type: 'datetime'
  76.  
  77. },
  78. yAxis: {
  79. max:55,
  80. min:14,
  81. title: {
  82. text: 'reading'
  83. },
  84. plotLines: [ {
  85. value: '20',
  86. color: 'red',
  87.  
  88. width: 2,
  89. label: {
  90. text: 'lower limit'
  91. }
  92. }
  93. , {
  94. value: '30',
  95. color: 'red',
  96.  
  97. width: 2,
  98. label: {
  99. text: 'upper limit'
  100. }
  101. }]
  102.  
  103.  
  104.  
  105. },
  106.  
  107. series: [{
  108. data: d,
  109. tooltip: {
  110. valueDecimals: 2
  111. }
  112. }]
  113. };
  114.  
  115. var jqxhr = $.get('https://drive.google.com/uc?export=download&id=1G_ffup-_S3muG1DakppAsH0IIfQv1ZSw', function(data) {
  116. var lines = data.split('n'),
  117. aDate,
  118. parseDate = function (rawDate) {
  119. // rawDate like 07/11/2017 15:28:34
  120. var dateAndTime = (rawDate.split('"')[1] || rawDate).split(' '),
  121. date = dateAndTime[0].split('/').reverse(),
  122. time = dateAndTime[1].split(':');
  123. //in Date.UTC months are indexed from 0, so -1
  124. return Date.UTC(+date[0], +date[1] - 1, +date[2], +time[0], +time[1], +time[2]);
  125. };
  126.  
  127. $.each(lines, function(lineNo, line) {
  128. if (lineNo > 0 && line) {
  129. var items = line.split(';');
  130. aDate = parseDate(items[1]);
  131. d.push([aDate, parseFloat(items[2])]);
  132. }
  133. });
  134. var chart = new Highcharts.stockChart(options);
  135. });
  136. });
  137.  
  138. </script>
  139. </head>
  140. <body>
  141.  
  142.  
  143. <div id="chart" style="width: 1200px; height: 600px; margin: 0
  144. auto"></div>
  145. </body>
  146. </html>
Add Comment
Please, Sign In to add comment