Example #1
0
        public void TestExecuteShouldZoomToFullExtentIfViewIsSquare()
        {
            var squareViewExtent = new Rect(0d, 0d, 1d, 1d);

            _scatterPlot.SetViewExtent(squareViewExtent);
            _handler.Execute(new ZoomToFullExtentCommand());
            var viewExtent = _scatterPlot.GetViewExtent();

            Assert.That(viewExtent.X, Is.EqualTo(-0.1d).Within(Tolerance));
            Assert.That(viewExtent.Y, Is.EqualTo(-0.1d).Within(Tolerance));
            Assert.That(viewExtent.Width, Is.EqualTo(1.2d).Within(Tolerance));
            Assert.That(viewExtent.Height, Is.EqualTo(1.2d).Within(Tolerance));
        }
Example #2
0
        public void TestPanShouldPan()
        {
            _handler.Execute(new PanCommand(_vector));
            var newViewExtent = _scatterPlot.GetViewExtent();

            Assert.That(newViewExtent.X, Is.EqualTo(0.25));
            Assert.That(newViewExtent.Y, Is.EqualTo(0.5));
        }
        public void TestGetSetViewExtentShouldGetSetViewExtent()
        {
            var viewExtent = new Rect();

            _scatterPlot.SetViewExtent(viewExtent);
            var result = _scatterPlot.GetViewExtent();

            Assert.That(result, Is.EqualTo(viewExtent));
        }
Example #4
0
        public void TestZoomInShouldZoomInByZoomFactor()
        {
            _handler.Execute(new ZoomInCommand(_point));
            var viewExtent = _scatterPlot.GetViewExtent();

            Assert.That(viewExtent.X, Is.EqualTo(10));
            Assert.That(viewExtent.Y, Is.EqualTo(10));
            Assert.That(viewExtent.Width, Is.EqualTo(90));
            Assert.That(viewExtent.Height, Is.EqualTo(90));
        }
        public XElement Serialize(ScatterPlot scatterPlot)
        {
            var xScatterPlot = new XElement(ScatterPlotTag);

            AddProperty(xScatterPlot, ExtentTag, scatterPlot.GetViewExtent());

            var xLayout = _layoutSerializer.Serialize(scatterPlot.GetLayout());

            xScatterPlot.Add(xLayout);

            return(xScatterPlot);
        }
Example #6
0
 public void TestSetViewExtentShouldSetViewExtent()
 {
     _handler.Execute(new SetViewExtentCommand(_viewExtent));
     Assert.That(_scatterPlot.GetViewExtent(), Is.EqualTo(_viewExtent));
 }