Beispiel #1
0
        private static List <DoubleColumn> GetColumnListFromPlotItemCollection(Altaxo.Graph.Gdi.Plot.PlotItemCollection plotItemCollection)
        {
            var flattenedContent = plotItemCollection.Flattened;
            var columnList       = new List <DoubleColumn>();

            foreach (var item in flattenedContent)
            {
                if (item is Gdi.Plot.XYColumnPlotItem)
                {
                    var yCol = ((Gdi.Plot.XYColumnPlotItem)item).XYColumnPlotData.YColumn;
                    if (yCol is DoubleColumn)
                    {
                        columnList.Add((DoubleColumn)yCol);
                    }
                }
            }
            return(columnList);
        }
Beispiel #2
0
        /// <summary>
        /// Executes the 'Plot common column' command.
        /// </summary>
        public void Execute()
        {
            Altaxo.Gui.Graph.Gdi.Viewing.IGraphController graphctrl;
            Altaxo.Graph.Gdi.GraphDocument graph;

            var commonFolderName = Main.ProjectFolder.GetCommonFolderOfNames(_tables.Select(table => table.Name));

            graph = Altaxo.Graph.Gdi.GraphTemplates.TemplateWithXYPlotLayerWithG2DCartesicCoordinateSystem.CreateGraph(
                PropertyExtensions.GetPropertyContextOfProjectFolder(commonFolderName),
                null,
                commonFolderName,
                true);

            var layer = graph.GetFirstXYPlotLayer();

            graphctrl = Current.ProjectService.CreateNewGraph(graph);
            var context = graph.GetPropertyContext();

            var templateStyle = Altaxo.Worksheet.Commands.PlotCommands.PlotStyle_Line(context);

            var processedColumns = new HashSet <Altaxo.Data.DataColumn>();

            foreach (string colname in _yCommonColumnNamesForPlotting)
            {
                // first create the plot items
                var columnList = new List <DataColumn>();
                foreach (var table in _tables)
                {
                    columnList.Add(table[colname]);
                }

                var plotItemList = Altaxo.Worksheet.Commands.PlotCommands.CreatePlotItems(columnList, XCommonColumnNameForPlot, templateStyle, processedColumns, context);

                var plotGroup = new Altaxo.Graph.Gdi.Plot.PlotItemCollection();
                plotGroup.GroupStyles.Add(Altaxo.Graph.Plot.Groups.ColorGroupStyle.NewExternalGroupStyle());
                plotGroup.AddRange(plotItemList);
                layer.PlotItems.Add(plotGroup);
            }
        }
		/// <summary>
		/// Executes the 'Plot common column' command.
		/// </summary>
		public void Execute()
		{
			Altaxo.Gui.Graph.Gdi.Viewing.IGraphController graphctrl;
			Altaxo.Graph.Gdi.GraphDocument graph;

			var commonFolderName = Main.ProjectFolder.GetCommonFolderOfNames(_tables.Select(table => table.Name));
			graph = Altaxo.Graph.Gdi.GraphTemplates.TemplateWithXYPlotLayerWithG2DCartesicCoordinateSystem.CreateGraph(
					PropertyExtensions.GetPropertyContextOfProjectFolder(commonFolderName),
					null,
					commonFolderName,
					true);

			var layer = graph.GetFirstXYPlotLayer();
			graphctrl = Current.ProjectService.CreateNewGraph(graph);
			var context = graph.GetPropertyContext();

			var templateStyle = Altaxo.Worksheet.Commands.PlotCommands.PlotStyle_Line(context);

			var processedColumns = new HashSet<Altaxo.Data.DataColumn>();
			foreach (string colname in _yCommonColumnNamesForPlotting)
			{
				// first create the plot items
				var columnList = new List<DataColumn>();
				foreach (var table in _tables)
					columnList.Add(table[colname]);

				var plotItemList = Altaxo.Worksheet.Commands.PlotCommands.CreatePlotItems(columnList, XCommonColumnNameForPlot, templateStyle, processedColumns, context);

				var plotGroup = new Altaxo.Graph.Gdi.Plot.PlotItemCollection();
				plotGroup.GroupStyles.Add(Altaxo.Graph.Plot.Groups.ColorGroupStyle.NewExternalGroupStyle());
				plotGroup.AddRange(plotItemList);
				layer.PlotItems.Add(plotGroup);
			}
		}