Exemplo n.º 1
0
        //Зберігає графік в форматі png
        private void pngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //if there is no graph drawn show error message
            if ((Graph.graphList != null) && (!Graph.graphList.Any()))
            {
                string message = rm.GetString("NoGraph");
                string title   = rm.GetString("Error");
                MessageBox.Show(message, title);
            }
            else
            {
                SaveFileDialog saveFile = new SaveFileDialog();
                string         desktop  = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //desktop path
                saveFile.InitialDirectory = desktop;
                saveFile.Filter           = "Image Files(*.png) |*.png;";
                saveFile.Title            = rm.GetString("SaveImg");
                saveFile.FileName         = "graph";
                saveFile.AddExtension     = true;
                saveFile.DefaultExt       = "png";
                saveFile.FilterIndex      = 2;
                saveFile.RestoreDirectory = true;

                if (saveFile.ShowDialog() == DialogResult.OK)
                {
                    var pngExporter = new PngExporter {
                        Width = 600, Height = 400, Background = OxyColors.White
                    };
                    pngExporter.ExportToFile(myModel, saveFile.FileName);
                }
            }
        }
Exemplo n.º 2
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.plot1.Model == null)
            {
                output("Errore: non posso salvare un grafico vuoto");
                return;
            }

            var pngExporter = new PngExporter {
                Width = this.plot1.Width, Height = this.plot1.Height, Background = OxyColors.White
            };

            // Displays a SaveFileDialog so the user can save the Image
            // assigned to Button2.
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "Png Image|*.png";
            saveFileDialog1.Title  = "Save a PNG File";
            saveFileDialog1.ShowDialog();

            // If the file name is not an empty string open it for saving.
            if (saveFileDialog1.FileName != "")
            {
                pngExporter.ExportToFile(this.plot1.Model, saveFileDialog1.FileName);
                output("Successo: grafo salvato correttamente in " + saveFileDialog1.FileName);
            }
            else
            {
                output("Errore: il nome del file non può essere nullo");
            }
        }
Exemplo n.º 3
0
        private static string createPlotImage(TECEstimator estimate)
        {
            string path        = Path.GetTempFileName();
            var    pngExporter = new PngExporter {
                Width = 600, Height = 400, Background = OxyColors.White
            };
            PlotModel plotModel = new PlotModel {
                Title = "Cost Distribution"
            };

            OxyPlot.Series.PieSeries pieSeries = new OxyPlot.Series.PieSeries {
                StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0
            };
            pieSeries.Slices.Add(new PieSlice("Material Cost", estimate.TECMaterialCost)
            {
                IsExploded = false
            });
            pieSeries.Slices.Add(new PieSlice("Labor Cost", estimate.TECLaborCost)
            {
                IsExploded = false
            });
            pieSeries.Slices.Add(new PieSlice("Sub. Labor Cost", estimate.SubcontractorLaborCost)
            {
                IsExploded = false
            });
            pieSeries.Slices.Add(new PieSlice("Sub. Material Cost", estimate.ElectricalMaterialCost)
            {
                IsExploded = false
            });
            plotModel.Series.Add(pieSeries);

            pngExporter.ExportToFile(plotModel, path);
            return(path);
        }
Exemplo n.º 4
0
        private void HourGraph(int[] input, string filename)
        {
            if (input.Length != 24)
            {
                return;
            }

            PlotModel      plot   = new PlotModel();
            var            series = new OxyPlot.Series.BarSeries();
            List <BarItem> l      = new List <BarItem>();

            for (int i = 0; i < 24; i++)
            {
                l.Add(new BarItem(value: input[23 - i]));
            }
            series.ItemsSource    = l;
            series.LabelPlacement = LabelPlacement.Inside;

            plot.Series.Add(series);
            plot.Axes.Add(new OxyPlot.Axes.CategoryAxis
            {
                ItemsSource = new string[] { "12AM", "11PM", "10PM", "9PM", "8PM", "7PM", "6PM", "5PM", "4PM", "3PM", "2PM", "1PM", "12PM", "11AM", "10AM", "9AM", "8AM", "7AM", "6AM", "5AM", "4AM", "3AM", "2AM", "1AM", },
                Key         = "HourAxis",
                Position    = AxisPosition.Left
            });

            var png = new PngExporter {
                Width = 600, Height = 600
            };

            png.ExportToFile(plot, filename + ".png");
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            IViewContent   view            = WorkbenchSingleton.Workbench.ActiveViewContent;
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = @"C:\";
            saveFileDialog1.Title            = "Save Plot Files";
            saveFileDialog1.CheckFileExists  = false;
            saveFileDialog1.CheckPathExists  = true;
            saveFileDialog1.DefaultExt       = "png";
            saveFileDialog1.Filter           = "PNG Image|*.png|JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
            saveFileDialog1.FilterIndex      = 2;
            saveFileDialog1.RestoreDirectory = true;

            var pngExporter = new PngExporter {
                Width = Convert.ToInt32(comboBox1.Text), Height = Convert.ToInt32(comboBox2.Text), Background = OxyColors.White
            };


            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = saveFileDialog1.FileName;
                pngExporter.ExportToFile((view.Control as MapStatistics)._pm, fileName);
            }
        }
