Changeset 9166 for branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/ChartController.cs
- Timestamp:
- 01/15/13 15:50:53 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/ChartController.cs
r9062 r9166 157 157 return Json("error", JsonRequestBehavior.AllowGet); 158 158 } 159 160 [HttpGet] 161 public JsonResult GetDatatableContent(string datatable, string datarow) { 162 try { 163 var model = Session["jobDetails"] as JobDetailsModel; 164 var plotableData = new PlotableData(); 165 166 for (var i=0; i < model.Runs.Count; i++) { 167 foreach (var result in model.Runs[i].Results) { 168 if (result.Value.Name == datatable) { 169 var matrix = result.Value as DecimalMatrix; 170 var index = Array.IndexOf(matrix.RowNames, datarow); 171 plotableData.Series.Add( 172 new SeriesEntry() { 173 Label = "" + (i + 1) + ". Run - " + datatable + " - " + datarow, 174 Values = matrix.Value[index] 175 } 176 ); 177 break; 178 } 179 } 180 } 181 182 return Json(plotableData, JsonRequestBehavior.AllowGet); 183 } 184 catch (Exception e) { 185 Trace.TraceError(e.Message); 186 } 187 Response.StatusCode = 400; 188 Response.Status = "Session timed out"; 189 return Json("error", JsonRequestBehavior.AllowGet); 190 } 191 192 [HttpGet] 193 public JsonResult GetDatatables() { 194 try { 195 var model = Session["jobDetails"] as JobDetailsModel; 196 var dts = new DatatableContainer(); 197 var datatables = new List<string>(); 198 foreach (var param in model.Runs[0].Results) { 199 if (param.Value is DecimalMatrix) { 200 datatables.Add(param.Value.Name); 201 } 202 } 203 204 dts.Datatables = datatables.ToArray(); 205 206 return Json(dts, JsonRequestBehavior.AllowGet); 207 } 208 catch (Exception e) { 209 Trace.TraceError(e.Message); 210 } 211 Response.StatusCode = 400; 212 Response.Status = "Session timed out or "; 213 return Json("error", JsonRequestBehavior.AllowGet); 214 } 215 216 [HttpGet] 217 public JsonResult GetRowNames(string datatable) { 218 var model = Session["jobDetails"] as JobDetailsModel; 219 try { 220 foreach (var param in model.Runs[0].Results) { 221 if (param.Value.Name == datatable) { 222 var matrix = param.Value as DecimalMatrix; 223 224 var rowNames = new RowNameContainer() { 225 RowNames = new List<string>(matrix.RowNames) 226 }; 227 return Json(rowNames, JsonRequestBehavior.AllowGet); 228 } 229 } 230 } 231 catch(Exception ex) { 232 Trace.WriteLine(ex.Message); 233 } 234 Response.StatusCode = 400; 235 Response.Status = "Session timed out"; 236 return Json("error", JsonRequestBehavior.AllowGet); 237 } 159 238 } 160 239 }
Note: See TracChangeset
for help on using the changeset viewer.