单军华
2017-02-22 8e680a1593ca22c8d3fb8a79180f06df4c4ca681
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//
//  JHChart.h
//  JHChartDemo
//
//  Created by cjatech-简豪 on 16/4/10.
//  Copyright © 2016年 JH. All rights reserved.
//
 
 
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
 
#define P_M(x,y) CGPointMake(x, y)
 
#define weakSelf(weakSelf)  __weak typeof(self) weakself = self;
 
@interface JHChart : UIView
 
 
/**
 *  The margin value of the content view chart view
 */
@property (nonatomic, assign) UIEdgeInsets contentInsets;
 
 
/**
 *  The origin of the chart is different from the meaning of the origin of the chart. 
    As a pie chart and graph center ring. The line graph represents the origin.
 */
@property (assign, nonatomic)  CGPoint chartOrigin;
 
 
/**
 *  Name of chart. The name is generally not displayed, just reserved fields
 */
@property (copy, nonatomic) NSString * chartTitle;
 
 
/**
 *  Start drawing chart.
 */
- (void)showAnimation;
 
/**
 *  Clear current chart when refresh
 */
- (void)clear;
 
 
/**
 *  Draw a line according to the conditions
 *  @param start:Draw Starting Point
 *  @param end:Draw Ending Point
 *  @param isDotted:Is the dotted line
 *  @param color:Line color
 */
- (void)drawLineWithContext:(CGContextRef )context
               andStarPoint:(CGPoint )start
                andEndPoint:(CGPoint)end
            andIsDottedLine:(BOOL)isDotted
                   andColor:(UIColor *)color;
 
 
/**
 *  Draw a piece of text at a point
 *  @param point:Draw position
 *  @param color:TextColor
 *  @param fontSize:Text font size
 */
- (void)drawText:(NSString *)text
      andContext:(CGContextRef )context
         atPoint:(CGPoint )point
       WithColor:(UIColor *)color
     andFontSize:(CGFloat)fontSize;
 
 
 
/**
 *  Similar to the above method
 *
 */
- (void)drawText:(NSString *)text
         context:(CGContextRef )context
         atPoint:(CGRect )rect
       WithColor:(UIColor *)color
            font:(UIFont*)font;
 
 
 
/**
 *  Determine the width of a certain segment of text in the default font.
 */
- (CGFloat)getTextWithWhenDrawWithText:(NSString *)text;
 
 
 
/**
 *  Draw a rectangle at a point
 *  p:Draw position
 *
 */
- (void)drawQuartWithColor:(UIColor *)color
             andBeginPoint:(CGPoint)p
                andContext:(CGContextRef)contex;
 
 
/**
 *  Draw a circle at a point
 *  @param redius:Circle redius
 *  @param p:Draw position
 *
 */
- (void)drawPointWithRedius:(CGFloat)redius
                   andColor:(UIColor *)color
                   andPoint:(CGPoint)p
                 andContext:(CGContextRef)contex;
 
 
/**
 *  According to the relevant conditions to determine the width of the text
 *  @param maxSize:Maximum range of text
 *  @param textFont:Text font
 *  @param aimString:Text that needs to be measured
 */
- (CGSize)sizeOfStringWithMaxSize:(CGSize)maxSize
                         textFont:(CGFloat)fontSize
                        aimString:(NSString *)aimString;
@end