123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //
- // NYBaseChartView.h
- // NYChartDemo
- //
- // Created by kgj on 2023/3/17.
- //
- #import <UIKit/UIKit.h>
- //竖屏
- #define KISPortrait UIInterfaceOrientationIsPortrait(KAppInterfaceOrientation)
- //横屏
- #define KISLandscape UIInterfaceOrientationIsLandscape(KAppInterfaceOrientation)
- //屏幕宽度
- #define KDeviceWidth [UIScreen mainScreen].bounds.size.width
- //屏幕高度
- #define KDeviceHeight [UIScreen mainScreen].bounds.size.height
- //屏幕分辨率
- #define KScreen_Resolution (KDeviceWidth * KDeviceHeight * ([UIScreen mainScreen].scale))
- //主色调 and 文本常规色调等配置
- //随机色
- #define KRandomColor KRGBColor(arc4random_uniform(256)/255.0,arc4random_uniform(256)/255.0,arc4random_uniform(256)/255.0)
- // RGB颜色
- #define KRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
- // RGB颜色 alpha
- #define KRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
- //16进制颜色
- #define KRGB16Color(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
- //Hex颜色 需要配置类扩展
- #define KHexColor(str) [UIColor colorWithHexString:(str)]
- //以iphone6为基础缩放系数
- #define Iphone6ScaleWidth KDeviceWidth/375.0
- //以iphone6为基础缩放系数
- #define Iphone6ScaleHeight KDeviceHeight/667.0
- //根据ip6的屏幕来拉伸宽
- #define KRealValue(x) ((x)*((KISPortrait ? KDeviceWidth : KDeviceHeight)/375.0f))
- //根据ip6的屏幕来拉伸宽Int
- #define KRealValueInt(x) ((NSInteger)((x)*((KISPortrait ? KDeviceWidth : KDeviceHeight)/375.0f)))
- //根据ip6的屏幕来拉伸高
- #define KRealHeightValue(height) ((height)*((KISPortrait ? KDeviceHeight : KDeviceWidth)/ 812.0f))
- //iphone5相对iphone6尺寸比例
- #define KIphoneSizeScale (KIs_Iphone_5?0.853:1.0)
- //屏幕方向
- #define KAppInterfaceOrientation \
- \
- ^(){ \
- UIInterfaceOrientation interfaceOrientation; \
- if (@available(iOS 13.0, *)) { \
- UIWindowScene *windowScene = (UIWindowScene *)[UIApplication sharedApplication].connectedScenes.allObjects.firstObject; \
- interfaceOrientation = windowScene.interfaceOrientation; \
- } else { \
- interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation; \
- } \
- return interfaceOrientation; \
- }()
- NS_ASSUME_NONNULL_BEGIN
- typedef void (^NYChartCellBlock)(id obj,int index);
- @protocol NYBaseChartViewDelegate <NSObject>
- @required
- - (void)loadView;
- @optional
- - (void)updateView;
- @end
- @interface NYBaseChartView : UIView
- /**
- * x轴数据
- */
- @property (nonatomic,strong,nullable) NSArray *arrayX;
- /**
- * y轴数据
- */
- @property (nonatomic,strong,nullable) NSArray *arrayY;
- /**
- * 点数据
- */
- @property (nonatomic,strong,nullable) NSMutableArray *pointArray;
- /**
- * 间隔时间
- */
- @property (nonatomic,assign) NSInteger interval_time;
- /**
- * x间隔 count 0 默认不间隔
- */
- @property (nonatomic,assign) NSInteger x_interval;
- /**
- * y间隔 count 0 默认不间隔
- */
- @property (nonatomic,assign) NSInteger y_interval;
- /**
- * x 字体色
- */
- @property (nonatomic,strong) UIColor *x_fontColor;
- /**
- * x 字体
- */
- @property (nonatomic,strong) UIFont *x_font;
- /**
- * y 字体色
- */
- @property (nonatomic,strong) UIColor *y_fontColor;
- /**
- * y 字体
- */
- @property (nonatomic,strong) UIFont *y_font;
- @end
- NS_ASSUME_NONNULL_END
|