Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've inherited a small WPF project. I've never done anything with WPF or XAML before, but it looks relatively straightforward. I've been asked to evaluate the feasibility of some changes.

Currently we have a wheel, with spokes. The spoke labels current 'stick out' outside the wheel, written horizontally, but at the 'spoke angle' (essentially, the labels look like extensions of the spoke). I've been asked if we can change this to display the spoke label in an arc-ing band around the wheel (the label on a coloured arc, centred on each spoke).
(the text is semi-dynamic, read from a data file!)

Seeing this:

Text On A Path in WPF[^]

and this:

ArcSegment[^]

It seems like this wouldn't be too difficult to achieve, but I have no idea about the technicalities.

What about word-wrapping of "arced" text? What about centring horizontally and vertically? What about calculating the text size so I can change the font size if it doesn't fit? How and when to flip the text on the arc so it is mostly the right way up? These are some of the details I can anticipate having to deal with, but have no idea how workable / easy / possible they are.

Is this change harder than it sounds?
Posted
Comments
BillWoodruff 15-Dec-13 19:02pm    
If you are producing a one-off graphic for static use, then, imho, I think you'll spend a lot of time to get something that looks good. Even mono-spaced fonts can be difficult to adjust properly on a path, depending on the path, the font, the use of capital letters, the justification of the characters, etc.

Certainly a great learning project for mastering graphic manipulation, though.
Kyudos 15-Dec-13 19:25pm    
The wheel is actually a chart control (info by spoke length), so things (may) need some sort of dynamic sizing / positioning. Perhaps with the straightforward circular arcs, short-ish labels etc. I might get away with manual text modification (e.g., manually adding carriage returns etc.). Another thought occurs - I'll need to control the text colour too, for maximum visibility on different colour backgrounds...I have the sneaking suspicion this "easy" change is not quite so simple!

1 solution

See Text On A Path in WPF[^] comments for my solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900