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

Learn how to create a graph and add data points manually.
"""

import BTAnalysisPyInterface as bta


def main():
    print("Setting up Q% plot...")

    print("Creating basic Q% plot...")

    # Example data: Time in seconds, Q in coulombs
    time_values = [0, 1, 2, 3, 4]
    q_values = [0.0, 0.5, 1.0, 1.2, 1.5]
    Q_total = max(q_values)

    # Create the graph
    graph = bta.add_graph(
        title="Q (%) vs Time", xAxis="Time", y1Axis="Q", x_unit="s", y1_unit="%"
    )

    # Add normalized points (Q in percentage)
    for i in range(len(time_values)):
        q_percent = (q_values[i] / Q_total) * 100
        graph.add_point(time_values[i], q_percent)

    print("Q percentage plot complete!")
