24 using System.Collections.Generic;
    26 using System.Drawing.Drawing2D;
    27 using System.Drawing.Imaging;
    34 namespace Ntp.Analyzer.Graph
    40             this.baseConfig = baseConfig;
    41             destinations = 
new List<StreamDestination>(baseConfig.
Locations);
    44         private static readonly 
object Locker = 
new object();
    48         protected abstract string YLabel { 
get; }
    52         protected TimeSpan GraphTimeSpan => 
new TimeSpan(baseConfig.Timespan, 0, 0, 0);
    54         public string ImageFileExtension => 
"png";
    56         public IEnumerable<StreamDestination> Destinations => destinations;
    60             Surface = 
new PlotSurface2D(baseConfig.Width, baseConfig.Height);
    68             var titleFont = 
new Font(
"Arial", 12);
    69             var axisFont = 
new Font(
"Arial", 10);
    70             var legendFont = 
new Font(
"Arial", 10);
    71             var tickFont = 
new Font(
"Arial", 8);
    75             Surface.Title = baseConfig.Title;
    76             Surface.TitleFont = titleFont;
    77             Surface.SmoothingMode = SmoothingMode.HighQuality;
    78             Surface.BackColor = Color.White;
    79             Surface.Add(
new Grid(), 
NPlot.PlotSurface2D.XAxisPosition.Bottom, 
NPlot.PlotSurface2D.YAxisPosition.Left);
    84             Surface.XAxis1.Label = 
string.Empty;
    85             Surface.XAxis1.LabelFont = axisFont;
    86             Surface.XAxis1.TickTextFont = tickFont;
    87             Surface.XAxis1.TicksLabelAngle = 0;
    88             Surface.XAxis1.TickTextNextToAxis = 
true;
    89             Surface.XAxis1.FlipTicksLabel = 
true;
    90             Surface.XAxis1.LabelOffset = 95;
    91             Surface.XAxis1.LabelOffsetAbsolute = 
true;
    92             Surface.XAxis1.NumberFormat = baseConfig.Timespan <= 2 ? 
"HH" : 
"MMMM d";
    93             Surface.YAxis1.Label = YLabel;
    94             Surface.YAxis1.LabelFont = axisFont;
    95             Surface.YAxis1.LabelOffsetScaled = 
true;
    96             Surface.YAxis1.TickTextFont = tickFont;
    97             Surface.YAxis1.NumberFormat = 
"{0:####0.00}";
    99             if (Surface.YAxis2 != null)
   101                 Surface.YAxis2.Label = 
"Value";
   102                 Surface.YAxis2.LabelFont = axisFont;
   103                 Surface.YAxis2.TickTextFont = tickFont;
   104                 Surface.YAxis2.NumberFormat = 
"{0:####0.00}";
   108             var legend = 
new Legend {Font = legendFont};
   109             legend.AttachTo(
NPlot.PlotSurface2D.XAxisPosition.Top, 
NPlot.PlotSurface2D.YAxisPosition.Left);
   110             legend.VerticalEdgePlacement = Legend.Placement.Inside;
   111             legend.HorizontalEdgePlacement = Legend.Placement.Inside;
   112             legend.BorderStyle = LegendBase.BorderType.Line;
   113             legend.BackgroundColor = Color.White;
   116             Surface.Legend = legend;
   117             Surface.LegendZOrder = 10;
   126             var stream = 
new MemoryStream();
   134                 using (var 
b = 
new Bitmap(baseConfig.Width, baseConfig.Height))
   135                 using (var g = Graphics.FromImage(b))
   137                     g.FillRectangle(
new Pen(Color.White).Brush, 0, 0, b.Width, b.Height);
   138                     Surface.Draw(Graphics.FromImage(b), 
new Rectangle(0, 0, b.Width, b.Height));
   140                     b.Save(stream, ImageFormat.Png);
   150         protected abstract void AddPlots();
   152         protected abstract void LoadData();
   158         protected LinePlot 
SetupPlot(
string name, Color color, IList time, IList data)
   160             var plot = 
new LinePlot
 NPlot.Bitmap.PlotSurface2D PlotSurface2D
 
GraphBase(IGraphBaseConfiguration baseConfig)
 
IEnumerable< StreamDestination > Locations
 
readonly List< StreamDestination > destinations
 
LinePlot SetupPlot(string name, Color color, IList time, IList data)
 
readonly IGraphBaseConfiguration baseConfig