Exemplo n.º 6
0
        private void StoreDiagram(int width, int height, string filename)
        {
            int step = width / (Nodes.Count + 1);

            PlotModel model = new PlotModel();



            LineSeries lineAvg = new LineSeries();


            float x = 0;

            foreach (var node in Nodes)
            {
                lineAvg.Points.Add(new DataPoint(DateTimeAxis.ToDouble(node.Key), node.Value.Avg));
                //log.Info($" point x: {x}  y: {node.Value.Avg}");
                x++;
            }
            model.Axes.Add(new DateTimeAxis()
            {
                StringFormat = "HH:mm", Title = "Время",
                IntervalType = DateTimeIntervalType.Hours
            });

            model.Series.Add(lineAvg);

            PngExporter pngEx = new PngExporter();

            pngEx.ExportToFile(model, filename);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Save an individual plot as a PNG
        /// </summary>
        /// <param name="view">The plot</param>
        /// <param name="directoryName">The name of the archive sub-directory</param>
        /// <param name="baseDir">The archive base directory</param>
        /// <param name="newArchive">Optional argument to delete existing sub-archive</param>
        private void Save(PlotView view, string directoryName, string baseDir, bool newArchive = false)
        {
            var pngExporter = new PngExporter {
                Width = Settings.Default.ImageWidth, Height = Settings.Default.ImageHeight, Background = OxyColors.White
            };
            var archiveDir  = Path.Combine(baseDir, CreateSafeDirectoryName(directoryName));
            var archiveFile = Path.Combine(archiveDir, CreateSafeFileName(view.Model.Title) + ".png");

            if (newArchive)
            {
                if (Directory.Exists(archiveDir))
                {
                    Directory.Delete(archiveDir, true);
                }
                Directory.CreateDirectory(archiveDir);
            }
            else if (!Directory.Exists(archiveDir))
            {
                Directory.CreateDirectory(archiveDir);
            }

            if (File.Exists(archiveFile))
            {
                File.Delete(archiveFile);
            }

            pngExporter.ExportToFile(view.Model, archiveFile);
        }
Exemplo n.º 8
0
        public void MessageGraph(DateTimeOffset[] messages, string OrderID, byte[] bg, byte[] line)
        {
            Array.Sort(messages);

            PlotModel plot = new PlotModel();

            plot.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom, Minimum = DateTimeAxis.ToDouble(messages[0].DateTime), Maximum = DateTimeAxis.ToDouble(DateTime.Now)
            });
            plot.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });
            var lineSeries = new LineSeries {
                Title = "Activity", MarkerType = MarkerType.None, Color = OxyColor.FromArgb(line[3], line[0], line[1], line[2])
            };

            for (int i = 0; i < messages.Length; i++)
            {
                lineSeries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(messages[i].DateTime), i + 1));
            }
            plot.Series.Add(lineSeries);

            var pngExporter = new PngExporter {
                Width = 1800, Height = 600, Background = OxyColor.FromArgb(bg[3], bg[0], bg[1], bg[2])
            };

            pngExporter.ExportToFile(plot, OrderID + ".png");
        }
Exemplo n.º 9
0
        public void CompareGraph(List <List <DateTimeOffset> > messages, string interval, string OrderID, byte[] bg, string[] names, double repeat)
        {
            PlotModel plot = new PlotModel();

            plot.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom, Maximum = DateTimeAxis.ToDouble(DateTime.Now)
            });
            plot.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });

            int step = 0;

            foreach (List <DateTimeOffset> submessages in messages)
            {
                OxyColor   color  = OxyColor.FromHsv(25 * step + 25, 75, 100);
                LineSeries result = internal_ActivityGraph(submessages.ToArray(), interval, color, repeat);
                if (result == null)
                {
                    continue;
                }
                else
                {
                    result.Title = names[step] + " - " + result.Points.Count + " Datapoints";
                    plot.Series.Add(result);
                }
                step++;
            }

            var pngExporter = new PngExporter {
                Width = 1800, Height = 600, Background = OxyColor.FromArgb(bg[3], bg[0], bg[1], bg[2])
            };

            pngExporter.ExportToFile(plot, OrderID + ".png");
        }
