apmtools 0.2.23__tar.gz → 0.2.24__tar.gz
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.
- {apmtools-0.2.23 → apmtools-0.2.24}/PKG-INFO +1 -1
- {apmtools-0.2.23 → apmtools-0.2.24}/pyproject.toml +1 -1
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/shiny/summary.py +35 -20
- {apmtools-0.2.23 → apmtools-0.2.24}/.gitignore +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/LICENSE +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/README.md +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/__init__.py +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/classes.py +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/data_processing.py +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/functions.py +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/legacy.py +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/shiny/__init__.py +0 -0
- {apmtools-0.2.23 → apmtools-0.2.24}/src/apmtools/units.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: apmtools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.024
|
|
4
4
|
Summary: A collection of tools for processing air pollution monitoring data
|
|
5
5
|
Project-URL: Homepage, https://github.com/federlorenz/apmtools
|
|
6
6
|
Author-email: Federico Lorenzetti <lorenzetti.federico@gmail.com>
|
|
@@ -528,7 +528,8 @@ def create_summary_app(
|
|
|
528
528
|
.summary-plot-container {
|
|
529
529
|
width: 100%;
|
|
530
530
|
max-width: none;
|
|
531
|
-
|
|
531
|
+
/* Height is set from actual rendered width by ResizeObserver. */
|
|
532
|
+
height: 500px;
|
|
532
533
|
min-width: 0;
|
|
533
534
|
min-height: 0;
|
|
534
535
|
padding: 0;
|
|
@@ -544,32 +545,46 @@ def create_summary_app(
|
|
|
544
545
|
}
|
|
545
546
|
"""),
|
|
546
547
|
ui.tags.script("""
|
|
547
|
-
// Plotly sometimes retains the pixel width measured before the
|
|
548
|
-
// Shiny sidebar and widget have finished laying out.
|
|
549
548
|
(() => {
|
|
550
|
-
|
|
549
|
+
// Calculate the actual height in pixels from the rendered width.
|
|
550
|
+
// CSS aspect-ratio alone does not reliably size shinywidgets.
|
|
551
|
+
const install = () => {
|
|
551
552
|
const container = document.querySelector('.summary-plot-container');
|
|
552
|
-
if (!container ||
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
553
|
+
if (!container || container.dataset.aspectObserverInstalled) return !!container;
|
|
554
|
+
container.dataset.aspectObserverInstalled = '1';
|
|
555
|
+
let previousWidth = 0;
|
|
556
|
+
const resize = () => {
|
|
557
|
+
const width = container.getBoundingClientRect().width;
|
|
558
|
+
if (width <= 0) return;
|
|
559
|
+
const height = Math.round(width / 2);
|
|
560
|
+
if (width === previousWidth && container.style.height === `${height}px`) return;
|
|
561
|
+
previousWidth = width;
|
|
562
|
+
container.style.height = `${height}px`;
|
|
563
|
+
const widget = container.querySelector('#plot');
|
|
564
|
+
if (widget) {
|
|
565
|
+
widget.style.width = '100%';
|
|
566
|
+
widget.style.height = `${height}px`;
|
|
567
|
+
}
|
|
568
|
+
const graph = container.querySelector('.js-plotly-plot');
|
|
569
|
+
if (graph && window.Plotly) {
|
|
570
|
+
// Plotly sometimes retains a previous fixed pixel height.
|
|
571
|
+
window.Plotly.relayout(graph, {width: Math.round(width), height: height});
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
const observer = new ResizeObserver(resize);
|
|
560
575
|
observer.observe(container);
|
|
561
|
-
|
|
576
|
+
window.addEventListener('resize', resize);
|
|
577
|
+
// React to Shiny rendering a new Plotly graph.
|
|
578
|
+
const mutation = new MutationObserver(() => requestAnimationFrame(resize));
|
|
579
|
+
mutation.observe(container, {childList: true, subtree: false});
|
|
580
|
+
requestAnimationFrame(resize);
|
|
562
581
|
return true;
|
|
563
582
|
};
|
|
564
|
-
|
|
565
|
-
window.addEventListener('resize', resizePlot);
|
|
566
|
-
if (!attach()) {
|
|
583
|
+
if (!install()) {
|
|
567
584
|
const startup = new MutationObserver((_, watcher) => {
|
|
568
|
-
if (
|
|
569
|
-
});
|
|
570
|
-
startup.observe(document.documentElement, {
|
|
571
|
-
childList: true, subtree: true
|
|
585
|
+
if (install()) watcher.disconnect();
|
|
572
586
|
});
|
|
587
|
+
startup.observe(document.documentElement, {childList: true, subtree: true});
|
|
573
588
|
}
|
|
574
589
|
})();
|
|
575
590
|
"""),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|