aboutsummaryrefslogtreecommitdiffstats
path: root/html_builders/graphs.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2023-11-17 13:24:42 -0800
committerPinapelz <yukais@pinapelz.com>2023-11-17 13:24:42 -0800
commit96019367e8f72eac26abd3b7a908c2b914bd1ae1 (patch)
treefa7dbe66ea8b12bde0970dc8db27f7601464b3b8 /html_builders/graphs.py
parentc159e86a3487dbae79de8d0887f288625084bfcd (diff)
v2: add initial Next JS files, remove static templates
Diffstat (limited to 'html_builders/graphs.py')
-rw-r--r--html_builders/graphs.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/html_builders/graphs.py b/html_builders/graphs.py
deleted file mode 100644
index 2770880..0000000
--- a/html_builders/graphs.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import plotly.graph_objs as go
-import pandas as pd
-import warnings
-import math
-from datetime import datetime, timedelta
-import numpy as np
-import mysql.connector
-from mysql.connector import errorcode
-
-def plot_subscriber_count_over_time(server, table_name, gtitle = "Subscriber Count Over Time for Nijisanji Members",
- overrideQuery = None, markers = "lines", exclude_channels = []):
- warnings.filterwarnings('ignore') # Ignore pandas warning regarding pyodbc
- query = f"SELECT name, subscriber_count, timestamp, channel_id FROM {table_name} ORDER by timestamp DESC" if overrideQuery is None else overrideQuery
- df = pd.read_sql_query(query, server.get_connection())
- groups = df.groupby("name")
- fig = go.Figure()
- config = dict({'responsive': True, 'displaylogo': False, 'modeBarButtonsToAdd': ['pan2d', 'zoomIn2d', 'zoomOut2d']})
- for channel, group in groups:
- if len(exclude_channels) != 0 and group['channel_id'].iloc[0] in exclude_channels:
- continue
- fig.add_trace(go.Scattergl(
- x = group["timestamp"], y = group["subscriber_count"], name = channel, mode = markers,
- showlegend = True))
- fig.update_layout(
- title = {'text': gtitle, 'x': 0.5, 'xanchor': 'center',
- 'yanchor': 'top', 'font': {'family': 'Arial', 'size': 30}},
- xaxis_title = "Timestamp",
- yaxis_title = "Subscribers",
- legend = dict(font = dict(size = 16), title = dict(text = "Channels")),
- height = 950,
- )
- return fig.to_html(config = config) \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage