Elegant Line Graphs for iOS. (Charting library)

Overview

BEMSimpleLineGraph

Build Status Version License Platform

BEMSimpleLineGraph makes it easy to create and customize line graphs for iOS.

BEMSimpleLineGraph is a charting library that makes it easy to create beautiful line graphs for iOS. It is easy to set-up and to use in any iOS Project. It's focused on highly customizable and interactive line graphs. Plus, it is lightweight and can be integrated in minutes (maybe even seconds).

BEMSimpleLineGraph's implementation, data source, and delegate are all modeled off of UITableView and UICollectionView. If you're familiar with using a UITableView, UITableViewController, or UICollectionView, using BEMSimpleLineGraph should be a breeze!

The full documentation of the project is available on its wiki.

Table of Contents

Project Details

Learn more about the BEMSimpleLineGraph project requirements, licensing, and contributions.

Requirements

See the full article on the wiki here.

  • Requires iOS 7 or later. The sample project is optimized for iOS 8.
  • Requires Automatic Reference Counting (ARC).
  • Optimized for ARM64 Architecture

Requires Xcode 6 for use in any iOS Project. Requires a minimum of iOS 7.0 as the deployment target.

Current Build Target Earliest Supported Build Target Earliest Compatible Build Target
iOS 8.0 iOS 7.0 iOS 6.1
Xcode 6.3 Xcode 6.1.1 Xcode 6.0
LLVM 6.1 LLVM 6.1 LLVM 5.0

REQUIREMENTS NOTE
Supported means that the library has been tested with this version. Compatible means that the library should work on this OS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly.

License

See the License. You are free to make changes and use this in either personal or commercial projects. Attribution is not required, but it is appreciated. A little Thanks! (or something to that affect) would be much appreciated. If you use BEMSimpleLineGraph in your app, let us know.

Support

Gitter chat
Join us on Gitter if you need any help or want to talk about the project.

Ask questions and get answers from a massive community or programmers on StackOverflow when you use the BEMSimpleLineGraph tag.

Sample App

The iOS Sample App included with this project demonstrates how to correctly setup and use BEMSimpleLineGraph. You can refer to the sample app for an understanding of how to use and setup BEMSimpleLineGraph.

Apps Using This Project

Dozens of production apps available on the iOS App Store use BEMSimpleLineGraph. You can view a full list of the known App Store apps using this project on the wiki, read their descriptions, get links, pricing, featured status, and screenshots of graph usage.

Add your BEMSimpleLineGraph app to the wiki page for a chance to get showcased in the Readme and / or the wiki. We can't wait to see what you create with BEMSimpleLineGraph.

Getting Started

See the full article on the wiki here.

