def chart_border(self): """Get a Polyline2D for the border of the plot.""" width = self._x_dim * len(self._months_int) height = self._y_dim pgon = Polygon2D.from_rectangle(self._base_point, Vector2D(0, 1), width, height) return Polyline2D.from_polygon(pgon)
def chart_border2d(self): """Get a Polyline2D for the border of the plot.""" base_pt = Point2D(self._base_point.x, self._base_point.y) width = self._container.max_point.x - self._container.min_point.x height = self._container.max_point.y - self._container.min_point.y pgon = Polygon2D.from_rectangle(base_pt, Vector2D(0, 1), width, height) return Polyline2D.from_polygon(pgon)
def test_from_polygon(): """Test the from_polygon method.""" pts_1 = (Point2D(0, 0), Point2D(2, 0), Point2D(2, 2), Point2D(0, 2)) pgon = Polygon2D(pts_1) pline = Polyline2D.from_polygon(pgon) assert isinstance(pline, Polyline2D) assert len(pline) == 5