public override void DrawGraph() { DrawBackground(); var scale = Get2DBounds(); foreach (var line in Lines) { line.DrawPoints(scale, _location); } var zeroZeroUiPoint = new GraphPoint(0, 0).ToUiPoint(scale, _location); GUI.Label(new Rect(zeroZeroUiPoint.x, zeroZeroUiPoint.y, 40, 40), "0"); if (Lines.Any()) { var line = Lines.First(); foreach (var point in line.Points) { var uiPoint = point.ToUiPoint(scale, _location); GUI.Label(new Rect(uiPoint.x, _location.max.y, 40, 40), point.X.ToString()); } } }
internal void DrawPoints(Bounds2D scale, Rect location) { GraphPoint previous = null; foreach (var point in Points) { point.DrawPoint(scale, location, _pointTexture, _pointSize, Colour); if (previous != null) { GraphUtils.DrawLineBetweenPoints(previous.ToUiPoint(scale, location), point.ToUiPoint(scale, location), _lineTexture, Colour, 3); } previous = point; } }
public void Add(GraphPoint point) { Points.Add(point); }