@@ -465,8 +465,9 @@ def generate_svg_pie_chart(self, data: dict[str, Decimal]) -> str: # noqa: PLR0
465465 def generate_svg_stacked_bar_chart ( # noqa: PLR0914
466466 self , monthly_data : dict , invoices : list , year : int , month : int | None = None
467467 ) -> str :
468- """Generate a stacked bar chart showing totals by category.
469-
468+ """
469+ Generate a stacked bar chart showing totals by category.
470+
470471 For yearly view (month=None): shows 12 monthly bars
471472 For monthly view (month=int): shows daily bars for that month
472473 """
@@ -515,9 +516,7 @@ def generate_svg_stacked_bar_chart( # noqa: PLR0914
515516 x : float = padding + bar_spacing * (idx + 0.5 )
516517
517518 # Get invoices for this time period by category
518- period_invoices = [
519- inv for inv in invoices if filter_func (inv , idx )
520- ]
519+ period_invoices = [inv for inv in invoices if filter_func (inv , idx )]
521520
522521 # Stack bars by category
523522 y_offset : float = height - padding
@@ -535,7 +534,9 @@ def generate_svg_stacked_bar_chart( # noqa: PLR0914
535534 bar_height = float (category_total / max_value * chart_height )
536535 y = y_offset - bar_height
537536
538- title_label = f"{ label_prefix } { bar_label } " if label_prefix else bar_label
537+ title_label = (
538+ f"{ label_prefix } { bar_label } " if label_prefix else bar_label
539+ )
539540 svg_parts .append (
540541 f'<rect x="{ x } " y="{ y } " width="{ bar_width } " height="{ bar_height } " '
541542 f'fill="{ self .CATEGORY_COLORS .get (category .label , "#999" )} " stroke="white" stroke-width="1">'
@@ -547,7 +548,9 @@ def generate_svg_stacked_bar_chart( # noqa: PLR0914
547548 # Bar label
548549 label_x = x + bar_width / 2
549550 label_y = height - padding + 15
550- font_size = "9" if month else "10" # Smaller font for daily view (more bars)
551+ font_size = (
552+ "9" if month else "10"
553+ ) # Smaller font for daily view (more bars)
551554 svg_parts .append (
552555 f'<text x="{ label_x } " y="{ label_y } " text-anchor="middle" '
553556 f'font-size="{ font_size } " fill="#666">{ bar_label } </text>'
0 commit comments