Exemplo n.º 10
0
        public void ExportImage(PlotModel model, string path, int height, int width)
        {
            var exporter = new PngExporter {
                Height = height, Width = width
            };

            exporter.ExportToFile(model, path);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Saves the graph as a .png
        /// </summary>
        /// <param name="path"></param>
        private void SaveAsPNG(string path)
        {
            PngExporter pngExporter = new PngExporter {
                Width = (int)this.ActualWidth, Height = (int)this.ActualHeight, Background = OxyColors.White
            };

            pngExporter.ExportToFile(Model, path);
        }
Exemplo n.º 12
0
        private void ActivityGraph(List <DateTimeOffset> messages, TimeSpan interval, string filename)
        {
            TimeSpan Interval = interval;

            if (interval.TotalHours < 1)
            {
                Interval = new TimeSpan(interval.Minutes * 30, 0, 0, 0);
            }
            List <DateTimeOffset> orderedMsg = messages.OrderBy(item => item).ToList();
            TimeSpan difference = orderedMsg.Last().Subtract(orderedMsg.First());
            int      r          = divideTimeSpan(Interval, difference) + 1;

            int[] vals = new int[r];

            foreach (DateTimeOffset msg in orderedMsg)
            {
                try
                {
                    if (msg == orderedMsg.First())
                    {
                        vals[0]++;
                    }
                    int currentQuotient = divideTimeSpan(Interval, msg.Subtract(orderedMsg.First()));
                    vals[currentQuotient]++;
                }
                catch (Exception ex)
                {
                    continue;
                }
            }

            PlotModel plot = new PlotModel();

            plot.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom, Minimum = DateTimeAxis.ToDouble(orderedMsg.Last().DateTime), Maximum = DateTimeAxis.ToDouble(orderedMsg.First().DateTime)
            });
            plot.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Minimum = 0
            });
            var lineSeries = new LineSeries {
                MarkerType = MarkerType.Diamond
            };
            DateTimeOffset c = orderedMsg.First();

            for (int i = 0; i < r; i++)
            {
                lineSeries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(c.DateTime), vals[i]));
                c = c.Add(Interval);
            }
            plot.Series.Add(lineSeries);

            var pngExporter = new PngExporter {
                Width = 1800, Height = 600
            };

            pngExporter.ExportToFile(plot, filename + ".png");
        }
Exemplo n.º 13
0
        public void ExportToFile()
        {
            var plotModel = TestModels.CreateTestModel1();
            const string FileName = "PngExporterTests_Plot1.png";
            var exporter = new PngExporter { Width = 400, Height = 300 };
            exporter.ExportToFile(plotModel, FileName);

            Assert.IsTrue(File.Exists(FileName));
        }
Exemplo n.º 14
0
        public static void ExportToPng(PlotModel model, string path, int width, int height)
        {
            var ex = new PngExporter()
            {
                Width  = width,
                Height = height
            };

            ex.ExportToFile(model, path);
        }
Exemplo n.º 15
0
        private void TabItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var thisTab = (TabItem)sender;

            var pngExporter = new PngExporter {
                Width = 600, Height = 400, Background = OxyColors.White
            };

            pngExporter.ExportToFile(((Plot)thisTab.Content).ActualModel, "C:\\Users\\marcigo\\Desktop\\szakdoga\\diploma\\figures\\" + (string)thisTab.Header + "_plot.png");
        }
Exemplo n.º 16
0
 public void Export()
 {
     if (Path.EndsWith(".png"))
     {
         var pngExporter = new PngExporter {
             Width = 600, Height = 400, Background = OxyColors.White
         };
         pngExporter.ExportToFile(MyModel, Path);
     }
 }
        private void menuSaveAsPng_Click(object sender, RoutedEventArgs e)
        {
            string fileName = SaveFile("", "Kaydet", "İmaj dosyası (*.png)|*.png");

            if (!string.IsNullOrEmpty(fileName))
            {
                var pngExporter = new PngExporter {
                    Width = 600, Height = 400, Background = OxyColors.White
                };
                pngExporter.ExportToFile(PlotView.Model, fileName);
            }
        }
Exemplo n.º 18
0
        public void ExportToFile()
        {
            var          plotModel = CreateTestModel1();
            const string FileName  = "PngExporterTests_Plot1.png";
            var          exporter  = new PngExporter {
                Width = 400, Height = 300
            };

            exporter.ExportToFile(plotModel, FileName);

            Assert.IsTrue(File.Exists(FileName));
        }
