コード例 #1
0
        /// <summary>
        /// Create and return an additional axis
        /// </summary>
        public Renderable.Axis AddAxis(Renderable.Edge edge, int axisIndex, string title, System.Drawing.Color?color = null)
        {
            Renderable.Axis axis;

            if (edge == Renderable.Edge.Left)
            {
                axis = new Renderable.AdditionalLeftAxis(axisIndex, title);
            }
            else if (edge == Renderable.Edge.Right)
            {
                axis = new Renderable.AdditionalRightAxis(axisIndex, title);
            }
            else if (edge == Renderable.Edge.Bottom)
            {
                axis = new Renderable.AdditionalBottomAxis(axisIndex, title);
            }
            else if (edge == Renderable.Edge.Top)
            {
                axis = new Renderable.AdditionalTopAxis(axisIndex, title);
            }
            else
            {
                throw new NotImplementedException("unsupported edge");
            }

            axis.Title.Label = title;
            axis.Configure(color: color);

            settings.Axes.Add(axis);
            return(axis);
        }
コード例 #2
0
ファイル: Plot.Axis.cs プロジェクト: valmac/ScottPlot
        /// <summary>
        /// Create and return an additional axis
        /// </summary>
        public Renderable.Axis AddAxis(Renderable.Edge edge, int axisIndex, string title = null, System.Drawing.Color?color = null)
        {
            if (axisIndex <= 1)
            {
                throw new ArgumentException("The default axes already occupy indexes 0 and 1. Additional axes require higher indexes.");
            }

            Renderable.Axis axis;

            if (edge == Renderable.Edge.Left)
            {
                axis = new Renderable.AdditionalLeftAxis(axisIndex, title);
            }
            else if (edge == Renderable.Edge.Right)
            {
                axis = new Renderable.AdditionalRightAxis(axisIndex, title);
            }
            else if (edge == Renderable.Edge.Bottom)
            {
                axis = new Renderable.AdditionalBottomAxis(axisIndex, title);
            }
            else if (edge == Renderable.Edge.Top)
            {
                axis = new Renderable.AdditionalTopAxis(axisIndex, title);
            }
            else
            {
                throw new NotImplementedException("unsupported edge");
            }

            if (color.HasValue)
            {
                axis.Color(color.Value);
            }

            settings.Axes.Add(axis);
            return(axis);
        }