From d2a14ea6c020aefe12bc47b9e38946981a6774b1 Mon Sep 17 00:00:00 2001 From: Tom Niget Date: Sun, 13 Apr 2025 00:58:28 +0200 Subject: [PATCH] Add hidden-by-default Total curve to the daily stream graph (#2497) * Add hidden-by-default Total curve to the daily stream graph * Update curve color Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> --------- Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> --- data/interfaces/default/graphs.html | 7 ++++++- plexpy/graphs.py | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/interfaces/default/graphs.html b/data/interfaces/default/graphs.html index 15a96a69..006d7ee9 100644 --- a/data/interfaces/default/graphs.html +++ b/data/interfaces/default/graphs.html @@ -301,6 +301,10 @@ return obj; }, {}); + if (!("Total" in chart_visibility)) { + chart_visibility["Total"] = false; + } + return data_series.map(function(s) { var obj = Object.assign({}, s); obj.visible = (chart_visibility[s.name] !== false); @@ -327,7 +331,8 @@ 'Direct Play': '#E5A00D', 'Direct Stream': '#FFFFFF', 'Transcode': '#F06464', - 'Max. Concurrent Streams': '#96C83C' + 'Max. Concurrent Streams': '#96C83C', + 'Total': '#96C83C' }; var series_colors = []; $.each(data_series, function(index, series) { diff --git a/plexpy/graphs.py b/plexpy/graphs.py index 70122aee..771b4eaf 100644 --- a/plexpy/graphs.py +++ b/plexpy/graphs.py @@ -138,6 +138,12 @@ class Graphs(object): if libraries.has_library_type('live'): series_output.append(series_4_output) + if len(series_output) > 0: + series_total = [sum(x) for x in zip(*[x['data'] for x in series_output])] + series_total_output = {'name': 'Total', + 'data': series_total} + series_output.append(series_total_output) + output = {'categories': categories, 'series': series_output} return output