private AxisGridLine CreateAxisGridLine(AxisMap map, double value) { var line = new AxisGridLine() { Position = GetPosition(map, value), LabelName = GetLabelName(value) }; return(line); }
// TODO: This is duplicated across multiple classes... must refactor private AxisGridLine CreateAxisGridLine(AxisMap map, DateTime value, string label) { var position = map.Map(value); var line = new AxisGridLine() { LabelName = label, Position = position.GetValueOrDefault() }; return(line); }
private static AxisGridLine CreateAxisLine(AxisMap map, bool value) { var location = map.Map(value); var line = new AxisGridLine() { LabelName = value.ToString(), Position = location ?? 0d }; return(line); }
// TODO: This is duplicated across multiple classes... must refactor private static AxisGridLine CreateAxisGridLine(AxisMap map, DateTime value) { var position = map.Map(value); var line = new AxisGridLine() { LabelName = value.ToLongTimeString(), Position = position.GetValueOrDefault() }; return(line); }
private CanvasLabel RenderLabel(AxisGridLine axisGridLine, Rect viewExtent, Size controlSize) { var scaledPosition = _valueScaler.Scale(axisGridLine.Position, viewExtent.Left, viewExtent.Width, 0d, controlSize.Width); var canvasLine = new CanvasLabel() { Text = axisGridLine.LabelName, X = scaledPosition, Y = controlSize.Height - MarginHeight }; return(canvasLine); }
private CanvasLine RenderLine(AxisGridLine axisGridLine, Rect viewExtent, Size controlSize) { var scaledPosition = _valueScaler.Scale(axisGridLine.Position, viewExtent.Left, viewExtent.Width, 0d, controlSize.Width); var canvasLine = new CanvasLine() { X1 = scaledPosition, Y1 = 0, X2 = scaledPosition, Y2 = controlSize.Height - MarginHeight }; return(canvasLine); }
private CanvasLabel RenderLabel(AxisGridLine axisGridLine, Rect viewExtent, Size controlSize) { var scaledPosition = _valueScaler.Scale(axisGridLine.Position, viewExtent.Top, viewExtent.Height, 0d, controlSize.Height); var canvasLine = new CanvasLabel() { Text = axisGridLine.LabelName, X = MarginWidth, Y = controlSize.Height - scaledPosition, IsRotated = true }; return(canvasLine); }
public void SetUp() { _viewExtent = new Rect(0, 0, 10, 10); _controlSize = new Size(10, 20); _axisGridLine = new AxisGridLine() { Position = 5d, LabelName = "Test" }; _axisLines = new List <AxisGridLine> { _axisGridLine }; _mockScaler = new Mock <IValueScaler>(); _mockScaler.Setup(p => p.Scale(5d, 0, 10, 0, 10)).Returns(5); _renderer = new YAxisGridLabelRenderer( _mockScaler.Object); }
public void SetUp() { _line = new AxisGridLine(); _lines = new List <AxisGridLine> { _line }; _mockMinMaxFactory = new Mock <IMinMaxDateTimeAxisGridLineFactory>(); _mockYearFactory = new Mock <IYearAxisGridLineFactory>(); _mockDayFactory = new Mock <IDayAxisGridLineFactory>(); _mockSecondFactory = new Mock <ISecondAxisGridLineFactory>(); _factory = new DateTimeGridLineFactory( _mockMinMaxFactory.Object, _mockYearFactory.Object, _mockDayFactory.Object, _mockSecondFactory.Object); }
public void SetUp() { _sourceValues = new List <object>(); _axisMap = new FakeAxisMap(); _gridGridLine = new AxisGridLine(); _gridLines = new List <AxisGridLine> { _gridGridLine }; _mockBooleanFactory = new Mock <IBooleanGridLineFactory>(); _mockDateTimeFactory = new Mock <IDateTimeGridLineFactory>(); _mockFloatFactory = new Mock <IFloatGridLineFactory>(); _mockIntegerFactory = new Mock <IIntegerGridLineFactory>(); _mockStringFactory = new Mock <IStringGridLineFactory>(); _factory = new GridLineFactory( _mockBooleanFactory.Object, _mockDateTimeFactory.Object, _mockFloatFactory.Object, _mockIntegerFactory.Object, _mockStringFactory.Object); }
public void SetUp() { _values = new List <object>(); _column = new ColumnBuilder() .WithDataType(typeof(object)) .WithValues(_values) .Build(); _layout = new ScatterPlotLayoutBuilder() .WithYAxisColumn(_column) .Build(); _scatterPlot = new ScatterPlotBuilder() .WithLayout(_layout) .Build(); _viewExtent = new Rect(); _axisMap = new FakeAxisMap(); _values = new List <object>(); _axisGridLine = new AxisGridLine(); _axisLines = new List <AxisGridLine> { _axisGridLine }; _mockViewRepository = new Mock <IViewRepository>(); _mockViewRepository.Setup(p => p.Get <ScatterPlot>()) .Returns(_scatterPlot); _mockMapFactory = new Mock <IMapFactory>(); _mockMapFactory.Setup(p => p.CreateAxisMap(_column, 0d, 1d, SortOrder.Ascending)) .Returns(_axisMap); _mockFactory = new Mock <IGridLineFactory>(); _mockFactory.Setup(p => p.Create(typeof(object), _axisMap, _values, _viewExtent.Left, _viewExtent.Right)) .Returns(_axisLines); _handler = new GetYAxisGridLinesQueryHandler( _mockViewRepository.Object, _mockMapFactory.Object, _mockFactory.Object); }
public void SetUp() { _controlSize = new Size(); _viewExtent = new Rect(); _axisGridLine = new AxisGridLine(); _axisGridLines = new List <AxisGridLine> { _axisGridLine }; _plotDto = new PlotDto(); _plotDtos = new List <PlotDto> { _plotDto }; _columnDto = new ColumnDto() { Name = "test" }; _xGridLine = new CanvasLine(); _yGridLine = new CanvasLine(); _plotItem = new CanvasCircle(); _xGridLabel = new CanvasLabel(); _yGridLabel = new CanvasLabel(); _xTitleLabel = new CanvasLabel(); _yTitleLabel = new CanvasLabel(); _mockQueryBus = new Mock <IQueryBus>(); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetViewExtentQuery>())) .Returns(_viewExtent); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetXAxisGridLinesQuery>())) .Returns(_axisGridLines); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetYAxisGridLinesQuery>())) .Returns(_axisGridLines); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetPlotsQuery>())) .Returns(_plotDtos); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetXAxisColumnQuery>())) .Returns(_columnDto); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetYAxisColumnQuery>())) .Returns(_columnDto); _mockGridRenderer = new Mock <IAxisGridRenderer>(); _mockGridRenderer.Setup(p => p.RenderXAxisGridLines(_axisGridLines, _viewExtent, _controlSize)) .Returns(new List <CanvasLine> { _xGridLine }); _mockGridRenderer.Setup(p => p.RenderYAxisGridLines(_axisGridLines, _viewExtent, _controlSize)) .Returns(new List <CanvasLine> { _yGridLine }); _mockGridRenderer.Setup(p => p.RenderXAxisGridLabels(_axisGridLines, _viewExtent, _controlSize)) .Returns(new List <CanvasLabel> { _xGridLabel }); _mockGridRenderer.Setup(p => p.RenderYAxisGridLabels(_axisGridLines, _viewExtent, _controlSize)) .Returns(new List <CanvasLabel> { _yGridLabel }); _mockPlotRenderer = new Mock <IPlotRenderer>(); _mockPlotRenderer.Setup(p => p.RenderPlots(_controlSize, _viewExtent, _plotDtos)) .Returns(new List <CanvasItem> { _plotItem }); _mockTitleRenderer = new Mock <IAxisTitleRenderer>(); _mockTitleRenderer.Setup(p => p.RenderXAxisTitle(_controlSize, _columnDto.Name)) .Returns(_xTitleLabel); _mockTitleRenderer.Setup(p => p.RenderYAxisTitle(_controlSize, _columnDto.Name)) .Returns(_yTitleLabel); _query = new GetAllItemsQuery( _mockQueryBus.Object, _mockGridRenderer.Object, _mockPlotRenderer.Object, _mockTitleRenderer.Object); }
private void AssertGridLine(AxisGridLine gridLine, double expectedPosition, string expectedLabel) { Assert.That(gridLine.Position, Is.EqualTo(expectedPosition)); Assert.That(gridLine.LabelName, Is.EqualTo(expectedLabel)); }
private void AssertGridLine(AxisGridLine gridLine, double position, string label) { Assert.That(gridLine.Position, Is.EqualTo(position).Within(0.001)); Assert.That(gridLine.LabelName, Is.EqualTo(label)); }