Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SHLineGraphView.h
  2. //
  3. // Copyright (c) 2014 Shan Ul Haq (http://grevolution.me)
  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.  
  23. #import <UIKit/UIKit.h>
  24.  
  25. @class SHPlot;
  26.  
  27. @interface SHLineGraphView : UIView
  28.  
  29. /**
  30.  *  an Array of dictionaries specifying the key/value pair where key is the object which will identify a particular
  31.  *  x point on the x-axis line. and the value is the label which you want to show on x-axis against that point on x-axis.
  32.  *  the keys are important here as when plotting the actual points on the graph, you will have to use the same key to
  33.  *  specify the point value for that x-axis point.
  34.  */
  35. @property (nonatomic, strong) NSArray *xAxisValues;
  36.  
  37. /**
  38.  *  the maximum y-value possible in the graph. make sure that the y-value is not in the plotting points is not greater
  39.  *  then this number. otherwise the graph plotting will show wrong results.
  40.  */
  41. @property (nonatomic, strong) NSNumber *yAxisRange;
  42.  
  43. /**
  44.  *  y-axis values are calculated according to the yAxisRange passed. so you do not have to pass the explicit labels for
  45.  *  y-axis, but if you want to put any suffix to the calculated y-values, you can mention it here (e.g. K, M, Kg ...)
  46.  */
  47. @property (nonatomic, strong) NSString *yAxisSuffix;
  48.  
  49. /**
  50.  *  readyonly dictionary that stores all the plots in the graph.
  51.  */
  52. @property (nonatomic, readonly, strong) NSMutableArray *plots;
  53.  
  54. /**
  55.  *  theme attributes dictionary. you can specify graph theme releated attributes in this dictionary. if this property is
  56.  *  nil, then a default theme setting is applied to the graph.
  57.  */
  58. @property (nonatomic, strong) NSDictionary *themeAttributes;
  59.  
  60. /**
  61.  *  this method will add a Plot to the graph.
  62.  *
  63.  *  @param newPlot the Plot that you want to draw on the Graph.
  64.  */
  65. - (void)addPlot:(SHPlot *)newPlot;
  66.  
  67. /**
  68.  *  this method is the actual method which starts the drawing of the graph and does all the magic. call this method when
  69.  *  you are ready and want to show the graph.
  70.  */
  71. - (void)setupTheView;
  72.  
  73.  
  74. //===== Theme Attribute Keys =====
  75.  
  76. /**
  77.  *  x-axis label color key. use this to define the x-axis color of the plot (UIColor*)
  78.  */
  79. UIKIT_EXTERN NSString *const kXAxisLabelColorKey;
  80.  
  81. /**
  82.  *  x-axis label font key. use this to define the font of the x-axis labels. (UIFont*)
  83.  */
  84. UIKIT_EXTERN NSString *const kXAxisLabelFontKey;
  85.  
  86. /**
  87.  *  y-axis label color key. use this to define the y-axis label color of the plot (UIColor*)
  88.  */
  89. UIKIT_EXTERN NSString *const kYAxisLabelColorKey;
  90.  
  91. /**
  92.  *  y-axis label font key. use this to define the font of the y-axis labels. (UIFont*)
  93.  */
  94. UIKIT_EXTERN NSString *const kYAxisLabelFontKey;
  95.  
  96. /**
  97.  *  y-axis label side margin key. use this to define the font of the y-axis labels side margin. the value will
  98.  *  be equally divided into the both sides of the label. (NSNumber*)
  99.  */
  100. UIKIT_EXTERN NSString *const kYAxisLabelSideMarginsKey;
  101.  
  102. /**
  103.  *  plot background line stroke color key. use this to define the stroke color of the background lines in plot (UIColor*)
  104.  */
  105. UIKIT_EXTERN NSString *const kPlotBackgroundLineColorKey;
  106.  
  107. /**
  108.  *  size of the dot being drawing for each data point
  109.  */
  110. UIKIT_EXTERN NSString *const kDotSizeKey;
  111.  
  112. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement