Question

LinearTickLabelMajor Custom text format

Posted 3 months ago by Avatar Adrian Murrell

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 3 months ago by Actipro Software Support - Cleveland, OH, USA

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 3 months ago by Adrian Murrell

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.

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA

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 3 months ago by Adrian Murrell

Boom! Nice one thanks, that did the trick.

Information The latest build of this product (2018.1 build 0671) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.