コード例 #1
0
            public static object SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent, bool nativeCall)
            {
                LabelPlotStyle s = null != o ? (LabelPlotStyle)o : new LabelPlotStyle();

                s._font               = (Font)info.GetValue("Font", s);
                s._independentColor   = info.GetBoolean("IndependentColor");
                s._brush              = (BrushX)info.GetValue("Brush", s);
                s._xOffset            = info.GetDouble("XOffset");
                s._yOffset            = info.GetDouble("YOffset");
                s._rotation           = info.GetDouble("Rotation");
                s.HorizontalAlignment = (System.Drawing.StringAlignment)info.GetEnum("HorizontalAlignment", typeof(System.Drawing.StringAlignment));
                s.VerticalAlignment   = (System.Drawing.StringAlignment)info.GetEnum("VerticalAlignment", typeof(System.Drawing.StringAlignment));
                s.AttachedAxis        = (CSPlaneID)info.GetValue("AttachedAxis", s);
                s._backgroundStyle    = (IBackgroundStyle)info.GetValue("Background", s);
                s._labelColumn        = (Altaxo.Data.ReadableColumnProxy)info.GetValue("LabelColumn", parent);


                if (nativeCall)
                {
                    // restore the cached values
                    s.SetCachedValues();
                    s.CreateEventChain();
                }

                return(s);
            }
コード例 #2
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                LabelPlotStyle s = (LabelPlotStyle)XmlSerializationSurrogate0.SDeserialize(o, info, parent, false);

                s._labelColumn = (Altaxo.Data.ReadableColumnProxy)info.GetValue("LabelColumn", parent);

                // restore the cached values
                s.SetCachedValues();
                s.CreateEventChain();

                return(s);
            }
コード例 #3
0
        public LabelPlotStyle(LabelPlotStyle from)
        {
            this._font               = (Font)from._font.Clone();
            this._independentColor   = from._independentColor;
            this._brush              = (BrushX)from._brush.Clone();
            this._xOffset            = from._xOffset;
            this._yOffset            = from._yOffset;
            this._rotation           = from._rotation;
            this._backgroundStyle    = null == from._backgroundStyle ? null : (IBackgroundStyle)from._backgroundStyle.Clone();
            this._cachedStringFormat = (System.Drawing.StringFormat)from._cachedStringFormat.Clone();
            this._attachedPlane      = null == from._attachedPlane ? null : from._attachedPlane.Clone();
            this._labelColumn        = (Altaxo.Data.ReadableColumnProxy)from._labelColumn.Clone();
            this._parent             = from._parent;

            CreateEventChain();
        }
コード例 #4
0
            public static void SSerialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                LabelPlotStyle s = (LabelPlotStyle)obj;

                info.AddValue("Font", s._font);
                info.AddValue("IndependentColor", s._independentColor);
                info.AddValue("Brush", s._brush);
                info.AddValue("XOffset", s._xOffset);
                info.AddValue("YOffset", s._yOffset);
                info.AddValue("Rotation", s._rotation);
                info.AddEnum("HorizontalAlignment", s.HorizontalAlignment);
                info.AddEnum("VerticalAlignment", s.VerticalAlignment);
                info.AddValue("AttachedAxis", s._attachedPlane);
                info.AddValue("Background", s._backgroundStyle);
                info.AddValue("LabelColumn", s._labelColumn);
            }
コード例 #5
0
            public static object SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent, bool nativeCall)
            {
                LabelPlotStyle s = null != o ? (LabelPlotStyle)o : new LabelPlotStyle();

                s._font               = (Font)info.GetValue("Font", s);
                s._independentColor   = info.GetBoolean("IndependentColor");
                s._brush              = (BrushX)info.GetValue("Brush", s);
                s._xOffset            = info.GetDouble("XOffset");
                s._yOffset            = info.GetDouble("YOffset");
                s._rotation           = info.GetDouble("Rotation");
                s.HorizontalAlignment = (System.Drawing.StringAlignment)info.GetEnum("HorizontalAlignment", typeof(System.Drawing.StringAlignment));
                s.VerticalAlignment   = (System.Drawing.StringAlignment)info.GetEnum("VerticalAlignment", typeof(System.Drawing.StringAlignment));
                bool     attachToAxis    = info.GetBoolean("AttachToAxis");
                EdgeType attachedAxis    = (EdgeType)info.GetValue("AttachedAxis", parent);
                bool     whiteOut        = info.GetBoolean("WhiteOut");
                BrushX   backgroundBrush = (BrushX)info.GetValue("BackgroundBrush", s);

                if (attachToAxis)
                {
                    s._attachedPlane = GetDirection(attachedAxis);
                }
                else
                {
                    s._attachedPlane = null;
                }

                if (whiteOut)
                {
                    s._backgroundStyle = new FilledRectangle(backgroundBrush.Color);
                }

                if (nativeCall)
                {
                    // restore the cached values
                    s.SetCachedValues();
                    s.CreateEventChain();
                }

                return(s);
            }
