• Stars
    star
    714
  • Rank 63,125 (Top 2 %)
  • Language
    Objective-C
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

XYChart is designed for line & bar of charts which can compare mutiple datas in form styles, and limited the range of values to show, and so on.

Version License Platform CI Status


XYChart is designed for line & bar of charts which can compare mutiple datas in form styles, and limited the range of values to show, and so on.

LineChart BarChart
WechatIMG65 WechatIMG66
single datas in linechart single datas in linechart
WechatIMG70 click
LineDotsClicked: show all if the dots closed in multi-datas BarClicked: custom click effects in multi-datas
gif gif
scrolling linechart (did set row width) scrolling barchart (did set row width)

Install

required iOS >= 8.0 with Cocoapods

pod 'XYChart'

Usage

Expand for XYChart details
@interface XYChart : UIView<XYChartReload>

@property (nonatomic, weak, nullable) id<XYChartDataSource> dataSource;
@property (nonatomic, weak, nullable) id<XYChartDelegate> delegate;

@property (nonatomic, readonly) XYChartType chartType;

- (instancetype)initWithFrame:(CGRect)frame type:(XYChartType)type NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithType:(XYChartType)type;

/**
 更新图标数据
 
 @param dataSource 数据
 @param animation 是否执行动画
 */
- (void)setDataSource:(id<XYChartDataSource>)dataSource animation:(BOOL)animation;

/**
 重载数据
 
 @param animation 是否执行动画
 */
- (void)reloadData:(BOOL)animation;

@end

Method 1: details

_chartView = [[XYChart alloc] initWithFrame:CGRectMake(0, 0, 300, 100) chartType:XYChartTypeLine];
_chartView.dataSource = self;
_chartView.delegate = self;
[self.view addSubview:_chartView];

Method 2:

// the obj follow the XYChartDataSource protocol
_datasource = [[XYChartDataSourceItem alloc] init];

_chartView = [[XYChart alloc] initWithType:XYChartTypeLine];
_chartView.dataSource = _datasource;
[self.view addSubview:_chartView];
Expand for XYChartDelegate protocol details
@protocol XYChartDelegate
@optional

/**
 是否展示UIMenuController
 */
- (BOOL)chart:(XYChart *)chart shouldShowMenu:(NSIndexPath *)index;

/**
 点击后的action,重载一般就不show UIMenuController了
 */
- (void)chart:(XYChart *)chart itemDidClick:(id<XYChartItem>)item;

/**
 line用于展示圆圈,bar用于柱形图的动画
 */
- (CAAnimation *)chart:(XYChart *)chart clickAnimationOfIndex:(NSIndexPath *)index;

@end
Expand for XYChartDataSource protocol details
/**
 多套对比数据展示
 */
@protocol XYChartDataSource

/**
 多少条并行对比数据,折线图表现多条线,柱状图表现一列中有几条柱状图
 */
- (NSUInteger)numberOfSectionsInChart:(XYChart *)chart;

/**
 完整的周期内,数据的个数,横向列数
 */
- (NSUInteger)numberOfRowsInChart:(XYChart *)chart;

/**
 x坐标的标题
 */
- (NSAttributedString *)chart:(XYChart *)chart titleOfRowAtIndex:(NSUInteger)index;

/**
 x坐标的标题
 */
- (NSAttributedString *)chart:(XYChart *)chart titleOfSectionAtValue:(CGFloat)sectionValue;

/**
 index下的数据模型
 */
- (id<XYChartItem>)chart:(XYChart *)chart itemOfIndex:(NSIndexPath *)index;

/**
 标记y轴方向高亮区间
 */
- (XYRange)visibleRangeInChart:(XYChart *)chart;

/**
 y轴方向分段,5就分5段
 */
- (NSUInteger)numberOfLevelInChart:(XYChart *)chart;

/**
 横向一栏的宽度
 */
- (CGFloat)rowWidthOfChart:(XYChart *)chart;

/**
 自适应平均分横向栏目的宽度
 */
- (BOOL)autoSizingRowInChart:(XYChart *)chart;

@end

Author

XcodeYang, [email protected]

License

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

More Repositories

1

UUChatTableView

Cocoa UI component for group or private chat bubbles with text, images and audio support
Objective-C
1,901
star
2

XYDebugView

XYDebugView is debug tool to draw the all view's frame in device screen and show it by 2d/3d style like reveal did.
Objective-C
102
star
3

VerticalTree

🥶Provides a vertical drawing of the tree structure which can view information about the tree‘s nodes and supports console debug views & layers and so on
Swift
66
star
4

FORScrollViewEmptyAssistant

UITableView/UICollectionView superclass for showing empty datasets whenever the view has no content to display
Objective-C
58
star
5

UUKeyboardInputView

It helps some viewes,like button、cell、segment, which cann't respond those inputView as textField or texeView them do.
Objective-C
52
star
6

dingtalk_check_in

钉钉早上自动打卡 😂 😂 😂
Objective-C
42
star
7

FlappyBird

SpriteKit and external-display
Swift
26
star
8

XYPhotoKit

照片选择库,提供拍照和相册两种方式,支持单选多选,数据层是PhotoKit
Objective-C
26
star
9

WX_MultiTabList

微信小程序,多个Tab列表的上下拉刷新方案
JavaScript
26
star
10

UIKitDynamics

UIKit Dynamic UIDynamicAnimator UIDynamicBehavior
Objective-C
15
star
11

Einstein

Einstein is an UITest framework that integrates the logic across the Project and UITest through AccessibilityIdentified. And in UITest, using it to better support test code writing.
Swift
15
star
12

FORGestureTrackDisplay

FORGestureTrackDisplay is debug tool to displaying and tracking all kinds of gustures when user touch the screen.
Objective-C
8
star
13

UIAnimation

Objective-C
3
star
14

aboutMe

JavaScript
2
star
15

zhipingyang.github.io

Swift...Swift...Swift...😄...😄...😄 ! ! !
CSS
1
star