{"id":21700704,"url":"https://github.com/zhipingyang/xychart","last_synced_at":"2025-04-04T09:08:11.235Z","repository":{"id":25336289,"uuid":"28763547","full_name":"ZhipingYang/XYChart","owner":"ZhipingYang","description":"XYChart is designed for line \u0026 bar of charts which can compare mutiple datas in form styles, and limited the range of values to show, and so on.","archived":false,"fork":false,"pushed_at":"2019-12-30T05:11:14.000Z","size":1173,"stargazers_count":716,"open_issues_count":5,"forks_count":173,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-03-28T08:06:15.086Z","etag":null,"topics":["barchart","chart","linechart"],"latest_commit_sha":null,"homepage":"","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/ZhipingYang.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}},"created_at":"2015-01-04T04:03:15.000Z","updated_at":"2024-12-27T11:17:20.000Z","dependencies_parsed_at":"2022-08-20T23:30:43.763Z","dependency_job_id":null,"html_url":"https://github.com/ZhipingYang/XYChart","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhipingYang%2FXYChart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhipingYang%2FXYChart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhipingYang%2FXYChart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhipingYang%2FXYChart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZhipingYang","download_url":"https://codeload.github.com/ZhipingYang/XYChart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149501,"owners_count":20891954,"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","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":["barchart","chart","linechart"],"created_at":"2024-11-25T20:16:24.556Z","updated_at":"2025-04-04T09:08:11.206Z","avatar_url":"https://github.com/ZhipingYang.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg align=\"center\" width=\"150\" src =\"https://user-images.githubusercontent.com/9360037/43032646-0771fd3c-8cef-11e8-913f-034ca293c625.png\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"http://cocoapods.org/pods/XYChart\"\u003e\n\t\t\u003cimage alt=\"Version\" src=\"https://img.shields.io/cocoapods/v/XYChart.svg?style=flat\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"http://cocoapods.org/pods/XYChart\"\u003e\n\t\t\u003cimage alt=\"License\" src=\"https://img.shields.io/cocoapods/l/XYChart.svg?style=flat\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"http://cocoapods.org/pods/XYChart\"\u003e\n\t\t\u003cimage alt=\"Platform\" src=\"https://img.shields.io/cocoapods/p/XYChart.svg?style=flat\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://travis-ci.org/ZhipingYang/XYChart\"\u003e\n\t\t\u003cimage alt=\"CI Status\" src=\"http://img.shields.io/travis/ZhipingYang/XYChart.svg?style=flat\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003e **XYChart** is designed for line \u0026 bar of charts which can compare mutiple datas in form styles, and limited the range of values to show, and so on.\n\n| **LineChart** | **BarChart** |\n|:-------:|:---------:|\n| ![WechatIMG65](https://user-images.githubusercontent.com/9360037/62707044-4671de00-ba23-11e9-9ddc-57509edba0dc.jpeg) | ![WechatIMG66](https://user-images.githubusercontent.com/9360037/62707048-47a30b00-ba23-11e9-90a9-c414a92da2cc.jpeg) |\n| single datas in linechart | single datas in linechart |\n| ![WechatIMG70](https://user-images.githubusercontent.com/9360037/62711726-20047080-ba2c-11e9-8890-022fe4e58df9.jpeg) | ![click](https://user-images.githubusercontent.com/9360037/62712419-5ee6f600-ba2d-11e9-9605-aeaba3097e9b.gif) |\n| **LineDotsClicked:** show all if the dots closed in multi-datas | **BarClicked:** custom click effects in multi-datas |\n| ![gif](https://user-images.githubusercontent.com/9360037/62709107-54c1f900-ba27-11e9-8312-8fcec88a58d5.gif) | ![gif](https://user-images.githubusercontent.com/9360037/62709087-48d63700-ba27-11e9-86f3-e92e4e1bd094.gif) |\n| scrolling linechart (did set row width) | scrolling barchart (did set row width) |\n\n\n## Install\n\n\u003e required `iOS \u003e= 8.0` with [Cocoapods](https://cocoapods.org/)\n\u003e \n\u003e ```ruby\n\u003e pod 'XYChart'\n\u003e ```\n\n## Usage\n\n\u003cdetails\u003e\u003csummary\u003e Expand for XYChart details \u003c/summary\u003e\n\u003cbr\u003e\n\n```objective-c\n@interface XYChart : UIView\u003cXYChartReload\u003e\n\n@property (nonatomic, weak, nullable) id\u003cXYChartDataSource\u003e dataSource;\n@property (nonatomic, weak, nullable) id\u003cXYChartDelegate\u003e delegate;\n\n@property (nonatomic, readonly) XYChartType chartType;\n\n- (instancetype)initWithFrame:(CGRect)frame type:(XYChartType)type NS_DESIGNATED_INITIALIZER;\n- (instancetype)initWithType:(XYChartType)type;\n\n/**\n 更新图标数据\n \n @param dataSource 数据\n @param animation 是否执行动画\n */\n- (void)setDataSource:(id\u003cXYChartDataSource\u003e)dataSource animation:(BOOL)animation;\n\n/**\n 重载数据\n \n @param animation 是否执行动画\n */\n- (void)reloadData:(BOOL)animation;\n\n@end\n```\n\n\u003c/details\u003e\n\n\n**Method 1：**\n[details](https://github.com/ZhipingYang/XYChart/issues/50)\n\n```objective-c\n_chartView = [[XYChart alloc] initWithFrame:CGRectMake(0, 0, 300, 100) chartType:XYChartTypeLine];\n_chartView.dataSource = self;\n_chartView.delegate = self;\n[self.view addSubview:_chartView];\n```\n\n**Method 2：**\n\n```objective-c\n// the obj follow the XYChartDataSource protocol\n_datasource = [[XYChartDataSourceItem alloc] init];\n\n_chartView = [[XYChart alloc] initWithType:XYChartTypeLine];\n_chartView.dataSource = _datasource;\n[self.view addSubview:_chartView];\n```\n\n\n\u003cdetails open\u003e\u003csummary\u003e Expand for \u003cbold\u003eXYChartDelegate\u003c/bold\u003e protocol details \u003c/summary\u003e\n\u003cbr\u003e\n\n```objective-c\n@protocol XYChartDelegate\n@optional\n\n/**\n 是否展示UIMenuController\n */\n- (BOOL)chart:(XYChart *)chart shouldShowMenu:(NSIndexPath *)index;\n\n/**\n 点击后的action，重载一般就不show UIMenuController了\n */\n- (void)chart:(XYChart *)chart itemDidClick:(id\u003cXYChartItem\u003e)item;\n\n/**\n line用于展示圆圈，bar用于柱形图的动画\n */\n- (CAAnimation *)chart:(XYChart *)chart clickAnimationOfIndex:(NSIndexPath *)index;\n\n@end\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e Expand for XYChartDataSource protocol details \u003c/summary\u003e\n\u003cbr\u003e\n\n```objective-c\n/**\n 多套对比数据展示\n */\n@protocol XYChartDataSource\n\n/**\n 多少条并行对比数据，折线图表现多条线，柱状图表现一列中有几条柱状图\n */\n- (NSUInteger)numberOfSectionsInChart:(XYChart *)chart;\n\n/**\n 完整的周期内，数据的个数，横向列数\n */\n- (NSUInteger)numberOfRowsInChart:(XYChart *)chart;\n\n/**\n x坐标的标题\n */\n- (NSAttributedString *)chart:(XYChart *)chart titleOfRowAtIndex:(NSUInteger)index;\n\n/**\n x坐标的标题\n */\n- (NSAttributedString *)chart:(XYChart *)chart titleOfSectionAtValue:(CGFloat)sectionValue;\n\n/**\n index下的数据模型\n */\n- (id\u003cXYChartItem\u003e)chart:(XYChart *)chart itemOfIndex:(NSIndexPath *)index;\n\n/**\n 标记y轴方向高亮区间\n */\n- (XYRange)visibleRangeInChart:(XYChart *)chart;\n\n/**\n y轴方向分段，5就分5段\n */\n- (NSUInteger)numberOfLevelInChart:(XYChart *)chart;\n\n/**\n 横向一栏的宽度\n */\n- (CGFloat)rowWidthOfChart:(XYChart *)chart;\n\n/**\n 自适应平均分横向栏目的宽度\n */\n- (BOOL)autoSizingRowInChart:(XYChart *)chart;\n\n@end\n```\n\u003c/details\u003e\n\n\n\n## Author\n\nXcodeYang, xcodeyang@gmail.com\n\n## License\n\nXYChart is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhipingyang%2Fxychart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhipingyang%2Fxychart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhipingyang%2Fxychart/lists"}