コード例 #1
0
        private void AddPlotToGraph(PlotInfo plot)
        {
            AllPlots.Add(plot);
            _plotsList.Add(plot.Metadata);

            plotsListBox.DataSource = null;
            plotsListBox.DataSource = _plotsList;
        }
コード例 #2
0
        private void removePlotBTN_Click(object sender, EventArgs e)
        {
            var selected = plotsListBox.SelectedIndex;

            AllPlots.RemoveAt(selected);
            _plotsList.RemoveAt(selected);
            plotsListBox.DataSource = null;
            plotsListBox.DataSource = _plotsList;
        }
コード例 #3
0
        private string GenerateAdditionalPlots()
        {
            if (AllPlots.Count <= 1)
            {
                return("");                     //no additional plots to add.
            }
            var sb = new StringBuilder();

            foreach (var plot in AllPlots.Skip(1))
            {
                sb.Append($"data <- read.table(\"{plot.InputFilePath.Replace(@"\","/")}\", header=T, sep=\",\");\n");
                sb.Append($"lines(data${plot.DomainDataColumnName.Replace(@"(", ".").Replace(@")", ".")}, data${plot.RangeDataColumnName.Replace(@"(", ".").Replace(@")", ".")}, xlim = c({plot.DomainMin}, {plot.DomainMax}), ylim = c({plot.RangeMin},{plot.RangeMax}),type = \"{plot.GraphType.Substring(0, 1).ToLower()}\", col = \"{plot.PlotColor}\");\n");
            }
            return(sb.ToString());
        }
コード例 #4
0
        private string FixRScript(string template)
        {
            var fixedContents = template;

            fixedContents = fixedContents.Replace("__xLabel__", xAxisLabelTXT.Text);
            fixedContents = fixedContents.Replace("__yLabel__", yAxisLabelTXT.Text);
            fixedContents = fixedContents.Replace("__Title__", graphTitleTXT.Text);
            fixedContents = fixedContents.Replace("__Subtitle__", graphSubtitleTXT.Text);
            fixedContents = fixedContents.Replace("__GraphWidth__", graphLengthTXT.Text);
            fixedContents = fixedContents.Replace("__GraphHeight__", graphHeightTXT.Text);
            fixedContents = fixedContents.Replace("__LabelColor__", colorCMB.Text);
            fixedContents = fixedContents.Replace("__LabelSize__", labelSizeTXT.Text);

            //fix the first plot settings...
            var firstPlot = AllPlots.First();

            fixedContents = fixedContents.Replace("__FirstPlotPath__", firstPlot.InputFilePath.Replace(@"\", "/"));
            fixedContents = fixedContents.Replace("__FirstPlotGraphType__", firstPlot.GraphType.Substring(0, 1).ToLower());
            fixedContents = fixedContents.Replace("__FirstPlotColor__", firstPlot.PlotColor);
            fixedContents = fixedContents.Replace("__FirstPlotDomainDataColumnName__", firstPlot.DomainDataColumnName.Replace(@"(", ".").Replace(@")", "."));
            fixedContents = fixedContents.Replace("__FirstPlotDomainMin__", firstPlot.DomainMin.ToString());
            fixedContents = fixedContents.Replace("__FirstPlotDomainMax__", firstPlot.DomainMax.ToString());
            fixedContents = fixedContents.Replace("__FirstPlotDomainHashPeriod__", firstPlot.DomainHashPeriod.ToString());
            fixedContents = fixedContents.Replace("__FirstPlotRangeDataColumnName__", firstPlot.RangeDataColumnName.Replace(@"(", ".").Replace(@")", "."));
            fixedContents = fixedContents.Replace("__FirstPlotRangeMin__", firstPlot.RangeMin.ToString());
            fixedContents = fixedContents.Replace("__FirstPlotRangeMax__", firstPlot.RangeMax.ToString());
            fixedContents = fixedContents.Replace("__FirstPlotRangeHashPeriod__", firstPlot.RangeHashPeriod.ToString());

            //get a filename from the user...
            fixedContents = fixedContents.Replace("__OutputFilePath__", GetSavedGraphPath().Replace(@"\", "/"));
            fixedContents = fixedContents.Replace("__OutputExtension__", Path.GetExtension(_saveFilePath));

            //add additional plot commands to graphing script
            fixedContents = fixedContents.Replace("##PLOT ADDITIONS##", GenerateAdditionalPlots());


            return(fixedContents);
        }