BEMSimpleLineGraph can be added to any project (big or small) in a matter of minutes (maybe even seconds if you're super speedy). CocoaPods is fully supported, and so are all the latest technologies (eg. ARC, Storyboards, Interface Builder Attributes, Modules, and more).

Installation

The easiest way to install BEMSimpleLineGraph is to use CocoaPods. To do so, simply add the following line to your Podfile:

pod 'BEMSimpleLineGraph'

The other way to install BEMSimpleLineGraph, is to drag and drop the Classes folder into your Xcode project. When you do so, check the "Copy items into destination group's folder" box.

Swift Projects

To use BEMSimpleLineGraph in a Swift project add the following to your bridging header:

#import "BEMSimpleLineGraphView.h"

Setup

Setting up BEMSimpleLineGraph in your project is simple. If you're familiar with UITableView, then **BEMSimpleLineGraph **should be a breeze. Follow the steps below to get everything up and running.

  1. Import "BEMSimpleLineGraphView.h" to the header of your view controller:

     #import "BEMSimpleLineGraphView.h"
    
  2. Implement the BEMSimpleLineGraphDelegate and BEMSimpleLineGraphDataSource in the same view controller:

     @interface YourViewController : UIViewController <BEMSimpleLineGraphDataSource, BEMSimpleLineGraphDelegate>
    
  3. BEMSimpleLineGraphView can be initialized in one of two ways. You can either add it directly to your interface (storyboard file) OR through code. Both ways provide the same initialization, just different ways to do the same thing. Use the method that makes sense for your app or project.

    Interface Initialization
    1 - Add a UIView to your UIViewController
    2 - Change the class type of the UIView to BEMSimpleLineGraphView
    3 - Link the view to your code using an IBOutlet. You can set the property to weak and nonatomic.
    4 - Select the BEMSimpleLineGraphView in your interface. Connect the dataSource property and then the delegate property to your ViewController.
    5 - Select the BEMSimpleLineGraphView and open the Attributes Inspector. Most of the line graph's customizable properties can easily be set from the Attributes Inspector. The Sample App demonstrates this capability. Note that graph data will not be loaded in Interface Builder.

    Code Initialization
    Just add the following code to your implementation (usually the viewDidLoad method).

    BEMSimpleLineGraphView *myGraph = [[BEMSimpleLineGraphView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
    myGraph.dataSource = self;
    myGraph.delegate = self;
    [self.view addSubview:myGraph];
    
  4. Implement the two required data source methods: numberOfPointsInLineGraph: and lineGraph:valueForPointAtIndex:. See documentation below for more information

Documentation

The essential parts of BEMSimpleLineGraph are documented below. For full documentation, see the wiki. Documentation is available directly within Xcode (just Option-Click any method for Quick Help).

Required Delegate / Data Source Methods

Number of Points in Graph
Returns the number of points in the line graph. The line graph gets the value returned by this method from its data source and caches it.

- (NSInteger)numberOfPointsInLineGraph:(BEMSimpleLineGraphView *)graph {
		return X; // Number of points in the graph.
}

Value for Point at Index
Informs the position of each point on the Y-Axis at a given index. This method is called for every point specified in the numberOfPointsInLineGraph: method. The parameter index is the position from left to right of the point on the X-Axis:

- (CGFloat)lineGraph:(BEMSimpleLineGraphView *)graph valueForPointAtIndex:(NSInteger)index {
		return …; // The value of the point on the Y-Axis for the index.
}

Reloading the Data Source

Similar to a UITableView's reloadData method, BEMSimpleLineGraph has a reloadGraph method. Call this method to reload all the data that is used to construct the graph, including points, axis, index arrays, colors, alphas, and so on. Calling this method will cause the line graph to call layoutSubviews on itself. The line graph will also call all of its data source and delegate methods again (to get the updated data).

- (void)anyMethodInYourOwnController {
    // Change graph properties
    // Update data source / arrays
    
    // Reload the graph
    [self.myGraph reloadGraph];
}

Interactive Graph

BEMSimpleLineGraph can react to the user touching the graph by two different ways: Popup Reporting and Touch Reporting.

On this example, both Popup Reporting and Touch Reporting are activated.

Bezier Curves

BEMSimpleLineGraph can be drawn with curved lines instead of directly connecting the dots with straight lines.
To do so, set the property enableBezierCurve to YES.

self.myGraph.enableBezierCurve = YES;

Properties

BEMSimpleLineGraphs can be customized by using various properties. A multitude of properties let you control the animation, colors, and alpha of the graph. Many of these properties can be set from Interface Build and the Attributes Inspector, others must be set in code.

Contributing

To contribute to BEMSimpleLineGraph please see the CONTRIBUTING.md file, which lays out exactly how you can contribute to this project.

Comments
  • New TestBed App and multiple bug fixes/cleanups

    New TestBed App and multiple bug fixes/cleanups

    Summary

    Creates new TestBed application to manipulate essentially all properties. Also miscellaneous bug fixes, particularly around Null data values.

    Fixes Issues

    This pull request fixes the following issues:

    • #282

    Changes

    The following changes are included in this pull request:

    • New TestBed application, intended for iPad, but runs on iPhone as well. Allows manipulation of essentially all properties to test for any problems, and allow visualization of different combinations of options.
    • Adds encoding/decoding to BEMSimpleGraph to save all properties during a restore.
    • Enabled (and fixed) more compiler type checking (e.g. NSArray <BEMCircle *> *)
    • Assorted bug fixes as well (versus existing Feature branch), especially null-data related
    • AverageLine:
      • Color should be picked up from line if not set (default nil)
    • Line:
      • If null data and interpolation on, then extrapolate for beginning/ending nulls.
      • Bezier curve should be used even when only two points.
      • If interpolation off, then bezier line should be interrupted by gaps (but not top/bottom).
      • Avoid infinity result in midPoint calculation.
    • SimpleLineGraphView:
      • Support restoration during startup.
      • NoDataLabel color should not default from Line (which defaults to white, invisible on default background)
      • If null value, ensure corresponding Dot isn't left on chart
      • If label isn't used after initially being created, ensure it's removed from view
      • If neither X nor Y reference lines, set line's enableRefLines to NO (although default, might have been previously YES
      • If Xaxis background is defaulting to colorBottom, then also use alphaBottom to match; same for Yaxis and colorTop.
      • Avoid infinite loop if delegate gives a zero incrementIndex for x axis
      • Fix one-pixel gap between yaxis and graph
      • Remove spurious NSLogs

    Notes

    • [x] This pull request makes breaking changes, and if so, involves the following:
      • [ ] Public API availability
      • [x] Internal functionality or behavior
    • [x] I have run and ensured that this pull request passes all XCTests

    Include any additional notes on your pull request After working on another app for a while, I'm back to the one I wanted to use this for, so I've been fixing bugs in the revised version (both mine and long-standing ones). I've merged in the changes that Sam Spencer did, but I may have misunderstood some of those; please check.

    In the process of doing this, I wanted a visualization tool that would let me check various attributes beyond what the demo program or IB does. I then got carried away and essentially implemented all the properties. (Remaining unimplemented ones are touchReportFingersRequired, autoScaleYAxis, Dashpatterns for averageLine, XAxis, Yaxis, and Gradient choices beyond a default one.) It also would be cool if it could export to the clipboard the choices you've made into ObjC (or Swift).

    The only breaking API change is that I couldn't restrain myself from fixing the multiple typos of Refrence in Line. h. As this is primarily an internal API, I think that's ok, but feel free to put it back if you differ.

    I don't think I've broken any real API calls, but there are some changes: Some of the types are now decorated (e.g. NSArray <NSNumber *> *) and for nullability alwaysDisplayPopUpAtIndex is now an NSUInteger rather than a CGFloat Gradients are now strongly held Added averageValueForLineGraph to delegate Restored modifyPopupView to be available again; not clear why removed. Added title and label properties to AverageLine API

    As last time, I apologize if I've overstepped, but I really like this library and want it to be as useful as possible

    enhancement bugfix 
    opened by mackworth 18
  • Parallel line for min/max values

    Parallel line for min/max values

    I'd like to have an interface like shown on this mockup:

    screenshot 2014-04-12 10 56 06

    But I really have difficulties to find the correct y values for my min and max point. Any suggestions?

    bug question 
    opened by adrian-schnell 14
  • BezierCurve do not always work

    BezierCurve do not always work

    Hi, maybe i have found an issue (i am not sure)

    BezierCurve, not work always.

    My impression is that if the array of value contain two equal data in sequence that invalidate the bezier.

    Issue reply:

    arrayOfValues = [[NSMutableArray alloc] initWithObjects: [NSNumber numberWithFloat:57.0],[NSNumber numberWithFloat:57.0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:57.6],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:58.0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:58.0], nil];
    

    img_3539

    arrayOfValues = [[NSMutableArray alloc] initWithObjects: [NSNumber numberWithFloat:58.0],[NSNumber numberWithFloat:57.0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:57.6],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:58.0],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:5],[NSNumber numberWithFloat:0],[NSNumber numberWithFloat:58.0], nil];

    img_3538

    NOTE: in the second example you can see another little issue, where there are the two 0 value in sequence the bezier curve drop down under the 0 value.

    I hope this help, let me know if you need other test, to resolve the issue because the library is AMAZING!!!!

    bug 
    opened by MattiaConfalonieri 11
  • Added a bunch of options including left/right y axis positioning, float values in Y-Axis and popovers, and null graph values!

    Added a bunch of options including left/right y axis positioning, float values in Y-Axis and popovers, and null graph values!

    Hi,

    First, thanks a lot for the library. We've had some fun implementing some charts with it and adding some features to match our designs. To summarize the features that were added:

    • New property added to swap Y-Axis position from the left or right of the graph
    • Reference lines now support dash patterns as an alternate style
    • Dots can be disabled when animating the line
    • Moved the pan gesture recognizer to standard touches began .... touched ended. This allows the popover to show on the initial click rather than needing to drag around first.
    • Null values can now be returned for valueForPoint. A new variable, BEMNullGraphValue, was defined to represent a null value (CGFLOAT_MAX)
      • When drawing null values, they can either be skipped leaving a gap in the line or they can be interpolated by drawing a line through non-null neighboring values.
    • Added properties that allow the customization of the no data label's font and color
    • Added new datasource methods to support a custom popover view. The datasource is able to define a custom view and then modify the view whenever the user touches and drags on the graph
    • Added support for float values in the Y-Axis as well as the stock popover. These floats are formatted with a custom formatting property (formatStringForValues). Additionally, changed how the required size is calculated for the stock popover and the Y-Axis. Because they now support floats, the largest value is not necessarily the widest value.
    • Added new datasource methods to define a prefix and/or suffix for the Y-Axis and popover values

    We hope you like the changes. We have some more changes in the pipeline. Within the next few weeks, we'll be adding support for multiple lines to be drawn on one graph. Additionally, we'll be adding some new delegate / datasoure methods for more customization around the values being chosen for the X-axis and Y-axis.

    enhancement new feature performance 
    opened by RobDay 10
  • Just Dots; No Line

    Just Dots; No Line

    Hello @Boris-Em, Thanks for sharing this excellent control.

    Another great feature for this which would be easy to implement, is to allow the user to show/hide the bezier completely and just show the dots. What do you think?

    new feature 
    opened by mythodeia 10
  • Y-axis label issues

    Y-axis label issues

    The x-axis labels currently show up below the frame and the background is the color/alphaBottom. This is not the same for the y-axis. The background is the backgroundColor. This can be avoided by making the background a solid color, but any other styling will get you in trouble. The example looks fine, but a white backgroundColor with different alpha top/bottom has issues (that i'm currently experiencing).

    Additionally, some y-axis labels are cutoff and only display "...". Personally, I would like to see this as just a smaller font if it cannot fit.

    A way to avoid the above issues all together would to have the y-axis labels appear inside the graph's frame (with the y-axis). This would be the best solution to me.

    enhancement 
    opened by kajensen 9
  • How to use lowerGraph

    How to use lowerGraph

    How do you use the lower graph property in the feature branch?

    I've tried declaring firstGraph and secondGraph as a property and doing the following:

    self.firstGraph.lowerGraph = self.secondGraph;

    but to no avail. Can someone give me an example of how to use lowerGraph?

    Thanks

    invalid 
    opened by Steven4294 9
  • Add option to draw an

    Add option to draw an "average" line

    First, a big thanks for this great lib... helps a lot!!

    I would be nice to have the option to draw a "average" line (average value from all data values) in a different color.

    new feature 
    opened by ManuelRiegler 9
  • Float number support for data source

    Float number support for data source

    Hello

    Does the data source support float number? I tried to add some float numbers but the Y-axis label is out of the chart view and the popup report label only can show integer number.

    NSArray *numberArray = @[@35.2f, @35.0f, @35.3f, @35.5f, @35.4f, @35.2f, @35.4f, @36.0f, @35.9f, @35.5f, @35.1, @34.9f, @35.0f];
    

    rsz_ios_simulator_screen_shot_201493_ 11111

    enhancement question 
    opened by amoshsueh 8
  • Glitches appearing on bezier corners

    Glitches appearing on bezier corners

    ios simulator screen shot 1 may 2014 12 28 35

    If you use bezier corners, you sometimes get glitches at the data points. I dont really know how to describe this, but hopefully this makes it clearer: glitch

    bug performance 
    opened by squarefrog 8
  • change difference of min/max points

    change difference of min/max points

    With your help, I was able to add the marks for min and max. Thanks again for that.

    Now I want to make the difference between the two lines bigger. The chart should start at about the middle of the screenshot - the max line should stay. Can you give me a hint, what and how to change the code to get this result?

    screenshot 2014-04-21 22 25 14

    question 
    opened by adrian-schnell 8
  • Is it possible to make some gaps on a same line plot?

    Is it possible to make some gaps on a same line plot?

    Dear Boris,

    I'd like to know is it possible to make an empty plots for some points? Also, I'd like to know can I colorise the same line plot. (E.g. starting with red colour then the same line will change it's colour to black colour or clear colour)? Like here in photo

    graph

    opened by kocharyanvahe 0
  • Kellyroach/upgrade to xcode941

    Kellyroach/upgrade to xcode941

    Summary

    • This pull request upgrades BEMSimpleLineGraph to Xcode 9.4.1 and fixes issues.

    Fixes Issues

    This pull request fixes the following issues:

    • memory leak issues
    • deprecated implementations in Tests issues
    • storyboard warnings issues
    • missing 1024x1024 AppIcon issue.

    Changes

    The following changes are included in this pull request:

    • BEMSimpleLineGraphView.m+.h
    • Two *.storyboard's
    • CustomizationTests.m and SimpleLineChartTests.m
    • project.pbxproj and *.xcscheme's to Xcode 9.4.1 recommended settings
    enhancement 
    opened by kellyroach 0
  • Enhancement: We can now set the text color for the popup label

    Enhancement: We can now set the text color for the popup label

    Summary

    Enhancement: We can now set the text color for the popup label

    Changes

    The following changes are included in this pull request:

    • Header and body file change
    enhancement 
    opened by Woodehh 1
  • Uneven X-Axis Label Spacing

    Uneven X-Axis Label Spacing

    I integrated the line graph and its working great in Objective-C, but the problem I'm having is with spacing on the xAxis. If you see the attached screenshot, the first label and second one, and second last and last one are not evenly spaced.

    Below is the function which I use to setup the graph:

    - (void)setupGraphs {
          mindfulGraph.enableXAxisLabel = YES;
          mindfulGraph.alwaysDisplayDots = YES;
          mindfulGraph.colorXaxisLabel = [UIColor lightGrayColor];
          mindfulGraph.colorBackgroundXaxis = [UIColor clearColor];
          mindfulGraph.enableYAxisLabel = YES;
          mindfulGraph.colorYaxisLabel = [UIColor lightGrayColor];
          mindfulGraph.colorBackgroundYaxis = [UIColor clearColor];
          mindfulGraph.enableReferenceYAxisLines = YES;
          mindfulGraph.colorReferenceLines = [UIColor lightGrayColor];
          mindfulGraph.enableLeftReferenceAxisFrameLine = YES;
          mindfulGraph.enableReferenceAxisFrame = YES;
    
          mindfulGraph.enablePopUpReport = YES;
    }
    

    0-neu-d2-47c91b1ae3cd8513e6bb9c835e1a9580

    question 
    opened by pixatra5163 2
  • Long X-Axis Labels Hidden

    Long X-Axis Labels Hidden

    First of all, thank you for creating such awesome graph library. It's really easy to use and customize.

    I have xAxisLabel issue while using this library. They were not showing at all at first integration. I did some debugging, and I found the reason.

    In BEMSimpleLineGraphView.m file, you created drawXAsis method. This was creating xAxisLabels and adding to graph view.

    Btw, they were just removed right after added, by the following code in this method.

    for (UILabel *l in overlapLabels) {
        [l removeFromSuperview];
    }
    

    The reason was, fullyContainsLabel was being set NO.

    BOOL fullyContainsLabel = CGRectContainsRect(self.bounds, label.frame);
    

    From debugging, what I found is,

    self.bounds.size = (280, 210)
    label.frame = ({some value}, 194.66000003, size (width = {some value}, height = 15.34000000))
    

    This means, the bottom edge of label goes beyond the height of graph view.

    Personally, I think, it makes more sense if we show label as long as it intersects with graph view, because we need to show the label even if it is showing partially.

    So, I changed the line to

    BOOL intersectsLabel = CGRectIntersectsRect(self.bounds, label.frame);
    

    And it worked very well.

    Also, I was having special requirements that, I need to show the y-axis values in formatted string like $20K, and dot-values being $18,237 which were not possible by just using formattedString.

    So, I defined some delegate methods and used it. If you don't mind, I may fork your repo and send PR.

    Please let me know your thoughts.

    bug duplicate bugfix 
    opened by kronos317 2
Releases(v4.1.1)
  • v4.1.1(Jan 24, 2016)

    Bug Fixes

    • Fixes #220 in accordance with Apple Documentation. Removed calls to closePath on BEMLine to prevent the lines being retraced (94f8915c9a9c85e5a4d16408e3521ea384acb813)
    • Fixes #233 by checking for data sources with less than two data points and drawing an appropriate line and line fill (aa51b1166f3e8f1e0020b7f8f9cac64b248524f2)

    Project Changes

    • Added a great deal of in-depth XCTests (295b9cb47457245243a38b52c2e8bf5736750cbf)
    Source code(tar.gz)
    Source code(zip)
  • v4.1(Jul 31, 2015)

    Improvements

    • Bezier Algorithm Improvements. This modifies the algorithm used to determine the graph's line. The old algorithm, although generating prettier graphs, displayed inaccurate information; line arcs would go above and below min/max values, and a graph that had two data points of the same value in a row would show invalid arcs between the two data points (always upward) giving the user an inaccurate representation of the data. Thanks to @tres for this wonderful improvement (9311f8d).
    • Allow gesture recognizer to function simultaneously with other gesture recognizers. (8c25436).

    New Features

    • New reference line width property (referenceLineWidth) allows you to control the width of the reference lines independently from the graph line. (0bb60c9)

    Bug Fixes

    • Fixes #135, an issue where bezier curve lines were not confined to the graph's boundaries (despite the fill gradients and colors being confined). (17fe25f)
    • Fixes an issue where permanent pop up labels are duplicated when layoutSubview is called (i.e. during interface orientation changes). (929df84)
    • Fixes a crash that may have occurred when attempting to perform calculations on a graph with no data, or before data is loaded. (e2a5167)
    • Fixes a static analyzer warning about uninitialized struct. (af70a96)

    GitHub Repo Updates

    • Readme Updates
      • Fixes quotation mark for Swift bridging header example (978b504)

    Public to Private API Transition

    • Removed previously public properties on BEMLine and made them private. These properties are not marked as deprecated because they should not have been public in the first-place, and any public use of them would have unintentional consequences. The following properties are no longer available publicly:
      • @property (assign, nonatomic) CGPoint P0
      • @property (assign, nonatomic) CGPoint P1
      • @property (assign, nonatomic) CGPoint P2
      • @property (assign, nonatomic) CGPoint P3
    Source code(tar.gz)
    Source code(zip)
  • v4.0(May 1, 2015)

    Breaking Changes

    • Changed the purpose of lineGraphDidFinishLoading:.
      • Added a new lineGraphDidFinishDrawing: delegate method to differentiate between when the graph finishes drawing & animating and when it finishes loading its data.
      • Those who previously used lineGraphDidFinishLoading: to take graph snapshots should now use lineGraphDidFinishDrawing: instead.
      • The new lineGraphDidFinishDrawing: can be used to create snapshots for the  WATCH
    • Deprecated the distanceToClosestPoint method. This method will become unavailable in a future update. There will be no replacement for this method and we suggest phasing it out.
    • Removed compile-time module check (@import vs. #import). Modules are now be used by default. (a43ba9380f5b2a8dc8fcb268b3eb611e1dcfb471)
    • Added warnings to deprecated methods which will be removed in the next major release:
      • numberOfPointsInGraph
      • didTouchGraphWithClosestIndex:
      • didReleaseGraphWithClosestIndex:
      • numberOfGapsBetweenLabels

    Semi-Breaking Changes

    • Improved the implementation of the X-Axis. The X-Axis background is now drawn by BEMSimpleLineGraph (as the Y-Axis is) instead of by BEMLine. This will help ensure stability and provide a more reliable system moving forward. It also fixes issues with gradient overlap into the X-Axis area.

    Xcode 6 Improvements

    • BEMSimpleLineGraph now takes advantage of Xcode 6's new IBDesignable and IBInspectable features. Preview select graph properties in Interface Builder.
    • Starting in Xcode 6.3 and Swift 1.2, BEMSimpleLineGraph is compatible with the new NULLABILITY standards. All methods and properties are, by default, non-nullable unless otherwise marked. (a43ba9380f5b2a8dc8fcb268b3eb611e1dcfb471)

    Key Feature

    • Average Lines (a939039a1e9a7d728cb71356b1e01902282b9132). Added an Average Line feature. Draw an average line with a specific y-value. Use the new averageLine property on BEMSimpleLineGraphView to setup and customize the line. Might be considered a fix for issue #42. The implementation of the average line feature is likely the direction BEMSimpleLineGraph is headed as it expands.

    New Features - Shoutout to @RobDay and his team at @dowjones for PR #132

    • New Properties
      • Optionally display only dots and no line on your graph (resolves #51) using the new displayDotsOnly property.
      • Added new positionYAxisRightproperty. A boolean flag that moves the Y-Axis to the right of the graph.
      • Added a new lineDashPatternForReference[X|Y]AxisLines property. Specify a dash pattern for the reference lines drawn on the graph. This creates the reference lines with a dotted or hashed pattern.
      • Added a new enable[Left|Right|Top|Bottom]ReferenceAxisFrameLine property. By setting these properties, you can control what reference frame lines are drawn on the graph.
      • New displayDotsWhileAnimating property. A boolean specifying whether or not to show the dots while animating the reference lines.
      • New noDataLabelColor. Specify the color for the no data label
      • New noDataLabelFont. Specify the font for the no data label
      • Created a new formatStringForValues property. A format string to apply to values in the Y-Axis. This lets you have fine-grain control over the decimal precision of these values (eg. ".02f")
      • New yAxis[Prefix|Suffix]OnLineGraph property. Specify popup prefix and suffix to show in the built-in popup view
    • Null Graph Values
      • The graph now has the ability to plot null graph values. BEMSimpleLineGraph.h now specifies a special value, BEMNullGraphValue, that corresponds to a null data point. In your response to valueForPointAtIndex, return this special value whenever your data point is null. BEMSimpleLineGraph will now skip over this value when drawing the line. If you set interpolateNullValues, the graph will connect non-null values while preserving spacing for the null value.
    • Customizing Popup Views
      • Added a popUpSuffixForlineGraph: delegate method. A suffix to append to the stock pop up label view's value.
      • Added a popUpPrefixForlineGraph: delegate method. A prefix to prepend to the stock pop up label view's value.
      • If you want to use a custom popup view instead of the built-in popup view, you can respond to the optional method popUpViewForLineGraph:. You respond to this method with a UIView that will be used in place of the default popup.
        • When you use the custom popup view, the data in the view needs to be changed whenever the user drags his or her finger. To handle this modification, BEMSimpleLineGraph will send the message lineGraph:modifyPopupView:ForIndex:. This lets you modify your view for a given datapoint.
    • Axis Customizations
      • Added a new delegate method, incrementPositionsForXAxisOnLineGraph that lets you set the specific indices where X-Axis labels should be drawn.
      • Added a new delegate method, baseIndexForXAxisOnLineGraph, that lets you specify the index of the first X-Axis label to draw.
      • incrementIndexForXAxisOnLineGraph. An increment to apply to the response.
      • baseIndexForXAxisOnLineGraph. X-Axis labels will be drawn on this increment across the X-Axis.
      • baseValueForYAxisOnLineGraph. The starting Y-Axis value to plot draw on the Y-Axis. This lets you set a specifically formatted value so that your access label can be more user friendly (21.50 instead of 21.47)
      • incrementValueForYAxisOnLineGraph- An increment value to add to the response of baseValueForYAxisOnLineGraph that specifies what Y-Axis values to draw. This lets you return a user friendly increment, eg. .25.
    • Snapshot Methods
      • Use the new graphSnapshotImageRenderedWhileInBackground: method to capture a graph snapshot while your app is in the background. Fixes #193. (512f716a36c94663080abb80224404e17940d133)
    • Animation & Drawing
      • New “expansion” animation has been added to the list of available animations. Try out the new animation with the BEMLineAnimationExpand type.

    Bug Fixes

    • Fixes #134, an issue where popup suffixes would not display when alwaysDisplayPopUpLabels was set to YES. The sample app now demonstrates the use of popup suffixes. (183a67504b3851e4f79f49b86a54e3e69935ac9f)
    • Fixes #138, an issue where popup prefixes would not display when alwaysDisplayPopUpLabels was set to YES. The sample app now demonstrates the use of popup prefixes. (c83d66c32e9b0ee31b95e996a919f896afdd7e38)
    • Fixes #70, a bug where reference axis frame drawing was conditional on reference axis lines being enabled. Now these properties are not dependent on one another. (f1f2ac453bcecd6f84fd5bcba5346068285e6467)
    • Fixes #196, vertical reference lines are now properly aligned with x-axis labels. (64b4fb1756eeb42c564b946a34b66edac21bf020)
    • Fixes #67, the far-right and far-left x-axis labels now re-orient themselves to avoid being clipped.(64b4fb1756eeb42c564b946a34b66edac21bf020)
    • Fixed an issue where the reference lines would have an alpha value of 0 if the line also had an alpha value of zero. Reference lines now set to an alpha of 0.1 when the line alpha is 0.0. As before, you can disable reference lines using the boolean properties to make them appear or disappear. (1acc2e206a0bbb4020ee3e8004ab900c71295a8a)

    GitHub Repo Updates

    • Graph Properties View Controller
      • View all available public BEMSimpleLineGraph properties directly from the sample project
      • Ability to use and toggle these properties directly from the Storyboard is coming soon
    • Readme Updates
      • New Apps Using This Project Section
      • Added details on IBDesignables
      • Added contributions note
      • Improved markdown formatting
      • Added StackOverflow support details
    • Updated project requirements
    Source code(tar.gz)
    Source code(zip)
  • v3.3(Feb 23, 2015)

    New Features

    • Added gradients (7c9fd3ebb728ff72c32854916757a9ac0c7f34f2, cf9c7863fa093b96ef6ae756deeeaf0c40d76c45, 040d87c33e58e708e81cb9a2bf6ff3acc7c34d29)
    • Ability to customize "No Data" label (fe98eb840a219b552394fb1d1dd85f9141d6be30)
    • Ability to customize Reference line color (548e6fbc9bfe3ddfdaa1887f925781e539315025)

    Performance Improvements

    • Performance improvements (019838fdb1f7785df5f66cc4760e4b76e036af57)
    • Decreased load time and memory overhead with 300+ dots. See issue #107 (83e79cf35b4aedd296ac6ff328b1d204210a6e54)

    Bug Fixes

    • Ensure permanent pop-up labels are not duplicated (b3f428830f6bc05164b0cf5e362d6ae597e0a03b, 1b547c0d201f6ece72d5bd00859aea5eb26342be)
    • Fix colorTouchInputLine (be7881196ec82aa1e4ad323220c2e14fc2b43920, bc730ace5448379421d791b99ad07ab068e44f7d)
    • Fixed touch report when no animation (8ad065e5abee6f59e26c80fcc605bc45b0596757, 01c5407a86954f4a8f6b642a79f385434aa5ddb2)
    • Fixed type missmatch (743b180249cb252a5367cf5db7c99eddd1c832bb)

    GitHub Repo Updates

    • Fix path in bridging header section of Readme.md (fece954137b5ecb0af30e8a331de1a6394b44ac5)
    • Added automatically generated Change Log file
      • 3b8ad18520cdfc1d32baa3f9e092900a8f9b11ee
      • 60c91bf9ffc32755c91eb431f839507fb019a510
      • 301d6cc81b090b0d7ff237bed2fa239770319da8
      • 2de3023c41d7ad155e86aace18d8caf24a4b16e8
      • e4ba73ca69c82aa38c5861208335ccec3a6352cb
    Source code(tar.gz)
    Source code(zip)
  • v3.2(Feb 23, 2015)

    New Features

    • New behavior for numberOfYAxisLabelsOnLineGraph (2406512d2670f380ea3b1d9251c3832813f901cc).
    • Added segmented control to select Bezier or Straight curve in sample app (c33a5601537d71226f414fcb50aa2bd0b37aa7f4).
    • Added support for negative data points (80b6b0c8fb030b220c811cdbe683c834a1763fa8).
    • New property to enable/disable the XAxis labels enableXAxisLabel (5fe260e09de1cbf80a45b3cf83a5d5318d1d12bc).
    • New delegate method to customize the size of the vertical padding on the graph staticPaddingForLineGraph (5ee055c9cd40ffc609d79fe6f23d6b5a28b35e2b).

    Minor Changes

    • The "No Data" Label is now optional thanks to delegate method noDataLabelEnableForLineGraph (cb7d5bdccc3b2d9d7977a1835285bf0be6304692).
    • Split property enableReferenceAxisLines into two properties for X and Y-Axis (63a1d9167870b1e4d45bd748ae6ca440d32cd1d7).

    Bug Fixes

    • Fixed enableYAxisLabel (5ffaed98dc4bafd61e7a333e02407dc60b51dac5)
      • Fixed the way the offset on the Y-Axis label is calculated when enableYAxisLabel is set to NO.
      • Fixed the way the labels are displayed when enableYAxisLabel is set to NO.
      • Deleted the calculation of the offset distance for Y-Axis Label (since it was already done).
      • Fixed the Y-Axis labels when enableYAxisLabel is set to NO.
      • Fixed the position of the dots when enableYAxisLabel is set to NO.
    • Fixed alwaysDisplayPopUpLabels (3da4fb7242ae3318bc1359224e00d64cd3f3dc82)
      • Fixed issue with alwaysDisplayPopUpLabels where the background wouldn’t be displayed when the Y-axis was displayed (see issue #71).
      • Changed name of property labelYaxisOffset to YAxisLabelXOffset.
      • Fixed documentation of autoScaleYAxis.
    • Fixed popupLabel (3e3338a3cd1e3eddcc691cf00bac97736ea6c0cd)
      • When the Y-Axis labels were activated, the popup label on the very edge of the Y-Axis label would display over the axis.
    • Fixed issue with bezier curve (47a583d8169da582fb96fe26dd0c411760520a11)
      • Fixed issue where the bezier curve used to be deactivated if 3 points with the same value were following each other. See issue #73.
    • Fixed issue #73 and labels Y axis height (12587c0b4a0ee218de44b509b2107ae2781f3630)
      • The issue with bezier curves should now be totally fixed.
      • The height of the labels on the Y-axis has been increased to make sure the could display all the text.
    • Fix representation of negative values in Y axis (0e586b998f47568376f9149ab32f4b6293e47970)
    • Fix incorrect presentation of years in code example (d36074d0904cdc22aac333733e4236dbd96d47df)
    Source code(tar.gz)
    Source code(zip)
  • v3.1(Aug 29, 2014)

    New Features

    • Added new properties to control the following:
      • Background Color of Axis
      • Alpha of Axis

    Bug Fixes

    • Fixed Issue #61
    • Fixed Issue #62
    Source code(tar.gz)
    Source code(zip)
  • v3.0(Aug 19, 2014)

    Breaking Changes

    • Separated the delegate into a delegate and a data source. This provides additional flexibility and brings BEMSimpleLineGraph even closer to UITableView and UICollectionView. Data source methods which were previously delegate methods are now marked as deprecated and unavailable. Implementing a data source method on the delegate will throw an exception.
    • Deprecated lineColorForIndex: due to the nature of the new graph mechanics. There is no replacement for this method at this time and implementing it will have no effect.
    • Deprecated lineAlphaForIndex: due to the nature of the new graph mechanics. There is no replacement for this method at this time and implementing it will have no effect.

    Performance Improvements

    • The line graph is now drawn in a completely different way, using UIBezierPaths instead of multiple UIViews. The result is a ~90% improvement in performance and memory usage. This major change resolves #34. And here's a little chart for comparison:

      | Version 2.3 | Version 3.0 | | :-: | :-: | | 120 MB memory usage at 100 points | 6 MB memory usage at 100 points | | 25 data points stable maximum | 250+ data points stable maximum | | Choppy Animation | Smooth Animations |

    New Features

    • Added labels and scaling features for the Y-Axis
    • Added multiline X-Axis labels
    • Optionally draw thin, translucent reference lines on the graph behind the main line
    • Added optional axis frames to draw a thin, translucent border between the graph and the axis labels
    • Popovers can now be displayed indefinitely
    • Choose between three different graph animation options (draw, fade, or none)
    • New delegate method to provide optional suffix for pop-up points

    Bug Fixes

    • Bezier corners are now buttery-smooth (Fixed #22)
    • Error handling when drawing the graph without data points

    Resolved Issues This update resolves the following issues: #19, #22, #24, #26, #28, #30, #33, #34, #37, #40, and #41.

    Known Issues There are no known issues in this release.

    Source code(tar.gz)
    Source code(zip)
  • v2.3(Jun 2, 2014)

    Bug Fixes

    • Fixed index beyond bounds when touching the graph (#31)

    Known Issues
    The following issues are know to be present in version 2.3. Some of these issues may also be present in earlier versions. Each known issue is being tracked and worked on (see the issue numbers). Issues marked with an F have been resolved on the feature branch.

    • Numerous data points cause high memory consumption and warnings (#34 F)
    • Glitches appear on bezier corners (#22 F)
    • X-Axis labels may display underneath the graph (#47)
    • Straight lines appear with extra curves (#21)
    • Exception thrown when number of X-Axis label is not good (#46)
    Source code(tar.gz)
    Source code(zip)
  • v2.2(May 19, 2014)

    Minor Breaking Changes

    • lineColorForIndex & lineAlphaForIndex are now deprecated in preparation of new update. These features will no longer be supported

    New Features

    • Added new feature PopUpReport: when the user touches the graph, a label will show up above the closest point giving the value of this point.
    • Added public properties sizePointand colorPoint to control the diameter and color of the points creating the graph.

    Bug Fixes

    • Various bug fixes (#18, #15)
    Source code(tar.gz)
    Source code(zip)
  • v2.1(Apr 20, 2014)

    Bug Fixes

    • Fixed the bug with Target Membership. See issue #14.
    • Misc bug fixes.

    Minor Enhancements

    • Support for adding a graph in UIScrollView. Thank you to @nmattisson. See issue #12.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Mar 3, 2014)

    Minor Fixes

    • Changed the padding on the graph to make sure the line doesn't get drawn outside the view (Bézier curves).
    • Updated the README.md.
    • Fixed Warning in the Sample Project by deleting duplicate files in Build Phases (README and License).

    Special Thanks Big thank you to @Sam-Spencer for all the hard work on the v2.0.

    Source code(tar.gz)
    Source code(zip)
  • v2.0(Mar 2, 2014)

    This update makes numerous improvements to the delegate methods, adds new methods / features, fixes bugs, and adds pre-compiler warnings for some features.

    Breaking Changes

    • Deprecated some delegate methods and replaced with newer delegate methods with more parameters.
    • Changed some previously public properties to private properties.

    New Features

    • New delegate methods to specify line color and alpha.
    • New delegate methods that notify the delegate when the graph starts and ends updates.
    • Added new calculation methods to calculate the graph's sum, average, standard deviation, median, mode, and more.
    • Added a new graph snapshot method which efficiently captures a UIImage of the graph.
    • Updated Sample App to reflect new features and changes.
    • Added pre-compiler check for the Objective-C Module Build Setting. Modules are used if enabled, otherwise traditional imports are used.
    • Added a warning for projects without ARC.

    Fixed Issues

    • Added call to super in layoutSubviews.
    • The reloadGraph method now calls setNeedsLayout instead of directly calling layoutSubviews.
    • Improved memory performance with @autoreleasepool blocks.
    • Added Type-Safety for 64-bit architecture.
    • Fixed X-Axis layout issues.
    • Fixed typos.
    Source code(tar.gz)
    Source code(zip)
  • v1.3(Feb 8, 2014)

    Bug fixes and optimization of X-Axis is drawing.

    Resolved Issues

    • Fixed bugs #3 and #6.
    • Thank you to @darkFunction for helping fixing bug #3.

    Improvements

    • The labels on the X-Axis are now offset to be centered if necessary and possible.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.2(Jan 14, 2014)

  • v1.2.1(Jan 8, 2014)

  • v1.2(Jan 8, 2014)

    New Features

    • Delegate can now be set via the Storyboard Outlet Inspector (in the interface) - in addition to setting it programatically.
    • Improved init method.
    • Improved sample app.

    Fixed Issues

    • Fixed reload data bugs.
    Source code(tar.gz)
    Source code(zip)
Owner
Boris Emorine
Boris Emorine
SwiftChart - A simple line and area charting library for iOS.

SwiftChart A simple line and area charting library for iOS. ?? Line and area charts ?? Multiple series ?? Partially filled series ?? Works with signed

Giampaolo Bellavite 1k Jan 2, 2023
SwiftUICharts - A simple line and bar charting library that supports accessibility written using SwiftUI.

SwiftUICharts - A simple line and bar charting library that supports accessibility written using SwiftUI.

Majid Jabrayilov 1.4k Jan 9, 2023
A charting library to visualize and interact with a vector map on iOS. It's like Geochart but for iOS!

FSInteractiveMap A charting library to visualize data on a map. It's like geochart but for iOS! The idea behind this library is to load a SVG file of

Arthur 544 Dec 30, 2022
Easily create graphs that calculate percentiles

SwiftUIPercentChart Easily create graphs that calculate percentiles How to install this package Open your project on Xcode Go to Project Tab and selec

Mehmet ateş 4 Jul 13, 2022
Declarative charting and visualization to use with SwiftUI

Chart Declarative charting and visualization to use with SwiftUI The package is in open development with a goal of making a declara

null 11 Jun 3, 2022
FSLineChart A line chart library for iOS.

FSLineChart A line chart library for iOS. Screenshots Installing FSLineChart Add the contents of the FSLineChart project to your directory or simply a

Arthur 856 Nov 24, 2022
Line Chart library for iOS written in Swift

Swift LineChart Usage var lineChart = LineChart() lineChart.addLine([3, 4, 9, 11, 13, 15]) Features Super simple Highly customizable Auto scaling Touc

Mirco Zeiss 601 Nov 15, 2022
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Jan 5, 2023
Demonstrate a way to build your own line chart without using any third-party library

LineChart This code demonstrate a way to build your own line chart without using any third-party library. It contains a simple yet effective algorithm

Van Hung Nguyen 0 Oct 17, 2021
Simple iOS Application built using UIKit displaying the list of Cryptocurrencies and a detailed screen with a line graph.

CryptoViewer Simple iOS Application built using UIKit displaying the list of Cryptocurrencies and a detailed screen with a line graph. Home Screen: Di

null 0 Jun 14, 2022
Line plot like in Robinhood app in SwiftUI

RHLinePlot Line plot like in Robinhood app, in SwiftUI Looking for how to do the moving price label effect? Another repo here. P.S. Of course this is

Wirawit Rueopas 234 Dec 27, 2022
ANDLineChartView is easy to use view-based class for displaying animated line chart.

ANDLineChartView for iOS ANDLineChartView is easy to use view-based class for displaying animated line chart. Usage API is simple. Just implement foll

Andrzej Naglik 421 Dec 11, 2022
An interactive line chart written in SwiftUI with many customizations.

LineChartView LineChartView is a Swift Package written in SwiftUI to add a line chart to your app. It has many available customizations and is interac

Jonathan Gander 59 Dec 10, 2022
Fully customizable line chart for SwiftUI 🤩

?? CheesyChart Create amazing Crypto and Stock charts ?? ?? Looking for an easy to use and fully customizable charting solution written in SwiftUI? Th

adri567 13 Dec 14, 2022
SwiftCharts - Easy to use and highly customizable charts library for iOS

SwiftCharts Easy to use and highly customizable charts library for iOS Features: Bars - plain, stacked, grouped, horizontal, vertical Scatter Lines (s

Ivan Schütz 2.4k Jan 4, 2023
Simple and intuitive iOS chart library. Contribution graph, clock chart, and bar chart.

TEAChart Simple and intuitive iOS chart library, for Pomotodo app. Contribution graph, clock chart, and bar chart. Supports Storyboard and is fully ac

柳东原 · Dongyuan Liu 1.2k Nov 29, 2022
Dr-Charts Easy to use, customizable and interactive charts library for iOS in Objective-C

dr-charts Easy to use, customizable and interactive charts library for iOS in Objective-C Features: Multiple chart types Line / Multiple lines / Lines

Zomato 93 Oct 10, 2022
Easy to use and highly customizable pie charts library for iOS

PieCharts Easy to use and highly customizable pie charts library for iOS Swift 4.2, iOS 8+ Video Features: Customizable slices Add overlays using simp

null 503 Dec 6, 2022
Easy to use Spider (Radar) Chart library for iOS written in Swift.

DDSpiderChart Easy to use Spider (Radar) Chart library for iOS written in Swift. Requirements iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ Xcode

Deniz Adalar 82 Nov 14, 2022