Changeset 9643
- Timestamp:
- 06/18/13 17:24:29 (11 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r9628 r9643 50 50 }, 51 51 dataRenderer: ajaxDataRenderer, 52 dataRendererOptions: {53 unusedOptionalUrl: "@url"54 },55 52 axes: { 56 53 xaxis: { … … 97 94 </script> 98 95 } 96 97 @helper RefreshChart(string destinationTag, string url, string startDateVar, string endDateVar) { 98 @:$.ajax({url: "@(new HtmlString(url))?start=" + @startDateVar + "&end=" + @endDateVar, datatype: "json", success: function(result) { 99 @: for (var i = 0; i < result.length; i++) { 100 @: @(destinationTag)Plot.series[i].data = result[i]; 101 @: } 102 @: @(destinationTag)Plot.replot( {resetAxes: true} ) 103 @:}}); 104 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs
r9628 r9643 84 84 85 85 return from ci in db.FactClientInfos 86 where ci. DimTime.Time > start && ci.DimTime.Time < end87 group ci by ci. DimTime.Time into timeGroup86 where ci.Time > start && ci.Time < end 87 group ci by ci.Time into timeGroup 88 88 orderby timeGroup.Key 89 89 select timeGroup; … … 93 93 return selectors.Select(selector => 94 94 data.Select(x => new[] { 95 timeSelector(x).ToString("yyyy-MM-dd HH:mm"), 95 //timeSelector(x).ToString("yyyy-MM-dd HH:mm"), 96 timeSelector(x).ToUnixTimestamp(), 96 97 selector(x) 97 98 }) … … 99 100 } 100 101 } 102 103 public static class DateTimeExtensions { 104 public static long ToUnixTimestamp(this DateTime d) { 105 var duration = d - new DateTime(1970, 1, 1, 0, 0, 0); 106 107 return (long)duration.TotalMilliseconds; 108 } 109 } 101 110 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Home/Index.cshtml
r9628 r9643 36 36 </section> 37 37 38 <fieldset> 39 <legend>Range</legend> 40 <ol> 41 <li>Start</li> 42 <li> 43 @Html.TextBox("Start", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 44 </li> 45 <li>End</li> 46 <li> 47 @Html.TextBox("End", DateTime.Now.ToString("yyyy-MM-dd"), new { @class = "date" }) 48 </li> 49 </ol> 50 <button id="refresh">Refresh</button> 51 </fieldset> 52 38 53 <section class="charts"> 39 54 <div id="AverageCpuUtilization"></div> … … 44 59 @section Styles { 45 60 @Styles.Render("~/Styles/jqPlot/jquery.jqplot") 61 @Styles.Render("~/Content/themes/base/css") 46 62 } 47 63 48 64 @section Scripts { 65 @Scripts.Render("~/bundles/jqueryui") 66 <script> 67 $("#refresh").button({ 68 icons: { 69 primary: "ui-icon-refresh" 70 } 71 }); 72 </script> 73 49 74 @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot") 50 75 @ChartHelper.AjaxDataRenderer() … … 68 93 title: "Memory / Used Memory (GB)", 69 94 minY: 0) 95 96 <script> 97 $(document).ready(function () { 98 $(".date").datepicker({ 99 dateFormat: "yy-mm-dd", 100 onSelect: function () { refreshCharts(); } 101 }); 102 103 $("#refresh").click(function() { 104 refreshCharts(); 105 }); 106 107 108 }); 109 110 function refreshCharts() { 111 var startDate = $('#Start').val(); 112 var endDate = $('#End').val(); 113 114 @* 115 var url = "@Url.Action("AverageCpuUtilization", "ChartData")?start=" + startDate + "&end" + endDate; 116 117 @ChartHelper.LineChartTime( 118 "AverageCpuUtilization", 119 "url", 120 title: "Avg. CPU Utilization History of all Slaves", 121 axisYFormat: "%.2f%%", 122 minY: 0, maxY: 100) 123 *@ 124 125 @ChartHelper.RefreshChart("AverageCpuUtilization", Url.Action("AverageCpuUtilization", "ChartData"), "startDate", "endDate") 126 @ChartHelper.RefreshChart("UsedCores", Url.Action("UsedCores", "ChartData"), "startDate", "endDate") 127 @ChartHelper.RefreshChart("UsedMemory", Url.Action("UsedMemory", "ChartData"), "startDate", "endDate") 128 } 129 </script> 70 130 }
Note: See TracChangeset
for help on using the changeset viewer.