예제 #1
0
 /// <summary>Return a list of extra fields that the definition should read.</summary>
 /// <param name="seriesDefinition">The calling series definition.</param>
 /// <returns>A list of fields - never null.</returns>
 public IEnumerable <string> GetExtraFieldsToRead(SeriesDefinition seriesDefinition)
 {
     return(new string[0]);
 }
예제 #2
0
 /// <summary>Set visual aspects (colour, line type, marker type) of the series definition.</summary>
 /// <param name="seriesDefinition">The definition to paint.</param>
 public void Paint(SeriesDefinition seriesDefinition)
 {
     seriesDefinition.Colour = ColourUtilities.ChangeColorBrightness(seriesDefinition.Colour, seriesDefinition.ColourModifier);
     seriesDefinition.Line   = lineType;
     seriesDefinition.Marker = markerType;
 }
예제 #3
0
        /// <summary>Get a list of all actual series to put on the graph.</summary>
        /// <param name="storage">Storage service (required for access to checkpoint names).</param>
        /// <param name="definitions">Series definitions to be used (allows for caching of data).</param>
        /// <param name="simulationsFilter">Unused simulation names filter.</param>
        public IEnumerable <SeriesDefinition> GetSeriesToPutOnGraph(IStorageReader storage, IEnumerable <SeriesDefinition> definitions, List <string> simulationsFilter = null)
        {
            stats.Clear();
            equationColours.Clear();

            int checkpointNumber = 0;
            List <SeriesDefinition> regressionLines = new List <SeriesDefinition>();

            foreach (var checkpointName in storage.CheckpointNames)
            {
                // Get all x/y data
                List <double> x = new List <double>();
                List <double> y = new List <double>();
                foreach (SeriesDefinition definition in definitions)
                {
                    if (definition.CheckpointName == checkpointName)
                    {
                        if (definition.X is double[] && definition.Y is double[])
                        {
                            x.AddRange(definition.X as IEnumerable <double>);
                            y.AddRange(definition.Y as IEnumerable <double>);
                        }
                    }
                }

                if (ForEachSeries)
                {
                    // Display a regression line for each series.
                    // todo - should this also filter on checkpoint name?
                    int numDefinitions = definitions.Count();
                    foreach (SeriesDefinition definition in definitions)
                    {
                        if (definition.X is double[] && definition.Y is double[])
                        {
                            SeriesDefinition regressionSeries = PutRegressionLineOnGraph(definition.X, definition.Y, definition.Colour, null);
                            if (regressionSeries != null)
                            {
                                regressionLines.Add(regressionSeries);
                                equationColours.Add(definition.Colour);
                            }
                        }
                    }
                }
                else
                {
                    var regresionLineName = "Regression line";
                    if (checkpointName != "Current")
                    {
                        regresionLineName = "Regression line (" + checkpointName + ")";
                    }

                    // Display a single regression line for all data.
                    SeriesDefinition regressionSeries = PutRegressionLineOnGraph(x, y, ColourUtilities.ChooseColour(checkpointNumber), regresionLineName);
                    if (regressionSeries != null)
                    {
                        regressionLines.Add(regressionSeries);
                        equationColours.Add(ColourUtilities.ChooseColour(checkpointNumber));
                    }
                }

                if (showOneToOne)
                {
                    regressionLines.Add(Put1To1LineOnGraph(x, y));
                }

                checkpointNumber++;
            }

            return(regressionLines);
        }
예제 #4
0
 /// <summary>A static setter function for marker from an index</summary>
 /// <param name="definition">The series definition to change.</param>
 /// <param name="index">The index</param>
 public static void SetMarker(SeriesDefinition definition, int index)
 {
     definition.Marker = (MarkerType)Enum.GetValues(typeof(MarkerType)).GetValue(index);
 }
예제 #5
0
 /// <summary>A static setter function for line type from an index</summary>
 /// <param name="definition">The series definition to change.</param>
 /// <param name="index">The index</param>
 public static void SetLineType(SeriesDefinition definition, int index)
 {
     definition.Line = (LineType)Enum.GetValues(typeof(LineType)).GetValue(index);
 }
예제 #6
0
 /// <summary>A static setter function for colour from an index.</summary>
 /// <param name="definition">The series definition to change.</param>
 /// <param name="index">The colour index into the colour palette.</param>
 public static void SetColour(SeriesDefinition definition, int index)
 {
     definition.Colour = ColourUtilities.ChangeColorBrightness(ColourUtilities.Colours[index], definition.ColourModifier);
 }