Example #1
0
        public void Test_AxisAutoY_Repeated()
        {
            double[] xs = { 1, 2, 3, 4, 5 };
            double[] ys = { 1, 4, 9, 16, 25 };

            var plt = new ScottPlot.Plot(400, 300);

            plt.PlotScatter(xs, ys);
            plt.Axis(-5, 10, -15, 40);

            for (int i = 0; i < 10; i++)
            {
                plt.AxisAutoY();
            }

            TestTools.SaveFig(plt);
        }
Example #2
0
        private void MiddleClickAutoAxis()
        {
            if (Configuration.MiddleClickAutoAxis == false)
            {
                return;
            }

            Settings.ZoomRectangle.Clear();

            if (Configuration.LockVerticalAxis == false)
            {
                Plot.AxisAutoY();
            }

            if (Configuration.LockHorizontalAxis == false)
            {
                Plot.AxisAutoX();
            }

            Render();
        }
Example #3
0
        public void Test_AxisAutoY_Works()
        {
            var plt = new ScottPlot.Plot(400, 300);

            plt.AddPoint(-5, -5);
            plt.AddPoint(5, 5);

            // set limits too small
            plt.SetAxisLimits(-1, 1, -1, 1);
            var limits1 = plt.GetAxisLimits();

            // autoAxis should make them bigger just for Y values
            plt.AxisAutoY();
            var limits2 = plt.GetAxisLimits();

            Assert.AreEqual(limits1.XMin, limits2.XMin);
            Assert.AreEqual(limits1.XMax, limits2.XMax);

            Assert.Less(limits2.YMin, limits1.YMin);
            Assert.Greater(limits2.YMax, limits1.YMax);
        }