Nevron Forum

Gauges: How to add a label whose text resizes with the gauge

https://www.nevron.com/Forum/Topic9448.aspx

By Kevin Harrison 1 - Thursday, November 5, 2015

Is this possible? I notice that the text size of labels in the examples does not change when the gauges are resized.
Thanks
Kevin
By Nevron Support - Friday, November 6, 2015

Hi Kevin,
You can use NLength with relative unit (parent percentage) to specify the text size of the gauge label texts - for example:

scale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(5, NRelativeUnit.ParentPercentage);


By Kevin Harrison 1 - Monday, November 16, 2015

Sorry, I wasn't precise enough. When I said label I didn't mean the scale labels.
I want to add a label showing the gauge value. For example I want to add a label to a radial gauge just below the centre spindle. This label should stay at the same relative position and its size should scale as the gauge is resized.
None of the examples do this as the labels; e.g. RPM on the Car dashboard, are a fixed size and move relative to the centre spindle as the gauge is resized. It doesn't look good!
Please can you give an example on how to achieve this?
By Nevron Support - Monday, November 16, 2015

Hi Kevin,

Similarly to the state indicators case maybe you'll have to implement some code that resizes those labels during a gauge resize. It will be problematic to use NLength with ParentPercentage as it takes the average size of parent width and height - maybe for fine grained scaling we should implement parentminsize, parentmaxsize, parentwidth and parentheight relative units.