LinearTickLabelMajor Custom text format

Gauge for WPF Forum

Posted 6 years ago by Adrian Murrell
Version: 17.2.0665
Avatar

Hi

I have a gauge where the values 1, 2, 3, 4, 5 represent Cold, Luke Warm, Warm, Hot, Very Hot for example. How do I format the tick labels on the gauge to apply this conversion e.g. 1 -> Cold, 2 -> Luke Warm etc. At the moment the user will just see lables of 1, 2, 3, 4, 5 on the gauge and i need to show the user the converted text values.

Appreciate any guidance.

 

Thanks

Adrian

Comments (4)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Adrian,

You'd probably have to use custom tick labels for that via the LinearTickLabelCustom class.  The LinearGaugeTicks QuickStart shows an example of supplying a custom tick label.


Actipro Software Support

Posted 6 years ago by Adrian Murrell
Avatar

Thanks. That does the job, but the custom label class seems to be for one off labels on a gauge, so although I can add multiple of these labels to achieve what I'm looking for, its not ideal, as I need to explicilty add\modify them when I'm dealing with a different object or a change in intervals.

 

Would be cool if you could bind to the Text property of a standard LinearTickLabelMajor, and supply your own text for a standardised major interval.

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Adrian,

I did some more looking at the API and found that we have a protected virtual GetValueText method on LinearTickLabelBase that passes you the double value and you return it a string.  Normally we round the number and format it using the TextFormat property setting.  But you could override that and convert it to your own labels.  That might be exactly what you're looking for.


Actipro Software Support

Posted 6 years ago by Adrian Murrell
Avatar

Boom! Nice one thanks, that did the trick.

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.