diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 3e7ac46..3767450 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -15,7 +15,7 @@ spec: spec: containers: - name: m1730-generator - image: git.baumann.gr/adebaumann/m1730-generator:0.72 + image: git.baumann.gr/adebaumann/m1730-generator:0.76 imagePullPolicy: Always ports: - containerPort: 5000 diff --git a/web/app.py b/web/app.py index 5f87b58..bfaa063 100644 --- a/web/app.py +++ b/web/app.py @@ -8,7 +8,7 @@ from fontTools.pens.svgPathPen import SVGPathPen app = Flask(__name__) -VERSION = "0.75" +VERSION = "0.76" _LOGO_PATH = pathlib.Path(__file__).parent / 'static' / 'logo.png' _LOGO_B64 = base64.b64encode(_LOGO_PATH.read_bytes()).decode() @@ -93,7 +93,7 @@ def _text_to_paths(text, x, y, font_size, anchor='start', fill='#1a1a1a', wrap_t def generate_svg(unit, min_val, max_val, range_label, big_ticks, small_ticks, label_count, - use_paths=True, log_scale=False, custom_labels=None): + use_paths=True, log_scale=False, custom_labels=None, label_size=9): if log_scale: if min_val <= 0 or max_val <= 0: raise ValueError("Logarithmic scale requires min and max values greater than 0.") @@ -197,10 +197,10 @@ def generate_svg(unit, min_val, max_val, range_label, big_ticks, small_ticks, la x = big_xs[idx] label = custom_labels[k] if custom_labels else _fmt(big_vals[idx]) if use_paths: - parts.append(' ' + _text_to_paths(label, x, 101.49598, 8.89194, anchor='middle')) + parts.append(' ' + _text_to_paths(label, x, 101.49598, label_size, anchor='middle')) else: parts.append( - f' {escape(label)}' ) @@ -226,10 +226,11 @@ def generate(): log_scale = request.form.get('scale_type', 'linear') == 'log' custom_labels = [s.strip() for s in request.form.get('labels', '').split(',') if s.strip()] or None + label_size = max(0.5, min(25.0, float(request.form.get('label_size', 9)))) try: svg = generate_svg(unit, min_val, max_val, range_label, big_ticks, small_ticks, - label_count, use_paths, log_scale, custom_labels) + label_count, use_paths, log_scale, custom_labels, label_size) except ValueError as err: return Response(str(err), status=400, mimetype='text/plain') return Response(svg, mimetype='image/svg+xml') diff --git a/web/templates/index.html b/web/templates/index.html index 4a3c317..38b7681 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -350,12 +350,16 @@ (Labels minus one) should divide evenly into Major intervals for best appearance -
+
Comma-separated. When set, overrides the calculated numbers and its count sets the number of labels.
+
+ + +