Skip to content

Commit

Permalink
Improved co-purchaser graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Theophile-Madet committed Sep 12, 2023
1 parent 581f792 commit 39ba617
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tapir/statistics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ def build_pie_chart_data(labels: list, data: list):
}


def build_line_chart_data(x_axis_values: list, y_axis_values: list, data_label: str):
return {
def build_line_chart_data(
x_axis_values: list,
y_axis_values: list,
data_label: str,
y_axis_max: float | None = None,
):
data = {
"type": "line",
"data": {
"labels": x_axis_values,
Expand All @@ -26,3 +31,6 @@ def build_line_chart_data(x_axis_values: list, y_axis_values: list, data_label:
],
},
}
if y_axis_max:
data["options"] = {"scales": {"y": {"max": y_axis_max}}}
return data
1 change: 1 addition & 0 deletions tapir/statistics/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def get_context_data(self, **kwargs):
data_label=_(
"Percentage of members with a co-purchaser relative to the number of active members"
),
y_axis_max=100,
)

def get_dates(self):
Expand Down

0 comments on commit 39ba617

Please sign in to comment.