Exemplo n.º 19
0
        private void exportMail(object sender, RoutedEventArgs e)
        {
            MailPopUP inputDialog = new MailPopUP();
            var       pngExporter = new PngExporter {
                Height = 600, Width = 900, Background = OxyColors.White
            };
            string pathToFile = "../../Data_Oxyplot.png";

            pngExporter.ExportToFile(this.model.oxyplotgraph, pathToFile);

            inputDialog.ShowDialog();
        }
Exemplo n.º 20
0
 public void Export()
 {
     if (Path.EndsWith(".png"))
     {
         var pngExporter = new PngExporter
         {
             Width      = Settings.Sizes.Width,
             Height     = Settings.Sizes.Height,
             Background = OxyColor.FromArgb(Settings.GraphColor.A, Settings.GraphColor.R, Settings.GraphColor.G, Settings.GraphColor.B)
         };
         pngExporter.ExportToFile(MyModel, Path);
     }
 }
Exemplo n.º 21
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            PngExporter x      = new PngExporter();
            var         dialog = new SaveFileDialog()
            {
                Filter = "Image Files (*.png)|*.png;"
            };

            if (dialog.ShowDialog() == true)
            {
                x.ExportToFile(StatModel, dialog.FileName);
            }
        }
Exemplo n.º 22
0
        private void saveData_Click(object sender, EventArgs e)
        {
            ClosePort();
            UpdateStatus();

            try
            {
                var dialog = new SaveFileDialog();
                dialog.InitialDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
                dialog.Filter           = "bin (*.bin)|*.bin|png (*.png)|*.png";
                dialog.FilterIndex      = 1;
                dialog.RestoreDirectory = true;
                dialog.CheckFileExists  = false;

                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (dialog.FileName.Contains(".png"))
                    {
                        var pngExporter = new PngExporter {
                            Width = oxyView.Width, Height = oxyView.Height, Background = OxyColors.White
                        };
                        pngExporter.ExportToFile(_oxyPlot, dialog.FileName);
                    }
                    else if (dialog.FileName.Contains(".bin"))
                    {
                        using (var writer = new BinaryWriter(new FileStream(dialog.FileName, FileMode.OpenOrCreate, FileAccess.Write)))
                        {
                            writer.Write((UInt32)_dataPsi.Points.Count);
                            writer.Write((UInt32)_dataCas2.Points.Count);

                            foreach (var pt in _dataPsi.Points)
                            {
                                writer.Write((float)pt.X);
                                writer.Write((float)pt.Y);
                            }

                            foreach (var pt in _dataCas2.Points)
                            {
                                writer.Write((float)pt.X);
                                writer.Write((float)pt.Y);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 23
0
        private void OnExport()
        {
            _fileDialog.SaveFileDialog.Filter = "PNG|*.png";
            _fileDialog.SaveFileDialog.Title  = GradeChart.Title;

            if (_fileDialog.SaveFileDialog.ShowDialog() == true)
            {
                var pngExporter = new PngExporter {
                    Width = 1920, Height = 1080, Background = OxyColors.White
                };

                pngExporter.ExportToFile(GradeChart, _fileDialog.SaveFileDialog.FileName);
            }
        }
Exemplo n.º 24
0
        public void TestGraph_Is_Created()
        {
            var plotModel = new PlotModel {
                Title = "Test Plot"
            };

            plotModel.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)"));
            var pngExporter = new PngExporter {
                Width = 1280, Height = 720, Background = OxyColors.White
            };

            pngExporter.ExportToFile(plotModel, $"{OutputPath}/test.png");
            Assert.IsTrue(File.Exists($"{OutputPath}/test.png"));
        }
Exemplo n.º 25
0
        private void pNGToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SelectFolder();

            try
            {
                // Export to PNG
                var pngExporter = new PngExporter {
                    Width = 900, Height = 900, Background = OxyColors.White
                };

                string FileNameTop   = Path.Combine(OutPath, DateTime.Now.ToString("yyyyMMddHHmmss_") + currentSystemName + "_Top".AddSuffixToFilename(".png"));
                string FileNameFront = Path.Combine(OutPath, DateTime.Now.ToString("yyyyMMddHHmmss_") + currentSystemName + "_Front".AddSuffixToFilename(".png"));
                string FileNameSide  = Path.Combine(OutPath, DateTime.Now.ToString("yyyyMMddHHmmss_") + currentSystemName + "_Side".AddSuffixToFilename(".png"));

                pngExporter.ExportToFile(plotViewTop.Model, FileNameTop);
                pngExporter.ExportToFile(plotViewFront.Model, FileNameFront);
                pngExporter.ExportToFile(plotViewSide.Model, FileNameSide);
            }
            catch
            {
            }
        }
Exemplo n.º 26
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;
            }
        }
Exemplo n.º 27
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfg = new SaveFileDialog();

            sfg.AddExtension = true;
            sfg.DefaultExt   = ".png";
            if (sfg.ShowDialog() == DialogResult.OK)
            {
                var pngExporter = new PngExporter {
                    Background = OxyColors.White
                };
                pngExporter.Resolution = 300;
                pngExporter.ExportToFile(dqn_plotView.Model, sfg.FileName);
            }
        }