コード例 #6
0
    /// <summary>
    /// This plots a label plot into the provided layer.
    /// </summary>
    /// <param name="layer">The layer to plot into.</param>
    /// <param name="xcol">The x column.</param>
    /// <param name="ycol">The y column.</param>
    /// <param name="labelcol">The label column.</param>
    public static void PlotOnlyLabel(XYPlotLayer layer, Altaxo.Data.DataColumn xcol, Altaxo.Data.DataColumn ycol, Altaxo.Data.DataColumn labelcol)  
    {
      XYColumnPlotData pa = new XYColumnPlotData(xcol,ycol);

      G2DPlotStyleCollection ps = new G2DPlotStyleCollection(LineScatterPlotStyleKind.Empty);
      LabelPlotStyle labelStyle = new LabelPlotStyle(labelcol);
      labelStyle.FontSize = 10;
      labelStyle.BackgroundStyle = new FilledRectangle(System.Drawing.Color.LightCyan);
      ps.Add(labelStyle);
      
      layer.PlotItems.Add(new XYColumnPlotItem(pa,ps));
    }
コード例 #7
0
ファイル: LabelPlotStyle.cs プロジェクト: Altaxo/Altaxo
		public LabelPlotStyle(LabelPlotStyle from, bool copyWithDataReferences)
		{
			CopyFrom(from, copyWithDataReferences);
		}
コード例 #8
0
    public bool InitializeDocument(params object[] args)
    {
      if (args.Length == 0 || !(args[0] is LabelPlotStyle))
        return false;

      bool isFirstTime = (null == _doc);
      _doc = (LabelPlotStyle)args[0];
     // _tempDoc = _useDocumentCopy == UseDocument.Directly ? _doc : (LabelPlotStyle)_doc.Clone();
      Initialize(true); // initialize always because we have to update the temporary variables
      return true;
    }
コード例 #9
0
    public XYPlotLabelStyleController(LabelPlotStyle doc)
    {
      if (doc == null)
        throw new ArgumentNullException("doc is null");

      if (!InitializeDocument(doc))
        throw new ApplicationException("Programming error");
    }
