# flake8: noqa T001, E501
# -*- coding: utf-8 -*-
"""
Styled Graph Example

Customize graph appearance with colors, line styles, and markers.
"""

import BTAnalysisPyInterface as bta


def main():
    bta.print("Creating styled graph...")

    for source in bta.get_sources():
        # Get summary data
        summary = source.get_summary(bta.SummaryType.PER_CYCLE)

        cycles = summary.get_column("Cycle number")
        q_charge = summary.get_column("Q charge")
        q_discharge = summary.get_column("Q discharge")

        # Create graph
        graph = bta.add_graph(
            title="Charge vs Discharge Capacity",
            xAxis="Cycle number",
            y1Axis="Capacity",
        )

        # Add series
        graph.add_series("Charge", cycles, q_charge)
        graph.add_series("Discharge", cycles, q_discharge)

        # Style the traces
        graph.configure_trace(
            "Charge",
            color="#2E86AB",  # Blue
            line_style=bta.LineStyle.SOLID,
            line_width=2.5,
            marker=bta.MarkerStyle.CIRCLE,
            marker_size=5.0,
        )

        graph.configure_trace(
            "Discharge",
            color="#A23B72",  # Purple
            line_style=bta.LineStyle.DASHED,
            line_width=2.0,
            marker=bta.MarkerStyle.SQUARE,
            marker_size=4.0,
        )

        bta.print("✓ Styled graph created")
