{"id":839,"url":"https://github.com/Jawbone/JBChartView","last_synced_at":"2025-08-13T07:33:24.846Z","repository":{"id":56915663,"uuid":"14386080","full_name":"Jawbone/JBChartView","owner":"Jawbone","description":"iOS-based charting library for both line and bar graphs.","archived":false,"fork":false,"pushed_at":"2018-08-06T21:57:46.000Z","size":10851,"stargazers_count":3722,"open_issues_count":10,"forks_count":417,"subscribers_count":148,"default_branch":"master","last_synced_at":"2025-08-10T14:15:55.425Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jawbone.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-14T05:28:46.000Z","updated_at":"2025-06-05T06:52:43.000Z","dependencies_parsed_at":"2022-08-21T03:50:31.253Z","dependency_job_id":null,"html_url":"https://github.com/Jawbone/JBChartView","commit_stats":null,"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"purl":"pkg:github/Jawbone/JBChartView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jawbone%2FJBChartView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jawbone%2FJBChartView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jawbone%2FJBChartView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jawbone%2FJBChartView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jawbone","download_url":"https://codeload.github.com/Jawbone/JBChartView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jawbone%2FJBChartView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270096285,"owners_count":24526360,"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-08-12T02:00:09.011Z","response_time":80,"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.634Z","updated_at":"2025-08-13T07:33:24.064Z","avatar_url":"https://github.com/Jawbone.png","language":"Objective-C","funding_links":[],"categories":["Charts","Objective-C","iOS tools","UI","IOS 或 OSX"],"sub_categories":["Misc","Other free courses","Getting Started"],"readme":"# JBChartView\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\t\n\t\u003cimg src=\"https://raw.github.com/Jawbone/JBChartView/master/Screenshots/main.jpg\"\u003e\n\u003c/p\u003e\n\nIntroducing \u003cb\u003eJBChartView - \u003c/b\u003e Jawbone's iOS-based charting library for both line and bar graphs. It is easy to set-up, and highly customizable. \n\n## Features\n\n- Drop-in UIView subclass supported across all devices.\n- Line and bar graph support.\n- Simple to use protocols modeled after a UITableView.\n- Highly customizable.\n- Expand \u0026 collapse animation support.\n\nRefer to the \u003ca href=\"https://github.com/Jawbone/JBChartView/blob/master/CHANGELOG.md\"\"\u003echangelog\u003c/a\u003e for an overview of JBChartView's feature history.\n\n## Requirements\n\n- Requires iOS 6 or later\n- Requires Automatic Reference Counting (ARC)\n\n## Demo Project\n\nBuild and run the \u003ci\u003eJBChartViewDemo\u003c/i\u003e project in Xcode. The demo demonstrates the use of both the line and bar charts. It also outlines how a chart's appearance can be customized. \n\n## More Demos\n\n- \u003ca href=\"https://github.com/Jawbone/anscombe-quartet-ios\"\u003eAmsombe's Quartet\u003c/a\u003e: project showcasing the use of JBChartView in the classic data visualization example known as Anscombe's Quartet.\n- \u003ca href=\"https://github.com/Jawbone/spark-friends-ios\"\u003eSpark Friends\u003c/a\u003e: project showcasing the use of JBChartView in the context of sparklines and (fake) user step data. \n\n## Installation\n\n\u003ca href=\"http://cocoapods.org/\" target=\"_blank\"\u003eCocoaPods\u003c/a\u003e is the recommended method of installing JBChartView.\n\n### The Pod Way\n\nSimply add the following line to your \u003ccode\u003ePodfile\u003c/code\u003e:\n\n\tplatform :ios, '6.0'\n\tpod 'JBChartView'\n\t\n### The Old School Way\n\nThe simplest way to use JBChartView with your application is to drag and drop the \u003ci\u003e/Classes\u003c/i\u003e folder into you're Xcode 5 project. It's also recommended you rename the \u003ci\u003e/Classes\u003c/i\u003e folder to something more descriptive (ie. \"\u003ci\u003eJawbone - JBChartView\u003c/i\u003e\").\n\n\u003ccenter\u003e\n\t\u003cimg src=\"https://raw.github.com/Jawbone/JBChartView/master/Screenshots/installation.png\"\u003e\n\u003c/center\u003e\n\n## Usage\n\nAll JBChartView implementations have a similiar data source and delgate pattern to \u003ci\u003eUITableView\u003c/i\u003e. If you're familiar with using a \u003ci\u003eUITableView\u003c/i\u003e or \u003ci\u003eUITableViewController\u003c/i\u003e, using a JBChartView subclass should be a breeze!\n\n#### Swift Projects\n\nTo use JBCartView in a Swift project add the following to your bridging header (JBChartView-Bridging-Header.h):\n\n\t#import \u003cUIKit/UIKit.h\u003e\n\t#import \"JBChartView.h\"\n\t#import \"JBBarChartView.h\"\n\t#import \"JBLineChartView.h\"\n\nFor more information about adding bridging headers see \u003ca href=\"https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html\" target=\"_blank\"\u003eSwift and Objective-C in the Same Project\u003c/a\u003e.\n\n#### JBBarChartView\n\nTo initialize a \u003ci\u003eJBBarChartView\u003c/i\u003e, you only need a few lines of code (see below). Bar charts can also be initialized via a \u003cb\u003enib\u003c/b\u003e or with a \u003cb\u003eframe\u003c/b\u003e.\n\n\tJBBarChartView *barChartView = [[JBBarChartView alloc] init];\n    barChartView.dataSource = self;\n    barChartView.delegate = self;\n    [self addSubview:barChartView];\n\nJust like you would for a `UITableView`, ensure you clear these properties in your `dealloc`:\n\n\t- (void)dealloc\n\t{\n\t\tJBBarChartView *barChartView = ...; // i.e. _barChartView\n\t\tbarChartView.delegate = nil;\n\t\tbarChartView.dataSource = nil;\n\t}\n    \nAt a minimum, you need to inform the data source how many bars are in the chart:\n\n\t- (NSUInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView\n\t{\n\t\treturn ...; // number of bars in chart\n\t}\n\nSecondly, you need to inform the delegate the height of each bar (automatically normalized across the entire chart):\n    \n    - (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtIndex:(NSUInteger)index\n    {\n\t\treturn ...; // height of bar at index\n\t}\n\t\nLastly, ensure you have set the *frame* of your barChartView \u0026 call *reloadData* at least once:\n\n\tbarChartView.frame = CGRectMake( ... );\n\t[barChartView reloadData];\n\nSubsequent changes to the chart's frame will not invoke *reloadData*; it must be called directly afterwards for any changes to take effect. \n\t\n\n### Animated Reload\n\nBoth line and bar charts support *animated* reloads. The delta between the old data model and new data model is calculated and animated appropriately (ie. bars or lines will shrink, expand or morph in size). Due to techinical limitations in Apple's \u003ca href=\"https://developer.apple.com/library/tvos/documentation/GraphicsImaging/Reference/CAShapeLayer_class/index.html#//apple_ref/occ/instp/CAShapeLayer/path\"\u003eQuartz Core Framework\u003c/a\u003e, line *fills* (both solid and gradient) can not be animated - they will simply 'snap' into place while the rest of the chart continues to animate.\n\n\t- (void)reloadDataAnimated:(BOOL)animated;\n\nState changes during a reload will be ignored. As well, subsequent calls to reloadData: or reloadDataAnimated: before any previous reloads are complete, will also be ignored. Lastly, all touch events will be ignored until a reload has completed. You can always check on the state of the animation via the exposed *read-only* property: \n\n\t@property (nonatomic, readonly) BOOL reloading;\n\nBy default, the animation will complete in approximately 0.25 seconds. The animation duration is independent from the data model size. \n\n**Note**: the above restrictions apply only to *animated* reloads, as non-animated reloads are synchronous.\n \n#### JBLineChartView\n\nSimiliarily, to initialize a JBLineChartView, you only need a few lines of code (see below). Line charts can also be initialized via a \u003cb\u003enib\u003c/b\u003e or with a \u003cb\u003eframe\u003c/b\u003e.\n\n\tJBLineChartView *lineChartView = [[JBLineChartView alloc] init];\n\tlineChartView.dataSource = self;\n\tlineChartView.delegate = self;\n\t[self addSubview:lineChartView];\n\nJust like you would for a `UITableView`, ensure you clear these properties in your `dealloc`:\n\n\t- (void)dealloc\n\t{\n\t\tJBLineChartView *lineChartView = ...; // i.e. _lineChartView\n\t\tlineChartView.delegate = nil;\n\t\tlineChartView.dataSource = nil;\n\t}\n\nAt a minimum, you need to inform the data source how many lines and vertical data points (for each line) are in the chart:\n\n\t- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView\n\t{\n\t\treturn ...; // number of lines in chart\n\t}\n\t\n\t- (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex\n\t{\n\t\treturn ...; // number of values for a line\n\t}\n\nSecondly, you need to inform the delegate of the y-position of each point (automatically normalized across the entire chart) for each line in the chart:\n    \n    - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex\n    {\n\t\treturn ...; // y-position (y-axis) of point at horizontalIndex (x-axis)\n\t}\n\n**Note**: you can return NAN instead of CGFloat to indicate missing values. The chart's line will begin at the first non-NAN value and end at the last non-NAN value. The line will interopolate any NAN values in between (ie. the line will not be interrupted).\n\n\treturn [[NSNumber numberWithFloat:NAN] floatValue];\n\nLastly, ensure you have set the *frame* of your lineChartView \u0026 call *reloadData* at least once:\n\n\tlineChartView.frame = CGRectMake( ... );\n\t[lineChartView reloadData];\n\n**Note**: subsequent changes to the chart's frame will not invoke *reloadData*; it must be called directly afterwards for any changes to take effect. \n\t\n## Customization\n\nBoth the line and bar charts support a robust set of customization options. Read more about them \u003ca href=\"Customization.md\"\u003ehere\u003c/a\u003e. \n\n## Minimum \u0026 Maximum Values\n\nBy default, a chart's minimum and maximum values are equal to the min and max supplied by the dataSource. You can override either value via:\n\n\t- (void)setMinimumValue:(CGFloat)minimumValue;\n\t- (void)setMaximumValue:(CGFloat)maximumValue;\n\nIf value(s) are supplied, they must be \u003e= 0, otherwise an assertion will be thrown. To reset the values back to their original defaults:\n\n\t- (void)resetMinimumValue;\n\t- (void)resetMaximumValue;\n\t\nThe min/max values are clamped to the ceiling and floor of the actual min/max values of the chart's data source; for example, if a maximumValue of 20 is supplied \u0026 the chart's actual max is 100, then 100 will be used. For min/max modifications to take effect, reloadData must be called.\n\n## Performance\n\nThe nature of charting is to display all available information, unlike a UITableView, which can cache rows that are offscreen. JBChartView's performance will suffer if the number of data points exceed the  resolution of the device. The same issue exists with MKMapView, when hundreds of pins are supplied within a certain geographic area.  It's why Apple recommends clustering to avoid performance issues. As such, for large datasets, we recommend that your dataSource to supply a subset of points; clustering those that are close to one another. \n\t\n## License\n\nUsage is provided under the \u003ca href=\"http://www.apache.org/licenses/LICENSE-2.0\" target=\"_blank\"\u003eApache License\u003c/a\u003e (v2.0). See \u003ca href=\"https://github.com/Jawbone/JBChartView/blob/master/LICENSE\"\u003eLICENSE\u003c/a\u003e for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJawbone%2FJBChartView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJawbone%2FJBChartView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJawbone%2FJBChartView/lists"}