Ejemplo n.º 1
0
        public void Export(string outputFolder, ref Dictionary <string, string> outputFiles)
        {
            string baseFilename = outputFolder + "/" + Herd.Utils.RemoveSpecialCharacters(name);

            //1st save in common formats: png and svg
            string fileName;

            //as png
            fileName = baseFilename + ".png";
            var pngExporter = new PngExporter {
                Width = 600, Height = 400, Background = OxyColors.Transparent
            };

            pngExporter.ExportToFile(Plot, fileName);
            //as svg
            fileName = baseFilename + ".svg";
            var svgExporter = new OxyPlot.Wpf.SvgExporter {
                Width = 600, Height = 400
            };

            svgExporter.ExportToFile(Plot, fileName);

            //2nd save data from the model for importing
            fileName = baseFilename + Herd.Files.Extensions.PlotDataExtension;

            using (TextWriter writer = File.CreateText(fileName))
            {
                writer.WriteLine("<" + XMLTags.PlotNodeTag + " "
                                 + XMLTags.nameAttribute + "=\"" + Herd.Utils.RemoveSpecialCharacters(name) + "\">");
                foreach (OxyPlot.Series.LineSeries lineSeries in Plot.Series)
                {
                    writer.WriteLine("  <" + XMLTags.LineSeriesTag + " " + XMLTags.nameAttribute + "=\"" + lineSeries.Title + "\">");

                    foreach (DataPoint dataPoint in lineSeries.Points)
                    {
                        writer.WriteLine("    <" + XMLTags.DataPointTag + ">");
                        writer.WriteLine("      <" + XMLTags.DataPointXTag + ">" + dataPoint.X + "</" + XMLTags.DataPointXTag + ">");
                        writer.WriteLine("      <" + XMLTags.DataPointYTag + ">" + dataPoint.Y + "</" + XMLTags.DataPointYTag + ">");
                        writer.WriteLine("    </" + XMLTags.DataPointTag + ">");
                    }

                    writer.WriteLine("  </" + XMLTags.LineSeriesTag + ">");
                }
                writer.WriteLine("</" + XMLTags.PlotNodeTag + ">");

                string relPlotFilename = Herd.Utils.RemoveSpecialCharacters(name) + Herd.Files.Extensions.PlotDataExtension;
                outputFiles[relPlotFilename] = XMLTags.PlotNodeTag;
            }
        }
Ejemplo n.º 2
0
        public override void export(string outputFolder)
        {
            string fileName;

            //as png
            fileName = outputFolder + "/" + name + ".png";
            var pngExporter = new PngExporter {
                Width = 600, Height = 400, Background = OxyColors.Transparent
            };

            pngExporter.ExportToFile(m_plot, fileName);
            //as svg
            fileName = outputFolder + "/" + name + ".svg";
            var svgExporter = new OxyPlot.Wpf.SvgExporter {
                Width = 600, Height = 400
            };

            svgExporter.ExportToFile(m_plot, fileName);
        }
Ejemplo n.º 3
-1
 public void export(string outputFolder)
 {
     string fileName;
     //as png
     fileName = outputFolder + "/" + name + ".png";
     var pngExporter = new PngExporter { Width = 600, Height = 400, Background = OxyColors.Transparent };
     pngExporter.ExportToFile(m_plot, fileName);
     //as svg
     fileName = outputFolder + "/" + name + ".svg";
     var svgExporter = new OxyPlot.Wpf.SvgExporter { Width = 600, Height = 400 };
     svgExporter.ExportToFile(m_plot, fileName);
 }