예제 #1
0
        /// <summary>
        /// Convert an apsim legend position to an oxyplot legend position.
        /// </summary>
        /// <param name="position">An apsim legend position.</param>
        public static OxyLegendPosition ToOxyPlotLegendPosition(this LegendPosition position)
        {
            switch (position)
            {
            case LegendPosition.TopLeft:
                return(OxyLegendPosition.TopLeft);

            case LegendPosition.TopCenter:
                return(OxyLegendPosition.TopCenter);

            case LegendPosition.TopRight:
                return(OxyLegendPosition.TopRight);

            case LegendPosition.LeftTop:
                return(OxyLegendPosition.LeftTop);

            case LegendPosition.LeftMiddle:
                return(OxyLegendPosition.LeftMiddle);

            case LegendPosition.LeftBottom:
                return(OxyLegendPosition.LeftBottom);

            case LegendPosition.RightTop:
                return(OxyLegendPosition.RightTop);

            case LegendPosition.RightMiddle:
                return(OxyLegendPosition.RightMiddle);

            case LegendPosition.RightBottom:
                return(OxyLegendPosition.RightBottom);

            case LegendPosition.BottomLeft:
                return(OxyLegendPosition.BottomLeft);

            case LegendPosition.BottomCenter:
                return(OxyLegendPosition.BottomCenter);

            case LegendPosition.BottomRight:
                return(OxyLegendPosition.BottomRight);

            default:
                throw new NotImplementedException($"Unknown legend position: {position}");
            }
        }
예제 #2
0
 public void TestLegendPositionConversion(LegendPosition input, OxyPlot.Legends.LegendPosition expectedOutput)
 {
     Assert.AreEqual(expectedOutput, input.ToOxyPlotLegendPosition());
 }