Latest 1.1.2
License MIT
Platforms ios 7.0
Frameworks UIKit, CoreGraphics, Foundation






CocoaPods is the recommended way to use WHChartView in your project.

  • Simply add this line to your Podfile:

    pod 'WHChartView'

  • Run pod install.

Include with #import "WHChartView.h" to use it wherever you need.


WHChartView *chart = [[WHChartView alloc]initWithFrame:(CGRect)rect];


- (void)setChartData:(NSArray *)chartData;
- (void)strokeChart;


/***  Coordinate ***/
@property (nonatomic, strong)   NSString *title;
@property (nonatomic, strong)   UIColor *colorOfTitle;
@property (nonatomic, strong)   UIColor *colorOfXYLabel;
@property (nonatomic, strong)   UIColor *colorOfAxis;
@property (nonatomic, strong)   UIColor *colorOfGridding;
@property (nonatomic)           BOOL showsGridding;
@property (nonatomic)           BOOL showsXLabel;
@property (nonatomic, strong)   NSArray *xLabelString;  //Data of XLabel

/***  Bar in Chart ***/
@property (nonatomic)           BOOL drawsBarChart;
@property (nonatomic, strong)   UIColor *colorOfBar;
@property (nonatomic, strong)   UIColor *colorOfUnusedPartOfBar;
@property (nonatomic)           BOOL showsShadowOfBar;
@property (nonatomic, strong)   UIColor *colorOfShadow;
@property (nonatomic)           double angleOfShadow;
@property (nonatomic)           CFTimeInterval animationDurationOfBar; //animationDuration

/***  Line in Chart ***/
@property (nonatomic)           BOOL drawsLineChart;
@property (nonatomic)           CGFloat lineWidth;
@property (nonatomic, strong)   UIColor *colorOfLine;
@property (nonatomic)           CFTimeInterval animationDurationOfLine;

@property (nonatomic)           BOOL smoothesLine;        //BazierPath
@property (nonatomic)           CGFloat kOfBezierPath;

@property (nonatomic)           BOOL showsGradientColor; //GradientColor
@property (nonatomic, strong)   NSArray *gradientColors;
@property (nonatomic, strong)   NSArray *gradientLocations;
@property (nonatomic)           CGPoint gradientStartPoint;
@property (nonatomic)           CGPoint gradientEndPoint;


    WHChartView *chart = [[WHChartView alloc]initWithFrame:CGRectMake(20, 50, self.view.bounds.size.width - 40, 200)];

    NSArray *dataValue = @[@123.5,@122,@87,@101.1,@16,@60.6,@51,@44,@20,@18,@98,@110,@19,@77];
    NSArray *xLabelString = @[@"6-10",@"6-11",@"6-12",@"6-13",@"6-14",@"6-15",@"6-16",@"6-17",@"6-12",@"6-13",@"6-14",@"6-15",@"6-16",@"6-17"];

    /***  Coordinate ***/
    chart.title = @"Bar and Line";
    //chart.colorOfTitle = [UIColor whClouds];              //Using default value;
    //chart.colorOfXYLabel = [UIColor lightGrayColor];      //Using default value;
    //chart.colorOfAxis = [UIColor whClouds];               //Using default value;
    //chart.colorOfGridding = [UIColor whClouds];           //Using default value;
    chart.showsGridding = YES;
    chart.showsXLabel = YES;
    chart.xLabelString = xLabelString;

    /***  Bar in Chart ***/
    chart.drawsBarChart = YES;
    chart.colorOfBar = [UIColor whAsbestos];
    chart.colorOfUnusedPartOfBar = [UIColor clearColor];
    chart.showsShadowOfBar = NO;
    //chart.colorOfShadow = [UIColor colorWithRed:0.35 green:0.45 blue:0.55 alpha:0.9];
    //chart.angleOfShadow = 30.0;
    //chart.animationDurationOfBar = 1.5;                   //Using default value;

    /***  Line in Chart ***/
    chart.drawsLineChart = YES;
    //chart.lineWidth = 1.0;                                //Using default value;
    //chart.colorOfLine = [UIColor blackColor];
    //chart.animationDurationOfLine = 1.5;                  //Using default value;

    chart.smoothesLine = YES;
    //chart.kOfBezierPath = 0.25;                           //Using default value;
    chart.showsGradientColor = YES;
    //chart.gradientColors = [NSArray arrayWithObjects:(id)[UIColor whGreen].CGColor ,(id)[UIColor whOrange].CGColor,(id)[UIColor whAlizarin].CGColor, nil];                            //Using default value;
    //chart.gradientLocations = @[@0.2,@0.5,@0.9 ];         //Using default value;
    //chart.gradientStartPoint = CGPointMake(0.5, 0);       //Using default value;
    //chart.gradientEndPoint = CGPointMake(0.5, 1);         //Using default value;

    [chart setChartData:dataValue];
    [chart strokeChart];

    [self.view addSubview:chart];


WHChartView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "WHChartView",
    "version": "1.1.2",
    "summary": "WHChartView can draw histogram and curve chart. It's cool. XD",
    "description": "To improve my iOS skills and make it useful.nn* Think: Why did you write this? What is the focus? What does it do?n* CocoaPods will be using this to generate tags, and improve search results.n* Try to keep it short, snappy and to the point.n* Finally, don't worry about the indent, CocoaPods strips it!",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "wongkoo": "[email protected]"
    "platforms": {
        "ios": "7.0"
    "source": {
        "git": "",
        "tag": "1.1.2"
    "source_files": "WHChartView/*",
    "frameworks": [

Pin It on Pinterest

Share This