コード例 #10
0
ファイル: PlotCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Creates a list of plot items from data columns, using a template plot style.
		/// </summary>
		/// <param name="selectedColumns">Columns for which to create plot items.</param>
		/// <param name="xColumnName">Name of the x column. If it is null or empty, or that column is not found in the table, the current assigned x column is used.</param>
		/// <param name="templatePlotStyle">The template plot style used to create the basic plot item.</param>
		/// <param name="processedColumns">On return, contains all columns that where used in creating the plot items. That are
		/// not only the columns given in the first argument, but maybe also columns that are right to those columns in the table and have special kinds, like
		/// labels, yerr, and so on.</param>
		/// <param name="context">Property context used to determine default values, e.g. for the pen width or symbol size.</param>
		/// <returns>List of plot items created.</returns>
		public static List<IGPlotItem> CreatePlotItems(IEnumerable<DataColumn> selectedColumns, string xColumnName, G2DPlotStyleCollection templatePlotStyle, HashSet<DataColumn> processedColumns, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
		{
			var result = new List<IGPlotItem>();
			foreach (DataColumn ycol in selectedColumns)
			{
				if (processedColumns.Contains(ycol))
					continue;
				else
					processedColumns.Add(ycol);

				DataColumnCollection table = DataColumnCollection.GetParentDataColumnCollectionOf(ycol);
				Altaxo.Data.DataColumn xcol;
				if (!string.IsNullOrEmpty(xColumnName) && null != table && table.ContainsColumn(xColumnName))
					xcol = table[xColumnName];
				else
					xcol = null == table ? null : table.FindXColumnOf(ycol);

				int groupNumber = table.GetColumnGroup(ycol);
				var parentTable = DataTable.GetParentDataTableOf(table);

				XYColumnPlotData pa;
				if (null != xcol)
					pa = new XYColumnPlotData(parentTable, groupNumber, xcol, ycol);
				else
					pa = new XYColumnPlotData(parentTable, groupNumber, new Altaxo.Data.IndexerColumn(), ycol);

				G2DPlotStyleCollection ps = templatePlotStyle != null ? (G2DPlotStyleCollection)templatePlotStyle.Clone() : new G2DPlotStyleCollection();

				if (null == table)
					continue;

				ErrorBarPlotStyle unpairedPositiveError = null;
				ErrorBarPlotStyle unpairedNegativeError = null;

				bool foundMoreColumns = true;
				for (int idx = 1 + table.GetColumnNumber(ycol); foundMoreColumns && idx < table.ColumnCount; idx++)
				{
					DataColumn col = table[idx];
					switch (table.GetColumnKind(idx))
					{
						case ColumnKind.Label:
							LabelPlotStyle labelStyle = new LabelPlotStyle(col, context);
							ps.Insert(0, labelStyle);
							break;

						case ColumnKind.Err:
							ErrorBarPlotStyle errStyle = new ErrorBarYPlotStyle(context);
							errStyle.PositiveErrorColumn = col as INumericColumn;
							errStyle.NegativeErrorColumn = col as INumericColumn;
							ps.Add(errStyle);
							break;

						case ColumnKind.pErr:
							if (null != unpairedNegativeError)
							{
								unpairedNegativeError.PositiveErrorColumn = col as INumericColumn; ;
								unpairedNegativeError = null;
							}
							else
							{
								unpairedPositiveError = new ErrorBarYPlotStyle(context);
								unpairedPositiveError.PositiveErrorColumn = col as INumericColumn;
								ps.Add(unpairedPositiveError);
							}
							break;

						case ColumnKind.mErr:
							if (null != unpairedPositiveError)
							{
								unpairedPositiveError.NegativeErrorColumn = col as INumericColumn;
								unpairedPositiveError = null;
							}
							else
							{
								unpairedNegativeError = new ErrorBarYPlotStyle(context);
								unpairedNegativeError.NegativeErrorColumn = col as INumericColumn;
								ps.Add(unpairedNegativeError);
							}
							break;

						default:
							foundMoreColumns = false;
							break;
					}

					if (foundMoreColumns)
						processedColumns.Add(table[idx]);
				}

				result.Add(new XYColumnPlotItem(pa, ps));
			}
			return result;
		}
コード例 #11
0
ファイル: ChemometricCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// This plots a label plot into the provided layer.
		/// </summary>
		/// <param name="layer">The layer to plot into.</param>
		/// <param name="table">The table of PLS output data.</param>
		/// <param name="xcol">The x column.</param>
		/// <param name="ycol">The y column.</param>
		/// <param name="labelcol">The label column.</param>
		public static void PlotOnlyLabel(XYPlotLayer layer, Altaxo.Data.DataTable table, Altaxo.Data.DataColumn xcol, Altaxo.Data.DataColumn ycol, Altaxo.Data.DataColumn labelcol)
		{
			var context = layer.GetPropertyContext();

			var groupNumber = table.DataColumns.GetColumnGroup(ycol);
			XYColumnPlotData pa = new XYColumnPlotData(table, groupNumber, xcol, ycol);

			G2DPlotStyleCollection ps = new G2DPlotStyleCollection(LineScatterPlotStyleKind.Empty, layer.GetPropertyContext());
			LabelPlotStyle labelStyle = new LabelPlotStyle(labelcol, context);
			labelStyle.BackgroundStyle = new FilledRectangle(NamedColors.LightCyan);
			ps.Add(labelStyle);

			layer.PlotItems.Add(new XYColumnPlotItem(pa, ps));
		}
コード例 #12
0
    public LabelPlotStyle(LabelPlotStyle from)
    {
      this._font = (Font)from._font.Clone();
      this._independentColor = from._independentColor;
      this._brush = (BrushX)from._brush.Clone();
      this._xOffset = from._xOffset;
      this._yOffset = from._yOffset;
      this._rotation = from._rotation;
      this._backgroundStyle = null == from._backgroundStyle ? null : (IBackgroundStyle)from._backgroundStyle.Clone();
      this._cachedStringFormat = (System.Drawing.StringFormat)from._cachedStringFormat.Clone();
      this._attachedPlane = null==from._attachedPlane ? null : from._attachedPlane.Clone();
      this._labelColumn = (Altaxo.Data.ReadableColumnProxy)from._labelColumn.Clone();
      this._parent = from._parent;

      CreateEventChain();
    }