Exemplo n.º 28
0
 public void Export()
 {
     if (Path.EndsWith(".png"))
     {
         var pngExporter = new PngExporter {
             Width      = GraphWidth, Height = GraphHeight,
             Background = OxyColor.FromArgb(
                 BackgroundColor.A,
                 BackgroundColor.R,
                 BackgroundColor.G,
                 BackgroundColor.B)
         };
         pngExporter.ExportToFile(MyModel, Path);
     }
 }
Exemplo n.º 29
0
        private void save_png_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog()
            {
                Filter = "PNG files (*.png)|*.png|All files (*.*)|*.*"
            };

            if (dialog.ShowDialog() == true)
            {
                var pngExporter = new PngExporter {
                    Width = 600, Height = 400, Background = OxyColors.White
                };
                pngExporter.ExportToFile(((XyPlotViewModel)this.DataContext).OxyPlotModel, dialog.FileName);
                MessageBox.Show("Saved", "SpiceSharpGUI");
            }
        }
Exemplo n.º 30
0
        private void exportPNG(object sender, RoutedEventArgs e)
        {
            var pngExporter = new PngExporter {
                Height = 600, Width = 900, Background = OxyColors.White
            };
            SaveFileDialog saveDialog = new Microsoft.Win32.SaveFileDialog();

            saveDialog.Filter = "PNG Files (*.png)|*.png";
            Nullable <bool> result = saveDialog.ShowDialog();

            if (result == true)
            {
                string filename = saveDialog.FileName;
                pngExporter.ExportToFile(this.model.oxyplotgraph, filename);
            }
        }
Exemplo n.º 31
0
        private void SaveData()
        {
            string   csv         = null;
            string   csv1        = null;
            string   csv2        = null;
            DateTime dt          = DateTime.Now;
            string   filename    = ".\\Saved\\csv\\" + dt.ToString("dd_MM_yyyy_hh_mm") + ".csv";
            string   imgfilename = ".\\Saved\\png\\" + dt.ToString("dd_MM_yyyy_hh_mm") + ".png";

            try
            {
                for (int i = 0; i < SampleCount; i++)
                {
                    csv += ChannelAVoltage[i].ToString() + "  ;  " + ChannelBVoltage[i].ToString() + "\r\n";
                }
                if (ka == true)
                {
                    for (int i = 0; i < inpA.Length; i++)
                    {
                        csv1 += inpA[i].ToString() + "\r\n";
                    }
                }
                if (kb == true)
                {
                    for (int i = 0; i < inpB.Length; i++)
                    {
                        csv2 += inpB[i].ToString() + "\r\n";
                    }
                }
                File.AppendAllText(@filename, "Channel A  ;  Channel B\r\n" + csv, Encoding.UTF8);
                File.AppendAllText(@filename, "Vrms A;  Freq A;  Vrms B;  Freq B\r\n" + LabelRMSAV.Text + ";  " + LabelFreqAV.Text + ";  " + LabelRMSBV.Text + ";  " + LabelFreqBV.Text + "\r\n\n", Encoding.UTF8);
                File.AppendAllText(@filename, "Text FFT Channel A\r\n" + csv1 + "\r\n\n", Encoding.UTF8);
                File.AppendAllText(@filename, "Text FFT Channel B\r\n" + csv2 + "\r\n\n", Encoding.UTF8);
                //File.AppendAllText(@filename, "FFT Kênh A Bậc 1 - 4\r\n" + csv11 + "\r\n\n", Encoding.UTF8);
                //File.AppendAllText(@filename, "FFT Kênh B Bậc 1 - 4\r\n" + csv22 + "\r\n\n", Encoding.UTF8);

                var pngExporter = new PngExporter {
                    Width = 900, Height = 480, Background = OxyColors.White
                };
                pngExporter.ExportToFile(Scope.Model, imgfilename);
            }
            catch
            {
            }
        }