Example #1
0
        public static void Renderer(Plotter plotter, string pathToRmdTemplate)
        {
            if (Path.GetExtension(pathToRmdTemplate).ToLower() != ".rmd")
            {
                return;
            }

            string launcherScript = Path.ChangeExtension(Path.GetTempFileName(), ".r");
            string renderOutput   = Path.ChangeExtension(Path.GetTempFileName(), ".htm");

            using (var sw = new StreamWriter(launcherScript))
            {
#if false
                sw.WriteLine("rmarkdown::render(\"{0}\", output_file=\"{1}\")",
                             fullPath.Replace("\\", "/"),
                             renderOutput.Replace("\\", "/"));
                sw.WriteLine("browseURL(\"{0}\")",
                             renderOutput.Replace("\\", "/"));
#else
                sw.WriteLine("library(rmarkdown)");
                sw.WriteLine("render(\"{0}\", output_file=\"{1}\")",
                             pathToRmdTemplate.Replace("\\", "/"),
                             renderOutput.Replace("\\", "/"));
                sw.WriteLine("browseURL(\"{0}\")",
                             renderOutput.Replace("\\", "/"));
#endif
                sw.Flush();

                // open launcher script with R renderer
                PlotterRenderR.Renderer(plotter, launcherScript);
            }
        }
Example #2
0
        private void Initialize_Once(object sender, EventArgs e)
        {
            _dispatcherTimer.Tick -= Initialize_Once;

            CheckSettings();
            PopulateAlgorithmMenu();
            LoadMostRecentAlgorithm();

            // register various plotter renderers
            PlotterRenderExcel.Register();
            PlotterRenderCSharp.Register();
            PlotterRenderR.Register();
            PlotterRenderRMarkdown.Register();
        }