Refactor print styles and enhance chart configuration for better visualization
Some checks failed
CI / ci (push) Has been cancelled

- Adjusted chart grid color for improved contrast in visualizations.
- Implemented print-specific styles to ensure proper layout and formatting on A4 paper.
- Enhanced chart configuration in JavaScript to include grid line width and tick border dash for clearer data representation.
- Updated HTML to streamline print functionality, replacing the PDF export button with a direct print command.
This commit is contained in:
2026-02-12 14:23:23 +03:00
parent 263379c072
commit 99f8cb2dec
3 changed files with 105 additions and 11 deletions

View File

@@ -7,8 +7,11 @@
<title>{% block title %}SWatcher{% endblock %}</title>
<link rel="icon" href="{% static 'favicon.ico' %}" type="image/x-icon">
<link rel="stylesheet" href="{% static 'css/output.css' %}">
<script src="{% static 'js/html2canvas-pro.min.js' %}"></script>
<script src="{% static 'js/jspdf.umd.min.js' %}"></script>
<style media="print">
/* Force A4 content width so print layout does not use screen width */
html, body { width: 180mm !important; min-width: 180mm !important; max-width: 180mm !important; margin: 0 !important; padding: 0 !important; overflow-x: hidden !important; }
body * { min-width: 0 !important; box-sizing: border-box !important; }
</style>
{% block imports %}
{% endblock %}
{% block css %}
@@ -22,7 +25,7 @@
</div>
<div class="navbar-end">
<div class="px-1 flex items-center gap-3 pr-10">
<button type="button" id="pdf-export-btn" class="btn btn-ghost btn-sm no-print" onclick="exportDashboardToPdf()" title="Save as PDF" aria-label="Save as PDF">
<button type="button" id="pdf-export-btn" class="btn btn-ghost btn-sm no-print" onclick="window.print()" title="Save as PDF (opens print dialog; choose &quot;Save as PDF&quot;)" aria-label="Save as PDF">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
@@ -74,7 +77,6 @@
localStorage.setItem('theme', newTheme);
});
</script>
<script src="{% static 'js/export-pdf.js' %}"></script>
<script>
(function() {
function updateSourceStatus(el, label, data) {