Customizing Scale Labels
Send Feedback

Glossary Item Box

Topic Overview


This topic provides a conceptual overview of customizing scale labels on the IGBulletGraphView™ control and demonstrates how to configure them using a code example.

In this topic


Custom labels summary

The scale labels allows you to apply identifying tags to various IGBulletGraphView control elements that are customizable via the IGBulletGraphViewDelegate using the bulletGraphView:formatStringForValue: delegate method. The method provides the IGBulletGraphView calling the method and the label value for formatting and returns an NSString of the new label text.

Customizing Scale Labels – Code Example


The code example uses the IGBulletGraphViewDelegate to implement the bulletGraphView:formatStringForValue: delegate method for formatting the label value to contain a percent symbol.


This code example requires the inclusion of the Chart framework; details about how to add this framework are available in the Adding the Chart Framework File topic.



In Objective-C:

@interface igViewController () <IGBulletGraphViewDelegate>
@implementation igViewController
- (void)viewDidLoad
    [super viewDidLoad];
    CGRect bulletGraphRect = self.view.bounds;
    bulletGraphRect.size.height = 250;
    bulletGraphRect.origin.y = (self.view.bounds.size.height / 2) - 125;
    IGBulletGraphView *bulletGraph = [[IGBulletGraphView alloc] initWithFrame:bulletGraphRect];
    bulletGraph.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
    bulletGraph.fontBrush = [[IGBrush alloc] initWithR:0 andG:0 andB:0 andA:1];
    bulletGraph.interval = 20;
    bulletGraph.targetValue = 82;
    bulletGraph.value = 75;
    bulletGraph.delegate = self;
    [self.view addSubview:bulletGraph];
- (NSString *)bulletGraphView:(IGBulletGraphView *)bulletGraphView formatStringForValue:(double)labelValue
    return [NSString stringWithFormat:@"%.0f%%", labelValue];

In C#:

public partial class BulletGraphScaleLabels_CSViewController : UIViewController
      public BulletGraphScaleLabels_CSViewController ()
      public override void ViewDidLoad ()
            base.ViewDidLoad ();
            RectangleF bulletGraphRect = this.View.Bounds;
            bulletGraphRect.Height = 250;
            bulletGraphRect.Y = (this.View.Bounds.Height / 2) - 125;
            IGBulletGraphView bulletGraph = new IGBulletGraphView ();
            bulletGraph.Frame = bulletGraphRect;
            bulletGraph.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin;
            bulletGraph.FontBrush = new IGBrush (UIColor.Black);
            bulletGraph.Interval = 20;
            bulletGraph.TargetValue = 82;
            bulletGraph.Value = 75;
            bulletGraph.Delegate = new BulletGraphDelegate ();
            this.View.Add (bulletGraph);
public class BulletGraphDelegate : IGBulletGraphViewDelegate
      public override string ResolveFormatString (IGBulletGraphView bulletGraphView, double labelValue)
            return String.Format ("{0}%", labelValue);

Related Content


The following topic provides additional information related to this topic.



The topics in this group cover enabling, configuring, and using the IGBulletGraphView control’s supported features.