コード例 #1
0
ファイル: TextGraphic_Glyphs.cs プロジェクト: olesar/Altaxo
      private string GetName(object obj)
      {
        string result = string.Empty;

        // first of all, retrieve the actual name
        var mylayer = obj as HostLayer;
        if (null == mylayer)
          return result;

        var layer = mylayer as XYPlotLayer;
        if (_layerNumber >= 0 && mylayer.SiblingLayers != null && _layerNumber < mylayer.SiblingLayers.Count)
          layer = mylayer.SiblingLayers[_layerNumber] as XYPlotLayer;
        if (null == layer)
          return result;
        IGPlotItem pa = null;
        if (_plotNumber < layer.PlotItems.Flattened.Length)
        {
          pa = layer.PlotItems.Flattened[_plotNumber];
        }
        if (pa != null)
        {
          result = pa.GetName(0);

          if (_plotLabelStyle != null && !_plotLabelStyleIsPropColName && pa is XYColumnPlotItem)
          {
            XYColumnPlotItemLabelTextStyle style = XYColumnPlotItemLabelTextStyle.YS;
            try
            { style = (XYColumnPlotItemLabelTextStyle)Enum.Parse(typeof(XYColumnPlotItemLabelTextStyle), _plotLabelStyle, true); }
            catch (Exception) { }
            result = ((XYColumnPlotItem)pa).GetName(style);
          }

          if (_plotLabelStyleIsPropColName && _plotLabelStyle != null && pa is XYColumnPlotItem)
          {
            XYColumnPlotData pb = ((XYColumnPlotItem)pa).Data;
            Data.DataTable tbl = null;
            if (pb.YColumn is Data.DataColumn)
              tbl = Data.DataTable.GetParentDataTableOf((Data.DataColumn)pb.YColumn);

            if (tbl != null)
            {
              int colNumber = tbl.DataColumns.GetColumnNumber((Data.DataColumn)pb.YColumn);
              if (tbl.PropertyColumns.ContainsColumn(_plotLabelStyle))
                result = tbl.PropertyColumns[_plotLabelStyle][colNumber].ToString();
            }
          }
        }

        return result;
      }
コード例 #2
0
        public void EhView_ContentsDoubleClick(NGTreeNode selNode)
        {
            IGPlotItem pi = selNode.Tag as IGPlotItem;

            if (null != pi)
            {
                if (pi is PlotItemCollection)
                {
                    // show not the dialog for PlotItemCollection, but only those for the group styles into that collection
                    Current.Gui.ShowDialog(new object[] { ((PlotItemCollection)pi).GroupStyles }, pi.Name);
                }
                else
                {
                    Current.Gui.ShowDialog(new object[] { pi }, pi.GetName(2), true);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Puts the selected data columns into the plot content.
        /// </summary>
        /// <param name="selNodes"></param>
        public void EhView_PutData(NGTreeNode[] selNodes)
        {
            // first, put the selected node into the list, even if it is not checked
            foreach (NGTreeNode sn  in selNodes)
            {
                if (null != sn.Parent)
                {
                    IGPlotItem newItem = this.CreatePlotItem(sn.Parent.Text, sn.Text);
                    _doc.Add(newItem);

                    NGTreeNode newNode = new NGTreeNode();
                    newNode.Text = newItem.GetName(2);
                    newNode.Tag  = newItem;
                    _plotItemsTree.Add(newNode);
                }
            }

            View.Contents_SetItems(_plotItemsTree);
            View.DataAvailable_ClearSelection();
            SetDirty();
        }