• Stars
    star
    111
  • Rank 314,510 (Top 7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A configurable chart that depicts the value of a measurement using a subtle animation.

CHCircleGaugeView

A configurable chart that depicts the value of a measurement using a subtle animation.

Version Platform

Installation

CocoaPods

CHCircleGaugeView is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "CHCircleGaugeView"

Manually

To install manually, just copy everything in the CHCircleGaugeView directory into your Xcode project.

Important: If your project doesn't use ARC you must add the -fobjc-arc compiler flag to all CHCircleGaugeView implementation files in Target Settings > Build Phases > Compile Sources.

Usage

Instantiate like any other view and customize it as needed:

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    CGRect frame = CGRectMake(0, 0, 200, 200);
    CHCircleGaugeView *circleGaugeView = [[CHCircleGaugeView alloc] initWithFrame:frame];
    [self.view addSubView:circleGaugeView];
    
    [circleGauge setValue:0.5 animated:YES];
}

States

There is a state property of type CHCircleGaugeViewState that determines how to display a few things.

  • CHCircleGaugeViewStateNA: "n/a" is displayed in the center of the circle and the gauge inside the track will not be present. The displayed string can be changed by setting the notApplicableString property on the gauge.
  • CHCircleGaugeViewStatePercentSign: "%" is displayed in the center of the circle and the gauge inside the track will not be present. The displayed string can be changed by setting the noDataString property on the gauge.
  • CHCircleGaugeViewStateScore: A whole number (with an optional units suffix) is displayed in the center of the circle and the gauge inside the track will represent the value.

Modifying or setting the value property will automatically cause the state to switch to CHCircleGaugeViewStateScore.

Setting Values

To change the value of the gauge you can call setValue:animated: or set value.

Configuration

The gauge can easily be configured by adjusting public properties:

  • trackTintColor: The color shown for the portion of the gauge that is always filled.
  • gaugeTintColor: The color shown on top of trackTintColor for the portion of the gauge that varies based on the value property.
  • textColor: The color of the text.
  • font: The font of the text.
  • trackWidth: The width for the portion of the gauge that is always filled. Defaults to a value of 0.5.
  • gaugeWidth: The width for the portion of the gauge that varies based on the value property. Defaults to a value of 2.
  • unitsString: String that is a suffix on the value. This string is meant to be just a few characters long. Defaults to nil.
  • notApplicableString: The text shown when the state of the gauge is CHCircleGaugeViewStateNA. Defaults to "n/a".
  • noDataString: The text shown when the state of the gauge is CHCircleGaugeViewStatePercentSign. Defaults to "%".
  • gaugeStyle: Determines how the gauge is drawn relative to the track. Defaults to CHCircleGaugeStyleInside.

Contributing

Pull request are welcomed. To add functionality or to make changes:

  1. Fork this repo.
  2. Open CHCircleGuageViewExample.xcworkspace in the CHCircleGuageViewExample directory.
  3. Make changes to the necessary files in the CHCircleGaugeView group.
  4. Ensure new public methods are documented.
  5. Submit a pull request.

Authors

Created by Osama Ashawa, Matthew Morey, Rogelio Gudino, and other contributors.

License

CHCircleGaugeView is available under the MIT license. See the LICENSE file for more information. If you're using CHCircleGaugeView in your project, attribution would be nice.

More Repositories

1

ChaiOneUI

Useful shared components for iOS development
Objective-C
25
star
2

CHDropDownTextField

A custom text field with drop-down support.
Objective-C
16
star
3

StoryTracker

iOS 8 sample application used to learn Swift as a team.
Swift
15
star
4

CHVariableHeightTilesLayout

Custom collection view layout that has the same vertical spacing between all cells.
Objective-C
8
star
5

ChaiOneUtils

Objective-C
4
star
6

rails-docker-demo

A minimal Rails website demo running on Docker containers and managed by fig
Ruby
3
star
7

spaceframe_spine

Spaceframe for Spine is a set of Rails generators to implement ChaiOne's best practices for a client-side application.
Ruby
3
star
8

postal_geocode

A simple postal code to lat/lng JSON API
Ruby
2
star
9

hue-jenkins

A simple script to update a Philips Hue bulb based on Jenkins build status.
Ruby
2
star
10

RoutableApp

Objective-C
2
star
11

ChaiOneAV

Objective-C
2
star
12

Swift-4-JSON-Extensions

Extensions for JSONDecoder and JSONEncoder
Swift
2
star
13

AWSnap

AWSnap signs your AWS requests for you. No request processing, no response handling, no extra nonsense. Works for all AWS endpoints.
Ruby
1
star
14

active_model_association_adapters

Simple association adapters for polyglot applications.
Ruby
1
star
15

Panko

Easy breadcrumbing for your Ruby app
Ruby
1
star
16

chaibot2.0

The new ChaiOne Hubot
1
star
17

Stag-retired-dnu

Ruby
1
star
18

objective-c-practice

Code used for ChaiONE training in Objective-C & iPhone
Objective-C
1
star
19

wristwatch

Easy cron dispatching
Ruby
1
star
20

chaicraft-iphone

An iPhone application to browse information & strategies of Starcraft II. Built & improved during training / practice sessions at ChaiONE.
Objective-C
1
star
21

chaitools-ember-blueprint

Provides an Ember.js application blueprint for use with `ember new --blueprint` command.
JavaScript
1
star
22

thumbnailer-chef-repo

Chef repo for a thumbnailer service
Ruby
1
star
23

translateable_example

Project spike to enable Translateable models
Ruby
1
star