Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PlotLineArea.cs
1using System;
3
5{
9 public class PlotLineArea : PlotLine
10 {
16 : base(Model)
17 {
18 }
19
25 public PlotLineArea(Model Model, string Color)
26 : base(Model, Color)
27 {
28 }
29
34 public override void Add(Statistic Record)
35 {
36 if (Record.Mean.HasValue)
37 {
38 this.AddPoint(this.GetStartTime(Record), Record.Mean.Value);
39 this.AddPoint(this.GetStopTime(Record), Record.Mean.Value);
40 }
41 else if (Record.Count > 0)
42 {
43 this.AddPoint(this.GetStartTime(Record), Record.Count);
44 this.AddPoint(this.GetStopTime(Record), Record.Count);
45 }
46 else
47 this.Break();
48 }
49
54 public override string GetPlotScript()
55 {
56 this.Break();
57
58 int i;
59
60 for (i = 1; i < this.Index; i++)
61 {
62 if (i > 1)
63 this.graph.Append('+');
64
65 this.graph.Append("plot2dlinearea(x");
66 this.graph.Append(i.ToString());
67 this.graph.Append(",y");
68 this.graph.Append(i.ToString());
69 this.graph.Append(",alpha(\"");
70 this.graph.Append(this.Color);
71 this.graph.AppendLine("\",16))");
72 }
73
74 if (this.Index > 1)
75 this.graph.Append('+');
76
77 return base.GetPlotScript();
78 }
79 }
80}
Root node of a simulation model
Definition: Model.cs:49
double GetStopTime(Statistic Record)
Gets the stop time of a statistic.
Definition: Plot.cs:37
double GetStartTime(Statistic Record)
Gets the start time of a statistic.
Definition: Plot.cs:27
override string GetPlotScript()
Gets the plot script
Definition: PlotLineArea.cs:54
override void Add(Statistic Record)
Adds a statistic to the plot.
Definition: PlotLineArea.cs:34
PlotLineArea(Model Model)
Plots a line area graph
Definition: PlotLineArea.cs:15
PlotLineArea(Model Model, string Color)
Plots a line area graph
Definition: PlotLineArea.cs:25
void AddPoint(double X, double Y)
Adds a point to the graph.
Definition: PlotLine.cs:84
override void Break()
Breaks the graph.
Definition: PlotLine.cs:101
readonly StringBuilder graph
Graph being built.
Definition: PlotLine.cs:21
Represents collected statistical information from a small portion of time.
Definition: Statistic.cs:12
long Count
Number of events
Definition: Statistic.cs:97