staticdash 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,3 +88,13 @@ tr:hover {
88
88
  height: auto;
89
89
  margin: 1em 0;
90
90
  }
91
+
92
+
93
+ .plot-container {
94
+ width: 100%;
95
+ }
96
+
97
+ .plot-container .plotly-graph-div {
98
+ width: 100% !important;
99
+ height: auto !important;
100
+ }
@@ -2,10 +2,26 @@ document.addEventListener("DOMContentLoaded", () => {
2
2
  const links = document.querySelectorAll(".nav-link");
3
3
  const sections = document.querySelectorAll(".page-section");
4
4
 
5
+ function resizePlotsIn(section) {
6
+ const plots = section.querySelectorAll(".plotly-graph-div");
7
+ plots.forEach(plot => {
8
+ if (typeof Plotly !== "undefined" && plot.data) {
9
+ Plotly.Plots.resize(plot);
10
+ }
11
+ });
12
+ }
13
+
5
14
  function showPage(id) {
6
15
  sections.forEach(section => section.style.display = "none");
7
16
  const page = document.getElementById(id);
8
- if (page) page.style.display = "block";
17
+ if (page) {
18
+ page.style.display = "block";
19
+
20
+ // Resize Plotly charts within the newly visible section
21
+ requestAnimationFrame(() => {
22
+ resizePlotsIn(page);
23
+ });
24
+ }
9
25
 
10
26
  links.forEach(link => link.classList.remove("active"));
11
27
  const activeLink = Array.from(links).find(link => link.dataset.target === id);
@@ -20,7 +36,7 @@ document.addEventListener("DOMContentLoaded", () => {
20
36
  });
21
37
  });
22
38
 
23
- // Show the first page by default
39
+ // Initial page load
24
40
  if (sections.length > 0) {
25
41
  showPage(sections[0].id);
26
42
  }
staticdash/dashboard.py CHANGED
@@ -18,7 +18,7 @@ class Page:
18
18
  self.elements.append(("text", text))
19
19
 
20
20
  def add_plot(self, plot):
21
- html = raw_util(plot.to_html(full_html=False, include_plotlyjs='cdn'))
21
+ html = raw_util(plot.to_html(full_html=False, include_plotlyjs='cdn', config={'responsive': True}))
22
22
  self.elements.append(("plot", html))
23
23
 
24
24
  def add_table(self, df, table_id=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staticdash
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: A lightweight static HTML dashboard generator with Plotly and pandas support.
5
5
  Author-email: Brian Day <brian.day1@gmail.com>
6
6
  License: CC0-1.0
@@ -0,0 +1,8 @@
1
+ staticdash/__init__.py,sha256=KqViaDkiQnhBI8-j3hr14umLDmPgddvdB_G1nJeC5Xs,38
2
+ staticdash/dashboard.py,sha256=DFTPvqSOI00c2qVS4MvOyia1ly-Ph8-oSlbQDT9TSj8,4644
3
+ staticdash/assets/css/style.css,sha256=OIcaUe9z3uQjfnisZiyxV-UodHQLq4kIWKxtq7BL2-Q,1315
4
+ staticdash/assets/js/script.js,sha256=GA6dd--Z_gvsLylOHZX73FkPPkznuFzsFGYYKL-sDxM,1223
5
+ staticdash-0.1.2.dist-info/METADATA,sha256=Mir0l0LNUGiusMsNv2lCOSB2y-sYwzmY10aUVUD5Gfg,2157
6
+ staticdash-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ staticdash-0.1.2.dist-info/top_level.txt,sha256=3MzZU6SptkUkjcHV1cvPji0H4aRzPphLHnpStgGEcxM,11
8
+ staticdash-0.1.2.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- staticdash/__init__.py,sha256=KqViaDkiQnhBI8-j3hr14umLDmPgddvdB_G1nJeC5Xs,38
2
- staticdash/dashboard.py,sha256=7kLyd2UBKJNTi5HwepG9ivEcxhaSq9t3jqjSFujS5xg,4615
3
- staticdash/assets/css/style.css,sha256=mc4j24VPIMB9pVWqH_ndyCrnLIJXUC0Tp3qn3lTOnJA,1186
4
- staticdash/assets/js/script.js,sha256=L9HxPRlKMrvSwtLftxA_9WIEDLjMCi7axJNfeQQNRfM,842
5
- staticdash-0.1.1.dist-info/METADATA,sha256=r55fdjdvi4aEJQ-6w8lhW9vD2vCXjjcLNQWTQO_6qRQ,2157
6
- staticdash-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- staticdash-0.1.1.dist-info/top_level.txt,sha256=3MzZU6SptkUkjcHV1cvPji0H4aRzPphLHnpStgGEcxM,11
8
- staticdash-0.1.1.dist-info/RECORD,,