Exemplo n.º 1
0
        /// <summary>
        /// Creates a report for the plot.
        /// </summary>
        /// <returns>
        /// A report.
        /// </returns>
        public Report CreateReport()
        {
            var r = new Report {
                Culture = CultureInfo.InvariantCulture
            };

            r.AddHeader(1, "P L O T   R E P O R T");
            r.AddHeader(2, "=== PlotModel ===");
            r.AddPropertyTable("PlotModel", this);

            r.AddHeader(2, "=== Axes ===");
            foreach (Axis a in this.Axes)
            {
                r.AddPropertyTable(a.GetType().Name, a);
            }

            r.AddHeader(2, "=== Annotations ===");
            foreach (var a in this.Annotations)
            {
                r.AddPropertyTable(a.GetType().Name, a);
            }

            r.AddHeader(2, "=== Series ===");
            foreach (var s in this.Series)
            {
                r.AddPropertyTable(s.GetType().Name, s);
                var ds = s as DataPointSeries;
                if (ds != null)
                {
                    var fields = new List <ItemsTableField> {
                        new ItemsTableField("X", "X"), new ItemsTableField("Y", "Y")
                    };
                    r.AddItemsTable("Data", ds.Points, fields);
                }
            }

#if !PCL
            var assemblyName = new AssemblyName(Assembly.GetExecutingAssembly().FullName);
            r.AddParagraph(string.Format("Report generated by OxyPlot {0}", assemblyName.Version.ToString(3)));
#endif

            return(r);
        }