Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/13 17:50:00 (12 years ago)
Author:
pfleck
Message:

#2063:
Insert charts on index page for CPU utilization, cores and memory usage.
Added html helper for generating chart javascript.
Added ChartDataController for generating JSON data for the charts.

Location:
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/BundleConfig.cs

    r9617 r9625  
    2323
    2424namespace HeuristicLab.Services.Hive.Statistics {
    25   public class BundleConfig {
     25  public static class BundleConfig {
    2626    public static void RegisterBundles(BundleCollection bundles) {
    2727      bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
     
    5656
    5757      bundles.Add(new ScriptBundle("~/Scripts/jqPlot/jquery.jqplot").Include(
    58                   "~/Scripts/jqPlot/jquery.jqplot.js"));
     58                  "~/Scripts/jqPlot/jquery.jqplot.js",
     59                  "~/Scripts/jqPlot/plugins/jqplot.highlighter.js",
     60                  "~/Scripts/jqPlot/plugins/jqplot.dateAxisRenderer.js",
     61                  "~/Scripts/jqPlot/plugins/jqplot.cursor.js"));
    5962
    6063      bundles.Add(new StyleBundle("~/Styles/jqPlot/jquery.jqplot").Include(
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/FilterConfig.cs

    r9589 r9625  
    2323
    2424namespace HeuristicLab.Services.Hive.Statistics {
    25   public class FilterConfig {
     25  public static class FilterConfig {
    2626    public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
    2727      filters.Add(new HandleErrorAttribute());
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/RouteConfig.cs

    r9589 r9625  
    2424
    2525namespace HeuristicLab.Services.Hive.Statistics {
    26   public class RouteConfig {
     26  public static class RouteConfig {
    2727    public static void RegisterRoutes(RouteCollection routes) {
    2828      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css

    r9604 r9625  
    184184  border: 1px solid #CCC;
    185185}
     186
     187.charts {
     188  font-size: 1.5em;
     189}
     190
     191.charts > div {
     192  height: 300px;
     193  margin-top: 15px;
     194  margin-bottom: 5px;
     195  margin-left: 10px;
     196  margin-right: 20px;
     197}
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/HomeController.cs

    r9617 r9625  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.Linq;
    25 using System.Web.Helpers;
    2624using System.Web.Mvc;
    2725using HeuristicLab.Services.Hive.DataAccess;
     
    7169      throw new Exception();
    7270    }
    73 
    74     public ActionResult Test() {
    75       var data = new Dictionary<string, float>
    76         {
    77             {"test", 10.023f},
    78             {"test2", 20.020f},
    79             {"test3", 19.203f},
    80             {"test4", 4.039f},
    81             {"test5", 5.343f}
    82     };
    83 
    84       var chart = new Chart(600, 400)
    85         .AddTitle("Testchart")
    86         .AddSeries(
    87           name: "13456",
    88           chartType: "Area",
    89           xValue: new[] { 1, 2, 3, 4, 5 },
    90           yValues: new[] { 10, 20, 35, 70, 50 }
    91         );
    92 
    93       chart.Write("png");
    94 
    95       return null;
    96     }
    9771  }
    9872}
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/HeuristicLab.Services.Hive.Statistics-3.3.csproj

    r9617 r9625  
    108108    <Compile Include="App_Start\RouteConfig.cs" />
    109109    <Compile Include="Controllers\AccountController.cs" />
     110    <Compile Include="Controllers\ChartDataController.cs" />
    110111    <Compile Include="Controllers\HomeController.cs" />
     112    <Compile Include="Helper\HtmlChartHelper.cs" />
    111113    <Compile Include="Models\OverallStatistics.cs" />
    112114    <Compile Include="Global.asax.cs">
     
    116118    <Compile Include="Models\AccountModels.cs" />
    117119    <Compile Include="Properties\AssemblyInfo.cs" />
     120    <Content Include="App_Code\ChartHelper.cshtml" />
    118121    <None Include="Properties\AssemblyInfo.cs.frame" />
    119122  </ItemGroup>
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Home/Index.cshtml

    r9617 r9625  
    1818        </tr>
    1919        <tr>
     20            <td>Used Cores</td>
     21            <td>@Model.CurrentlyUsedCores</td>
     22        </tr>
     23        <tr>
    2024            <td>System-Wide Waiting Tasks</td>
    2125            <td>@Model.CurrentlyJobsWaiting</td>
    22         </tr>
    23         <tr>
    24             <td>Used Cores</td>
    25             <td>@Model.CurrentlyUsedCores</td>
    2626        </tr>
    2727        <tr>
     
    3636</section>
    3737
    38 <section>
    39     <div id="chartdiv" style="height:400px;width:300px;"></div>
     38<section class="charts">
     39    <div id="AverageCpuUtilization"></div>
     40    <div id="UsedCores"></div>
     41    <div id="UsedMemory"></div>
    4042</section>
    4143
    4244@section Styles {
    43     @Styles.Render("~/Scripts/jqPlot/jquery.jqplot")
     45    @Styles.Render("~/Styles/jqPlot/jquery.jqplot")
    4446}
    4547
    4648@section Scripts {
    4749    @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot")
    48     <script>
    49         $.jqplot('chartdiv', [[[1, 2], [3, 5.12], [5, 13.1], [7, 33.6], [9, 85.9], [11, 219.9]]]);
    50     </script>
     50    @ChartHelper.AjaxDataRenderer()
     51
     52    @ChartHelper.LineChartTime(
     53        "AverageCpuUtilization",
     54        Url.Action("AverageCpuUtilization", "ChartData"),
     55        title: "Avg. CPU Utilization History of all Slaves",
     56        axisYFormat: "%.2f%%",
     57        minY: 0, maxY: 100)
     58
     59    @ChartHelper.LineChartTime(
     60        "UsedCores",
     61        Url.Action("UsedCores", "ChartData"),
     62        title: "Cores / Used Cores",
     63        minY: 0)
     64
     65    @ChartHelper.LineChartTime(
     66        "UsedMemory",
     67        Url.Action("UsedMemory", "ChartData"),
     68        title: "Memory / Used Memory",
     69        minY: 0)
    5170}
Note: See TracChangeset for help on using the changeset viewer.