ScaleSmart
Automating optimal, rational graph scales for science lab data. A web-based utility designed to eliminate the tedious math involved in plotting scientific graphs by hand.
The Problem
Science students frequently lose marks in practical exams due to poorly scaled graphs. A proper manual graph must follow strict rules:
- The 80% Rule: Plotted data must cover at least 80% of the drawn axis.
- The Rational Scale Rule: The scale (value per square) must be easily readable decimals (e.g., 1, 2, 5, 0.25).
- Padding: Data points cannot touch the absolute border.
Calculating this manually for complex decimal data (like titration absorbance values) is time-consuming and prone to error.
The Solution
ScaleSmart takes raw X/Y data and runs it through a custom filtering algorithm to find the absolute best fit for standard 180x250 square graph paper. It strictly adheres to laboratory grading rubrics and automatically generates a high-quality vector PDF ready for printing.
Key Features
Excel-Style Input
Interactive data grid with keyboard navigation and instant clipboard pasting directly from Excel or Google Sheets.
Strict Rule Enforcement
Algorithmically filters out "bad" rational numbers and guarantees >80% paper coverage while auto-detecting Portrait or Landscape orientation.
Vector PDF Export
Bypasses heavy raster images to inject raw SVG math directly into an A4 PDF, resulting in tiny file sizes (~50KB) and infinite zoom quality.
Manual Overrides
Allows users to force start values (e.g., starting exactly at 0) or manually flip the orientation if the automated choice needs adjustment.
The Logic Engine
The core of ScaleSmart dynamically generates acceptable scales based on the data's order of magnitude, rather than relying on brittle, hardcoded lists.
1. Generate Candidates
Calculates the raw minimum scale (Range / PaperSize), finds the nearest Base-10 magnitude, and generates candidates using standard multipliers:
- Standard: [1, 2, 2.5, 4, 5, 8]
- Nice Rationals: [0.8, 1.25, 1.6]
- Binary Fractions: [0.5, 0.25, 0.125, 0.0625, ...]
2. The Filtering Loop
Tests each candidate against strict mathematical constraints:
Capacity Check: (Scale * PaperSquares) > DataRange
Fill Check (80% Rule): (DataRange / TotalCapacity) >= 0.80
Start Value Snapping: Centers graph to clean multiple of scale.
The first scale in the sorted array that survives all filters is selected.