├── HyChartsDemo ├── .DS_Store ├── HyChartsDemo │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ViewController.h │ ├── AppDelegate.h │ ├── SceneDelegate.h │ ├── HyChartsDemo │ │ ├── HyChartsDemoController.h │ │ ├── HyChartsBarDemoController.h │ │ ├── HyChartsLineDemoController.h │ │ ├── HyChartsKlineDemoController.h │ │ ├── HyChartsKlineMainDemoController.h │ │ ├── HyChartsKlineNewDemoController.h │ │ ├── HyChartsKlineVolumeDemoController.h │ │ ├── HyChartsKLineAuxiliaryDemoController.h │ │ ├── HyChartsAnyReactChainsDemoController.h │ │ ├── HyChartsReactChainsDemoController.h │ │ ├── HyChartsKlineReactChainsDemoController.h │ │ ├── HyChartsBarDemoCursor.h │ │ ├── HyChartsLineDemoCursor.h │ │ ├── HyChartsKLineDemoCursor.h │ │ ├── HyChartsReactChainsDemoController.m │ │ ├── HyChartsKlineDemoController.m │ │ ├── HyChartsKLineDemoDataHandler.h │ │ ├── HyChartsKLineDemoCursor.m │ │ └── HyChartsDemoController.m │ ├── ViewController.m │ ├── main.m │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ └── SceneDelegate.m ├── Pods │ ├── HyCategoriess │ │ ├── README.md │ │ ├── HyCategories │ │ │ ├── UIKit │ │ │ │ ├── UIWindow+HyExtension.h │ │ │ │ ├── UIWindow+HyExtension.m │ │ │ │ ├── UIScreen+HyExtension.h │ │ │ │ ├── UIBezierPath+HyExtension.h │ │ │ │ ├── UIGestureRecognizer+HyExtension.h │ │ │ │ ├── UIApplication+HyExtension.h │ │ │ │ ├── UIControl+HyExtension.h │ │ │ │ ├── UILabel+HyExtension.h │ │ │ │ ├── UIFont+HyExtension.h │ │ │ │ ├── UITableViewCell+HyExtension.h │ │ │ │ ├── UICollectionViewCell+HyExtension.h │ │ │ │ ├── UIBarButtonItem+HyExtension.h │ │ │ │ ├── UIButton+HyExtension.h │ │ │ │ ├── UITabBarController+HyExtension.h │ │ │ │ ├── UITableViewHeaderFooterView+HyExtension.h │ │ │ │ ├── UIScreen+HyExtension.m │ │ │ │ ├── UICollectionReusableView+HyExtension.h │ │ │ │ ├── UIDevice+HyExtension.h │ │ │ │ ├── UIButton+HyExtension.m │ │ │ │ ├── UIColor+HyExtension.h │ │ │ │ ├── UIApplication+HyExtension.m │ │ │ │ ├── UIGestureRecognizer+HyExtension.m │ │ │ │ ├── UITextView+HyExtension.h │ │ │ │ ├── UIFont+HyExtension.m │ │ │ │ ├── UIViewController+HyExtension.h │ │ │ │ └── UINavigationController+HyExtension.h │ │ │ ├── Foundation │ │ │ │ ├── NSInvocation+HyExtension.h │ │ │ │ ├── NSMethodSignature+HyExtension.h │ │ │ │ ├── NSObject+HyExtension.h │ │ │ │ ├── NSMethodSignature+HyExtension.m │ │ │ │ └── NSInvocation+HyExtension.m │ │ │ └── HyCategories.h │ │ └── LICENSE │ ├── Target Support Files │ │ ├── HyCycleView │ │ │ ├── HyCycleView.modulemap │ │ │ ├── HyCycleView-dummy.m │ │ │ ├── HyCycleView-prefix.pch │ │ │ ├── HyCycleView.xcconfig │ │ │ ├── HyCycleView-umbrella.h │ │ │ ├── HyCycleView.debug.xcconfig │ │ │ ├── HyCycleView.release.xcconfig │ │ │ └── HyCycleView-Info.plist │ │ ├── HyCategoriess │ │ │ ├── HyCategoriess.modulemap │ │ │ ├── HyCategoriess-dummy.m │ │ │ ├── HyCategoriess-prefix.pch │ │ │ ├── HyCategoriess.debug.xcconfig │ │ │ ├── HyCategoriess.release.xcconfig │ │ │ ├── HyCategoriess-Info.plist │ │ │ └── HyCategoriess-umbrella.h │ │ └── Pods-HyChartsDemo │ │ │ ├── Pods-HyChartsDemo.modulemap │ │ │ ├── Pods-HyChartsDemo-dummy.m │ │ │ ├── Pods-HyChartsDemo-frameworks-Debug-output-files.xcfilelist │ │ │ ├── Pods-HyChartsDemo-frameworks-Release-output-files.xcfilelist │ │ │ ├── Pods-HyChartsDemo-frameworks-Debug-input-files.xcfilelist │ │ │ ├── Pods-HyChartsDemo-frameworks-Release-input-files.xcfilelist │ │ │ ├── Pods-HyChartsDemo-umbrella.h │ │ │ ├── Pods-HyChartsDemo-Info.plist │ │ │ ├── Pods-HyChartsDemo.debug.xcconfig │ │ │ ├── Pods-HyChartsDemo.release.xcconfig │ │ │ └── Pods-HyChartsDemo-acknowledgements.markdown │ ├── Manifest.lock │ └── HyCycleView │ │ ├── LICENSE │ │ └── HyCycleView │ │ ├── HySegmentView.h │ │ └── UIView+HyFrame.h ├── Podfile ├── HyChartsDemo.xcodeproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── HyChartsDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Podfile.lock ├── HyChartsDemoTests │ ├── Info.plist │ └── HyChartsDemoTests.m └── HyChartsDemoUITests │ ├── Info.plist │ └── HyChartsDemoUITests.m ├── Pictures ├── BarChart.png ├── ChartsOne.png ├── ChartsTwo.png ├── LineChart.png └── KLineChart.png ├── HyCharts ├── Model │ ├── DataSource │ │ ├── ModelDataSource │ │ │ ├── HyChartBarModelDataSource.m │ │ │ ├── HyChartLineModelDataSource.m │ │ │ ├── HyChartModelDataSourceProtocol.h │ │ │ ├── HyChartBarModelDataSource.h │ │ │ ├── HyChartLineModelDataSource.h │ │ │ ├── HyChartModelDataSource.m │ │ │ ├── HyChartBarModelDataSourceProtocol.h │ │ │ ├── HyChartLineModelDataSourceProtocol.h │ │ │ ├── HyChartModelDataSource.h │ │ │ ├── HyChartKLineModelDataSource.m │ │ │ ├── HyChartKLineModelDataSource.h │ │ │ └── HyChartKLineModelDataSourceProtocol.h │ │ ├── ConfigureDataSource │ │ │ ├── HyChartConfigureDataSource.h │ │ │ ├── HyChartBarConfigureDataSource.h │ │ │ ├── HyChartConfigureDataSourceProtocol.h │ │ │ ├── HyChartLineConfigureDataSource.h │ │ │ ├── HyChartBarConfigureDataSourceProtocol.h │ │ │ ├── HyChartKLineConfigureDataSource.h │ │ │ ├── HyChartLineConfigureDataSourceProtocol.h │ │ │ ├── HyChartKLineConfigureDataSourceProtocol.h │ │ │ ├── HyChartBarConfigureDataSource.m │ │ │ ├── HyChartKLineConfigureDataSource.m │ │ │ ├── HyChartLineConfigureDataSource.m │ │ │ └── HyChartConfigureDataSource.m │ │ ├── HyChartDataSourceProtocol.h │ │ ├── HyChartDataSource.m │ │ ├── HyChartBarDataSourceProtocol.h │ │ ├── HyChartLineDataSourceProtocol.h │ │ ├── HyChartBarDataSource.h │ │ ├── HyChartKLineDataSourceProtocol.h │ │ ├── HyChartDataSource.h │ │ ├── HyChartLineDataSource.h │ │ ├── HyChartKLineDataSource.h │ │ ├── AxisDataSource │ │ │ ├── HyChartAxisDataSource.h │ │ │ └── HyChartAxisDataSourceProtocol.h │ │ ├── HyChartKLineDataSource.m │ │ ├── HyChartBarDataSource.m │ │ └── HyChartLineDataSource.m │ ├── Entity │ │ ├── HyChartBarModel.h │ │ ├── HyChartLineModel.h │ │ ├── HyChartBarModelProtocol.h │ │ ├── HyChartLineModelProtocol.h │ │ ├── HyChartModel.m │ │ ├── HyChartKLineModel.h │ │ ├── HyChartModel.h │ │ ├── HyChartModelProtocol.h │ │ ├── HyChartBarModel.m │ │ └── HyChartLineModel.m │ ├── Axis │ │ ├── HyChartAxisInfo.h │ │ ├── HyChartAxisGridLineInfo.h │ │ ├── XAxis │ │ │ ├── HyChartXAxisInfo.h │ │ │ ├── HyChartXAxisInfo.m │ │ │ ├── HyChartXAxisInfoProtocol.h │ │ │ ├── HyChartXAxisModel.h │ │ │ ├── HyChartXAxisModelProtocol.h │ │ │ └── HyChartXAxisModel.m │ │ ├── YAxis │ │ │ ├── HyChartYAxisInfo.h │ │ │ ├── HyChartYAxisInfoProtocol.h │ │ │ ├── HyChartYAxisInfo.m │ │ │ ├── HyChartYAxisModel.h │ │ │ ├── HyChartYAxisModelProtocol.h │ │ │ └── HyChartYAxisModel.m │ │ ├── HyChartAxisModel.h │ │ ├── HyChartAxisModelProtocol.h │ │ ├── HyChartAxisGridLineInfo.m │ │ ├── HyChartAxisGridLineInfoProtocol.h │ │ ├── HyChartAxisInfo.m │ │ ├── HyChartAxisModel.m │ │ └── HyChartAxisInfoProtocol.h │ ├── Algorithm │ │ ├── HyChartAlgorithm.h │ │ ├── HyChartAlgorithmProtocol.h │ │ └── HyChartAlgorithmContext.h │ └── Configure │ │ ├── HyChartKLineConfigure.h │ │ ├── HyChartBarConfigure.h │ │ ├── HyChartLineConfigure.h │ │ ├── HyChartConfigure.h │ │ ├── HyChartBarConfigureProtocol.h │ │ ├── HyChartBarConfigure.m │ │ ├── HyChartConfigureProtocol.h │ │ ├── HyChartConfigure.m │ │ ├── HyChartLineConfigure.m │ │ └── HyChartLineConfigureProtocol.h ├── View │ ├── Layers │ │ ├── HyChartLayerProtocol.h │ │ ├── HyChartLineLayer.h │ │ ├── HyChartBarLayer.h │ │ ├── HyChartKLineVolumeLayer.h │ │ ├── HyChartKLineAuxiliaryLayer.h │ │ ├── HyChartKLineMainLayer.h │ │ ├── HyChartLayer.h │ │ ├── HyChartAxisLayer.h │ │ └── HyChartLayer.m │ ├── Charts │ │ ├── HyChartBarView.h │ │ ├── HyChartLineView.h │ │ ├── HyChartKLineAuxiliaryView.h │ │ ├── HyChartKLineVolumeView.h │ │ ├── HyChartView.h │ │ ├── HyChartKLineMainView.h │ │ ├── HyChartKLineView.h │ │ └── HyChartBarView.m │ └── Cursor │ │ ├── HyChartCursorConfigure.h │ │ ├── HyChartCursor.h │ │ ├── HyChartCursorProtocol.h │ │ ├── HyChartCursorConfigureProtocol.h │ │ └── HyChartCursorConfigure.m └── HyCharts.h ├── HyCharts.podspec ├── README.md └── .gitignore /HyChartsDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydreamit/HyCharts/HEAD/HyChartsDemo/.DS_Store -------------------------------------------------------------------------------- /Pictures/BarChart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydreamit/HyCharts/HEAD/Pictures/BarChart.png -------------------------------------------------------------------------------- /Pictures/ChartsOne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydreamit/HyCharts/HEAD/Pictures/ChartsOne.png -------------------------------------------------------------------------------- /Pictures/ChartsTwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydreamit/HyCharts/HEAD/Pictures/ChartsTwo.png -------------------------------------------------------------------------------- /Pictures/LineChart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydreamit/HyCharts/HEAD/Pictures/LineChart.png -------------------------------------------------------------------------------- /Pictures/KLineChart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hydreamit/HyCharts/HEAD/Pictures/KLineChart.png -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/README.md: -------------------------------------------------------------------------------- 1 | # HyCategories 2 | 3 | ## 如何导入 4 | 5 | __Podfile__ 6 | 7 | ``` 8 | pod 'HyCategoriess' 9 | ``` 10 | -------------------------------------------------------------------------------- /HyChartsDemo/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, "9.0" 2 | inhibit_all_warnings! 3 | use_frameworks! 4 | 5 | target 'HyChartsDemo' do 6 | 7 | pod 'HyCategoriess' 8 | pod 'HyCycleView' 9 | 10 | end 11 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView.modulemap: -------------------------------------------------------------------------------- 1 | framework module HyCycleView { 2 | umbrella header "HyCycleView-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess.modulemap: -------------------------------------------------------------------------------- 1 | framework module HyCategoriess { 2 | umbrella header "HyCategoriess-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_HyCycleView : NSObject 3 | @end 4 | @implementation PodsDummy_HyCycleView 5 | @end 6 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_HyCategoriess : NSObject 3 | @end 4 | @implementation PodsDummy_HyCategoriess 5 | @end 6 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_HyChartsDemo { 2 | umbrella header "Pods-HyChartsDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HyChartsDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HyChartsDemo 5 | @end 6 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HyCategoriess.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HyCycleView.framework -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HyCategoriess.framework 2 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HyCycleView.framework -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2020/4/14. 6 | // Copyright © 2020 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/HyCategoriess/HyCategoriess.framework 3 | ${BUILT_PRODUCTS_DIR}/HyCycleView/HyCycleView.framework -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/HyCategoriess/HyCategoriess.framework 3 | ${BUILT_PRODUCTS_DIR}/HyCycleView/HyCycleView.framework -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartBarModelDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarModelDataSource.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartBarModelDataSource.h" 10 | 11 | 12 | @implementation HyChartBarModelDataSource 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartLineModelDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineModelDataSource.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLineModelDataSource.h" 10 | 11 | 12 | @implementation HyChartLineModelDataSource 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/14. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/SceneDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2020/4/14. 6 | // Copyright © 2020 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SceneDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow * window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsDemoController.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsBarDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsBarDemoController.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsBarDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsLineDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsLineDemoController.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsLineDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartLayerProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLayerProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol HyChartLayerProtocol 14 | 15 | - (void)setNeedsRendering; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartBarModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarModel.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModel.h" 10 | #import "HyChartBarModelProtocol.h" 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartBarModel : HyChartModel 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineModel.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModel.h" 10 | #import "HyChartLineModelProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartLineModel : HyChartModel 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKlineDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKlineDemoController.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsDemoController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsKlineDemoController : HyChartsDemoController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKlineMainDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKlineMainDemoController.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsKlineMainDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKlineNewDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKlineNewDemoController.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/19. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsKlineNewDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKlineVolumeDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKlineVolumeDemoController.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsKlineVolumeDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKLineAuxiliaryDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKLineAuxiliaryDemoController.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsKLineAuxiliaryDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartBarView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarView.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartView.h" 10 | #import "HyChartBarLayer.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /// 柱状图 15 | @interface HyChartBarView : HyChartView> 16 | 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsAnyReactChainsDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsAnyReactChainsDemoController.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/22. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsAnyReactChainsDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsReactChainsDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsReactChainsDemoController.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsDemoController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsReactChainsDemoController : HyChartsDemoController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisInfo.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "HyChartAxisInfoProtocol.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartAxisInfo : NSObject 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartLineLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineLayer.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/25. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLayer.h" 10 | #import "HyChartLineDataSource.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartLineLayer : HyChartLayer 15 | 16 | - (void)resetLayers; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyCharts/View/Cursor/HyChartCursorConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartCursor.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/1. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartCursorConfigureProtocol.h" 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartCursorConfigure : NSObject 16 | 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisGridLineInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisGridLineInfo.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisGridLineInfoProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartAxisGridLineInfo : NSObject 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineView.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartView.h" 10 | #import "HyChartLineDataSourceProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | 15 | /// 折/曲线图 16 | @interface HyChartLineView : HyChartView> 17 | 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKlineReactChainsDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKlineReactChainsDemoController.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/22. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsReactChainsDemoController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface HyChartsKlineReactChainsDemoController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartBarModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarModelProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModelProtocol.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol HyChartBarModelProtocol 14 | 15 | /// 支持多条柱 16 | @property (nonatomic, strong) NSArray *values; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_HyChartsDemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_HyChartsDemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /HyChartsDemo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HyCategoriess (1.0.0) 3 | - HyCycleView (1.0.3) 4 | 5 | DEPENDENCIES: 6 | - HyCategoriess 7 | - HyCycleView 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - HyCategoriess 12 | - HyCycleView 13 | 14 | SPEC CHECKSUMS: 15 | HyCategoriess: f5d9ee6b5f58793e950a77a31b7ad9ddb1662928 16 | HyCycleView: e4bf8fd283c060ea66cf89fef8e57cece495d2ee 17 | 18 | PODFILE CHECKSUM: 0727f516d2044def44d05196b3e204d81faa5a9f 19 | 20 | COCOAPODS: 1.9.3 21 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIWindow+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/20. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIWindow (HyExtension) 15 | 16 | 17 | + (UIWindow *)hy_keyWindow; 18 | 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIWindow+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/20. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "UIWindow+HyExtension.h" 11 | 12 | @implementation UIWindow (HyExtension) 13 | 14 | + (UIWindow *)hy_keyWindow { 15 | return UIApplication.sharedApplication.keyWindow; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HyCategoriess (1.0.0) 3 | - HyCycleView (1.0.3) 4 | 5 | DEPENDENCIES: 6 | - HyCategoriess 7 | - HyCycleView 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - HyCategoriess 12 | - HyCycleView 13 | 14 | SPEC CHECKSUMS: 15 | HyCategoriess: f5d9ee6b5f58793e950a77a31b7ad9ddb1662928 16 | HyCycleView: e4bf8fd283c060ea66cf89fef8e57cece495d2ee 17 | 18 | PODFILE CHECKSUM: 0727f516d2044def44d05196b3e204d81faa5a9f 19 | 20 | COCOAPODS: 1.9.3 21 | -------------------------------------------------------------------------------- /HyCharts/Model/Algorithm/HyChartAlgorithm.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAlgorithm.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAlgorithmProtocol.h" 11 | #import "HyChartKLineModelDataSourceProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartAlgorithm : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartBarLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarLayer.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/23. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartBarDataSource.h" 11 | #import "HyChartLayer.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartBarLayer : HyChartLayer 17 | 18 | - (void)resetLayers; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2020/4/14. 6 | // Copyright © 2020 Hy. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | // Do any additional setup after loading the view. 21 | 22 | } 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsBarDemoCursor.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsBarDemoCursor.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/13. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyCharts.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartsBarDemoCursor : NSObject 15 | 16 | @property (nonatomic,weak) UIView *showView; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsLineDemoCursor.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsLineDemoCursor.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/13. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyCharts.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartsLineDemoCursor : NSObject 15 | 16 | @property (nonatomic,weak) UIView *showView; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKLineDemoCursor.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKLineDemoCursor.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/22. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyCharts.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartsKLineDemoCursor : NSObject 15 | 16 | @property (nonatomic,weak) UIView *showView; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /HyCharts.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'HyCharts' 3 | s.version = '1.0.4' 4 | s.summary = 'HyLineChartView HyBarChartView HyKLineChartView' 5 | s.homepage = 'https://github.com/hydreamit/HyCharts' 6 | s.license = 'MIT' 7 | s.authors = {'Hy' => 'hydreamit@163.com'} 8 | s.platform = :ios, '9.0' 9 | s.source = {:git => 'https://github.com/hydreamit/HyCharts.git', :tag => s.version} 10 | s.source_files = 'HyCharts/**/*.{h,m}' 11 | s.framework = 'UIKit' 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartKLineVolumeLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineVolumeLayer.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/3/31. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLayer.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSource.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartKLineVolumeLayer : HyChartLayer 16 | 17 | @property (nonatomic, assign) HyChartKLineTechnicalType technicalType; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/HyCycleView 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartKLineAuxiliaryLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineAuxiliaryLayer.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/1. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLayer.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSource.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | @interface HyChartKLineAuxiliaryLayer : HyChartLayer 17 | 18 | @property (nonatomic, assign) HyChartKLineAuxiliaryType auxiliaryType; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartModelDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartModelDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartModelProtocol.h" 11 | #import 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartModelDataSourceProtocol 17 | 18 | - (instancetype)configNumberOfItems:(NSInteger(^)(void))block; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "HyCyclePageView.h" 14 | #import "HyCycleView.h" 15 | #import "HySegmentView.h" 16 | #import "UIView+HyFrame.h" 17 | 18 | FOUNDATION_EXPORT double HyCycleViewVersionNumber; 19 | FOUNDATION_EXPORT const unsigned char HyCycleViewVersionString[]; 20 | 21 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/XAxis/HyChartXAxisInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartXAxisInfo.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartXAxisInfoProtocol.h" 11 | #import "HyChartAxisInfo.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartXAxisInfo : HyChartAxisInfo 16 | 17 | @property (nonatomic, copy, readonly) id(^textAtIndexBlock)(NSInteger, id); 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/14. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/YAxis/HyChartYAxisInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartYAxisInfo.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartYAxisInfoProtocol.h" 11 | #import "HyChartAxisInfo.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartYAxisInfo : HyChartAxisInfo 16 | 17 | @property (nonatomic, copy, readonly) id(^textAtIndexBlock)(NSInteger index, NSNumber *maxValue, NSNumber *minValue); 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartLineModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineModelProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModelProtocol.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol HyChartLineModelProtocol 14 | 15 | /// 支持多条线 16 | @property (nonatomic, strong) NSArray *values; 17 | 18 | /// 每条线的断点设置, 默认为NO —— @(YES) \ @(NO) 19 | @property (nonatomic, strong) NSArray *breakpoints; 20 | 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartKLineAuxiliaryView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineAuxiliaryView.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/1. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartView.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSourceProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | /// K线辅助图 17 | @interface HyChartKLineAuxiliaryView : HyChartView> 18 | 19 | /// 切换技术指标 20 | - (void)switchKLineAuxiliaryType:(HyChartKLineAuxiliaryType)type; 21 | 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartKLineVolumeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineVolumeView.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartView.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSourceProtocol.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | /// K线交易量图 17 | @interface HyChartKLineVolumeView : HyChartView> 18 | 19 | /// 切换技术指标 20 | - (void)switchKLineTechnicalType:(HyChartKLineTechnicalType)type; 21 | 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/YAxis/HyChartYAxisInfoProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartYAxisInfoProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisInfoProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartYAxisInfoProtocol 15 | 16 | /// 每个坐标点对应的t内容 (NSString NSAttributedString) 17 | - (instancetype)configTextAtIndex:(id(^)(NSInteger index, NSNumber *maxValue, NSNumber *minValue))block; 18 | 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartConfigureDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartConfigureDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureDataSourceProtocol.h" 11 | #import "HyChartConfigure.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartConfigureDataSource : NSObject 16 | 17 | @property (nonatomic, strong, readonly) HyChartConfigure *configure; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /HyCharts/View/Cursor/HyChartCursor.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartCursor.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/1. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartCursorConfigureProtocol.h" 11 | #import "HyChartCursorProtocol.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartCursor : CALayer 16 | 17 | + (instancetype)chartCursorWithLayer:(CALayer *)layer; 18 | 19 | @property (nonatomic, strong, readonly) id configure; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/HyCycleView 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/HyCycleView 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/XAxis/HyChartXAxisInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartXAxisInfo.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartXAxisInfo.h" 10 | 11 | 12 | @interface HyChartXAxisInfo () 13 | @property (nonatomic, copy) id(^textAtIndexBlock)(NSInteger, id); 14 | @end 15 | 16 | 17 | @implementation HyChartXAxisInfo 18 | 19 | - (instancetype)configTextAtIndex:(id(^)(NSInteger index, id model))block { 20 | self.textAtIndexBlock = [block copy]; 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIScreen+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScreen+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIScreen (HyExtension) 15 | 16 | + (CGFloat)hy_screenScale; 17 | 18 | @property (nonatomic,assign,readonly) CGRect hy_currentBounds; 19 | 20 | - (CGRect)hy_boundsForOrientation:(UIInterfaceOrientation)orientation; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisModel.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisModelProtocol.h" 11 | #import "HyChartAxisGridLineInfo.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartAxisModel : NSObject 17 | 18 | @property (nonatomic, assign, readonly) NSInteger indexs; 19 | 20 | @property (nonatomic, strong, readonly) HyChartAxisGridLineInfo *axisGridLineInfo; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartKLineConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineConfigure.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigure.h" 11 | #import "HyChartKLineConfigureProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartKLineConfigure : HyChartConfigure 17 | 18 | @property (nonatomic, copy, readonly) void(^lineConfigureAtIndexBlock)(NSInteger, id); 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/XAxis/HyChartXAxisInfoProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartXAxisInfoProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisInfoProtocol.h" 11 | #import "HyChartModelProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartXAxisInfoProtocol 17 | 18 | /// 每个坐标点对应的内容 (NSString NSAttributedString) 19 | - (instancetype)configTextAtIndex:(id(^)(NSInteger index, id model))block; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsReactChainsDemoController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsReactChainsDemoController.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsReactChainsDemoController.h" 10 | 11 | 12 | @implementation HyChartsReactChainsDemoController 13 | 14 | - (NSArray *)titleArray { 15 | return @[@"K线组合图", @"其他组合图"]; 16 | } 17 | 18 | - (NSArray *)controllerArray { 19 | return @[@"HyChartsKlineReactChainsDemoController", 20 | @"HyChartsAnyReactChainsDemoController"]; 21 | } 22 | @end 23 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisModelProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisGridLineInfoProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartAxisModelProtocol 15 | 16 | /// 设置总个数 17 | - (instancetype)configNumberOfIndexs:(NSInteger)indexs; 18 | /// 设置网格数据 19 | - (instancetype)configAxisGridLineInfo:(void(^)(id axisGridLineInfo))block; 20 | 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "CoreFoundation" -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/HyCategoriess 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "CoreFoundation" -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/HyCategoriess 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisDataSourceProtocol.h" 11 | #import "HyChartConfigureDataSourceProtocol.h" 12 | #import "HyChartModelDataSourceProtocol.h" 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @protocol HyChartDataSourceProtocol 18 | 19 | /// 坐标轴数据 20 | @property (nonatomic, strong, readonly) id axisDataSource; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartView.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartViewProtocol.h" 11 | #import "HyChartDataSourceProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | 17 | /// 抽象类 请使用子类视图 18 | @interface HyChartView<__covariant DataSourceType : id> : UIView 19 | 20 | /* 21 | 数据源: 22 | 1. 配置坐标轴 23 | 2. 配置图表信息 24 | 3. 配置图表数据 25 | */ 26 | - (DataSourceType)dataSource; 27 | 28 | 29 | 30 | @end 31 | 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartDataSource.h" 10 | #import "HyChartAxisDataSource.h" 11 | 12 | 13 | @interface HyChartDataSource () 14 | @property (nonatomic, strong) HyChartAxisDataSource *axisDataSource; 15 | @end 16 | 17 | 18 | @implementation HyChartDataSource 19 | - (HyChartAxisDataSource *)axisDataSource { 20 | if (!_axisDataSource) { 21 | _axisDataSource = [[HyChartAxisDataSource alloc] init]; 22 | } 23 | return _axisDataSource; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartKLineMainLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineMainLayer.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLayer.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSource.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | @interface HyChartKLineMainLayer : HyChartLayer 17 | 18 | @property (nonatomic, assign) HyChartKLineTechnicalType technicalType; 19 | 20 | @property (nonatomic, assign, getter=isTimeLine) BOOL timeLine; 21 | 22 | - (void)renderingNewprice; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartBarConfigureDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarConfigureDataSource.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureDataSource.h" 11 | #import "HyChartBarConfigureDataSourceProtocol.h" 12 | #import "HyChartBarConfigure.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartBarConfigureDataSource : HyChartConfigureDataSource 17 | 18 | @property (nonatomic, strong, readonly) HyChartBarConfigure *configure; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/HyCharts.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyCharts.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #ifndef HyCharts_h 10 | #define HyCharts_h 11 | 12 | #import "HyChartBarView.h" 13 | #import "HyChartLineView.h" 14 | #import "HyChartKLineView.h" 15 | #import "HyChartKLineMainView.h" 16 | #import "HyChartKLineVolumeView.h" 17 | #import "HyChartKLineAuxiliaryView.h" 18 | 19 | #import "HyChartCursorProtocol.h" 20 | #import "HyChartBarDataSourceProtocol.h" 21 | #import "HyChartLineDataSourceProtocol.h" 22 | #import "HyChartKLineDataSourceProtocol.h" 23 | 24 | #import "HyChartsMethods.h" 25 | 26 | 27 | #endif /* HyCharts_h */ 28 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartBarConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarConfigure.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartConfigure.h" 10 | #import "HyChartBarConfigureProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartBarOneConfigure : NSObject 15 | + (instancetype)defaultConfigure; 16 | @end 17 | 18 | @interface HyChartBarConfigure : HyChartConfigure 19 | @property (nonatomic, copy, readonly) void(^barConfigureAtIndexBlock)(NSInteger, id); 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartKLineMainView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineMainView.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartView.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSourceProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | /// K线主图 17 | @interface HyChartKLineMainView : HyChartView> 18 | 19 | /// 是否是分时线 20 | @property (nonatomic, assign, getter=isTimeLine) BOOL timeLine; 21 | 22 | /// 切换K线主图技术指标 23 | - (void)switchKLineTechnicalType:(HyChartKLineTechnicalType)type; 24 | 25 | 26 | @end 27 | 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /HyCharts/View/Cursor/HyChartCursorProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartCursorProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/8. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartModelProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @class HyChartView; 15 | @protocol HyChartCursorProtocol 16 | @required 17 | 18 | - (void(^)(HyChartView *chartView, 19 | id model, 20 | NSString *xText, 21 | NSString *yText, 22 | CGPoint point))show; 23 | 24 | - (void)dismiss; 25 | 26 | - (BOOL)isShowing; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/XAxis/HyChartXAxisModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartXAxisModel.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartXAxisModelProtocol.h" 11 | #import "HyChartAxisModel.h" 12 | #import "HyChartXAxisInfo.h" 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /// X 轴数据 18 | @interface HyChartXAxisModel : HyChartAxisModel 19 | 20 | @property (nonatomic, strong, readonly) HyChartXAxisInfo *topXAxisInfo; 21 | 22 | @property (nonatomic, strong, readonly) HyChartXAxisInfo *bottomXAxisInfo; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartConfigureDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartConfigureDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartConfigureDataSourceProtocol 15 | 16 | - (id)configConfigure:(void (^_Nullable)(id configure))block; 17 | 18 | @property (nonatomic, strong, readonly) id configure; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartLineConfigureDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineConfigureDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureDataSource.h" 11 | #import "HyChartLineConfigureDataSourceProtocol.h" 12 | #import "HyChartLineConfigure.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartLineConfigureDataSource : HyChartConfigureDataSource 17 | 18 | @property (nonatomic, strong, readonly) HyChartLineConfigure *configure; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HyCharts 2 | ## 如何导入 3 | 4 | __Podfile__ 5 | 6 | ``` 7 | pod 'HyCharts' 8 | ``` 9 | 10 | __手动导入__ 11 | 12 | 直接将`HyCharts`文件夹拖入项目中 13 | 14 | ## Demo图片 15 |
16 | 17 | 18 | 19 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartBarModelDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarModelDataSource.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModelDataSource.h" 10 | #import "HyChartBarModelDataSourceProtocol.h" 11 | #import "HyChartBarModel.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartBarModelDataSource : HyChartModelDataSource 16 | 17 | @property (nonatomic, strong) NSArray *visibleVaxVlaues; 18 | @property (nonatomic, strong) NSArray *visibleMinVlaues; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/Foundation/NSInvocation+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSInvocation+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/19. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSInvocation (HyExtension) 15 | 16 | + (instancetype)hy_invocationWithTarget:(id)target 17 | selector:(SEL)selector 18 | returnValue:(void *)returnValue 19 | arguments:(void *)argument, ...; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartBarConfigureDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarConfigureDataSourceProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartBarConfigureProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartBarConfigureDataSourceProtocol 15 | 16 | - (id)configConfigure:(void (^_Nullable)(id configure))block; 17 | 18 | @property (nonatomic, strong, readonly) id configure; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartKLineConfigureDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineConfigureDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureDataSource.h" 11 | #import "HyChartKLineConfigureDataSourceProtocol.h" 12 | #import "HyChartKLineConfigure.h" 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface HyChartKLineConfigureDataSource : HyChartConfigureDataSource 18 | 19 | @property (nonatomic, strong, readonly) HyChartKLineConfigure *configure; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLayer.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | #import "HyChartLayerProtocol.h" 12 | #import "HyChartDataSource.h" 13 | #import 14 | #import "HyChartModel.h" 15 | 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | 20 | @interface HyChartLayer<__covariant DataSourceType : HyChartDataSource *> : CALayer 21 | 22 | + (instancetype)layerWithDataSource:(DataSourceType)dataSource; 23 | 24 | - (DataSourceType)dataSource; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartLineConfigureDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineConfigureDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartLineConfigureProtocol.h" 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @protocol HyChartLineConfigureDataSourceProtocol 16 | 17 | - (id)configConfigure:(void (^_Nullable)(id configure))block; 18 | 19 | @property (nonatomic, strong, readonly) id configure; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartKLineConfigureDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineConfigureDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartKLineConfigureProtocol.h" 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @protocol HyChartKLineConfigureDataSourceProtocol 16 | 17 | - (id)configConfigure:(void (^_Nullable)(id configure))block; 18 | 19 | @property (nonatomic, strong, readonly) id configure; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartAxisLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisLayer.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/19. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartDataSource.h" 11 | #import "HyChartLayer.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartAxisLayer : HyChartLayer 17 | 18 | @property (nonatomic, assign) UIEdgeInsets contentEdgeInsets; 19 | 20 | + (instancetype)layerWithDataSource:(HyChartDataSource *)dataSource 21 | xAxisModel:(HyChartXAxisModel *)xAxisModel 22 | yAxisModel:(HyChartYAxisModel *)yAxisModel; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisGridLineInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisGridLineInfo.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartAxisGridLineInfo.h" 10 | 11 | @implementation HyChartAxisGridLineInfo 12 | @synthesize axisGridLineColor = _axisGridLineColor, axisGridLineWidth = _axisGridLineWidth, axisGridLineDashPhase = _axisGridLineDashPhase, axisGridLineDashPattern = _axisGridLineDashPattern, axisGridLineType = _axisGridLineType; 13 | 14 | - (instancetype)init{ 15 | if (self = [super init]) { 16 | _axisGridLineColor = [UIColor groupTableViewBackgroundColor]; 17 | _axisGridLineWidth = .5; 18 | }return self; 19 | } 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartLineConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineConfigure.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartLineConfigureProtocol.h" 11 | #import "HyChartConfigure.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartLineOneConfigure : NSObject 17 | + (instancetype)defaultConfigure; 18 | @end 19 | 20 | @interface HyChartLineConfigure : HyChartConfigure 21 | @property (nonatomic, copy, readonly) void(^lineConfigureAtIndexBlock)(NSInteger, id); 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartBarConfigureDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarConfigureDataSource.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartBarConfigureDataSource.h" 10 | #import "HyChartBarConfigure.h" 11 | 12 | 13 | @interface HyChartBarConfigureDataSource () 14 | @property (nonatomic, strong) HyChartBarConfigure *configure; 15 | @end 16 | 17 | 18 | @implementation HyChartBarConfigureDataSource 19 | @synthesize configure = _configure; 20 | 21 | - (HyChartBarConfigure *)configure { 22 | if (!_configure){ 23 | _configure = [[HyChartBarConfigure alloc] init]; 24 | } 25 | return _configure; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartBarDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarDataSourceProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartDataSourceProtocol.h" 10 | #import "HyChartBarModelDataSourceProtocol.h" 11 | #import "HyChartBarConfigureDataSourceProtocol.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @protocol HyChartBarDataSourceProtocol 16 | 17 | /// 图表配置数据 18 | @property (nonatomic, strong, readonly) id configreDataSource; 19 | /// 图表模型数据 20 | @property (nonatomic, strong, readonly) id modelDataSource; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartKLineConfigureDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineConfigureDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartKLineConfigureDataSource.h" 10 | #import "HyChartKLineConfigure.h" 11 | 12 | @interface HyChartKLineConfigureDataSource () 13 | @property (nonatomic, strong) HyChartKLineConfigure *configure; 14 | @end 15 | 16 | @implementation HyChartKLineConfigureDataSource 17 | @synthesize configure = _configure; 18 | 19 | - (HyChartKLineConfigure *)configure { 20 | if (!_configure){ 21 | _configure = [[HyChartKLineConfigure alloc] init]; 22 | } 23 | return _configure; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIBezierPath+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBezierPath+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/30. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIBezierPath (HyExtension) 15 | 16 | + (UIBezierPath *)hy_bezierPathWithRoundedRect:(CGRect)rect 17 | cornerRadiusArray:(NSArray *)cornerRadius 18 | lineWidth:(CGFloat)lineWidth; 19 | 20 | + (nullable UIBezierPath *)hy_bezierPathWithText:(NSString *)text font:(UIFont *)font; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartLineDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartDataSourceProtocol.h" 10 | #import "HyChartLineModelDataSourceProtocol.h" 11 | #import "HyChartLineConfigureDataSourceProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartLineDataSourceProtocol 17 | 18 | /// 图表配置数据 19 | @property (nonatomic, strong, readonly) id configreDataSource; 20 | /// 图表模型数据 21 | @property (nonatomic, strong, readonly) id modelDataSource; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIGestureRecognizer+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIGestureRecognizer (HyExtension) 15 | 16 | @property (nonatomic,weak,readonly,nullable) UIView *hy_targetView; 17 | 18 | + (instancetype)hy_gestureRecognizerWithActionBlock:(void (^)(UIGestureRecognizer *gesture))block; 19 | 20 | - (void)hy_addActionBlock:(void(^)(UIGestureRecognizer *gesture))block; 21 | 22 | - (void)hy_removeAllActionBlocks; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/YAxis/HyChartYAxisInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartYAxisInfo.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartYAxisInfo.h" 10 | 11 | 12 | @interface HyChartYAxisInfo () 13 | @property (nonatomic, copy) id(^textAtIndexBlock)(NSInteger, NSNumber *maxValue, NSNumber *minValue); 14 | @end 15 | 16 | 17 | @implementation HyChartYAxisInfo 18 | - (instancetype)init { 19 | if (self = [super init]) { 20 | // self.displayAxisZeroText = NO; 21 | } return self; 22 | } 23 | 24 | - (instancetype)configTextAtIndex:(id(^)(NSInteger index, NSNumber *maxValue, NSNumber *minValue))block { 25 | self.textAtIndexBlock = [block copy]; 26 | return self; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartKLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineView.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartView.h" 10 | #import "HyChartsTypedef.h" 11 | #import "HyChartKLineDataSourceProtocol.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | /// K线组装图 ------- K线主图 、交易量图、辅助图 16 | @interface HyChartKLineView : HyChartView> 17 | 18 | 19 | /// 是否是分时线 20 | @property (nonatomic, assign, getter=isTimeLine) BOOL timeLine; 21 | 22 | /// 切换K线主图技术指标 23 | - (void)switchKLineTechnicalType:(HyChartKLineTechnicalType)type; 24 | 25 | /// 切换辅助图技术指标 26 | - (void)switchKLineAuxiliaryType:(HyChartKLineAuxiliaryType)type; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartLineConfigureDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineConfigureDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLineConfigureDataSource.h" 10 | #import "HyChartConfigureDataSource.h" 11 | #import "HyChartLineConfigure.h" 12 | 13 | @interface HyChartLineConfigureDataSource () 14 | @property (nonatomic, strong) HyChartLineConfigure *configure; 15 | @end 16 | 17 | 18 | @implementation HyChartLineConfigureDataSource 19 | @synthesize configure = _configure; 20 | 21 | - (HyChartLineConfigure *)configure { 22 | if (!_configure){ 23 | _configure = [[HyChartLineConfigure alloc] init]; 24 | } 25 | return _configure; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartLineModelDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineModelDataSource.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModelDataSource.h" 10 | #import "HyChartLineModelDataSourceProtocol.h" 11 | #import "HyChartLineModel.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartLineModelDataSource : HyChartModelDataSource 16 | 17 | @property (nonatomic, strong) NSArray *visibleMaxVlaues; 18 | 19 | @property (nonatomic, strong) NSArray *visibleMinVlaues; 20 | 21 | @property (nonatomic, strong) NSArray *> *valuesArray; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/Foundation/NSMethodSignature+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMethodSignature+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/19. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSMethodSignature (HyExtension) 15 | 16 | @property (nonatomic,readonly,nullable) const char *hy_typeEncoding; 17 | @property (nonatomic,copy,readonly,nullable) NSString *hy_typeString; 18 | 19 | + (instancetype)hy_classMethodSignatureWithClass:(Class)cls selector:(SEL)sel; 20 | 21 | + (instancetype)hy_instanceMethodSignatureWithClass:(Class)cls selector:(SEL)sel; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartConfigure.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartConfigure.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartConfigure : NSObject 15 | 16 | /* 17 | 缩放过后的数据 18 | */ 19 | @property (nonatomic, assign) CGFloat scaleWidth; 20 | @property (nonatomic, assign) CGFloat scaleMargin; 21 | @property (nonatomic, assign) CGFloat scaleItemWidth; 22 | @property (nonatomic, assign) CGFloat scaleEdgeInsetStart; 23 | @property (nonatomic, assign) CGFloat scaleEdgeInsetEnd; 24 | 25 | @property (nonatomic,assign) BOOL notEnough; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartBarDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarDataSource.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartDataSource.h" 10 | #import "HyChartBarDataSourceProtocol.h" 11 | #import "HyChartBarModelDataSource.h" 12 | #import "HyChartBarConfigureDataSource.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartBarDataSource : HyChartDataSource 17 | 18 | @property (nonatomic, strong, readonly) HyChartAxisDataSource *axisDataSource; 19 | @property (nonatomic, strong, readonly) HyChartBarModelDataSource *modelDataSource; 20 | @property (nonatomic, strong, readonly) HyChartBarConfigureDataSource *configreDataSource; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartKLineDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartDataSourceProtocol.h" 11 | #import "HyChartKLineConfigureDataSourceProtocol.h" 12 | #import "HyChartKLineModelDataSourceProtocol.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartKLineDataSourceProtocol 17 | 18 | /// 图表配置数据 19 | @property (nonatomic, strong, readonly) id configreDataSource; 20 | /// 图表模型数据 21 | @property (nonatomic, strong, readonly) id modelDataSource; 22 | 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartDataSourceProtocol.h" 11 | #import "HyChartModelDataSource.h" 12 | #import "HyChartConfigureDataSource.h" 13 | #import "HyChartAxisDataSource.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface HyChartDataSource : NSObject 18 | 19 | @property (nonatomic, strong, readonly) HyChartAxisDataSource *axisDataSource; 20 | @property (nonatomic, strong, readonly) HyChartModelDataSource *modelDataSource; 21 | @property (nonatomic, strong, readonly) HyChartConfigureDataSource *configreDataSource; 22 | 23 | @end 24 | 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKlineDemoController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKlineDemoController.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsKlineDemoController.h" 10 | #import 11 | #import 12 | #import "HyCharts.h" 13 | 14 | 15 | @implementation HyChartsKlineDemoController 16 | 17 | - (NSArray *)titleArray { 18 | return @[@"K线主图", @"K线交易量图", @"K线辅助图", @"K线图"]; 19 | } 20 | 21 | - (NSArray *)controllerArray { 22 | return @[@"HyChartsKlineMainDemoController", 23 | @"HyChartsKlineVolumeDemoController", 24 | @"HyChartsKLineAuxiliaryDemoController", 25 | @"HyChartsKlineNewDemoController"]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartLineDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartDataSource.h" 11 | #import "HyChartLineDataSourceProtocol.h" 12 | #import "HyChartLineModelDataSource.h" 13 | #import "HyChartLineConfigureDataSource.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface HyChartLineDataSource : HyChartDataSource 18 | 19 | @property (nonatomic, strong, readonly) HyChartAxisDataSource *axisDataSource; 20 | @property (nonatomic, strong, readonly) HyChartLineModelDataSource *modelDataSource; 21 | @property (nonatomic, strong, readonly) HyChartLineConfigureDataSource *configreDataSource; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartKLineDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartDataSource.h" 11 | #import "HyChartKLineDataSourceProtocol.h" 12 | #import "HyChartKLineConfigureDataSource.h" 13 | #import "HyChartKLineModelDataSource.h" 14 | 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | @interface HyChartKLineDataSource : HyChartDataSource 19 | 20 | @property (nonatomic, strong, readonly) HyChartAxisDataSource *axisDataSource; 21 | @property (nonatomic, strong, readonly) HyChartKLineModelDataSource *modelDataSource; 22 | @property (nonatomic, strong, readonly) HyChartKLineConfigureDataSource *configreDataSource; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /HyCharts/View/Cursor/HyChartCursorConfigureProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartCursorProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/1. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartModelProtocol.h" 11 | #import 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartCursorConfigureProtocol 17 | 18 | /// 线宽 19 | @property (nonatomic, assign) CGFloat cursorLineWidth; 20 | /// 线条颜色 21 | @property (nonatomic, strong) UIColor *cursorLineColor; 22 | /// 游标中心圆点大小 23 | @property (nonatomic, assign) CGSize cursorPointSize; 24 | /// 游标中心圆点颜色 25 | @property (nonatomic, strong) UIColor *cursorPointColor; 26 | /// 游标文字颜色 27 | @property (nonatomic, strong) UIColor *cursorTextColor; 28 | /// 游标文字字体 29 | @property (nonatomic, strong) UIFont *cursorTextFont; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ConfigureDataSource/HyChartConfigureDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartConfigureDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartConfigureDataSource.h" 10 | #import "HyChartConfigure.h" 11 | 12 | 13 | @interface HyChartConfigureDataSource () 14 | @property (nonatomic, strong) id configure; 15 | @end 16 | 17 | 18 | @implementation HyChartConfigureDataSource 19 | 20 | - (id)configConfigure:(void (^_Nullable)(id configure))block { 21 | !block ?: block(self.configure); 22 | return self; 23 | } 24 | 25 | - (id)configure { 26 | if (!_configure){ 27 | _configure = [[HyChartConfigure alloc] init]; 28 | } 29 | return _configure; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /HyCharts/View/Cursor/HyChartCursorConfigure.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartCursor.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/1. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartCursorConfigure.h" 10 | 11 | @implementation HyChartCursorConfigure 12 | @synthesize cursorLineWidth = _cursorLineWidth, cursorPointSize = _cursorPointSize, cursorPointColor = _cursorPointColor, cursorLineColor = _cursorLineColor, cursorTextColor = _cursorTextColor, cursorTextFont = _cursorTextFont; 13 | 14 | - (instancetype)init { 15 | if (self = [super init]) { 16 | _cursorLineWidth = .5; 17 | _cursorLineColor = UIColor.whiteColor; 18 | _cursorPointSize = CGSizeMake(6, 6); 19 | _cursorTextColor = UIColor.whiteColor; 20 | _cursorTextFont = [UIFont systemFontOfSize:12]; 21 | _cursorPointColor = UIColor.whiteColor; 22 | }return self; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisGridLineInfoProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisGridLineInfoProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartsTypedef.h" 11 | #import 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | /// 坐标轴网格 17 | @protocol HyChartAxisGridLineInfoProtocol 18 | 19 | #pragma mark - 坐标轴网格属性 20 | 21 | /// 网格颜色 22 | @property (nonatomic, strong) UIColor *axisGridLineColor; 23 | /// 网格线宽 24 | @property (nonatomic, assign) CGFloat axisGridLineWidth; 25 | /// 虚线模板起始位置 26 | @property (nonatomic, assign) CGFloat axisGridLineDashPhase; 27 | /// 虚线模板数组 28 | @property (nonatomic, strong) NSArray *axisGridLineDashPattern; 29 | /// 网格样式 30 | @property (nonatomic, assign) HyChartAxisLineType axisGridLineType; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartModel.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModel.h" 10 | 11 | 12 | @interface HyChartModel () 13 | @property (nonatomic,weak) id provider; 14 | @end 15 | 16 | 17 | @implementation HyChartModel 18 | @synthesize text = _text, exData = _exData, numberFormatter = _numberFormatter, breakingPoint = _breakingPoint, ignorePoint = _ignorePoint; 19 | 20 | - (CGFloat (^)(NSNumber * _Nonnull))valuePositon { 21 | return self.provider.valuePositon; 22 | } 23 | 24 | - (CGFloat (^)(NSNumber * _Nonnull))valueHeight { 25 | return self.provider.valueHeight; 26 | } 27 | 28 | - (void)setValuePositonProvider:(id)provider { 29 | self.provider = provider; 30 | } 31 | 32 | - (void)handleModel {} 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/AxisDataSource/HyChartAxisDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisDataSourceProtocol.h" 11 | #import "HyChartXAxisModel.h" 12 | #import "HyChartYAxisModel.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | /// 坐标轴数据源 17 | @interface HyChartAxisDataSource : NSObject 18 | 19 | @property (nonatomic, strong, readonly) HyChartXAxisModel *xAxisModel; 20 | @property (nonatomic, strong, readonly) HyChartYAxisModel *yAxisModel; 21 | 22 | @property (nonatomic, strong, readonly) HyChartXAxisModel *(^xAxisModelWityViewType)(HyChartKLineViewType type); 23 | @property (nonatomic, strong, readonly) HyChartYAxisModel *(^yAxisModelWityViewType)(HyChartKLineViewType type); 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIApplication+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIApplication (HyExtension) 15 | 16 | + (UIResponder *)hy_appDelegate; 17 | 18 | + (NSURL *)hy_documentsURL; 19 | + (NSString *)hy_documentsPath; 20 | 21 | + (NSURL *)hy_cachesURL; 22 | + (NSString *)hy_cachesPath; 23 | 24 | + (NSURL *)hy_libraryURL; 25 | + (NSString *)hy_libraryPath; 26 | 27 | + (NSString *)hy_appBuildVersion; 28 | + (NSString *)hy_appBundleName; 29 | + (NSString *)hy_appBundleID; 30 | + (NSString *)hy_appVersion; 31 | 32 | + (BOOL)hy_fileExistInMainBundle:(NSString *)name; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | 38 | 39 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/XAxis/HyChartXAxisModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartXAxisModelProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartAxisModelProtocol.h" 11 | #import "HyChartXAxisInfoProtocol.h" 12 | 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @protocol HyChartXAxisModelProtocol 18 | 19 | /// 是否禁用上X轴 默认为YES 20 | @property (nonatomic, assign) BOOL topXaxisDisabled; 21 | /// 是否禁用下X轴 默认为NO 22 | @property (nonatomic, assign) BOOL bottomXaxisDisabled; 23 | 24 | /// 配置top X 轴信息 25 | - (id)configTopXAxisInfo:(void(^)(id xAxisInfo))block; 26 | /// 配置 bottom X 轴信息 27 | - (id)configBottomXAxisInfo:(void(^)(id xAxisInfo))block; 28 | 29 | @end 30 | 31 | 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIControl+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIControl (HyExtension) 15 | 16 | - (void)hy_addBlockForControlEvents:(UIControlEvents)controlEvents 17 | block:(void (^)(id sender))block; 18 | 19 | - (void)hy_resetBlockForControlEvents:(UIControlEvents)controlEvents 20 | block:(void (^)(id sender))block; 21 | 22 | - (void)hy_removeAllBlocksForControlEvents:(UIControlEvents)controlEvents; 23 | 24 | - (void)hy_resetTarget:(id)target 25 | action:(SEL)action 26 | forControlEvents:(UIControlEvents)controlEvents; 27 | 28 | - (void)hy_removeAllTargets; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UILabel+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/8/29. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UILabel (HyExtension) 15 | 16 | + (instancetype)hy_labelWithFrame:(CGRect)frame 17 | font:(UIFont *)font 18 | text:(nullable NSString *)text 19 | textColor:(UIColor *)textColor 20 | textAlignment:(NSTextAlignment)textAlignment 21 | numberOfLines:(NSInteger)numberOfLines; 22 | 23 | - (void)hy_drawTextColor:(UIColor *)color 24 | progress:(CGFloat)progress; 25 | 26 | - (void)hy_drawTextColor:(UIColor *)color 27 | rect:(CGRect)rect; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCycleView/HyCycleView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/YAxis/HyChartYAxisModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartYAxisModel.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartYAxisModelProtocol.h" 11 | #import "HyChartAxisModel.h" 12 | #import "HyChartYAxisInfo.h" 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /// Y 轴数据 18 | @interface HyChartYAxisModel : HyChartAxisModel 19 | 20 | @property (nonatomic, strong) NSNumber *yAxisMinValue; 21 | @property (nonatomic, strong) NSNumber *yAxisMaxValue; 22 | 23 | @property (nonatomic, copy, readonly) NSNumber *(^yAxisMinValueBlock)(void); 24 | @property (nonatomic, copy, readonly) NSNumber *(^yAxisMaxValueBlock)(void); 25 | 26 | @property (nonatomic, strong, readonly) id leftYAxisInfo; 27 | @property (nonatomic, strong, readonly) id rightYAxisInfo; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartKLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineModel.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModel.h" 10 | #import "HyChartKLineModelProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartKLineModel : HyChartModel 15 | 16 | @property (nonatomic, strong) NSNumber *maxPrice; 17 | @property (nonatomic, strong) NSNumber *minPrice; 18 | @property (nonatomic, strong) NSNumber *maxVolume; 19 | @property (nonatomic, strong) NSNumber *minVolume; 20 | @property (nonatomic, strong) NSNumber *maxAuxiliary; 21 | @property (nonatomic, strong) NSNumber *minAuxiliary; 22 | @property (nonatomic, strong) NSNumberFormatter *priceNunmberFormatter; 23 | @property (nonatomic, strong) NSNumberFormatter *volumeNunmberFormatter; 24 | 25 | @property (nonatomic,copy,readonly) void (^timeLineValuesBlock)(HyChartKLineModel *model); 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIFont+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | 13 | #define Hy_SystemFont(size) [UIFont systemFontOfSize:size] 14 | #define Hy_BoldFont(size) [UIFont boldSystemFontOfSize:size] 15 | 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | @interface UIFont (HyExtension) 20 | 21 | @property (nonatomic,assign,readonly) BOOL hy_isBold; 22 | @property (nonatomic,assign,readonly) BOOL hy_isItalic; 23 | @property (nonatomic,assign,readonly) BOOL hy_isMonoSpace; 24 | @property (nonatomic,assign,readonly) BOOL hy_isColorGlyphs; 25 | @property (nonatomic,assign,readonly) CGFloat hy_fontWeight; 26 | 27 | - (UIFont *)hy_fontToNormal; 28 | - (UIFont *)hy_fontToBold; 29 | - (UIFont *)hy_fontToItalic; 30 | - (UIFont *)hy_fontToBoldItalic; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UITableViewCell+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/4. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UITableViewCell (HyExtension) 15 | 16 | @property (nonatomic,strong) id hy_cellData; 17 | @property (nonatomic,strong,readonly) id hy_sectionData; 18 | @property (nonatomic,strong,readonly) id hy_tableViewData; 19 | @property (nonatomic,weak,readonly) UITableView *hy_tableView; 20 | @property (nonatomic,strong,readonly) NSIndexPath *hy_indexPath; 21 | 22 | 23 | + (instancetype)hy_cellWithTableView:(UITableView *)tableview 24 | indexPath:(NSIndexPath *)indexPath 25 | cellData:(id)cellData; 26 | 27 | - (void)hy_cellLoad; 28 | - (void)hy_reloadCellData; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartModel.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | 10 | #import "HyChartModelProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartValuePositonProviderProtocol 15 | @property (nonatomic,copy, readonly) CGFloat (^valuePositon)(NSNumber *value); 16 | @property (nonatomic,copy, readonly) CGFloat (^valueHeight)(NSNumber *value); 17 | @end 18 | 19 | @interface HyChartModel : NSObject 20 | 21 | @property (nonatomic, assign) CGFloat position; 22 | @property (nonatomic, assign) CGFloat visiblePosition; 23 | @property (nonatomic, strong) NSNumberFormatter *numberFormatter; 24 | @property (nonatomic, strong) NSNumber *maxValue; 25 | @property (nonatomic, strong) NSNumber *minValue; 26 | 27 | - (void)setValuePositonProvider:(id)provider; 28 | 29 | - (void)handleModel; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartBarConfigureProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarConfigureProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureProtocol.h" 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @protocol HyChartBarOneConfigureProtocol 16 | /// 线条颜色 17 | @property (nonatomic, strong) UIColor *strokeColor; 18 | /// 填充颜色 19 | @property (nonatomic, strong) UIColor *fillColor; 20 | /// 线宽度 默认1.0 21 | @property (nonatomic, assign) CGFloat lineWidth; 22 | /// 虚线模板起始位置 23 | @property (nonatomic, assign) CGFloat lineDashPhase; 24 | /// 虚线模板数组 25 | @property (nonatomic, strong) NSArray *lineDashPattern; 26 | 27 | @end 28 | 29 | 30 | @protocol HyChartBarConfigureProtocol 31 | 32 | - (instancetype)configBarConfigureAtIndex:(void(^)(NSInteger index, id oneConfigure))block; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemoTests/HyChartsDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsDemoTests.m 3 | // HyChartsDemoTests 4 | // 5 | // Created by Hy on 2018/4/14. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HyChartsDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HyChartsDemoTests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKLineDemoDataHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKLineDemoDataHandler.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/21. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyCharts.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface HyChartsKLineDemoDataHandler : NSObject 15 | 16 | + (void)requestDataWithType:(NSString *)type 17 | dataSource:(id)dataSource 18 | completion:(void(^_Nullable)(void))completion; 19 | 20 | + (void)handleWithArray:(NSArray *)array 21 | dataSorce:(id)dataSorce; 22 | 23 | 24 | + (CALayer *)technicalLayerWithDataSorce:(id)dataSorce; 25 | 26 | + (CALayer *)volumTechnicalLayerWithDataSorce:(id)dataSorce; 27 | 28 | + (CALayer *)auxiliaryLayerWithDataSorce:(id)dataSorce; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UICollectionViewCell+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionViewCell+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/5. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UICollectionViewCell (HyExtension) 15 | 16 | @property (nonatomic,strong) id hy_cellData; 17 | @property (nonatomic,strong,readonly) id hy_sectionData; 18 | @property (nonatomic,strong,readonly) id hy_collectionViewData; 19 | @property (nonatomic,strong,readonly) NSIndexPath *hy_indexPath; 20 | @property (nonatomic,strong,readonly) UICollectionView *hy_collectionView; 21 | 22 | + (instancetype)hy_cellWithCollectionView:(UICollectionView *)collectionView 23 | indexPath:(NSIndexPath *)indexPath 24 | cellData:(id)cellData; 25 | 26 | - (void)hy_cellLoad; 27 | - (void)hy_reloadCellData; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartModelDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartModelDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartModelDataSource.h" 10 | 11 | 12 | @interface HyChartModelDataSource () 13 | @property (nonatomic, copy) NSInteger(^numberOfItemsBlock)(void); 14 | @property (nonatomic, copy) void (^modelForItemAtIndexBlock)(HyChartModel *model, NSInteger index); 15 | @end 16 | 17 | 18 | @implementation HyChartModelDataSource 19 | 20 | - (instancetype)configNumberOfItems:(NSInteger(^)(void))block { 21 | self.numberOfItemsBlock = [block copy]; 22 | return self; 23 | } 24 | 25 | - (instancetype)configModelForItemAtIndex:(void (^_Nullable)(id model, NSInteger index))block { 26 | self.modelForItemAtIndexBlock = [block copy]; 27 | return self; 28 | } 29 | 30 | - (NSArray *)models { 31 | if (!_models){ 32 | _models = @[].mutableCopy; 33 | } 34 | return _models; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartModelProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | @protocol HyChartModelProtocol 17 | 18 | /// X轴上显示内容 19 | @property (nonatomic, copy) NSString *text; 20 | /// 用来保存自己需要的额外数据 21 | @property (nonatomic, strong) id exData; 22 | 23 | /// 图层上x轴上的绝对位置 24 | @property (nonatomic, assign,readonly) CGFloat position; 25 | /// 图层上x轴上的可见相对位置 26 | @property (nonatomic, assign,readonly) CGFloat visiblePosition; 27 | 28 | /// 图层上数据y轴上位置 29 | @property (nonatomic,copy, readonly) CGFloat (^valuePositon)(NSNumber *value); 30 | /// 图层上数据y轴上高度值 31 | @property (nonatomic,copy, readonly) CGFloat (^valueHeight)(NSNumber *value); 32 | 33 | /// 是否为段点 默认为NO 34 | @property (nonatomic,assign) BOOL breakingPoint; 35 | /// 是否忽略这个点 36 | @property (nonatomic,assign) BOOL ignorePoint; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartKLineDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartKLineDataSource.h" 10 | 11 | @interface HyChartKLineDataSource () 12 | @property (nonatomic, strong) HyChartKLineModelDataSource *modelDataSource; 13 | @property (nonatomic, strong) HyChartKLineConfigureDataSource *configreDataSource; 14 | @end 15 | 16 | 17 | @implementation HyChartKLineDataSource 18 | @synthesize modelDataSource = _modelDataSource, configreDataSource = _configreDataSource; 19 | 20 | - (HyChartKLineConfigureDataSource *)configreDataSource { 21 | if (!_configreDataSource){ 22 | _configreDataSource = [[HyChartKLineConfigureDataSource alloc] init]; 23 | } 24 | return _configreDataSource; 25 | } 26 | 27 | - (HyChartKLineModelDataSource *)modelDataSource { 28 | if (!_modelDataSource) { 29 | _modelDataSource = [[HyChartKLineModelDataSource alloc] init]; 30 | } 31 | return _modelDataSource; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/AxisDataSource/HyChartAxisDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartXAxisModelProtocol.h" 11 | #import "HyChartYAxisModelProtocol.h" 12 | #import "HyChartAxisGridLineInfoProtocol.h" 13 | #import "HyChartsTypedef.h" 14 | 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | /// 坐标轴数据源 19 | @protocol HyChartAxisDataSourceProtocol 20 | 21 | 22 | /// 配置X轴数据 23 | - (id)configXAxisWithModel:(void(^)(id xAxisModel))block; 24 | 25 | /// 配置Y轴数据 26 | - (id)configYAxisWithModel:(void(^)(id yAxisModel))block; 27 | 28 | 29 | /// 使用HyChartKlineView 配置Y轴数据 30 | - (id)configYAxisWithModelAndViewType:(void(^)(id yAxisModel, HyChartKLineViewType type))block; 31 | 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /HyCharts/View/Layers/HyChartLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLayer.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLayer.h" 10 | 11 | 12 | @interface HyChartLayer () 13 | @property (nonatomic, strong) id dataSource; 14 | @end 15 | 16 | 17 | @implementation HyChartLayer 18 | 19 | + (instancetype)layerWithDataSource:(id)dataSource { 20 | 21 | HyChartLayer *layer = [self layer]; 22 | layer.backgroundColor = UIColor.clearColor.CGColor; 23 | layer.dataSource = dataSource; 24 | return layer; 25 | } 26 | 27 | - (void)setNeedsRendering { 28 | if (!self.dataSource) { 29 | return; 30 | } 31 | } 32 | 33 | - (CGFloat (^)(NSNumber * _Nonnull))valuePositon { 34 | return ^(NSNumber *value){ 35 | CGFloat valuePositon = .0; 36 | return valuePositon; 37 | }; 38 | } 39 | 40 | - (CGFloat (^)(NSNumber * _Nonnull))valueHeight { 41 | return ^(NSNumber *value){ 42 | CGFloat valueHeight = .0; 43 | return valueHeight; 44 | }; 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartBarConfigure.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarConfigure.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartBarConfigure.h" 10 | 11 | @implementation HyChartBarOneConfigure 12 | @synthesize strokeColor = _strokeColor, fillColor = _fillColor, lineDashPhase = _lineDashPhase, lineDashPattern = _lineDashPattern, lineWidth = _lineWidth; 13 | 14 | + (instancetype)defaultConfigure { 15 | HyChartBarOneConfigure *configure = [[self alloc] init]; 16 | configure.lineWidth = 1.0; 17 | return configure; 18 | } 19 | 20 | - (UIColor *)fillColor { 21 | return _fillColor ?: self.strokeColor; 22 | } 23 | @end 24 | 25 | 26 | @interface HyChartBarConfigure() 27 | @property (nonatomic, copy) void(^barConfigureAtIndexBlock)(NSInteger, id); 28 | @end 29 | 30 | @implementation HyChartBarConfigure 31 | - (instancetype)configBarConfigureAtIndex:(void(^)(NSInteger, id))block { 32 | self.barConfigureAtIndexBlock = [block copy]; 33 | return self; 34 | } 35 | 36 | @end 37 | 38 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIBarButtonItem+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItem+HYCreate.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/5/10. 7 | // Copyright © 2017年 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIBarButtonItem (HyExtension) 15 | 16 | @property (nullable,nonatomic,copy) void (^hy_actionBlock)(UIBarButtonItem *item); 17 | 18 | + (instancetype)hy_itemWithImage:(UIImage *)image 19 | style:(UIBarButtonItemStyle)style 20 | actionBlock:(void(^_Nullable)(UIBarButtonItem *item))actionBlock; 21 | 22 | + (instancetype)hy_itemWithTitle:(NSString *)title 23 | style:(UIBarButtonItemStyle)style 24 | actionBlock:(void(^_Nullable)(UIBarButtonItem *item))actionBlock; 25 | 26 | + (instancetype)hy_itemWithSystemItem:(UIBarButtonSystemItem)systemItem 27 | actionBlock:(void(^_Nullable)(UIBarButtonItem *item))actionBlock; 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartBarDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarDataSource.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartBarDataSource.h" 10 | #import "HyChartBarConfigureDataSource.h" 11 | #import "HyChartBarModelDataSource.h" 12 | 13 | 14 | @interface HyChartBarDataSource () 15 | @property (nonatomic, strong) HyChartBarModelDataSource * modelDataSource; 16 | @property (nonatomic, strong) HyChartBarConfigureDataSource *configreDataSource; 17 | @end 18 | 19 | 20 | @implementation HyChartBarDataSource 21 | @synthesize modelDataSource = _modelDataSource, configreDataSource = _configreDataSource; 22 | - (HyChartBarConfigureDataSource *)configreDataSource { 23 | if (!_configreDataSource){ 24 | _configreDataSource = [[HyChartBarConfigureDataSource alloc] init]; 25 | } 26 | return _configreDataSource; 27 | } 28 | 29 | - (HyChartBarModelDataSource *)modelDataSource { 30 | if (!_modelDataSource) { 31 | _modelDataSource = [[HyChartBarModelDataSource alloc] init]; 32 | } 33 | return _modelDataSource; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartBarModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarModel.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartBarModel.h" 10 | #import "HyChartsMethods.h" 11 | 12 | @implementation HyChartBarModel 13 | @synthesize values = _values; 14 | 15 | - (void)setValues:(NSArray *)values { 16 | 17 | __block NSNumber *maxVaule = nil; 18 | __block NSNumber *minVaule = nil; 19 | NSMutableArray *mArray = @[].mutableCopy; 20 | [values enumerateObjectsUsingBlock:^(NSNumber * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 21 | NSString *numberString = [self.numberFormatter stringFromNumber:obj]; 22 | NSNumber *deNumber = SafetyNumber([NSDecimalNumber decimalNumberWithString:numberString]); 23 | [mArray addObject:deNumber]; 24 | maxVaule = maxVaule ? MaxNumber(maxVaule, deNumber) : deNumber; 25 | minVaule = minVaule ? MinNumber(minVaule, deNumber) : deNumber; 26 | }]; 27 | 28 | _values = mArray.copy; 29 | self.maxValue = maxVaule; 30 | self.minValue = minVaule; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 @Hy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/HyChartLineDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLineDataSource.h" 10 | #import "HyChartLineConfigureDataSource.h" 11 | #import "HyChartLineModelDataSource.h" 12 | 13 | 14 | @interface HyChartLineDataSource () 15 | @property (nonatomic, strong) HyChartLineModelDataSource *modelDataSource; 16 | @property (nonatomic, strong) HyChartLineConfigureDataSource *configreDataSource; 17 | @end 18 | 19 | 20 | @implementation HyChartLineDataSource 21 | @synthesize modelDataSource = _modelDataSource, configreDataSource = _configreDataSource; 22 | 23 | - (HyChartLineConfigureDataSource *)configreDataSource { 24 | if (!_configreDataSource){ 25 | _configreDataSource = [[HyChartLineConfigureDataSource alloc] init]; 26 | } 27 | return _configreDataSource; 28 | } 29 | 30 | - (HyChartLineModelDataSource *)modelDataSource { 31 | if (!_modelDataSource) { 32 | _modelDataSource = [[HyChartLineModelDataSource alloc] init]; 33 | } 34 | return _modelDataSource; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCycleView/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 曾宪华 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisInfo.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartAxisInfo.h" 10 | 11 | @implementation HyChartAxisInfo 12 | 13 | @synthesize axisTextFont = _axisTextFont, axisTextColor = _axisTextColor, axisTextOffset = _axisTextOffset, axisLineColor = _axisLineColor, axisLineWidth = _axisLineWidth, axisLineType = _axisLineType, axisTextPosition = _axisTextPosition, axisLineDashPhase = _axisLineDashPhase, axisLineDashPattern = _axisLineDashPattern, rotateAngle = _rotateAngle, autoSetText = _autoSetText, displayAxisZeroText = _displayAxisZeroText; 14 | 15 | - (instancetype)init{ 16 | if (self = [super init]) { 17 | _axisTextFont = [UIFont systemFontOfSize:12]; 18 | _axisTextColor = [UIColor grayColor]; 19 | _axisTextOffset = CGPointZero; 20 | _axisLineColor = [UIColor grayColor]; 21 | _axisLineWidth = .5; 22 | _axisLineDashPhase = 0; 23 | _axisLineDashPattern = @[@10, @5]; 24 | _autoSetText = YES; 25 | _displayAxisZeroText = YES; 26 | }return self; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIButton+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIButton (HyExtension) 15 | 16 | + (instancetype)hy_buttonWithType:(UIButtonType)type 17 | frame:(CGRect)frame 18 | title:(nullable NSString * )title 19 | selectedTitle:(nullable NSString *)selectedTitle 20 | titleColor:(nullable UIColor *)titleColor 21 | selectedTitleColor:(nullable UIColor *)selectedTitleColor 22 | titleFont:(nullable UIFont *)titleFont 23 | backgroundColor:(nullable UIColor *)backgroundColor 24 | backgroundImage:(nullable UIImage *)backgroundImage 25 | clickBlock:(nullable void(^)(UIButton *button))clickBlock; 26 | 27 | - (void)hy_clickBlock:(void(^_Nullable)(UIButton *button))block; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /HyCharts/Model/Algorithm/HyChartAlgorithmProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAlgorithmProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartKLineModelDataSource.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartAlgorithmProtocol 15 | 16 | - (void (^)(NSInteger number, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleSMA; 17 | 18 | - (void (^)(NSInteger number, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleEMA; 19 | 20 | - (void (^)(NSInteger number, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleBOLL; 21 | 22 | - (void (^)(NSInteger number1, NSInteger number2, NSInteger number3, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleMACD; 23 | 24 | - (void (^)(NSInteger number1, NSInteger number2, NSInteger number3, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleKDJ; 25 | 26 | - (void (^)(NSInteger number, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleRSI; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisModel.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/20. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartAxisModel.h" 10 | #import "HyChartAxisGridLineInfo.h" 11 | 12 | 13 | @interface HyChartAxisModel () 14 | @property (nonatomic, assign) NSInteger indexs; 15 | @property (nonatomic, strong) HyChartAxisGridLineInfo *axisGridLineInfo; 16 | @end 17 | 18 | 19 | @implementation HyChartAxisModel 20 | 21 | - (instancetype)configNumberOfIndexs:(NSInteger)indexs { 22 | self.indexs = indexs; 23 | return self; 24 | } 25 | 26 | - (instancetype (^)(NSInteger))numberOfIndexs { 27 | return ^(NSInteger indexs){ 28 | self.indexs = indexs; 29 | return self; 30 | }; 31 | } 32 | 33 | - (instancetype)configAxisGridLineInfo:(void(^)(id axisGridLineInfo))block { 34 | !block ?: block(self.axisGridLineInfo); 35 | return self; 36 | } 37 | 38 | - (HyChartAxisGridLineInfo *)axisGridLineInfo { 39 | if (!_axisGridLineInfo){ 40 | _axisGridLineInfo = [[HyChartAxisGridLineInfo alloc] init]; 41 | } 42 | return _axisGridLineInfo; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UITabBarController+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarController+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/13. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UITabBarController (HyExtension) 15 | 16 | @property (nonatomic,assign) NSUInteger hy_clickItemFromIndex; 17 | @property (nonatomic,copy,nullable) void(^hy_clickItemBlock)(UITabBarController *_self, NSInteger index, BOOL isRepeat); 18 | 19 | - (void)hy_jumpSelectedToIndex:(NSInteger)index 20 | animated:(BOOL)animated 21 | completion:(void(^)(UIViewController *selectedVc))completion; 22 | 23 | - (void)hy_addChildViewController:(UIViewController *)childVc 24 | title:(NSString *)title 25 | image:(NSString *)image 26 | selectedImage:(NSString *)selectedImage 27 | imageInsets:(UIEdgeInsets)imageInsets 28 | titlePosition:(UIOffset)titlePosition; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess" "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess/HyCategoriess.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView/HyCycleView.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess/HyCategoriess.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView/HyCycleView.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView" 6 | OTHER_LDFLAGS = $(inherited) -framework "CoreFoundation" -framework "HyCategoriess" -framework "HyCycleView" -framework "UIKit" 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 10 | PODS_ROOT = ${SRCROOT}/Pods 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess" "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess/HyCategoriess.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView/HyCycleView.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess/HyCategoriess.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView/HyCycleView.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/HyCategoriess" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/HyCycleView" 6 | OTHER_LDFLAGS = $(inherited) -framework "CoreFoundation" -framework "HyCategoriess" -framework "HyCycleView" -framework "UIKit" 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 10 | PODS_ROOT = ${SRCROOT}/Pods 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartBarModelDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarModelDataSourceProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | 10 | #import "HyChartBarModelProtocol.h" 11 | #import "HyChartModelDataSourceProtocol.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartBarModelDataSourceProtocol 17 | 18 | - (instancetype)configModelForItemAtIndex:(void (^_Nullable)(id model, NSInteger index))block; 19 | 20 | /// 模型数组 21 | @property (nonatomic, strong,readonly) NSMutableArray> *models; 22 | /// 可见跨度的模型数组 23 | @property (nonatomic, strong,readonly) NSArray> *visibleModels; 24 | /// 可见跨度的靠近X轴点的模型数组 25 | @property (nonatomic, strong,readonly) NSArray> *visibleXAxisModels; 26 | /// 可见最大值模型 27 | @property (nonatomic, strong,readonly) id visibleMaxModel; 28 | /// 可见最小值模型 29 | @property (nonatomic, strong,readonly) id visibleMinModel; 30 | 31 | @property (nonatomic, strong, readonly) NSNumberFormatter *numberFormatter; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartLineModelDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineModelDataSourceProtocol.h 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLineModelProtocol.h" 10 | #import "HyChartModelDataSourceProtocol.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol HyChartLineModelDataSourceProtocol 15 | 16 | - (instancetype)configModelForItemAtIndex:(void (^_Nullable)(id model, NSInteger index))block; 17 | 18 | /// 模型数组 19 | @property (nonatomic, strong, readonly) NSMutableArray> *models; 20 | /// 可见跨度的模型数组 21 | @property (nonatomic, strong, readonly) NSArray> *visibleModels; 22 | /// 可见跨度的靠近X轴点的模型数组 23 | @property (nonatomic, strong, readonly) NSArray> *visibleXAxisModels; 24 | /// 可见最大值模型 25 | @property (nonatomic, strong, readonly) id visibleMaxModel; 26 | /// 可见最小值模型 27 | @property (nonatomic, strong, readonly) id visibleMinModel; 28 | 29 | @property (nonatomic, strong, readonly) NSNumberFormatter *numberFormatter; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /HyCharts/Model/Algorithm/HyChartAlgorithmContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAlgorithmContext.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartKLineModelDataSource.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | 15 | @interface HyChartAlgorithmContext : NSObject 16 | 17 | /// 指数移动平均数 18 | + (void (^)(NSInteger number, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleSMA; 19 | 20 | /// 指数移动平均数 21 | + (void (^)(NSInteger number,HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleEMA; 22 | 23 | /// 布林线 24 | + (void (^)(NSInteger number,HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleBOLL; 25 | 26 | 27 | /// 指数平滑异同平均线 28 | + (void (^)(NSInteger number1, NSInteger number2, NSInteger number3, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleMACD; 29 | 30 | /// 随机指标 31 | + (void (^)(NSInteger number1, NSInteger number2, NSInteger number3, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleKDJ; 32 | 33 | /// RSI指标公式 34 | + (void (^)(NSInteger number, HyChartKLineModelDataSource *modelDataSource, NSInteger rangeIndex))handleRSI; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartModelDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartModelDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartModelDataSourceProtocol.h" 11 | #import "HyChartModel.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface HyChartModelDataSource<__covariant ModelType : HyChartModel *> : NSObject 16 | 17 | @property (nonatomic, copy, readonly) NSInteger(^numberOfItemsBlock)(void); 18 | - (void(^)(ModelType, NSInteger index))modelForItemAtIndexBlock; 19 | 20 | @property (nonatomic, strong) NSMutableArray *models; 21 | @property (nonatomic, strong) NSArray *visibleModels; 22 | @property (nonatomic, strong) NSArray *visibleXAxisModels; 23 | @property (nonatomic, strong) ModelType visibleMaxModel; 24 | @property (nonatomic, strong) ModelType visibleMinModel; 25 | @property (nonatomic, assign) NSInteger visibleFromIndex; 26 | @property (nonatomic, assign) NSInteger visibleToIndex; 27 | @property (nonatomic, strong) NSNumber *maxValue; 28 | @property (nonatomic, strong) NSNumber *minValue; 29 | @property (nonatomic, strong) NSNumberFormatter *numberFormatter; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UITableViewHeaderFooterView+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewHeaderFooterView+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/4. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef NS_ENUM(NSUInteger, HyTableSeactionViewKinds) { 15 | HyTableSeactionViewKindsHeader, 16 | HyTableSeactionViewKindsFooter 17 | }; 18 | 19 | @interface UITableViewHeaderFooterView (HyExtension) 20 | 21 | @property (nonatomic,strong) id hy_sectionData; 22 | @property (nonatomic,assign,readonly) NSInteger hy_section; 23 | @property (nonatomic,weak,readonly) UITableView *hy_tableView; 24 | @property (nonatomic,strong,readonly) id hy_tableViewData; 25 | @property (nonatomic,assign,readonly) HyTableSeactionViewKinds hy_seactionViewKinds; 26 | 27 | + (instancetype)hy_headerFooterViewWithTableView:(UITableView *)tableView 28 | section:(NSInteger)section 29 | seactionViewKinds:(HyTableSeactionViewKinds)seactionViewKinds 30 | sectionData:(id)sectionData; 31 | 32 | - (void)hy_headerFooterViewLoad; 33 | - (void)hy_reloadHeaderFooterViewData; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIScreen+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScreen+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "UIScreen+HyExtension.h" 11 | 12 | @implementation UIScreen (HyExtension) 13 | 14 | + (CGFloat)hy_screenScale { 15 | 16 | static CGFloat screenScale = 0.0; 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | if ([NSThread isMainThread]) { 20 | screenScale = [[UIScreen mainScreen] scale]; 21 | } else { 22 | dispatch_sync(dispatch_get_main_queue(), ^{ 23 | screenScale = [[UIScreen mainScreen] scale]; 24 | }); 25 | } 26 | }); 27 | return screenScale; 28 | } 29 | 30 | - (CGRect)hy_currentBounds { 31 | return [self hy_boundsForOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; 32 | } 33 | 34 | - (CGRect)hy_boundsForOrientation:(UIInterfaceOrientation)orientation { 35 | 36 | CGRect bounds = [self bounds]; 37 | 38 | if (UIInterfaceOrientationIsLandscape(orientation)) { 39 | CGFloat buffer = bounds.size.width; 40 | bounds.size.width = bounds.size.height; 41 | bounds.size.height = buffer; 42 | } 43 | return bounds; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/Foundation/NSObject+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/19. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | #define Hy_RespondsToSel(_object, sel) [_object respondsToSelector:sel] 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface NSObject (HyExtension) 17 | 18 | - (nullable id)hy_deepCopy; 19 | 20 | - (id)hy_performSelector:(SEL)selector 21 | arguments:(nullable void *)argument, ...; 22 | 23 | - (void)hy_performSelector:(SEL)selector 24 | returnValue:(void *)returnValue 25 | arguments:(nullable void *)argument, ...; 26 | 27 | - (void)hy_addObserverBlockForKeyPath:(NSString *)keyPath 28 | block:(void (^)(id _Nonnull obj, _Nullable id oldValue, _Nullable id newValue))block; 29 | - (void)hy_removeObserverBlocksForKeyPath:(NSString *)keyPath; 30 | - (void)hy_removeObserverBlocks; 31 | 32 | - (void)hy_setAssociateRetainValue:(id)value withKey:(void *)key; 33 | - (void)hy_setAssociateCopyValue:(id)value withKey:(void *)key; 34 | - (void)hy_setAssociateAssignValue:(id)value withKey:(void *)key; 35 | - (id)hy_getAssociatedValueForKey:(void *)key; 36 | - (void)hy_removeAssociatedValues; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/YAxis/HyChartYAxisModelProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartYAxisModelProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartYAxisInfoProtocol.h" 11 | #import "HyChartAxisModelProtocol.h" 12 | #import "HyChartModelProtocol.h" 13 | 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @protocol HyChartYAxisModelProtocol 18 | 19 | 20 | /// 是否禁用左侧Y轴 默认为NO 21 | @property (nonatomic, assign) BOOL leftYAxisDisabled; 22 | /// 是否禁用右侧Y轴 默认为YES 23 | @property (nonatomic, assign) BOOL rightYAaxisDisabled; 24 | 25 | 26 | /// 下边界溢出值的比例 27 | @property (nonatomic, strong) NSNumber *yAxisMinValueExtraPrecent; 28 | /// 上边界溢出值的比例 29 | @property (nonatomic, strong) NSNumber *yAxisMaxValueExtraPrecent; 30 | 31 | 32 | /// 设置固定最大值, yAxisMinValueExtraPrecent 失效 33 | - (id)configYAxisMinValue:(NSNumber *(^)(void))block; 34 | /// 设置固定最小值 yAxisMaxValueExtraPrecent 失效 35 | - (id)configYAxisMaxValue:(NSNumber *(^)(void))block; 36 | 37 | 38 | /// 配置基本信息 39 | - (id)configLeftYAxisInfo:(void(^)(id yAxisInfo))block; 40 | /// 配置数据 41 | - (id)configRightYAxisInfo:(void(^)(id yAxisInfo))block; 42 | 43 | 44 | @end 45 | 46 | NS_ASSUME_NONNULL_END 47 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UICollectionReusableView+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionReusableView+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/5. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef NS_ENUM(NSUInteger, HyCollectionSeactionViewKinds) { 15 | HyCollectionSeactionViewKindsHeader, 16 | HyCollectionSeactionViewKindsFooter 17 | }; 18 | 19 | @interface UICollectionReusableView (HyExtension) 20 | 21 | @property (nonatomic,strong) id hy_sectionData; 22 | @property (nonatomic,assign,readonly) NSInteger hy_section; 23 | @property (nonatomic,strong,readonly) id hy_collectionViewData; 24 | @property (nonatomic,strong,readonly) UICollectionView *hy_collectionView; 25 | @property (nonatomic,assign,readonly) HyCollectionSeactionViewKinds hy_seactionViewKinds; 26 | 27 | + (instancetype)hy_headerFooterViewWithCollectionView:(UICollectionView *)collectionView 28 | indexPath:(NSIndexPath *)indexPath 29 | seactionViewKinds:(HyCollectionSeactionViewKinds)seactionViewKinds 30 | sectionData:(id)sectionData; 31 | - (void)hy_headerFooterViewLoad; 32 | - (void)hy_reloadHeaderFooterViewData; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIDevice+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIDevice+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface UIDevice (HyExtension) 16 | 17 | + (double)hy_systemVersion; 18 | 19 | + (BOOL)hy_isPad; 20 | + (BOOL)hy_isSimulator; 21 | 22 | + (NSString *)hy_ipAddressWIFI; 23 | + (NSString *)hy_ipAddressCell; 24 | 25 | + (NSUInteger)hy_cpuCount; 26 | + (float)hy_cpuUsage; 27 | + (NSArray *)hy_cpuUsagePerProcessor; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | 33 | #ifndef Hy_kSystemVersion 34 | #define Hy_kSystemVersion [UIDevice hy_systemVersion] 35 | #endif 36 | 37 | #ifndef Hy_iOS6Later 38 | #define Hy_iOS6Later (Hy_kSystemVersion >= 6) 39 | #endif 40 | 41 | #ifndef Hy_iOS7Later 42 | #define Hy_iOS7Later (Hy_kSystemVersion >= 7) 43 | #endif 44 | 45 | #ifndef Hy_iOS8Later 46 | #define Hy_iOS8Later (Hy_kSystemVersion >= 8) 47 | #endif 48 | 49 | #ifndef Hy_iOS9Later 50 | #define Hy_iOS9Later (Hy_kSystemVersion >= 9) 51 | #endif 52 | 53 | #ifndef Hy_iOS10Later 54 | #define Hy_iOS10Later (Hy_kSystemVersion >= 10) 55 | #endif 56 | 57 | #ifndef Hy_iOS11Later 58 | #define Hy_iOS11Later (Hy_kSystemVersion >= 11) 59 | #endif 60 | 61 | #ifndef Hy_iOS12Later 62 | #define Hy_iOS12Later (Hy_kSystemVersion >= 12) 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/HyChartAxisInfoProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartAxisInfoProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartsTypedef.h" 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | 16 | @protocol HyChartAxisInfoProtocol 17 | 18 | 19 | #pragma mark - 坐标轴上Text属性 20 | /// 轴上文字字体 21 | @property (nonatomic, strong) UIFont *axisTextFont; 22 | /// 轴上文字颜色 23 | @property (nonatomic, strong) UIColor *axisTextColor; 24 | /// 轴上文字偏移量 25 | @property (nonatomic, assign) CGPoint axisTextOffset; 26 | /// 轴上文字旋转角度 [-PI/2, PI/2]之间 27 | @property (nonatomic, assign) CGFloat rotateAngle; 28 | /// 轴上文字位置 29 | @property (nonatomic, assign) HyChartAxisTextPosition axisTextPosition; 30 | /// 自动内部设置坐标轴文字(默认为YES), X轴文字(根据 HyChartModelProtocol 的设置的text) Y轴文字(根据最大值和最小值平均分) 31 | @property (nonatomic, assign) BOOL autoSetText; 32 | /// 是否显示坐标原点文字 33 | @property (nonatomic, assign) BOOL displayAxisZeroText; 34 | 35 | #pragma mark - 坐标轴属性 36 | /// 轴的颜色 37 | @property (nonatomic, strong) UIColor *axisLineColor; 38 | /// 轴线粗细 39 | @property (nonatomic, assign) CGFloat axisLineWidth; 40 | /// 虚线模板起始位置 41 | @property (nonatomic, assign) CGFloat axisLineDashPhase; 42 | /// 虚线模板数组 43 | @property (nonatomic, strong) NSArray *axisLineDashPattern; 44 | /// 轴线样式 45 | @property (nonatomic, assign) HyChartAxisLineType axisLineType; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/HyCategories.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyCategories.h 3 | // HyCategoriesDemo 4 | // 5 | // Created by huangyi on 2019/11/21. 6 | // Copyright © 2019 Hy. All rights reserved. 7 | // 8 | 9 | #ifndef HyCategories_h 10 | #define HyCategories_h 11 | 12 | #import "HyRunTimeMethods.h" 13 | #import "UIViewController+HyExtension.h" 14 | #import "UINavigationController+HyExtension.h" 15 | #import "UITabBarController+HyExtension.h" 16 | #import "UIView+HyExtension.h" 17 | #import "UIScrollView+HyExtension.h" 18 | #import "UITableView+HyExtension.h" 19 | #import "UITableViewCell+HyExtension.h" 20 | #import "UITableViewHeaderFooterView+HyExtension.h" 21 | #import "UICollectionView+HyExtension.h" 22 | #import "UICollectionViewCell+HyExtension.h" 23 | #import "UICollectionReusableView+HyExtension.h" 24 | #import "UILabel+HyExtension.h" 25 | #import "UITextField+HyExtension.h" 26 | #import "UITextView+HyExtension.h" 27 | #import "UIControl+HyExtension.h" 28 | #import "UIButton+HyExtension.h" 29 | #import "UIBarButtonItem+HyExtension.h" 30 | #import "UIGestureRecognizer+HyExtension.h" 31 | #import "UIFont+HyExtension.h" 32 | #import "UIColor+HyExtension.h" 33 | #import "UIScreen+HyExtension.h" 34 | #import "UIWindow+HyExtension.h" 35 | #import "UIDevice+HyExtension.h" 36 | #import "UIApplication+HyExtension.h" 37 | #import "UIBezierPath+HyExtension.h" 38 | #import "NSObject+HyExtension.h" 39 | #import "NSInvocation+HyExtension.h" 40 | #import "NSMethodSignature+HyExtension.h" 41 | 42 | #endif /* HyCategories_h */ 43 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2020/4/14. 6 | // Copyright © 2020 Hy. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | #pragma mark - UISceneSession lifecycle 25 | 26 | 27 | - (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { 28 | // Called when a new scene session is being created. 29 | // Use this method to select a configuration to create the new scene with. 30 | return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; 31 | } 32 | 33 | 34 | - (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { 35 | // Called when the user discards a scene session. 36 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 37 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 38 | } 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /HyCharts/Model/Entity/HyChartLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineModel.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/7. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLineModel.h" 10 | #import "HyChartsMethods.h" 11 | 12 | @implementation HyChartLineModel 13 | @synthesize values = _values, breakpoints = _breakpoints; 14 | 15 | - (void)setValues:(NSArray *)values { 16 | 17 | __block NSNumber *maxVaule = nil; 18 | __block NSNumber *minVaule = nil; 19 | NSMutableArray *mArray = @[].mutableCopy; 20 | [values enumerateObjectsUsingBlock:^(NSNumber * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 21 | NSString *numberString = [self.numberFormatter stringFromNumber:obj]; 22 | NSNumber *deNumber = SafetyNumber([NSDecimalNumber decimalNumberWithString:numberString]); 23 | [mArray addObject:deNumber]; 24 | maxVaule = maxVaule ? MaxNumber(maxVaule, deNumber) : deNumber; 25 | minVaule = minVaule ? MinNumber(minVaule, deNumber) : deNumber; 26 | }]; 27 | 28 | _values = mArray.copy; 29 | self.maxValue = maxVaule; 30 | self.minValue = minVaule; 31 | } 32 | 33 | - (NSArray *)breakpoints { 34 | if (_breakpoints.count != self.values.count) { 35 | NSMutableArray *array = @[].mutableCopy; 36 | for (NSInteger i = 0; i < self.values.count; i++) { 37 | [array addObject:@(NO)]; 38 | } 39 | _breakpoints = array.copy; 40 | } 41 | return _breakpoints; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/Foundation/NSMethodSignature+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMethodSignature+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/19. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "NSMethodSignature+HyExtension.h" 11 | #import "HyRunTimeMethods.h" 12 | 13 | @implementation NSMethodSignature (HyExtension) 14 | 15 | /* 16 | - (IMP)methodForSelector:(SEL)aSelector; 17 | + (IMP)instanceMethodForSelector:(SEL)aSelector; 18 | */ 19 | - (NSString *)hy_typeString { 20 | 21 | SEL selector = sel_registerName("_typeString"); 22 | IMP imp = [self methodForSelector:selector]; 23 | if (imp != NULL) { 24 | return HyValueImpFuctoin(imp, NSString *, self, selector); 25 | } 26 | return nil; 27 | } 28 | 29 | - (const char *)hy_typeEncoding { 30 | return self.hy_typeString.UTF8String; 31 | } 32 | 33 | + (instancetype)hy_classMethodSignatureWithClass:(Class)cls selector:(SEL)sel { 34 | 35 | if (!cls || !sel) { 36 | return nil; 37 | } 38 | Class metacls = objc_getMetaClass(NSStringFromClass(cls).UTF8String); 39 | return [metacls instanceMethodSignatureForSelector:sel]; 40 | } 41 | 42 | + (instancetype)hy_instanceMethodSignatureWithClass:(Class)cls selector:(SEL)sel { 43 | 44 | if (!cls || !sel) { 45 | return nil; 46 | } 47 | Class class = objc_getClass(NSStringFromClass(cls).UTF8String); 48 | return [class instanceMethodSignatureForSelector:sel]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/XAxis/HyChartXAxisModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartXAxisModel.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartXAxisModel.h" 10 | 11 | 12 | 13 | @interface HyChartXAxisModel () 14 | @property (nonatomic, strong) HyChartXAxisInfo *topXAxisInfo; 15 | @property (nonatomic, strong) HyChartXAxisInfo *bottomXAxisInfo; 16 | @end 17 | 18 | 19 | @implementation HyChartXAxisModel 20 | @synthesize topXaxisDisabled = _topXaxisDisabled, bottomXaxisDisabled = _bottomXaxisDisabled; 21 | 22 | - (instancetype)init { 23 | if (self = [super init]) { 24 | _topXaxisDisabled = YES; 25 | _bottomXaxisDisabled = NO; 26 | } 27 | return self; 28 | } 29 | 30 | - (id)configTopXAxisInfo:(void(^)(id xAxisInfo))block { 31 | !block ?: block(self.topXAxisInfo); 32 | return self; 33 | } 34 | 35 | - (id)configBottomXAxisInfo:(void(^)(id xAxisInfo))block { 36 | !block ?: block(self.bottomXAxisInfo); 37 | return self; 38 | } 39 | 40 | - (HyChartXAxisInfo *)topXAxisInfo { 41 | if (self.topXaxisDisabled) { 42 | return nil; 43 | } 44 | if (!_topXAxisInfo){ 45 | _topXAxisInfo = [[HyChartXAxisInfo alloc] init]; 46 | } 47 | return _topXAxisInfo; 48 | } 49 | 50 | - (HyChartXAxisInfo *)bottomXAxisInfo { 51 | if (self.bottomXaxisDisabled) { 52 | return nil; 53 | } 54 | if (!_bottomXAxisInfo){ 55 | _bottomXAxisInfo = [[HyChartXAxisInfo alloc] init]; 56 | } 57 | return _bottomXAxisInfo; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemoUITests/HyChartsDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsDemoUITests.m 3 | // HyChartsDemoUITests 4 | // 5 | // Created by Hy on 2018/4/14. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HyChartsDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HyChartsDemoUITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | - (void)tearDown { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | } 29 | 30 | - (void)testExample { 31 | // UI tests must launch the application that they test. 32 | XCUIApplication *app = [[XCUIApplication alloc] init]; 33 | [app launch]; 34 | 35 | // Use recording to get started writing UI tests. 36 | // Use XCTAssert and related functions to verify your tests produce the correct results. 37 | } 38 | 39 | - (void)testLaunchPerformance { 40 | if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { 41 | // This measures how long it takes to launch your application. 42 | [self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{ 43 | [[[XCUIApplication alloc] init] launch]; 44 | }]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/HyCategoriess/HyCategoriess-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "NSInvocation+HyExtension.h" 14 | #import "NSMethodSignature+HyExtension.h" 15 | #import "NSObject+HyExtension.h" 16 | #import "HyCategories.h" 17 | #import "HyRunTimeMethods.h" 18 | #import "UIApplication+HyExtension.h" 19 | #import "UIBarButtonItem+HyExtension.h" 20 | #import "UIBezierPath+HyExtension.h" 21 | #import "UIButton+HyExtension.h" 22 | #import "UICollectionReusableView+HyExtension.h" 23 | #import "UICollectionView+HyExtension.h" 24 | #import "UICollectionViewCell+HyExtension.h" 25 | #import "UIColor+HyExtension.h" 26 | #import "UIControl+HyExtension.h" 27 | #import "UIDevice+HyExtension.h" 28 | #import "UIFont+HyExtension.h" 29 | #import "UIGestureRecognizer+HyExtension.h" 30 | #import "UILabel+HyExtension.h" 31 | #import "UINavigationController+HyExtension.h" 32 | #import "UIScreen+HyExtension.h" 33 | #import "UIScrollView+HyExtension.h" 34 | #import "UITabBarController+HyExtension.h" 35 | #import "UITableView+HyExtension.h" 36 | #import "UITableViewCell+HyExtension.h" 37 | #import "UITableViewHeaderFooterView+HyExtension.h" 38 | #import "UITextField+HyExtension.h" 39 | #import "UITextView+HyExtension.h" 40 | #import "UIView+HyExtension.h" 41 | #import "UIViewController+HyExtension.h" 42 | #import "UIWindow+HyExtension.h" 43 | 44 | FOUNDATION_EXPORT double HyCategoriessVersionNumber; 45 | FOUNDATION_EXPORT const unsigned char HyCategoriessVersionString[]; 46 | 47 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/Foundation/NSInvocation+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSInvocation+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/19. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "NSInvocation+HyExtension.h" 11 | 12 | @implementation NSInvocation (HyExtension) 13 | 14 | + (instancetype)hy_invocationWithTarget:(id)target 15 | selector:(SEL)selector 16 | returnValue:(void *)returnValue 17 | arguments:(void *)argument, ... { 18 | 19 | NSMethodSignature *signature = [target methodSignatureForSelector:selector]; 20 | if (!signature) {[target doesNotRecognizeSelector:selector]; return nil;} 21 | 22 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 23 | if (!invocation) { [target doesNotRecognizeSelector:selector]; return nil; } 24 | 25 | [invocation setTarget:target]; 26 | [invocation setSelector:selector]; 27 | 28 | if (argument) { 29 | va_list valist; 30 | va_start(valist, argument); 31 | 32 | [invocation setArgument:argument atIndex:2]; 33 | void *currentArgument; 34 | NSInteger index = 3; 35 | while ((currentArgument = va_arg(valist, void *))) { 36 | [invocation setArgument:currentArgument atIndex:index]; 37 | index++; 38 | } 39 | va_end(valist); 40 | } 41 | 42 | [invocation invoke]; 43 | 44 | if (returnValue) { 45 | [invocation getReturnValue:returnValue]; 46 | } 47 | 48 | return invocation; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartConfigureProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartConfigureProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "HyChartsTypedef.h" 12 | 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartConfigureProtocol 17 | 18 | /// 值柱体宽度 (线条可不设) 19 | @property (nonatomic, assign) CGFloat width; 20 | /// 值间距 21 | @property (nonatomic, assign) CGFloat margin; 22 | /// 是否自动算margin 正好铺满 23 | @property (nonatomic, assign) BOOL autoMargin; 24 | /// 开始边距 25 | @property (nonatomic, assign) CGFloat edgeInsetStart; 26 | /// 结束边距 27 | @property (nonatomic, assign) CGFloat edgeInsetEnd; 28 | /// 数据渲染方向 29 | @property (nonatomic, assign) HyChartRenderingDirection renderingDirection; 30 | /// 数据不够 / 放大缩小 不能完全铺满时,靠哪一边 (默认靠左) 31 | @property (nonatomic, assign) HyChartNotEnoughSide notEnoughSide; 32 | 33 | 34 | /// 偏移量 35 | @property (nonatomic, assign) CGFloat trans; 36 | /// 当前缩放值 37 | @property (nonatomic, assign) CGFloat scale; 38 | /// 最小缩放值 39 | @property (nonatomic, assign) CGFloat minScale; 40 | /// 最大缩放值 41 | @property (nonatomic, assign) CGFloat maxScale; 42 | /// 间隙(edgeInset、 margin)是否跟着缩放 默认为YES 43 | @property (nonatomic, assign) BOOL canScaleSpace; 44 | /// 当前展示范围 45 | @property (nonatomic, assign) CGFloat displayWidth; 46 | /// 最小展示范围(优先级别高于minScale) 47 | @property (nonatomic, assign) CGFloat minDisplayWidth; 48 | /// 最大展示范围(优先级别高于maxScale) 49 | @property (nonatomic, assign) CGFloat maxDisplayWidth; 50 | 51 | /// 精度 52 | @property (nonatomic, assign) NSInteger decimal; 53 | @property (nonatomic, strong, readonly) NSNumberFormatter *numberFormatter; 54 | 55 | @end 56 | 57 | 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartKLineModelDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineModelDataSource.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartKLineModelDataSource.h" 10 | #import "HyChartKLineModelProtocol.h" 11 | 12 | @implementation HyChartKLineModelDataSource 13 | 14 | - (NSNumber * _Nonnull (^)(HyChartKLineViewType))maxValueWithViewType { 15 | return ^NSNumber *(HyChartKLineViewType type){ 16 | NSNumber *number = 0; 17 | switch (type) { 18 | case HyChartKLineViewTypeMain: { 19 | number = self.maxPrice; 20 | }break; 21 | case HyChartKLineViewTypeVolume: { 22 | number = self.maxVolume; 23 | }break; 24 | case HyChartKLineViewTypeAuxiliary: { 25 | number = self.maxAuxiliary; 26 | }break; 27 | default: 28 | break; 29 | } 30 | return number; 31 | }; 32 | } 33 | 34 | - (NSNumber * _Nonnull (^)(HyChartKLineViewType))minValueWithViewType { 35 | return ^NSNumber *(HyChartKLineViewType type){ 36 | NSNumber *number = 0; 37 | switch (type) { 38 | case HyChartKLineViewTypeMain: { 39 | number = self.minPrice; 40 | }break; 41 | case HyChartKLineViewTypeVolume: { 42 | number = self.minVolume; 43 | }break; 44 | case HyChartKLineViewTypeAuxiliary: { 45 | number = self.minAuxiliary; 46 | }break; 47 | default: 48 | break; 49 | } 50 | return number; 51 | }; 52 | } 53 | 54 | - (NSNumberFormatter *)numberFormatter { 55 | return self.priceNunmberFormatter; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsKLineDemoCursor.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsKLineDemoCursor.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/4/22. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsKLineDemoCursor.h" 10 | #import "HyChartCursor.h" 11 | #import 12 | 13 | 14 | @interface HyChartsKLineDemoCursor () 15 | @property (nonatomic,strong) HyChartCursor *chartCursour ; 16 | @end 17 | 18 | 19 | @implementation HyChartsKLineDemoCursor 20 | - (HyChartCursor *)chartCursour { 21 | if (!_chartCursour){ 22 | _chartCursour = [HyChartCursor chartCursorWithLayer:self.showView.layer]; 23 | _chartCursour.configure.cursorLineColor = UIColor.grayColor; 24 | _chartCursour.configure.cursorPointColor = UIColor.grayColor; 25 | _chartCursour.configure.cursorTextColor = Hy_ColorWithRGB(53, 117, 249); 26 | _chartCursour.configure.cursorTextFont = [UIFont systemFontOfSize:12]; 27 | _chartCursour.frame = self.showView.layer.bounds; 28 | } 29 | return _chartCursour; 30 | } 31 | 32 | - (void (^)(HyChartView * _Nonnull, id _Nonnull, NSString * _Nonnull, NSString * _Nonnull, CGPoint))show { 33 | return ^(HyChartView *chartView, id model, NSString *xText, NSString *yText, CGPoint centerPoint) { 34 | if (centerPoint.y < CGRectGetMaxY(chartView.frame)) { 35 | [self dismiss]; 36 | [self.showView.layer addSublayer:self.chartCursour]; 37 | self.chartCursour.show(chartView, model, xText, yText, centerPoint); 38 | } 39 | }; 40 | } 41 | 42 | - (void)dismiss { 43 | [self.chartCursour dismiss]; 44 | [self.chartCursour removeFromSuperlayer]; 45 | } 46 | 47 | - (BOOL)isShowing { 48 | return self.chartCursour.superlayer; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartKLineModelDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineModelDataSource.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartModelDataSource.h" 11 | #import "HyChartKLineModelDataSourceProtocol.h" 12 | #import "HyChartKLineModel.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface HyChartKLineModelDataSource : HyChartModelDataSource 17 | 18 | @property (nonatomic, strong) HyChartKLineModel *visibleMaxPriceModel; 19 | @property (nonatomic, strong) HyChartKLineModel *visibleMinPriceModel; 20 | @property (nonatomic, strong) HyChartKLineModel *visibleMaxVolumeModel; 21 | @property (nonatomic, strong) HyChartKLineModel *visibleMinVolumeModel; 22 | 23 | @property (nonatomic, strong) NSNumber *maxPrice; 24 | @property (nonatomic, strong) NSNumber *minPrice; 25 | @property (nonatomic, strong) NSNumber *maxVolume; 26 | @property (nonatomic, strong) NSNumber *minVolume; 27 | @property (nonatomic, strong) NSNumber *maxAuxiliary; 28 | @property (nonatomic, strong) NSNumber *minAuxiliary; 29 | @property (nonatomic, strong) NSArray *> *valuesArray; 30 | @property (nonatomic, strong) NSNumberFormatter *priceNunmberFormatter; 31 | @property (nonatomic, strong) NSNumberFormatter *volumeNunmberFormatter; 32 | @property (nonatomic, copy, readonly) NSNumber *(^maxValueWithViewType)(HyChartKLineViewType type); 33 | @property (nonatomic, copy, readonly) NSNumber *(^minValueWithViewType)(HyChartKLineViewType type); 34 | @property (nonatomic, assign) HyChartKLineTechnicalType klineMianTechnicalType; 35 | @property (nonatomic, assign) HyChartKLineTechnicalType klineVolumeTechnicalType; 36 | @property (nonatomic, assign) HyChartKLineAuxiliaryType auxiliaryType; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /HyCharts/Model/DataSource/ModelDataSource/HyChartKLineModelDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartKLineModelDataSourceProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartKLineModelProtocol.h" 11 | #import "HyChartModelDataSourceProtocol.h" 12 | #import "HyChartsTypedef.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol HyChartKLineModelDataSourceProtocol 17 | 18 | 19 | - (instancetype)configModelForItemAtIndex:(void (^_Nullable)(id model, NSInteger index))block; 20 | 21 | /// 模型数组 22 | @property (nonatomic, strong, readonly) NSMutableArray> *models; 23 | /// 可见跨度的模型数组 24 | @property (nonatomic, strong, readonly) NSArray> *visibleModels; 25 | /// 可见跨度的靠近X轴点的模型数组 26 | @property (nonatomic, strong, readonly) NSArray> *visibleXAxisModels; 27 | 28 | /// 可见最大值模型 29 | @property (nonatomic, strong, readonly) id visibleMaxPriceModel; 30 | /// 可见最小值模型 31 | @property (nonatomic, strong, readonly) id visibleMinPriceModel; 32 | /// 可见最大值模型 33 | @property (nonatomic, strong, readonly) id visibleMaxVolumeModel; 34 | /// 可见最小值模型 35 | @property (nonatomic, strong, readonly) id visibleMinVolumeModel; 36 | 37 | @property (nonatomic, assign, readonly) HyChartKLineTechnicalType klineMianTechnicalType; 38 | @property (nonatomic, assign, readonly) HyChartKLineTechnicalType klineVolumeTechnicalType; 39 | @property (nonatomic, assign, readonly) HyChartKLineAuxiliaryType auxiliaryType; 40 | @property (nonatomic, strong, readonly) NSNumberFormatter *priceNunmberFormatter; 41 | @property (nonatomic, strong, readonly) NSNumberFormatter *volumeNunmberFormatter; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIButton+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "UIButton+HyExtension.h" 11 | #import "UIControl+HyExtension.h" 12 | 13 | 14 | @implementation UIButton (HyExtension) 15 | 16 | + (instancetype)hy_buttonWithType:(UIButtonType)type 17 | frame:(CGRect)frame 18 | title:(NSString *)title 19 | selectedTitle:(NSString *)selectedTitle 20 | titleColor:(UIColor *)titleColor 21 | selectedTitleColor:(UIColor *)selectedTitleColor 22 | titleFont:(UIFont *)titleFont 23 | backgroundColor:(UIColor *)backgroundColor 24 | backgroundImage:(UIImage *)backgroundImage 25 | clickBlock:(void(^)(UIButton *button))clickBlock { 26 | 27 | UIButton *button = [UIButton buttonWithType:type]; 28 | button.frame = frame; 29 | [button setTitle:title forState:UIControlStateNormal]; 30 | if (selectedTitle) { 31 | [button setTitle:selectedTitle forState:UIControlStateSelected]; 32 | } 33 | [button setTitleColor:titleColor forState:UIControlStateNormal]; 34 | if (selectedTitleColor) { 35 | [button setTitleColor:selectedTitleColor forState:UIControlStateSelected]; 36 | } 37 | if (titleFont) { 38 | [button.titleLabel setFont:titleFont]; 39 | } 40 | [button setBackgroundColor:backgroundColor]; 41 | [button setBackgroundImage:backgroundImage forState:UIControlStateNormal]; 42 | [button hy_addBlockForControlEvents:UIControlEventTouchUpInside block:clickBlock]; 43 | return button; 44 | } 45 | 46 | - (void)hy_clickBlock:(void (^)(UIButton * _Nonnull))block { 47 | [self hy_resetBlockForControlEvents:UIControlEventTouchUpInside block:block]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIColor+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 17/7/14. 7 | // Copyright © 2017年 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | #define Hy_ColorWithHex(hex) [UIColor hy_colorWithHexString:hex] 13 | #define Hy_ColorWithRGB(r, g , b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] 14 | #define Hy_ColorWithRGBA(r, g , b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | @interface UIColor (HyExtension) 19 | 20 | // RGB 21 | @property (nonatomic,assign,readonly) CGFloat hy_red; 22 | @property (nonatomic,assign,readonly) CGFloat hy_green; 23 | @property (nonatomic,assign,readonly) CGFloat hy_blue; 24 | @property (nonatomic,assign,readonly) CGFloat hy_alpha; 25 | @property (nonatomic,assign,readonly) uint32_t hy_rgbValue; 26 | @property (nonatomic,assign,readonly) uint32_t hy_rgbaValue; 27 | @property (nonatomic,copy,readonly,nullable) NSString *hy_hexString; 28 | @property (nonatomic,copy,readonly,nullable) NSString *hy_hexStringWithAlpha; 29 | // HSB 30 | @property (nonatomic,assign,readonly) CGFloat hy_hue; 31 | @property (nonatomic,assign,readonly) CGFloat hy_saturation; 32 | @property (nonatomic,assign,readonly) CGFloat hy_brightness; 33 | 34 | @property (nonatomic,assign,readonly) CGColorSpaceModel hy_colorSpaceModel; 35 | @property (nonatomic,copy,readonly) NSString *hy_colorSpaceString; 36 | 37 | 38 | + (UIColor *)hy_randomColor; 39 | + (UIColor *)hy_colorWithRGBValue:(uint32_t)rgbValue; 40 | + (UIColor *)hy_colorWithRGBAValue:(uint32_t)rgbaValue; 41 | + (UIColor *)hy_colorWithRGBValue:(uint32_t)rgbValue alpha:(CGFloat)alpha; 42 | + (nullable UIColor *)hy_colorWithHexString:(NSString *)hexString; 43 | 44 | - (UIColor *)hy_transitionToColor:(UIColor *)toColor progress:(CGFloat)progress; 45 | - (UIColor *)hy_colorCombineColor:(UIColor *)color blendMode:(CGBlendMode)blendMode; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartConfigure.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartConfigure.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartConfigure.h" 10 | 11 | 12 | @interface HyChartConfigure () 13 | @property (nonatomic, strong) NSNumberFormatter *numberFormatter; 14 | @end 15 | 16 | @implementation HyChartConfigure 17 | @synthesize width = _width, margin = _margin, edgeInsetStart = _edgeInsetStart, edgeInsetEnd = _edgeInsetEnd, trans = _trans, scale = _scale, maxScale = _maxScale, minScale = _minScale, autoMargin = _autoMargin, renderingDirection = _renderingDirection, decimal = _decimal, minDisplayWidth = _minDisplayWidth, maxDisplayWidth = _maxDisplayWidth, displayWidth = _displayWidth, notEnoughSide = _notEnoughSide, canScaleSpace = _canScaleSpace; 18 | 19 | - (instancetype)init { 20 | if (self = [super init]) { 21 | 22 | self.margin = 5; 23 | self.width = 10; 24 | self.edgeInsetStart = 5; 25 | self.edgeInsetEnd = 5; 26 | 27 | self.trans = 0; 28 | self.scale = 1; 29 | self.maxScale = 5; 30 | self.minScale = .3; 31 | 32 | self.canScaleSpace = YES; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)setDecimal:(NSInteger)decimal { 38 | _decimal = decimal; 39 | self.numberFormatter.maximumFractionDigits = decimal; 40 | self.numberFormatter.minimumFractionDigits = decimal; 41 | } 42 | 43 | - (NSNumberFormatter *)numberFormatter { 44 | if (!_numberFormatter){ 45 | _numberFormatter = [NSNumberFormatter new]; 46 | _numberFormatter.roundingMode = NSNumberFormatterRoundDown; 47 | _numberFormatter.maximumFractionDigits = 0; 48 | _numberFormatter.minimumFractionDigits = 0; 49 | _numberFormatter.minimumIntegerDigits = 1; 50 | _numberFormatter.groupingSeparator = @""; 51 | _numberFormatter.numberStyle = NSNumberFormatterDecimalStyle; 52 | _numberFormatter.decimalSeparator = @".";; 53 | } 54 | return _numberFormatter; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartLineConfigure.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineConfigure.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartLineConfigure.h" 10 | 11 | 12 | @implementation HyChartLineOneConfigure 13 | @synthesize lineWidth = _lineWidth, lineType = _lineType, linePointStrokeColor = _linePointStrokeColor, linePointFillColor = _linePointFillColor,linePointType = _linePointType, linePointSize = _linePointSize, shadeColors = _shadeColors, linePointWidth = _linePointWidth, lineColor = _lineColor, lineDashPhase = _lineDashPhase, lineDashPattern = _lineDashPattern, disPlayNewvalue = _disPlayNewvalue, newvalueFont = _newvalueFont, newvalueColor = _newvalueColor, disPlayMaxMinValue = _disPlayMaxMinValue, maxminValueColor = _maxminValueColor, maxminValueFont = _maxminValueFont; 14 | 15 | + (instancetype)defaultConfigure { 16 | HyChartLineOneConfigure *configure = [[self alloc] init]; 17 | configure.lineWidth = 1.0; 18 | configure.linePointWidth = 1.0; 19 | configure.linePointSize = CGSizeMake(10, 10); 20 | configure.lineColor = UIColor.orangeColor; 21 | 22 | configure.disPlayNewvalue = NO; 23 | configure.newvalueColor = UIColor.grayColor; 24 | configure.newvalueFont = [UIFont systemFontOfSize:12]; 25 | 26 | configure.disPlayMaxMinValue = NO; 27 | configure.maxminValueColor = UIColor.grayColor; 28 | configure.maxminValueFont = [UIFont systemFontOfSize:10]; 29 | 30 | return configure; 31 | } 32 | 33 | - (UIColor *)linePointStrokeColor { 34 | return _linePointStrokeColor ?: self.lineColor; 35 | } 36 | 37 | @end 38 | 39 | 40 | @interface HyChartLineConfigure() 41 | @property (nonatomic, copy) void(^lineConfigureAtIndexBlock)(NSInteger, id); 42 | @end 43 | 44 | @implementation HyChartLineConfigure 45 | 46 | - (instancetype)configLineConfigureAtIndex:(void(^)(NSInteger, id))block { 47 | self.lineConfigureAtIndexBlock = [block copy]; 48 | return self; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /HyCharts/Model/Configure/HyChartLineConfigureProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartLineConfigureProtocol.h 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/26. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HyChartConfigureProtocol.h" 11 | #import "HyChartsTypedef.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @protocol HyChartLineOneConfigureProtocol 16 | /// 线条颜色 17 | @property (nonatomic, strong) UIColor *lineColor; 18 | /// 线宽度 默认1.0 19 | @property (nonatomic, assign) CGFloat lineWidth; 20 | /// 虚线模板起始位置 21 | @property (nonatomic, assign) CGFloat lineDashPhase; 22 | /// 虚线模板数组 23 | @property (nonatomic, strong) NSArray *lineDashPattern; 24 | /// 线样式 25 | @property (nonatomic, assign) HyChartLineType lineType; 26 | /// 值点线宽度 27 | @property (nonatomic, assign) CGFloat linePointWidth; 28 | /// 值点大小 29 | @property (nonatomic, assign) CGSize linePointSize; 30 | /// 值点Stroke颜色 31 | @property (nonatomic, strong) UIColor *linePointStrokeColor; 32 | /// 值点Fill颜色 33 | @property (nonatomic, strong) UIColor *linePointFillColor; 34 | /// 值点样式 35 | @property (nonatomic, assign) HyChartLinePointType linePointType; 36 | /// 阴影渐变颜色数组 >= 3 37 | @property (nonatomic, strong) NSArray *shadeColors; 38 | 39 | 40 | /// 是否展示最新数据 默认YES 41 | @property (nonatomic, assign) BOOL disPlayNewvalue; 42 | /// 最新数据文字颜色 默认灰色 43 | @property (nonatomic, strong) UIColor *newvalueColor; 44 | /// 最新数据文字字体 默认12 45 | @property (nonatomic, strong) UIFont *newvalueFont; 46 | 47 | 48 | /// 是否展示最大最小数据 默认YES 49 | @property (nonatomic, assign) BOOL disPlayMaxMinValue; 50 | /// 最大最小数据文字颜色 默认灰色 51 | @property (nonatomic, strong) UIColor *maxminValueColor; 52 | /// 最大最小数据文字字体。默认10 53 | @property (nonatomic, strong) UIFont *maxminValueFont; 54 | 55 | 56 | @end 57 | 58 | 59 | @protocol HyChartLineConfigureProtocol 60 | 61 | - (instancetype)configLineConfigureAtIndex:(void(^)(NSInteger index, id oneConfigure))block; 62 | 63 | 64 | @end 65 | 66 | NS_ASSUME_NONNULL_END 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/SceneDelegate.m: -------------------------------------------------------------------------------- 1 | #import "SceneDelegate.h" 2 | 3 | @interface SceneDelegate () 4 | 5 | @end 6 | 7 | @implementation SceneDelegate 8 | 9 | 10 | - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { 11 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 12 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 13 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 14 | } 15 | 16 | 17 | - (void)sceneDidDisconnect:(UIScene *)scene { 18 | // Called as the scene is being released by the system. 19 | // This occurs shortly after the scene enters the background, or when its session is discarded. 20 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 21 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 22 | } 23 | 24 | 25 | - (void)sceneDidBecomeActive:(UIScene *)scene { 26 | // Called when the scene has moved from an inactive state to an active state. 27 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 28 | } 29 | 30 | 31 | - (void)sceneWillResignActive:(UIScene *)scene { 32 | // Called when the scene will move from an active state to an inactive state. 33 | // This may occur due to temporary interruptions (ex. an incoming phone call). 34 | } 35 | 36 | 37 | - (void)sceneWillEnterForeground:(UIScene *)scene { 38 | // Called as the scene transitions from the background to the foreground. 39 | // Use this method to undo the changes made on entering the background. 40 | } 41 | 42 | 43 | - (void)sceneDidEnterBackground:(UIScene *)scene { 44 | // Called as the scene transitions from the foreground to the background. 45 | // Use this method to save data, release shared resources, and store enough scene-specific state information 46 | // to restore the scene back to its current state. 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /HyCharts/Model/Axis/YAxis/HyChartYAxisModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartYAxisModel.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/17. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartYAxisModel.h" 10 | 11 | 12 | 13 | @interface HyChartYAxisModel () 14 | @property (nonatomic, strong) HyChartYAxisInfo *leftYAxisInfo; 15 | @property (nonatomic, strong) HyChartYAxisInfo *rightYAxisInfo; 16 | @property (nonatomic, copy) NSNumber *(^yAxisMinValueBlock)(void); 17 | @property (nonatomic, copy) NSNumber *(^yAxisMaxValueBlock)(void); 18 | @end 19 | 20 | 21 | @implementation HyChartYAxisModel 22 | @synthesize leftYAxisDisabled = _leftYAxisDisabled, rightYAaxisDisabled = _rightYAaxisDisabled; 23 | @synthesize yAxisMinValueExtraPrecent = _yAxisMinValueExtraPrecent, yAxisMaxValueExtraPrecent = _yAxisMaxValueExtraPrecent; 24 | 25 | - (instancetype)init { 26 | if (self = [super init]) { 27 | _leftYAxisDisabled = NO; 28 | _rightYAaxisDisabled = YES; 29 | } return self; 30 | } 31 | 32 | - (id)configLeftYAxisInfo:(void(^)(id yAxisInfo))block { 33 | !block ?: block(self.leftYAxisInfo); 34 | return self; 35 | } 36 | 37 | - (id)configRightYAxisInfo:(void(^)(id yAxisInfo))block { 38 | !block ?: block(self.rightYAxisInfo); 39 | return self; 40 | } 41 | 42 | - (id)configYAxisMinValue:(NSNumber *(^)(void))block { 43 | self.yAxisMinValueBlock = [block copy]; 44 | return self; 45 | } 46 | 47 | - (id)configYAxisMaxValue:(NSNumber *(^)(void))block { 48 | self.yAxisMaxValueBlock = [block copy]; 49 | return self; 50 | } 51 | 52 | - (HyChartYAxisInfo *)leftYAxisInfo { 53 | if (self.leftYAxisDisabled) { 54 | return nil; 55 | } 56 | if (!_leftYAxisInfo){ 57 | _leftYAxisInfo = [[HyChartYAxisInfo alloc] init]; 58 | } 59 | return _leftYAxisInfo; 60 | } 61 | 62 | - (HyChartYAxisInfo *)rightYAxisInfo { 63 | if (self.rightYAaxisDisabled) { 64 | return nil; 65 | } 66 | if (!_rightYAxisInfo){ 67 | _rightYAxisInfo = [[HyChartYAxisInfo alloc] init]; 68 | } 69 | return _rightYAxisInfo; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /HyChartsDemo/HyChartsDemo/HyChartsDemo/HyChartsDemoController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartsDemoController.m 3 | // DemoCode 4 | // 5 | // Created by Hy on 2018/4/11. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartsDemoController.h" 10 | #import 11 | #import "HyChartsMethods.h" 12 | 13 | @implementation HyChartsDemoController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | self.navigationItem.title = @"HyCharts"; 19 | NSArray *titleArray = self.titleArray; 20 | NSArray *controllerArray = self.controllerArray; 21 | 22 | __weak typeof(self) _self = self; 23 | UITableView *tableView = 24 | [UITableView hy_tableViewWithFrame:self.view.bounds style:UITableViewStylePlain tableViewData:titleArray cellClasses:@[UITableViewCell.class] headerFooterViewClasses:nil delegateConfigure:^(HyTableViewDelegateConfigure *configure) { 25 | configure.configCellWithData(^(UITableViewCell *cell, id cellData, NSIndexPath *indexPath) { 26 | cell.textLabel.text = (NSString *)cellData; 27 | }).configDidSelectRowAtIndexPath(^(UITableView *tableView, NSIndexPath *indexPath) { 28 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 29 | __strong typeof(_self) self = _self; 30 | UIViewController *vc = NSClassFromString(controllerArray[indexPath.row]).new; 31 | vc.hidesBottomBarWhenPushed = YES; 32 | vc.navigationItem.title = titleArray[indexPath.row]; 33 | [self.navigationController pushViewController:vc animated:YES]; 34 | }); 35 | }]; 36 | 37 | tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; 38 | if (@available(iOS 11.0, *)){ 39 | tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; 40 | } 41 | [self.view addSubview:tableView]; 42 | } 43 | 44 | - (NSArray *)titleArray { 45 | return @[@"柱状图", @"折/曲线图", @"K线图", @"组合图"]; 46 | } 47 | 48 | - (NSArray *)controllerArray { 49 | return @[@"HyChartsBarDemoController", 50 | @"HyChartsLineDemoController", 51 | @"HyChartsKlineDemoController", 52 | @"HyChartsReactChainsDemoController"]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIApplication+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "UIApplication+HyExtension.h" 11 | 12 | @implementation UIApplication (HyExtension) 13 | 14 | + (UIResponder *)hy_appDelegate { 15 | return (UIResponder *)UIApplication.sharedApplication.delegate; 16 | } 17 | 18 | + (NSURL *)hy_documentsURL { 19 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory 20 | inDomains:NSUserDomainMask] lastObject]; 21 | } 22 | 23 | + (NSString *)hy_documentsPath { 24 | return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; 25 | } 26 | 27 | + (NSURL *)hy_cachesURL { 28 | return [[[NSFileManager defaultManager] 29 | URLsForDirectory:NSCachesDirectory 30 | inDomains:NSUserDomainMask] lastObject]; 31 | } 32 | 33 | + (NSString *)hy_cachesPath { 34 | return [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]; 35 | } 36 | 37 | + (NSURL *)hy_libraryURL { 38 | return [[[NSFileManager defaultManager] 39 | URLsForDirectory:NSLibraryDirectory 40 | inDomains:NSUserDomainMask] lastObject]; 41 | } 42 | 43 | + (NSString *)hy_libraryPath { 44 | return [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject]; 45 | } 46 | 47 | + (BOOL)hy_fileExistInMainBundle:(NSString *)name { 48 | NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; 49 | NSString *path = [NSString stringWithFormat:@"%@/%@", bundlePath, name]; 50 | return [[NSFileManager defaultManager] fileExistsAtPath:path]; 51 | } 52 | 53 | + (NSString *)hy_appBundleName { 54 | return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; 55 | } 56 | 57 | + (NSString *)hy_appBundleID { 58 | return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; 59 | } 60 | 61 | + (NSString *)hy_appVersion { 62 | return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; 63 | } 64 | 65 | + (NSString *)hy_appBuildVersion { 66 | return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIGestureRecognizer+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "UIGestureRecognizer+HyExtension.h" 11 | #import "HyRunTimeMethods.h" 12 | 13 | 14 | @interface HyGestureRecognizerBlockTarget : NSObject 15 | @property (nonatomic, copy) void (^block)(UIGestureRecognizer *); 16 | @end 17 | @implementation HyGestureRecognizerBlockTarget 18 | + (instancetype)blockTargetWithBlock:(void (^)(UIGestureRecognizer *))block { 19 | HyGestureRecognizerBlockTarget *blockTarget = [[self alloc] init]; 20 | blockTarget.block = [block copy]; 21 | return blockTarget; 22 | } 23 | - (void)action:(UIGestureRecognizer *)sender { 24 | !self.block ?: self.block(sender); 25 | } 26 | @end 27 | 28 | 29 | @implementation UIGestureRecognizer (HyExtension) 30 | 31 | - (UIView *)hy_targetView { 32 | CGPoint location = [self locationInView:self.view]; 33 | UIView *targetView = [self.view hitTest:location withEvent:nil]; 34 | return targetView; 35 | } 36 | 37 | + (instancetype)hy_gestureRecognizerWithActionBlock:(void (^)(UIGestureRecognizer *gesture))block { 38 | UIGestureRecognizer *gesture = [[self alloc] init]; 39 | [gesture hy_addActionBlock:block]; 40 | return gesture; 41 | } 42 | 43 | - (void)hy_addActionBlock:(void(^)(UIGestureRecognizer *gesture))block { 44 | HyGestureRecognizerBlockTarget *target = [HyGestureRecognizerBlockTarget blockTargetWithBlock:block]; 45 | [self addTarget:target action:@selector(action:)]; 46 | [[self hy_allGestureRecognizerBlockTargets] addObject:target]; 47 | } 48 | 49 | - (void)hy_removeAllActionBlocks { 50 | NSMutableArray *targets = [self hy_allGestureRecognizerBlockTargets]; 51 | [targets enumerateObjectsUsingBlock:^(id target, NSUInteger idx, BOOL *stop) { 52 | [self removeTarget:target action:@selector(action:)]; 53 | }]; 54 | [targets removeAllObjects]; 55 | } 56 | 57 | - (NSMutableArray *)hy_allGestureRecognizerBlockTargets { 58 | NSMutableArray *targets = objc_getAssociatedObject(self, _cmd); 59 | if (!targets) { 60 | targets = @[].mutableCopy; 61 | objc_setAssociatedObject(self, _cmd, targets, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 62 | } 63 | return targets; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UITextView+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextView+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/8/29. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | 15 | @interface HyTextViewDelegateConfigure : NSObject 16 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewShouldBeginEditing)(BOOL (^)(UITextView *textView)); 17 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewShouldEndEditing)(BOOL (^)(UITextView *textView)); 18 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewDidBeginEditing)(void (^)(UITextView *textView)); 19 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewDidEndEditing)(void (^)(UITextView *textView)); 20 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewDidChange)(void (^)(UITextView *textView)); 21 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewDidChangeSelection)(BOOL (^)(UITextView *textView)); 22 | @property (nonatomic,copy,readonly) HyTextViewDelegateConfigure *(^configTextViewShouldChangeTextInRange)(BOOL (^)(UITextView *textView, NSRange range, NSString *text)); 23 | @end 24 | 25 | 26 | 27 | @interface UITextView (HyExtension) 28 | 29 | + (instancetype)hy_textFieldWithFrame:(CGRect)frame 30 | font:(UIFont *)font 31 | text:(NSString *)text 32 | textColor:(UIColor *)textColor 33 | delegate:(id)delegate; 34 | 35 | 36 | + (instancetype)hy_textFieldWithFrame:(CGRect)frame 37 | font:(UIFont *)font 38 | text:(NSString *)text 39 | textColor:(UIColor *)textColor 40 | delegateConfigure:(void(^)(HyTextViewDelegateConfigure *configure))delegateConfigure; 41 | 42 | 43 | 44 | - (NSRange)hy_selectedRange; 45 | - (void)hy_selecteTextWithRange:(NSRange)range; 46 | - (void)hy_selectAllText; 47 | 48 | 49 | - (void)hy_insertOrReplaceEdittingText:(NSString *)text; 50 | - (void)hy_setTextKeepingSelectedRange:(NSString *)text; 51 | - (void)hy_setAttributedTextKeepingSelectedRange:(NSAttributedString *)attributedText; 52 | - (void)hy_scrollToTextVisibleAnimated:(BOOL)animated; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIFont+HyExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+HyExtension.m 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/18. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import "UIFont+HyExtension.h" 11 | #import "NSObject+HyExtension.h" 12 | #import 13 | 14 | 15 | @implementation UIFont (HyExtension) 16 | 17 | - (BOOL)hy_isBold { 18 | [self respondsToSelector:@selector(fontDescriptor)]; 19 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return NO; 20 | return (self.fontDescriptor.symbolicTraits & UIFontDescriptorTraitBold) > 0; 21 | } 22 | 23 | - (BOOL)hy_isItalic { 24 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return NO; 25 | return (self.fontDescriptor.symbolicTraits & UIFontDescriptorTraitItalic) > 0; 26 | } 27 | 28 | - (BOOL)hy_isMonoSpace { 29 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return NO; 30 | return (self.fontDescriptor.symbolicTraits & UIFontDescriptorTraitMonoSpace) > 0; 31 | } 32 | 33 | - (BOOL)hy_isColorGlyphs { 34 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return NO; 35 | return (CTFontGetSymbolicTraits((__bridge CTFontRef)self) & kCTFontTraitColorGlyphs) != 0; 36 | } 37 | 38 | - (CGFloat)hy_fontWeight { 39 | NSDictionary *dict = [self.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute]; 40 | return [dict[UIFontWidthTrait] floatValue]; 41 | } 42 | 43 | - (UIFont *)hy_fontToBold { 44 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return self; 45 | return [UIFont fontWithDescriptor:[self.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:self.pointSize]; 46 | } 47 | 48 | - (UIFont *)hy_fontToItalic { 49 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return self; 50 | return [UIFont fontWithDescriptor:[self.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic] size:self.pointSize]; 51 | } 52 | 53 | - (UIFont *)hy_fontToBoldItalic { 54 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return self; 55 | return [UIFont fontWithDescriptor:[self.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold | UIFontDescriptorTraitItalic] size:self.pointSize]; 56 | } 57 | 58 | - (UIFont *)hy_fontToNormal { 59 | if (!Hy_RespondsToSel(self, @selector(fontDescriptor))) return self; 60 | return [UIFont fontWithDescriptor:[self.fontDescriptor fontDescriptorWithSymbolicTraits:0] size:self.pointSize]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/Target Support Files/Pods-HyChartsDemo/Pods-HyChartsDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## HyCategoriess 5 | 6 | MIT License 7 | 8 | Copyright (c) 2019 @Hy 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | ## HyCycleView 30 | 31 | The MIT License (MIT) 32 | 33 | Copyright (c) 2016 曾宪华 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | 53 | Generated by CocoaPods - https://cocoapods.org 54 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UIViewController+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 2017/9/11. 7 | // Copyright © 2017 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | typedef NS_ENUM(NSUInteger, HyPopGestureState) { 16 | HyPopGestureState_No, 17 | HyPopGestureState_Begin, 18 | HyPopGestureState_Change, 19 | HyPopGestureState_SuccessPop, 20 | HyPopGestureState_FailPop 21 | }; 22 | 23 | @protocol UINavigationControllerPopGestureHandlerProtocol 24 | @optional 25 | - (void)hy_popGestureHandlerWithState:(HyPopGestureState)state 26 | isPopingController:(BOOL)isPopingController; 27 | @end 28 | 29 | 30 | 31 | @interface UIViewController (HyExtension) 32 | 33 | @property (nonatomic,assign,readonly) BOOL hy_isPresented; 34 | @property (nonatomic,assign) HyPopGestureState hy_popGestureState; 35 | @property (nonatomic,copy) void(^hy_reloadControllerBlock)(id params); 36 | 37 | @property (nonatomic,copy,nullable) void(^hy_viewDidLoadBlock)(UIViewController *_self); 38 | @property (nonatomic,copy,nullable) void(^hy_viewWillAppearBlock)(UIViewController *_self, BOOL animated, BOOL firstLoad); 39 | @property (nonatomic,copy,nullable) void(^hy_viewDidAppearBlock)(UIViewController *_self, BOOL animated, BOOL firstLoad); 40 | @property (nonatomic,copy,nullable) void(^hy_viewWillLayoutSubviewsBlock)(UIViewController *_self, BOOL firstLoad); 41 | @property (nonatomic,copy,nullable) void(^hy_viewDidLayoutSubviewsBlock)(UIViewController *_self, BOOL firstLoad); 42 | 43 | @property (nonatomic,copy,nullable) void(^hy_viewWillDisappearBlock)(UIViewController *_self, BOOL animated); 44 | @property (nonatomic,copy,nullable) void(^hy_viewDidDisappearBlock)(UIViewController *_self, BOOL animated); 45 | 46 | - (void)hy_viewDidLoad; 47 | - (void)hy_viewWillAppear:(BOOL)animated firstLoad:(BOOL)flag; 48 | - (void)hy_viewDidAppear:(BOOL)animated firstLoad:(BOOL)flag; 49 | - (void)hy_viewWillLayoutSubviewsIsFirstLoad:(BOOL)flag; 50 | - (void)hy_viewDidLayoutSubviewsIsFirstLoad:(BOOL)flag; 51 | 52 | - (void)hy_viewWillDisappear:(BOOL)animated; 53 | - (void)hy_viewDidDisappear:(BOOL)animated; 54 | 55 | + (nullable UIViewController *)hy_topViewController; 56 | + (nullable UIViewController *)hy_currentViewController; 57 | - (nullable UIViewController *)hy_childViewControllerWithName:(NSString *)name; 58 | 59 | @end 60 | 61 | NS_ASSUME_NONNULL_END 62 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCycleView/HyCycleView/HySegmentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HySegmentView.h 3 | // HyCycleView 4 | // https://github.com/hydreamit/HyCycleView 5 | // 6 | // Created by Hy on 2016/5/22. 7 | // Copyright © 2016年 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | 13 | typedef NS_ENUM(NSUInteger, HySegmentViewItemPosition) { 14 | HySegmentViewItemPositionLeft, 15 | HySegmentViewItemPositionCenter, 16 | HySegmentViewItemPositionRight 17 | }; 18 | 19 | 20 | @class HySegmentView; 21 | @interface HySegmentViewConfigure : NSObject 22 | 23 | - (NSInteger)getCurrentIndex; 24 | - (UIEdgeInsets)getInset; 25 | - (CGFloat)getItemMargin; 26 | 27 | /// 内边距 28 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^inset)(UIEdgeInsets); 29 | /// 左右边距和中间间隔的比例 30 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^insetAndMarginRatio)(CGFloat); 31 | /// 标签间距 默认是平均分配, 不够分默认值30 32 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^itemMargin)(CGFloat); 33 | /// 是否保持margin/inset不变(外部自定义itemView变化时) 34 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^keepingMarginAndInset)(BOOL); 35 | /// 开始选中的标签数 36 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^startIndex)(NSInteger); 37 | /// 标签总数 38 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^numberOfItems)(NSInteger); 39 | /// 点击回调 返回YES内部实现点击动画逻辑, NO外部自己通过调用方法clickItemFromIndex:实现 40 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^clickItemAtIndex)(BOOL(^)(NSInteger index, BOOL isRepeat)); 41 | /// 每个标签 对应的视图 42 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^viewForItemAtIndex)(UIView *(^)(UIView *currentView, NSInteger index, CGFloat progress, HySegmentViewItemPosition position, NSArray *animationViews)); 43 | /// 动画视图 44 | @property (nonatomic, copy, readonly) HySegmentViewConfigure *(^animationViews)(NSArray *(^)(NSArray *currentAnimationViews, UICollectionViewCell *fromCell, UICollectionViewCell *toCell, NSInteger fromIndex, NSInteger toIndex, CGFloat progress)); 45 | @end 46 | 47 | 48 | @interface HySegmentView : UIView 49 | 50 | + (instancetype)segmentViewWithFrame:(CGRect)frame 51 | configureBlock:(void (^)(HySegmentViewConfigure *configure))configureBlock; 52 | 53 | @property (nonatomic,strong,readonly) HySegmentViewConfigure *configure; 54 | 55 | - (void)clickItemAtIndex:(NSInteger)index; 56 | - (void)clickItemFromIndex:(NSInteger)fromIndex 57 | toIndex:(NSInteger)toIndex 58 | progress:(CGFloat)progress; 59 | 60 | - (void)reloadData; 61 | 62 | @end 63 | 64 | 65 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCategoriess/HyCategories/UIKit/UINavigationController+HyExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+HyExtension.h 3 | // HyCategories 4 | // https://github.com/hydreamit/HyCategories 5 | // 6 | // Created by Hy on 17/6/22. 7 | // Copyright © 2017年 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | #import "UIViewController+HyExtension.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface UINavigationController (HyExtension) 16 | 17 | @property (nonatomic,weak,readonly,nullable) UIViewController *hy_rootViewController; 18 | @property (nonatomic,weak,readonly,nullable) UIViewController *hy_poppingViewController; 19 | @property (nonatomic,assign,readonly,nullable) UIPanGestureRecognizer *hy_popGestureRecognizer; 20 | 21 | - (nullable UIViewController *)hy_viewControllerFromIndex:(NSInteger)index; 22 | - (nullable UIViewController *)hy_viewControllerToIndex:(NSInteger)index; 23 | - (nullable UIViewController *)hy_viewControllerWithName:(NSString *)name; 24 | 25 | - (void)hy_popToViewControllerWithName:(NSString *)name animated:(BOOL)animated; 26 | - (void)hy_popToViewControllerWithToIndex:(NSInteger)index animated:(BOOL)animated; 27 | - (void)hy_popToViewControllerWithFromIndex:(NSInteger)index animated:(BOOL)animated; 28 | 29 | - (void)hy_removeViewControllerWithName:(NSString *)name; 30 | - (void)hy_removeViewControllerFromIndex:(NSInteger)index; 31 | - (void)hy_removeViewControllerToIndex:(NSInteger)index; 32 | 33 | - (BOOL)hy_containViewControllerWithName:(NSString *)name; 34 | 35 | - (void)hy_repleaseViewControllerAtIndex:(NSInteger )index 36 | withController:(UIViewController *)controller; 37 | 38 | 39 | - (void)hy_pushViewController:(UIViewController *)viewController 40 | animated:(BOOL)animated 41 | completion:(void (^_Nullable)(void))completion; 42 | 43 | - (nullable UIViewController *)hy_popViewControllerAnimated:(BOOL)animated 44 | completion:(void (^_Nullable)(void))completion; 45 | 46 | - (nullable NSArray<__kindof UIViewController *> *)hy_popToViewController:(UIViewController *)viewController 47 | animated:(BOOL)animated 48 | completion:(void (^_Nullable)(void))completion; 49 | 50 | - (nullable NSArray<__kindof UIViewController *> *)hy_popToRootViewControllerAnimated:(BOOL)animated 51 | completion:(void (^_Nullable)(void))completion; 52 | 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /HyCharts/View/Charts/HyChartBarView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HyChartBarView.m 3 | // HyChartsDemo 4 | // 5 | // Created by Hy on 2018/3/18. 6 | // Copyright © 2018 Hy. All rights reserved. 7 | // 8 | 9 | #import "HyChartBarView.h" 10 | #import "HyChartBarLayer.h" 11 | #import "HyChartBarDataSource.h" 12 | #import "HyChartBarModel.h" 13 | #import "HyChartsMethods.h" 14 | #import 15 | 16 | 17 | @interface HyChartBarView () 18 | @property (nonatomic, strong) HyChartBarLayer *chartLayer; 19 | @property (nonatomic, strong) HyChartBarDataSource *dataSource; 20 | @property (nonatomic, strong) NSNumberFormatter *yAxisNunmberFormatter; 21 | @end 22 | 23 | 24 | @implementation HyChartBarView 25 | 26 | - (void)handleVisibleModelsWithStartIndex:(NSInteger)startIndex endIndex:(NSInteger)endIndex { 27 | 28 | __block HyChartBarModel *maxModel = nil; 29 | __block HyChartBarModel *minModel = nil; 30 | 31 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(startIndex, endIndex - startIndex + 1)]; 32 | self.dataSource.modelDataSource.visibleModels = [self.dataSource.modelDataSource.models objectsAtIndexes:indexSet]; 33 | [self.dataSource.modelDataSource.visibleModels enumerateObjectsUsingBlock:^(HyChartBarModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 34 | 35 | ((void(*)(id, SEL, HyChartModel *, NSUInteger))objc_msgSend)(self, sel_registerName("handlePositionWithModel:idx:"), obj, idx); 36 | 37 | if (!maxModel) { 38 | maxModel = obj; 39 | minModel = obj; 40 | } else { 41 | if (obj.maxValue.doubleValue > maxModel.maxValue.doubleValue) { 42 | maxModel = obj; 43 | } 44 | if (obj.minValue.doubleValue < minModel.minValue.doubleValue) { 45 | minModel = obj; 46 | } 47 | } 48 | }]; 49 | 50 | self.dataSource.modelDataSource.minValue = minModel.minValue; 51 | self.dataSource.modelDataSource.maxValue = maxModel.maxValue; 52 | self.dataSource.modelDataSource.visibleMaxModel = maxModel; 53 | self.dataSource.modelDataSource.visibleMinModel = minModel; 54 | } 55 | 56 | - (HyChartBarLayer *)chartLayer { 57 | if (!_chartLayer){ 58 | _chartLayer = [HyChartBarLayer layerWithDataSource:self.dataSource]; 59 | } 60 | return _chartLayer; 61 | } 62 | 63 | - (HyChartBarDataSource *)dataSource { 64 | if (!_dataSource){ 65 | _dataSource = [[HyChartBarDataSource alloc] init]; 66 | } 67 | return _dataSource; 68 | } 69 | 70 | - (HyChartBarModel *)model { 71 | return HyChartBarModel.new; 72 | } 73 | 74 | - (NSNumberFormatter *)yAxisNunmberFormatter { 75 | return self.dataSource.configreDataSource.configure.numberFormatter; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /HyChartsDemo/Pods/HyCycleView/HyCycleView/UIView+HyFrame.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+HyFrame.h 3 | // HyCycleView 4 | // https://github.com/hydreamit/HyCycleView 5 | // 6 | // Created by Hy on 2016/5/15. 7 | // Copyright © 2016年 Hy. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | 13 | @interface UIView (HyFrame) 14 | 15 | @property (nonatomic, assign) CGSize size; 16 | @property (nonatomic, assign) CGFloat width; 17 | @property (nonatomic, assign) CGFloat height; 18 | 19 | @property (nonatomic, assign) CGFloat left; 20 | @property (nonatomic, assign) CGFloat top; 21 | @property (nonatomic, assign) CGFloat right; 22 | @property (nonatomic, assign) CGFloat bottom; 23 | 24 | @property (nonatomic, assign) CGFloat centerX; 25 | @property (nonatomic, assign) CGFloat centerY; 26 | @property (nonatomic, assign) CGPoint origin; 27 | @property (nonatomic, assign, readonly) CGPoint middlePoint; 28 | 29 | @property (nonatomic,copy,readonly) UIView *(^rectValue)(CGFloat left, CGFloat top, CGFloat width, CGFloat heigth); 30 | 31 | @property (nonatomic,copy,readonly) UIView *(^widthValue)(CGFloat width); 32 | @property (nonatomic,copy,readonly) UIView *(^heightValue)(CGFloat heigth); 33 | @property (nonatomic,copy,readonly) UIView *(^sizeValue)(CGFloat width, CGFloat heigth); 34 | 35 | @property (nonatomic,copy,readonly) UIView *(^leftValue)(CGFloat left); 36 | @property (nonatomic,copy,readonly) UIView *(^topValue)(CGFloat top); 37 | @property (nonatomic,copy,readonly) UIView *(^rightValue)(CGFloat right); 38 | @property (nonatomic,copy,readonly) UIView *(^bottomValue)(CGFloat bottom); 39 | 40 | @property (nonatomic,copy,readonly) UIView *(^centerXValue)(CGFloat centerX); 41 | @property (nonatomic,copy,readonly) UIView *(^centerYValue)(CGFloat centerY); 42 | @property (nonatomic,copy,readonly) UIView *(^originValue)(CGFloat left, CGFloat top); 43 | 44 | @property (nonatomic,copy,readonly) UIView *(^widthIsEqualTo)(UIView *view); 45 | @property (nonatomic,copy,readonly) UIView *(^heightIsEqualTo)(UIView *view); 46 | @property (nonatomic,copy,readonly) UIView *(^sizeIsEqualTo)(UIView *view); 47 | 48 | @property (nonatomic,copy,readonly) UIView *(^leftIsEqualTo)(UIView *view); 49 | @property (nonatomic,copy,readonly) UIView *(^topIsEqualTo)(UIView *view); 50 | @property (nonatomic,copy,readonly) UIView *(^rightIsEqualTo)(UIView *view); 51 | @property (nonatomic,copy,readonly) UIView *(^bottomIsEqualTo)(UIView *view); 52 | 53 | @property (nonatomic,copy,readonly) UIView *(^centerXIsEqualTo)(UIView *view); 54 | @property (nonatomic,copy,readonly) UIView *(^centerYIsEqualTo)(UIView *view); 55 | @property (nonatomic,copy,readonly) UIView *(^originIsEqualTo)(UIView *view); 56 | 57 | @property (nonatomic,copy,readonly) UIView *(^containTo)(UIView *view); 58 | 59 | @end 60 | 61 | 62 | --------------------------------------------------------------------------------