Exemplo n.º 1
0
        /// <summary>A list of all descriptor names that can be listed as 'vary by' in markers/line types etc.</summary>
        public IEnumerable <string> GetDescriptorNames(IStorageReader reader)
        {
            var simulationDescriptions = GraphPage.FindSimulationDescriptions(this);
            var names = new List <string>();

            foreach (var simulationDescription in simulationDescriptions)
            {
                names.AddRange(simulationDescription.Descriptors.Select(d => d.Name));
            }
            names.Add("Graph series");

            // Add all string and integer fields to descriptor names.
            foreach (var column in reader.GetColumns(TableName))
            {
                if (column.Item2 == typeof(string) || column.Item2 == typeof(int))
                {
                    if (column.Item1 != "CheckpointID" && column.Item1 != "SimulationID")
                    {
                        names.Add(column.Item1);
                    }
                }
            }

            return(names.Distinct());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get all series definitions using the GraphPage API - which will
        /// load the series' data in parallel.
        /// </summary>
        private IEnumerable <SeriesDefinition> GetSeriesDefinitions()
        {
            // Using the graphpage API - this will load each series' data in parallel.
            GraphPage page = new GraphPage();

            page.Graphs.Add(this);
            return(page.GetAllSeriesDefinitions(Parent, FindInScope <IDataStore>()?.Reader).FirstOrDefault()?.SeriesDefinitions);
        }
Exemplo n.º 3
0
        private IEnumerable <APSIM.Shared.Documentation.Graph> GetChildGraphs()
        {
            var graphs = new List <APSIM.Shared.Documentation.Graph>();
            var page   = new Models.GraphPage();

            page.Graphs.AddRange(FindAllChildren <Models.Graph>().Where(g => g.Enabled));
            var storage = FindInScope <Models.Storage.IDataStore>();

            foreach (var map in page.GetAllSeriesDefinitions(this, storage.Reader))
            {
                try
                {
                    graphs.Add(map.Graph.ToGraph(map.SeriesDefinitions));
                }
                catch (Exception err)
                {
                    Console.Error.WriteLine(err);
                }
            }
            return(graphs);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets a list of names of simulations in scope.
 /// </summary>
 /// <returns></returns>
 public string[] GetValidSimNames()
 {
     return(GraphPage.FindSimulationDescriptions(FindAncestor <Series>())?.Select(s => s.Name)?.ToArray());
 }