Implement rotated numeric label generation for the arc scale
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+14
@@ -491,6 +491,20 @@ def generate_svg(unit, min_val, max_val, left_label, right_label, big_ticks, sma
|
||||
length, width = (MEDIUM_LEN, MEDIUM_W) if j == medium_j else (SMALL_LEN, SMALL_W)
|
||||
parts.append(_tick_line(angle, length, width))
|
||||
|
||||
lx, ly = PIVOT_X, PIVOT_Y - LABEL_RADIUS
|
||||
for k, idx in enumerate(label_indices):
|
||||
angle = big_angles[idx]
|
||||
label = custom_labels[k] if custom_labels else _fmt(big_vals[idx])
|
||||
wrap = f'rotate({angle:.5f},{PIVOT_X:.5f},{PIVOT_Y:.5f})'
|
||||
if use_paths:
|
||||
parts.append(' ' + _text_to_paths(label, lx, ly, label_size, fd,
|
||||
anchor='middle', wrap_transform=wrap))
|
||||
else:
|
||||
parts.append(
|
||||
f' <text style="font-size:{label_size:.5f}px;font-family:\'{fd.label}\',monospace;fill:#1a1a1a"'
|
||||
f' text-anchor="middle" x="{lx:.5f}" y="{ly:.5f}" transform="{wrap}">{escape(label)}</text>'
|
||||
)
|
||||
|
||||
parts += [' </g>', '</svg>']
|
||||
return '\n'.join(parts)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user