{"id":850,"url":"https://github.com/Zomato/DR-charts","last_synced_at":"2025-07-30T19:32:26.570Z","repository":{"id":112083997,"uuid":"59807930","full_name":"Zomato/DR-charts","owner":"Zomato","description":null,"archived":false,"fork":false,"pushed_at":"2018-12-23T16:19:23.000Z","size":20087,"stargazers_count":95,"open_issues_count":16,"forks_count":35,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-11T21:40:32.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zomato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-27T05:56:46.000Z","updated_at":"2025-01-16T07:13:46.000Z","dependencies_parsed_at":"2023-03-08T22:15:16.863Z","dependency_job_id":null,"html_url":"https://github.com/Zomato/DR-charts","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Zomato/DR-charts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zomato%2FDR-charts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zomato%2FDR-charts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zomato%2FDR-charts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zomato%2FDR-charts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zomato","download_url":"https://codeload.github.com/Zomato/DR-charts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zomato%2FDR-charts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267928985,"owners_count":24167431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:32.912Z","updated_at":"2025-07-30T19:32:26.079Z","avatar_url":"https://github.com/Zomato.png","language":"Objective-C","funding_links":[],"categories":["Charts","UI"],"sub_categories":["Other free courses","Getting Started"],"readme":"dr-charts\n=========\n\nEasy to use, customizable and interactive charts library for iOS in Objective-C\n\n### Features:\n* Multiple chart types\n  * Line / Multiple lines / Lines Parallel To X and Y -Axis\n  * Circular Charts\n  * Vertical Bar Charts\n  * Horizontal Stack Charts\n  * Pie Chart\n* Easy to use: no learning curve, no complicated settings - just assemble Charts with the help of DataSource.\n* Interactivity support - Easily accessible using the Delegates\n* Extremely customizable\n\n\n### Objective-C, iOS 8+\n\n### Demo\n\n![LineChart](https://raw.githubusercontent.com/Zomato/DR-charts/master/art/LineChart.gif) ![BarChart](https://raw.githubusercontent.com/Zomato/DR-charts/master/art/BarChart.gif) ![PieChart](https://raw.githubusercontent.com/Zomato/DR-charts/master/art/PieChart.gif) ![HorizontalStackChart](https://raw.githubusercontent.com/Zomato/DR-charts/master/art/HorizontalStackChart.gif) ![CircularChart](https://raw.githubusercontent.com/Zomato/DR-charts/master/art/CircularChart.gif) \n\n\n## Installation\n\n[CocoaPods](http://cocoapods.org) is the recommended way to add Dr-Charts to your project.\n\n#### Using CocoaPod\nSimply add the following line to your Podfile and install the pod. \n```\npod 'drCharts', :git =\u003e 'https://github.com/Zomato/DR-charts.git'\n```\nWhere \"dr-charts\" is the name of the library.\n\n#### The Old School Way\nThe simplest way to add _Dr-Charts_ to your project is to drag and drop the /Classes folder into your Xcode project. It is also recommended to rename the /Classes folder to something more descriptive (i.e. 'Dr-Charts').\n\n\n#### CHART TYPE\n##### Line Chart\n\nThis is an example of Line Chart:\n\n###### Set Properties\n```objc\npragma Mark CreateLineGraph\n- (void)createLineGraph{\n    MultiLineGraphView *graph = [[MultiLineGraphView alloc] initWithFrame:CGRectMake(0, header_height, WIDTH(self.view), HEIGHT(self.view) - header_height)];\n    \n    [graph setDelegate:self];\n    [graph setDataSource:self];\n    \n    [graph setShowLegend:TRUE];\n    [graph setLegendViewType:LegendTypeHorizontal];\n    \n    [graph setDrawGridY:TRUE];\n    [graph setDrawGridX:TRUE];\n    \n    [graph setGridLineColor:[UIColor lightGrayColor]];\n    [graph setGridLineWidth:0.3];\n    \n    [graph setTextFontSize:12];\n    [graph setTextColor:[UIColor blackColor]];\n    [graph setTextFont:[UIFont systemFontOfSize:graph.textFontSize]];\n    \n    [graph setMarkerColor:[UIColor orangeColor]];\n    [graph setMarkerTextColor:[UIColor whiteColor]];\n    [graph setMarkerWidth:0.4];\n    [graph setShowMarker:TRUE];\n    [graph showCustomMarkerView:TRUE];\n\n    [graph drawGraph];\n    [self.view addSubview:graph];\n}\n```\n###### Set DataSource\n```objc\n#pragma mark MultiLineGraphViewDataSource\n- (NSMutableArray *)xDataForLineToBePlotted{\n    NSMutableArray *array = [[NSMutableArray alloc] init];\n    for (int i = 0; i \u003c 30; i++) {\n        [array addObject:[NSString stringWithFormat:@\"%d\", 1000 + i]];\n    }\n    return array;\n}\n- (NSInteger)numberOfLinesToBePlotted{\n    return 2;\n}\n- (LineDrawingType)typeOfLineToBeDrawnWithLineNumber:(NSInteger)lineNumber{\n    switch (lineNumber) {\n        case 0:\n            return LineDefault;\n            break;\n        case 1:\n            return LineParallelXAxis;\n            break;\n    }\n    return LineDefault;\n}\n- (UIColor *)colorForTheLineWithLineNumber:(NSInteger)lineNumber{\n    NSInteger aRedValue = arc4random()%255;\n    NSInteger aGreenValue = arc4random()%255;\n    NSInteger aBlueValue = arc4random()%255;\n    UIColor *randColor = [UIColor colorWithRed:aRedValue/255.0f green:aGreenValue/255.0f blue:aBlueValue/255.0f alpha:1.0f];\n    return randColor;\n}\n- (CGFloat)widthForTheLineWithLineNumber:(NSInteger)lineNumber{\n    return 1;\n}\n- (NSString *)nameForTheLineWithLineNumber:(NSInteger)lineNumber{\n    return [NSString stringWithFormat:@\"data %ld\",(long)lineNumber];\n}\n- (BOOL)shouldFillGraphWithLineNumber:(NSInteger)lineNumber{\n    switch (lineNumber) {\n        case 0:\n            return false;\n            break;\n        case 1:\n            return true;\n            break;\n    }\n    return false;\n}\n- (BOOL)shouldDrawPointsWithLineNumber:(NSInteger)lineNumber{\n    switch (lineNumber) {\n        case 0:\n            return true;\n            break;\n        case 1:\n            return false;\n            break;\n    }\n    return false;\n}\n- (NSMutableArray *)dataForLineWithLineNumber:(NSInteger)lineNumber{\n    switch (lineNumber) {\n        case 0:\n        {\n            NSMutableArray *array = [[NSMutableArray alloc] init];\n            for (int i = 0; i \u003c 30; i++) {\n                [array addObject:[NSNumber numberWithLong:random() % 100]];\n            }\n            return array;\n        }\n            break;\n        case 1:\n        {\n            NSMutableArray *array = [[NSMutableArray alloc] init];\n            [array addObject:[NSNumber numberWithLong:random() % 100]];\n            [array addObject:[NSNumber numberWithLong:random() % 100]];\n            \n            return array;\n        }\n            break;\n    }\n    return [[NSMutableArray alloc] init];\n}\n\n- (UIView *)customViewForLineChartTouchWithXValue:(NSNumber *)xValue andYValue:(NSNumber *)yValue{\n    UIView *view = [[UIView alloc] init];\n    [view setBackgroundColor:[UIColor whiteColor]];\n    [view.layer setCornerRadius:4.0F];\n    [view.layer setBorderWidth:1.0F];\n    [view.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];\n    [view.layer setShadowColor:[[UIColor blackColor] CGColor]];\n    [view.layer setShadowRadius:2.0F];\n    [view.layer setShadowOpacity:0.3F];\n    \n    UILabel *label = [[UILabel alloc] init];\n    [label setFont:[UIFont systemFontOfSize:12]];\n    [label setTextAlignment:NSTextAlignmentCenter];\n    [label setText:[NSString stringWithFormat:@\"Line Data: %@\", yValue]];\n    [label setFrame:CGRectMake(0, 0, 100, 30)];\n    [view addSubview:label];\n    \n    [view setFrame:label.frame];\n    return view;\n}\n```\n###### Set Delegate\n```objc\n#pragma mark MultiLineGraphViewDelegate\n- (void)didTapWithValuesAtX:(NSString *)xValue valuesAtY:(NSString *)yValue{\n    NSLog(@\"Line Chart: Value-X:%@, Value-Y:%@\",xValue, yValue);\n}\n```\n\n##### Bar Chart\n\nThis is an example of a Bar Chart:\n\n###### Set Properties\n```objc\n#pragma Mark CreateHorizontalChart\n- (void)createBarChart{\n    BarChart *barChartView = [[BarChart alloc] initWithFrame:CGRectMake(0, header_height, WIDTH(self.view), HEIGHT(self.view) - header_height)];\n    [barChartView setDataSource:self];\n    [barChartView setDelegate:self];\n    \n    [barChartView setShowLegend:TRUE];\n    [barChartView setLegendViewType:LegendTypeHorizontal];\n    \n    [barChartView setDrawGridY:TRUE];\n    [barChartView setDrawGridX:TRUE];\n    \n    [barChartView setGridLineColor:[UIColor lightGrayColor]];\n    [barChartView setGridLineWidth:0.3];\n    \n    [barChartView setTextFontSize:12];\n    [barChartView setTextColor:[UIColor blackColor]];\n    [barChartView setTextFont:[UIFont systemFontOfSize:barChartView.textFontSize]];\n\n    [barChartView setShowCustomMarkerView:TRUE];\n    [barChartView drawBarGraph];\n\n    [self.view addSubview:barChartView];\n}\n```\n###### Set DataSource\n```objc\n#pragma mark BarChartDataSource\n- (NSMutableArray *)xDataForBarChart{\n    NSMutableArray *array = [[NSMutableArray alloc] init];\n    for (int i = 0; i \u003c 20; i++) {\n        [array addObject:[NSString stringWithFormat:@\"%d\", 2000 + i]];\n    }\n    return  array;\n}\n\n- (NSInteger)numberOfBarsToBePlotted{\n    return 2;\n}\n\n- (UIColor *)colorForTheBarWithBarNumber:(NSInteger)barNumber{\n    NSInteger aRedValue = arc4random()%255;\n    NSInteger aGreenValue = arc4random()%255;\n    NSInteger aBlueValue = arc4random()%255;\n    UIColor *randColor = [UIColor colorWithRed:aRedValue/255.0f green:aGreenValue/255.0f blue:aBlueValue/255.0f alpha:1.0f];\n    return randColor;\n}\n\n- (CGFloat)widthForTheBarWithBarNumber:(NSInteger)barNumber{\n    return 40;\n}\n\n- (NSString *)nameForTheBarWithBarNumber:(NSInteger)barNumber{\n    return [NSString stringWithFormat:@\"Data %d\",(int)barNumber];\n}\n\n- (NSMutableArray *)yDataForBarWithBarNumber:(NSInteger)barNumber{\n    NSMutableArray *array = [[NSMutableArray alloc] init];\n    for (int i = 0; i \u003c 20; i++) {\n        [array addObject:[NSNumber numberWithLong:random() % 100]];\n    }\n    return array;\n}\n\n- (UIView *)customViewForBarChartTouchWithValue:(NSNumber *)value{\n    UIView *view = [[UIView alloc] init];\n    [view setBackgroundColor:[UIColor whiteColor]];\n    [view.layer setCornerRadius:4.0F];\n    [view.layer setBorderWidth:1.0F];\n    [view.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];\n    [view.layer setShadowColor:[[UIColor blackColor] CGColor]];\n    [view.layer setShadowRadius:2.0F];\n    [view.layer setShadowOpacity:0.3F];\n    \n    UILabel *label = [[UILabel alloc] init];\n    [label setFont:[UIFont systemFontOfSize:12]];\n    [label setTextAlignment:NSTextAlignmentCenter];\n    [label setText:[NSString stringWithFormat:@\"Bar Data: %@\", value]];\n    [label setFrame:CGRectMake(0, 0, 100, 30)];\n    [view addSubview:label];\n    \n    [view setFrame:label.frame];\n    return view;\n}\n```\n###### Set Delegate\n```objc\n#pragma mark BarChartDelegate\n- (void)didTapOnBarChartWithValue:(NSString *)value{\n    NSLog(@\"Bar Chart: %@\",value);\n}\n```\n\n##### Pie Chart\n\nThis is an example of Pie Chart\n\n###### Set Properties\n```objc\n#pragma Mark CreatePieChart\n- (void)createPieChart{\n    PieChart *chart = [[PieChart alloc] initWithFrame:CGRectMake(0, header_height, WIDTH(self.view), (HEIGHT(self.view) - header_height)/2)];\n    [chart setDataSource:self];\n    [chart setDelegate:self];\n    \n    [chart setShowLegend:TRUE];\n    [chart setLegendViewType:LegendTypeHorizontal];\n    \n    [chart setTextFontSize:12];\n    [chart setTextColor:[UIColor blackColor]];\n    [chart setTextFont:[UIFont systemFontOfSize:chart.textFontSize]];\n    \n    [chart setShowValueOnPieSlice:TRUE];\n    [chart setShowCustomMarkerView:TRUE];\n    \n    [chart drawPieChart];\n    [self.view addSubview:chart];\n}\n```\n###### Set DataSource\n```objc\n#pragma mark PieChartDataSource\n- (NSInteger)numberOfValuesForPieChart{\n    return 5;\n}\n\n- (UIColor *)colorForValueInPieChartWithIndex:(NSInteger)lineNumber{\n    NSInteger aRedValue = arc4random()%255;\n    NSInteger aGreenValue = arc4random()%255;\n    NSInteger aBlueValue = arc4random()%255;\n    UIColor *randColor = [UIColor colorWithRed:aRedValue/255.0f green:aGreenValue/255.0f blue:aBlueValue/255.0f alpha:1.0f];\n    return randColor;\n}\n\n- (NSString *)titleForValueInPieChartWithIndex:(NSInteger)index{\n    return [NSString stringWithFormat:@\"data %ld\",(long)index];\n}\n\n- (NSNumber *)valueInPieChartWithIndex:(NSInteger)index{\n    return [NSNumber numberWithLong:random() % 100];\n}\n\n- (UIView *)customViewForPieChartTouchWithValue:(NSNumber *)value{\n    UIView *view = [[UIView alloc] init];\n    [view setBackgroundColor:[UIColor whiteColor]];\n    [view.layer setCornerRadius:4.0F];\n    [view.layer setBorderWidth:1.0F];\n    [view.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];\n    [view.layer setShadowColor:[[UIColor blackColor] CGColor]];\n    [view.layer setShadowRadius:2.0F];\n    [view.layer setShadowOpacity:0.3F];\n\n    UILabel *label = [[UILabel alloc] init];\n    [label setFont:[UIFont systemFontOfSize:12]];\n    [label setTextAlignment:NSTextAlignmentCenter];\n    [label setText:[NSString stringWithFormat:@\"Pie Data: %@\", value]];\n    [label setFrame:CGRectMake(0, 0, 100, 30)];\n    [view addSubview:label];\n    \n    [view setFrame:label.frame];\n    return view;\n}\n```\n###### Set Delegate\n```objc\n#pragma mark PieChartDelegate\n- (void)didTapOnPieChartWithValue:(NSString *)value{\n    NSLog(@\"Pie Chart: %@\",value);\n}\n```\n\n##### Horizontal Stack Chart\n\nThis is an example of Horizontal Stack Chart\n\n###### Set Properties\n```objc\n#pragma Mark CreateHorizontalChart\n- (void)createHorizontalStackChart{\n    HorizontalStackBarChart *chartView = [[HorizontalStackBarChart alloc] initWithFrame:CGRectMake(0, header_height, WIDTH(self.view), 150)];\n    [chartView setDataSource:self];\n    [chartView setDelegate:self];\n\n    [chartView setShowLegend:TRUE];\n    [chartView setLegendViewType:LegendTypeHorizontal];\n    \n    [chartView setTextFontSize:12];\n    [chartView setTextColor:[UIColor blackColor]];\n    [chartView setTextFont:[UIFont systemFontOfSize:chartView.textFontSize]];\n    \n    [chartView setShowValueOnBarSlice:TRUE];\n    [chartView setShowCustomMarkerView:TRUE];\n\n    [chartView drawStackChart];\n    [self.view addSubview:chartView];\n}\n```\n###### Set DataSource\n```objc\n#pragma mark HorizontalStackBarChartDataSource\n- (NSInteger)numberOfValuesForStackChart{\n    return 5;\n}\n\n- (UIColor *)colorForValueInStackChartWithIndex:(NSInteger)index{\n    NSInteger aRedValue = arc4random()%255;\n    NSInteger aGreenValue = arc4random()%255;\n    NSInteger aBlueValue = arc4random()%255;\n    UIColor *randColor = [UIColor colorWithRed:aRedValue/255.0f green:aGreenValue/255.0f blue:aBlueValue/255.0f alpha:1.0f];\n    return randColor;\n}\n\n- (NSString *)titleForValueInStackChartWithIndex:(NSInteger)index{\n    return [NSString stringWithFormat:@\"data %ld\",(long)index];\n}\n\n- (NSNumber *)valueInStackChartWithIndex:(NSInteger)index{\n    return [NSNumber numberWithLong:random() % 100];\n}\n\n- (UIView *)customViewForStackChartTouchWithValue:(NSNumber *)value{\n    UIView *view = [[UIView alloc] init];\n    [view setBackgroundColor:[UIColor whiteColor]];\n    [view.layer setCornerRadius:4.0F];\n    [view.layer setBorderWidth:1.0F];\n    [view.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];\n    [view.layer setShadowColor:[[UIColor blackColor] CGColor]];\n    [view.layer setShadowRadius:2.0F];\n    [view.layer setShadowOpacity:0.3F];\n    \n    UILabel *label = [[UILabel alloc] init];\n    [label setFont:[UIFont systemFontOfSize:12]];\n    [label setTextAlignment:NSTextAlignmentCenter];\n    [label setText:[NSString stringWithFormat:@\"Stack Data: %@\", value]];\n    [label setFrame:CGRectMake(0, 0, 100, 30)];\n    [view addSubview:label];\n    \n    [view setFrame:label.frame];\n    return view;\n}\n```\n###### Set Delegate\n```objc\n#pragma mark HorizontalStackBarChartDelegate\n- (void)didTapOnHorizontalStackBarChartWithValue:(NSString *)value{\n    NSLog(@\"Horizontal Stack Chart: %@\",value);\n}\n```\n\n##### Circular Chart\n\nThis is an example of Circular Chart\n\n###### Set Properties\n```objc\n#pragma Mark CreateCircularChart\n- (void)createCircularChart{\n    CircularChart *chart = [[CircularChart alloc] initWithFrame:CGRectMake(0, header_height, WIDTH(self.view), (HEIGHT(self.view) - header_height)/2)];\n    [chart setDataSource:self];\n    [chart setDelegate:self];\n\n    [chart setShowLegend:TRUE];\n    [chart setLegendViewType:LegendTypeHorizontal];\n    \n    [chart setTextFontSize:12];\n    [chart setTextColor:[UIColor blackColor]];\n    [chart setTextFont:[UIFont systemFontOfSize:chart.textFontSize]];\n\n    [chart setShowCustomMarkerView:TRUE];\n\n    [chart drawPieChart];\n    [self.view addSubview:chart];\n}\n```\n###### Set DataSource\n```objc\n#pragma mark CircularChartDataSource\n- (CGFloat)strokeWidthForCircularChart{\n    return 50;\n}\n\n- (NSInteger)numberOfValuesForCircularChart{\n    return 2;\n}\n\n- (UIColor *)colorForValueInCircularChartWithIndex:(NSInteger)lineNumber{\n    NSInteger aRedValue = arc4random()%255;\n    NSInteger aGreenValue = arc4random()%255;\n    NSInteger aBlueValue = arc4random()%255;\n    UIColor *randColor = [UIColor colorWithRed:aRedValue/255.0f green:aGreenValue/255.0f blue:aBlueValue/255.0f alpha:1.0f];\n    return randColor;\n}\n\n- (NSString *)titleForValueInCircularChartWithIndex:(NSInteger)index{\n    return [NSString stringWithFormat:@\"data %ld\",(long)index];\n}\n\n- (NSNumber *)valueInCircularChartWithIndex:(NSInteger)index{\n    return [NSNumber numberWithLong:random() % 100];\n}\n\n- (UIView *)customViewForCircularChartTouchWithValue:(NSNumber *)value{\n    UIView *view = [[UIView alloc] init];\n    [view setBackgroundColor:[UIColor whiteColor]];\n    [view.layer setCornerRadius:4.0F];\n    [view.layer setBorderWidth:1.0F];\n    [view.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];\n    [view.layer setShadowColor:[[UIColor blackColor] CGColor]];\n    [view.layer setShadowRadius:2.0F];\n    [view.layer setShadowOpacity:0.3F];\n    \n    UILabel *label = [[UILabel alloc] init];\n    [label setFont:[UIFont systemFontOfSize:12]];\n    [label setTextAlignment:NSTextAlignmentCenter];\n    [label setText:[NSString stringWithFormat:@\"Circular Data: %@\", value]];\n    [label setFrame:CGRectMake(0, 0, 100, 30)];\n    [label setAdjustsFontSizeToFitWidth:TRUE];\n    [view addSubview:label];\n    \n    [view setFrame:label.frame];\n    return view;\n}\n```\n###### Set Delegate\n```objc\n#pragma mark CircularChartDelegate\n- (void)didTapOnCircularChartWithValue:(NSString *)value{\n    NSLog(@\"Circular Chart: %@\",value);\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZomato%2FDR-charts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FZomato%2FDR-charts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZomato%2FDR-charts/lists"}