(self, dr: svgwrite.Drawing, g: svgwrite.container.Group, size: XY, offset: XY)
Draw the circular Poster using distances broken down by time
Draw the circular Poster using distances broken down by time
Draw the circular Poster using distances broken down by time
def draw(self, dr: svgwrite.Drawing, g: svgwrite.container.Group, size: XY, offset: XY) -> None:
        """Draw the circular Poster using distances broken down by time"""
        if self.poster.tracks is None:
            raise PosterError("No tracks to draw.")
        if self.poster.length_range_by_date is None:
            return

        years = self.poster.years.count()
        _, counts = utils.compute_grid(years, size)
        if counts is None:
            raise PosterError("Unable to compute grid.")
        count_x, count_y = counts[0], counts[1]
        x, y = 0, 0
        cell_size = size * XY(1 / count_x, 1 / count_y)
        margin = XY(4, 4)
        if count_x <= 1:
            margin.x = 0
        if count_y <= 1:
            margin.y = 0
        sub_size = cell_size - 2 * margin
        for year in self.poster.years.iter():
            g_year = dr.g(id=f"year{year}")
            g.add(g_year)
            self._draw_year(dr, g_year, sub_size, offset + margin + cell_size * XY(x, y), year)
            x += 1
            if x >= count_x:
                x = 0
                y += 1
def draw ( self , dr : svgwrite . Drawing , g : svgwrite . container . Group , size : XY , offset : XY ) -> None : if self . poster . tracks is None : raise PosterError ( "No tracks to draw." ) if self . poster . length_range_by_date is None : return years = self . poster . years . count ( ) _ , counts = utils . compute_grid ( years , size ) if counts is None : raise PosterError ( "Unable to compute grid." ) count_x , count_y = counts [ 0 ] , counts [ 1 ] x , y = 0 , 0 cell_size = size * XY ( 1 / count_x , 1 / count_y ) margin = XY ( 4 , 4 ) if count_x <= 1 : margin . x = 0 if count_y <= 1 : margin . y = 0 sub_size = cell_size - 2 * margin for year in self . poster . years . iter ( ) : g_year = dr . g ( id = f"year{year}" ) g . add ( g_year ) self . _draw_year ( dr , g_year , sub_size , offset + margin + cell_size * XY ( x , y ) , year ) x += 1 if x >= count_x : x = 0 y += 1