4using System.Threading.Tasks;
26 private readonly
string performanceId;
27 private readonly
int titleId;
28 private readonly
string title;
29 private readonly
string unit;
30 private readonly
string windowSize;
31 private readonly
double? min;
32 private readonly
double? max;
43 this.performanceId = PerformanceId;
44 this.titleId = TitleId;
49 this.windowSize = WindowSize;
50 this.embeddedReports = EmbeddedReports;
53 [Page(1,
"Time", 150)]
55 [ToolTip(3,
"Search for records from this point in time.")]
56 public DateTime From = DateTime.Today.AddDays(-1);
58 [Page(1,
"Time", 150)]
60 [ToolTip(5,
"Search for records to this point in time.")]
61 public DateTime To = DateTime.Today.AddDays(1);
82 return Task.CompletedTask;
95 if (this.embeddedReports is
null || this.embeddedReports.Length == 0)
98 this.performanceId, this.titleId, this.title, this.unit,
99 this.min, this.max, this.windowSize);
103 foreach (SampleStatisticsCommand
Report in this.embeddedReports)
124 DateTime From, DateTime To,
string PerformanceId,
int TitleId,
125 string DefaultTitle,
string Unit,
double? MinValue,
double? MaxValue,
137 List<Filter> Filters =
new List<Filter>()
142 if (From > DateTime.MinValue)
145 if (To < DateTime.MaxValue)
150 IEnumerable<SampleStatistic> Records;
152 if (Filters.Count == 1)
166 const int MaxRecords = 50;
167 bool ShowTable = NrRecords <= MaxRecords;
211 StringBuilder Markdown =
new StringBuilder();
213 Markdown.Append(await
Language.
GetStringAsync(typeof(SampleStatisticsCommand), 18,
"Number of records:"));
214 Markdown.Append(
" **");
215 Markdown.Append(NrRecords.ToString());
216 Markdown.Append(
"**. (");
217 Markdown.Append((await
Language.
GetStringAsync(typeof(SampleStatisticsCommand), 19,
"Table shown if %0% records or less.")).Replace(
"%0%", MaxRecords.ToString()));
218 Markdown.Append(
")");
225 StringBuilder sb =
new StringBuilder();
227 sb.AppendLine(
"StepX:=join([foreach Rec in RS do [Rec.Start,Rec.Stop]]);");
228 sb.AppendLine(
"StepMean:=join([foreach Rec in RS do [Rec.Mean,Rec.Mean]]);");
229 sb.AppendLine(
"RS2:=[Rec in RS:exists(Rec.StdDev)];");
231 if (MinValue.HasValue)
233 sb.Append(
"SubSigma(x,s):=Max(x-s,");
238 sb.AppendLine(
"SubSigma(x,s):=x-s;");
240 if (MaxValue.HasValue)
242 sb.Append(
"AddSigma(x,s):=Min(x+s,");
247 sb.AppendLine(
"AddSigma(x,s):=x+s;");
249 sb.AppendLine(
"G:=sum([foreach Rec in RS do polygon2d([a:=Rec.Start,b:=Rec.Stop,b,a],[a:=Rec.Min,a,b:=Rec.Max,b],'Orange')])+");
250 sb.AppendLine(
"sum([foreach Rec in RS2 do polygon2d([a:=Rec.Start,b:=Rec.Stop,b,a],[a:=SubSigma(Rec.Mean,2*Rec.StdDev),a,b:=AddSigma(Rec.Mean,2*Rec.StdDev),b],'OrangeRed')])+");
251 sb.AppendLine(
"sum([foreach Rec in RS2 do polygon2d([a:=Rec.Start,b:=Rec.Stop,b,a],[a:=SubSigma(Rec.Mean,Rec.StdDev),a,b:=AddSigma(Rec.Mean,Rec.StdDev),b],'Red')])+");
252 sb.AppendLine(
"plot2dline(StepX,StepMean,'Black');");
253 sb.AppendLine(
"G.Title:=Title;");
254 sb.AppendLine(
"G.LabelX:=LabelX;");
255 sb.AppendLine(
"G.LabelY:=LabelY; ");
270 "legend(['Mean ('+WindowSize+')'," +
271 "'±σ ('+WindowSize+')'," +
272 "'±2σ ('+WindowSize+')'," +
273 "'Min-Max ('+WindowSize+')']," +
274 "['Black','Red','OrangeRed','Orange'],'White',4)",
277 {
"WindowSize", WindowSize }
Class that can be used to encapsulate Markdown to be returned from a Web Service, bypassing any encod...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field equal to a given value.
This filter selects objects that have a named field greater or equal to a given value.
This filter selects objects that have a named field lesser than a given value.
ReportNode Report
Report node.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Represents collected statistical information from a small portion of time.
DateTime Stop
End of period.
DateTime Start
Start of period.
long Count
Number of events
Class managing a script expression.
static Task< object > EvalAsync(string Script)
Evaluates script, in string format.
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
const string GraphHeightVariableName
Variable name for graph height
const string GraphWidthVariableName
Variable name for graph width
Unit(Prefix Prefix, ICollection< UnitFactor > Factors)
Represents a unit.
Abstract base class for commands executing a server administrator report.
Abstract base class for server report nodes, requiring admin privileges to be seen and executed.
Defines a column in a table.
Class handling the reception of data from a query.
Task TableDone(string TableId)
Reports a table as being complete.
Task EndSection()
Ends a section. Each call to BeginSection(string) must be followed by a call to EndSection().
Task NewObject(object Object)
Reports a new object.
Task Start()
Starts query execution.
Task NewRecords(string TableId, params Record[] Records)
Reports a new set of records in a table.
Task BeginSection(string Header)
Begins a new section. Sections can be nested. Each call to BeginSection(string) must be followed by a...
Task NewTable(string TableId, string TableName, params Column[] Columns)
Defines a new table in the query output.
Task LogMessage(Exception Exception)
Logs an Exception as a query message.
async Task Done()
Query execution completed.
Task SetStatus(string Status)
Sets the current status of the query execution.
Task SetTitle(string Title)
Sets the title of the report.
Defines a record in a table.
ColumnAlignment
Column alignment.