I use TeeChart for Xamarin.iOS. I have CircularGauge, which must display large numbers (e+200). Axis labels with long text (large numbers) are located in strange manner on the centre of chart. ValueFormat property isn't working for CircularGauge. GetAxisDrawLabel event works, but labels aren't locating properly after formatting. Location is calculated for their old long values, not formatted values. I think this is TeeChart bug. How to solve this issue? Please, help.
1 Answers
We had the same problem several weeks ago. After long brainstorming we found workaround for this case. We used scaling for range and incoming value before writing to gauge. I will try to explain by example.
We want display values in range from -1.3e+20 to 1.3e+20.
- We set minimum value 10000 and maximum value 99999 in gauge. Text in labels always has length 5 and gauge calculates labels size and position for 5 chars;
We change label text in event handler for event which gives possibility to change text in labels before showing. This method sets following text:
var text = ((-1.3e+20) + (value - 10000.0) / (99999 - 10000) * ((1.3e+20) - (-1.3e+20))).ToString("e1");
Incoming value for arrow we change by formula:
var scaledValue = 10000 + (value - (-1.3e+20)) / ((1.3e+20) - (-1.3e+20)) * (99999 - 10000);
After this calculation arrow are located in correct position and labels have correct text. All this hacks does not matter for users which will be look on the gauge.
I hope this solution will help you.