I have a gauge that goes from -70 to 150 with the interval set to 50. I would like the ticks and labels to mark the [-50,0,50,100,150] values but they currently mark the [-70,-20,30,80,130] values.
Is there a way to specify the interval starting point?
Thanks for the suggestion... I was able to change the requirements so that my gauge can start at -50 instead of -70, but I'll keep this in mind if I end up needing to change it back.
Unfortunately, the gauge doesn't have such feature. I can think of one potential workaround, but it's not very graceful.You would use the following IGGaugeViewDelegate method to override the label:
-(NSString *)gaugeView:(IGGaugeView *)gaugeView formatStringForValue:(double)labelValue { NSArray *validValues = @[@-50, @0, @50, @100, @150]; for (int i=0; i<validValues.count; i++) { double val = [validValues[i] doubleValue]; if (val == labelValue) { return [NSString stringWithFormat:@"%.2f", labelValue]; } } return @""; }
This would require you to set your gauge interval to a lowest common denominator between the original and new set of labels. In your case, if you start at -70 the interval would have to be set to 10, and while it does give you the correct labels in the end, you end up with quite a bit more tick marks.