Skip to content

Commit

Permalink
add logo
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmoudHousam committed Jan 2, 2025
1 parent 1216226 commit 63ed8ad
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Binary file added Logo_TV_2015.svg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion demo/demo_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@


if __name__ == "__main__":
report = CreateReport(report_title="Example Report")
report = CreateReport(
report_title="Example Report", logo_path="Logo_TV_2015.svg.png"
)
report.add_figure(bar_fig, bar_options)
report.add_figure(scatter_fig, scatter_options)
report.add_figure(pie_fig, pie_options)
Expand Down
10 changes: 10 additions & 0 deletions templates/report_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
width: 100%;
overflow: hidden;
}
.logo {
width: 70px;
margin: 20px;
top: 0;
left: 0;
z-index: 10;
}
.page {
position: absolute;
top: 0;
Expand Down Expand Up @@ -68,6 +75,9 @@
</style>
</head>
<body>
{% if logo_path %}
<img src="{{ logo_path }}" alt="Logo" class="logo" />
{% endif %}
<div id="page0" class="page active">
<div class="report-title">{{ report_name }}</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion vizblend/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@


class CreateReport:
def __init__(self, report_title: str):
def __init__(self, report_title: str, logo_path: str = None):
self.report_title = report_title
self.logo_path = logo_path
self.figures = []

def add_figure(self, fig_or_func, options: dict):
Expand Down Expand Up @@ -49,6 +50,7 @@ def blend_graphs_to_html(self):
divs=divs,
total_pages=len(divs) + 1, # Include the initial report title page
report_name=self.report_title,
logo_path=self.logo_path,
)
output_dir = "./"
if not os.path.exists(output_dir):
Expand Down

0 comments on commit 63ed8ad

Please sign in to comment.