ramangrover29 | a04696c | 2013-07-31 21:50:38 -0700 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 3 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> |
ramangrover29 | a04696c | 2013-07-31 21:50:38 -0700 | [diff] [blame] | 4 | <script type="text/javascript" src="/webui/static/js/smoothie.js"></script> |
ramangrover29 | a04696c | 2013-07-31 21:50:38 -0700 | [diff] [blame] | 5 | <script type="text/javascript"> |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 6 | $(document).ready(function() { |
| 7 | var feedSeries = new TimeSeries(); |
| 8 | var buildGraph = setInterval(fetchFeedReport, 500); |
ramangrover29 | a04696c | 2013-07-31 21:50:38 -0700 | [diff] [blame] | 9 | |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 10 | function fetchFeedReport() { |
| 11 | $.ajax({ |
| 12 | url: '/feed/data?dataverse=%s&dataset=%s&feed=%s', |
| 13 | method: 'GET', |
| 14 | dataType: 'json', |
| 15 | success: onFeedReportReceived |
| 16 | }); |
| 17 | } |
ramangrover29 | 40636ee | 2013-08-04 22:05:49 -0700 | [diff] [blame] | 18 | |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 19 | |
| 20 | function onFeedReportReceived(data) { |
| 21 | var tput = data["value"]; |
| 22 | if (tput == null) { |
| 23 | clearInterval(buildGraph); |
| 24 | } else { |
| 25 | feedSeries.append(data["time"], data["value"]); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | function myYRangeFunction(range) { |
| 30 | var min = 0; |
| 31 | var max = 5000; |
| 32 | return {min: min, max: max}; |
| 33 | } |
| 34 | |
| 35 | |
| 36 | function createTimeline() { |
| 37 | var chart = new SmoothieChart({minValue:0,horizontalLines:[{color:'#ffffff',lineWidth:1,value:0},{color:'#880000',lineWidth:2,value:3333},{color:'#880000',lineWidth:2,value:-3333}]}); |
| 38 | chart.addTimeSeries(feedSeries, { strokeStyle: 'rgba(0, 255, 0, 1)', fillStyle: 'rgba(0, 255, 0, 0.2)', lineWidth: 4 }); |
| 39 | chart.streamTo(document.getElementById("chart"), 500); |
| 40 | } |
| 41 | createTimeline(); |
| 42 | }); |
ramangrover29 | a04696c | 2013-07-31 21:50:38 -0700 | [diff] [blame] | 43 | </script> |
ramangrover29 | c996e28 | 2013-08-03 14:36:45 -0700 | [diff] [blame] | 44 | </head> |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 45 | <body> |
ramangrover29 | c996e28 | 2013-08-03 14:36:45 -0700 | [diff] [blame] | 46 | |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 47 | <p>Feed Ingestion</p> |
ramangrover29 | c996e28 | 2013-08-03 14:36:45 -0700 | [diff] [blame] | 48 | |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 49 | <canvas id="chart" width="600" height="300"></canvas> |
ramangrover29 | c996e28 | 2013-08-03 14:36:45 -0700 | [diff] [blame] | 50 | |
ramangrover29 | a04696c | 2013-07-31 21:50:38 -0700 | [diff] [blame] | 51 | </body> |
| 52 | </html> |
ramangrover29 | 75b7355 | 2013-08-06 10:31:04 -0700 | [diff] [blame^] | 53 | |