Coder Social home page Coder Social logo

owbarchartview's Introduction

OWBarChartView

show chartview with animation.

HOW TO USE:

step one:

pod 'OWBarChartView', '~> 0.0.1'
or

  download Demo.

step two:

Create a NSDictionary as data, the format of the dictionary is as follows:

NSMutableDictionary *dataDic = [NSMutableDictionary dictionary];

NSArray *first_values = @[@(20),@(15),@(30),@(25),@(40)];
UIColor *firstColor = [UIColor redColor];
NSMutableDictionary *first = [NSMutableDictionary dictionary];
[first setObject:first_values forKey:@"values"];
[first setObject:firstColor forKey:@"color"];

NSArray *second_values = @[@(10),@(30),@(25),@(40),@(60)];
UIColor *secondColor = [UIColor yellowColor];
NSMutableDictionary *second = [NSMutableDictionary dictionary];
[second setObject:second_values forKey:@"values"];
[second setObject:secondColor forKey:@"color"];

NSArray *XArray = @[@"Monday", @"Tuesday", @"Wednesday", @"Thursday", @"Friday"];
NSArray *YArray = @[@(5),@(10),@(15),@(20),@(25),@(30),@(35),@(40),@(45),@(50),@(55),@(60),];
[dataDic setObject:first forKey:@"first"];
[dataDic setObject:second forKey:@"second"];
[dataDic setObject:XArray forKey:@"XArray"];
[dataDic setObject:YArray forKey:@"YArray"];

   (Comment: "XArray", "YArray" are necessary.)    

step three:

  Create a OWBarChartView.

_barChart = [[OWBarChartView alloc] initWithDataDictionary:dataDic];
    CGFloat chartHeight = 300.0;
    _barChart.frame = CGRectMake(0, (height - chartHeight)/2, width, chartHeight);
    _barChart.structureType = ChartStructureType_Full;
    _barChart.structureLineWidth = 0.5;
    _barChart.asixWidth = 2.0;
    _barChart.XAsixFont = [UIFont systemFontOfSize:12.0];
    _barChart.YAsixFont = [UIFont systemFontOfSize:12.0];
    [self.view addSubview:_barChart];

If you still dont understand, please check the code in the Demo. If you find anything wrong, feel free to correct me. ---By a rookie. ([email protected], [email protected])

owbarchartview's People

Contributors

wymann avatar

Stargazers

 avatar Carabineiro avatar  avatar

Watchers

James Cloos avatar Carabineiro avatar  avatar

Forkers

carabina

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.