GithubHelp home page GithubHelp logo

jbchartview's Introduction

JBChartView


Introducing JBChartView - Jawbone's iOS-based charting library for both line and bar graphs. It is easy to set-up, and highly customizable.

Features

  • Drop-in UIView subclass supported across all devices.
  • Line and bar graph support.
  • Simple to use protocols modeled after a UITableView.
  • Highly customizable.
  • Expand & collapse animation support.

Refer to the <a href="https://github.com/Jawbone/JBChartView/blob/master/CHANGELOG.md"">changelog for an overview of JBChartView's feature history.

Requirements

  • Requires iOS 6 or later
  • Requires Automatic Reference Counting (ARC)

Demo Project

Build and run the JBChartViewDemo project in Xcode. The demo demonstrates the use of both the line and bar charts. It also outlines how a chart's appearance can be customized.

More Demos

  • Amsombe's Quartet: project showcasing the use of JBChartView in the classic data visualization example known as Anscombe's Quartet.
  • Spark Friends: project showcasing the use of JBChartView in the context of sparklines and (fake) user step data.

Installation

CocoaPods is the recommended method of installing JBChartView.

The Pod Way

Simply add the following line to your Podfile:

platform :ios, '6.0'
pod 'JBChartView'

The Old School Way

The simplest way to use JBChartView with your application is to drag and drop the /Classes folder into you're Xcode 5 project. It's also recommended you rename the /Classes folder to something more descriptive (ie. "Jawbone - JBChartView").

Usage

All JBChartView implementations have a similiar data source and delgate pattern to UITableView. If you're familiar with using a UITableView or UITableViewController, using a JBChartView subclass should be a breeze!

Swift Projects

To use JBCartView in a Swift project add the following to your bridging header (JBChartView-Bridging-Header.h):

#import <UIKit/UIKit.h>
#import "JBChartView.h"
#import "JBBarChartView.h"
#import "JBLineChartView.h"

For more information about adding bridging headers see Swift and Objective-C in the Same Project.

JBBarChartView

To initialize a JBBarChartView, you only need a few lines of code (see below). Bar charts can also be initialized via a nib or with a frame.

JBBarChartView *barChartView = [[JBBarChartView alloc] init];
barChartView.dataSource = self;
barChartView.delegate = self;
[self addSubview:barChartView];

Just like you would for a UITableView, ensure you clear these properties in your dealloc:

- (void)dealloc
{
	JBBarChartView *barChartView = ...; // i.e. _barChartView
	barChartView.delegate = nil;
	barChartView.dataSource = nil;
}

At a minimum, you need to inform the data source how many bars are in the chart:

- (NSUInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView
{
	return ...; // number of bars in chart
}

Secondly, you need to inform the delegate the height of each bar (automatically normalized across the entire chart):

- (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtIndex:(NSUInteger)index
{
	return ...; // height of bar at index
}

Lastly, ensure you have set the frame of your barChartView & call reloadData at least once:

barChartView.frame = CGRectMake( ... );
[barChartView reloadData];

Subsequent changes to the chart's frame will not invoke reloadData; it must be called directly afterwards for any changes to take effect.

Animated Reload

Both line and bar charts support animated reloads. The delta between the old data model and new data model is calculated and animated appropriately (ie. bars or lines will shrink, expand or morph in size). Due to techinical limitations in Apple's Quartz Core Framework, line fills (both solid and gradient) can not be animated - they will simply 'snap' into place while the rest of the chart continues to animate.

- (void)reloadDataAnimated:(BOOL)animated;

State changes during a reload will be ignored. As well, subsequent calls to reloadData: or reloadDataAnimated: before any previous reloads are complete, will also be ignored. Lastly, all touch events will be ignored until a reload has completed. You can always check on the state of the animation via the exposed read-only property:

@property (nonatomic, readonly) BOOL reloading;

By default, the animation will complete in approximately 0.25 seconds. The animation duration is independent from the data model size.

Note: the above restrictions apply only to animated reloads, as non-animated reloads are synchronous.

JBLineChartView

Similiarily, to initialize a JBLineChartView, you only need a few lines of code (see below). Line charts can also be initialized via a nib or with a frame.

JBLineChartView *lineChartView = [[JBLineChartView alloc] init];
lineChartView.dataSource = self;
lineChartView.delegate = self;
[self addSubview:lineChartView];

Just like you would for a UITableView, ensure you clear these properties in your dealloc:

- (void)dealloc
{
	JBLineChartView *lineChartView = ...; // i.e. _lineChartView
	lineChartView.delegate = nil;
	lineChartView.dataSource = nil;
}

At a minimum, you need to inform the data source how many lines and vertical data points (for each line) are in the chart:

- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView
{
	return ...; // number of lines in chart
}

- (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex
{
	return ...; // number of values for a line
}

Secondly, you need to inform the delegate of the y-position of each point (automatically normalized across the entire chart) for each line in the chart:

- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
{
	return ...; // y-position (y-axis) of point at horizontalIndex (x-axis)
}

Note: you can return NAN instead of CGFloat to indicate missing values. The chart's line will begin at the first non-NAN value and end at the last non-NAN value. The line will interopolate any NAN values in between (ie. the line will not be interrupted).

return [[NSNumber numberWithFloat:NAN] floatValue];

Lastly, ensure you have set the frame of your lineChartView & call reloadData at least once:

lineChartView.frame = CGRectMake( ... );
[lineChartView reloadData];

Note: subsequent changes to the chart's frame will not invoke reloadData; it must be called directly afterwards for any changes to take effect.

Customization

Both the line and bar charts support a robust set of customization options. Read more about them here.

Minimum & Maximum Values

By default, a chart's minimum and maximum values are equal to the min and max supplied by the dataSource. You can override either value via:

- (void)setMinimumValue:(CGFloat)minimumValue;
- (void)setMaximumValue:(CGFloat)maximumValue;

If value(s) are supplied, they must be >= 0, otherwise an assertion will be thrown. To reset the values back to their original defaults:

- (void)resetMinimumValue;
- (void)resetMaximumValue;

The min/max values are clamped to the ceiling and floor of the actual min/max values of the chart's data source; for example, if a maximumValue of 20 is supplied & the chart's actual max is 100, then 100 will be used. For min/max modifications to take effect, reloadData must be called.

Performance

The nature of charting is to display all available information, unlike a UITableView, which can cache rows that are offscreen. JBChartView's performance will suffer if the number of data points exceed the resolution of the device. The same issue exists with MKMapView, when hundreds of pins are supplied within a certain geographic area. It's why Apple recommends clustering to avoid performance issues. As such, for large datasets, we recommend that your dataSource to supply a subset of points; clustering those that are close to one another.

License

Usage is provided under the Apache License (v2.0). See LICENSE for full details.

jbchartview's People

Contributors

amro avatar andrewloyola avatar ecaselles avatar eventualbuddha avatar gumbypp avatar joelk avatar jonparker avatar kmcbride avatar ktran03 avatar l4u avatar legranddamien avatar loumoore avatar luosheng avatar mszaro avatar nikalra avatar pala avatar sampage avatar simonnickel avatar skywinder avatar terryworona avatar undo1 avatar vocaro avatar yasuoza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jbchartview's Issues

`JBLineChartFooterView` Value Marks are Inaccurate

When a line contains dots, the value marks on the JBLineChartFooterView's x-axis don't match up with the center of the dots. Either the dots on the graph are being placed slightly off, or the value marks on the x-axis are being placed slightly off. You can see this happening in the demo app:
Detail:
point

Original image:
img_3967

Typo in readme?

In the readme lists the showsDotsForLineAtLineIndex under the header for customizing the dot size:

To customize the size of each dot, implement (default is 3x the line width):

  • (BOOL)lineChartView:(JBLineChartView *)lineChartView showsDotsForLineAtLineIndex:(NSUInteger)lineIndex;

Crash, lineChartView "must implement numberOfPointsInLineChartView" ?

** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'JBLineChartView // dataSource must implement - (NSInteger)numberOfPointsInLineChartView:(JBLineChartView *)lineChartView'

I'm on the latest version (2.2) and I implemented the methods:

  • (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView;
  • (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex;

I tried adding numberOfPointsInLineChartView... but it didn't help and I don't think that method is used anymore...

I must be doing something wrong...

NSAssert on bar height in JBBarChartView, > 0 when it should be >=

In JBBarChartView.m you have the following line:

        NSAssert(height > 0, @"JBBarChartView // datasource function - (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index must return a CGFloat >= 0");

The assert tests if height is greater than zero, the message says >= 0

If you pass a 0 for the height (perfectly valid height) the app crashes.

Requires iOS 7 or later

What needs to be done in order to create a fork which supports iOS 6? Is there any crucial components depending on iOS 7 here?

Thanks

Negative Bars?

Any plans on adding negative bars? Bars that go below the X-axis?

JBChartView demo footerview problem

I am wondering why the offset is set in the JBChartView demo project.


the footerview is over charview by 10px.

this is due to the variable set in JBBarChartView.m

CGFloat static const kJBBarChartViewPopOffset = 10.0f;

to be able to see this, need to change JBColorConstants.h file

#define kJBColorBarChartControllerBackground [UIColor colorWithWhite:0.0 alpha:0.2]

Stach bars?

Can we create stacked bar? or multiple bar types in the same bar chart?

How to Know the x,width of each bar

Hi,
I'm hoping you can help me with this issue, Iยดm creating a view to signalise witch bar is clicked. At this point I have been abble to show a circular view below the chart view using the CGPoint "touchPoint". This is not working very well, because I need to know the x and width of each bar.

I need to create a class method for that to be able to use in all the code

Thanks for the help,

Best regards
Pedro

`showsLineSelection` Does Nothing

Setting showsLineSelection = NO does nothing. The selected line is still highlighted and the lines that are not selected are still faded. A quick look at JBLineChartView.m shows that the showsLineSelection @property is never called in the code.

Aligning X-axis, padding?

Are there any methods to set the padding on the line chart so as to align the points with an X-axis (or Y-axis) labeling?
Thanks

Multiple y-axis

Hey!

This is likely an enhancement unless I have missed an option allowing this functionality already in JBChartView. I'm looking for a way to show graphs similar to our web app like this... http://cl.ly/image/1y420e0N011Z

As you see we have a y-axis on both sides with the line scale changed for each line it's drawing. Right now if I show the same data in JBChartView the lower value number (which is alot lower) shows as a straight line which makes sense but would prefer more visible lines. http://cl.ly/image/3t3l3F0q2N2t

I thought about maybe layering two graphs ontop of one another but not sure how that'd effect selection.

Love this library, love the charts within the UP app! ๐Ÿ‘

Thanks!

Typo in JBBarChartView.h

In the required methods, the prototype of heightForBarViewAtIndex says:

  • (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index;

Note that the word "At" appears twice in heightForBarViewAtAtIndex

non-evenly distributed plots

Hi, i'd like to know if chartview is able to handle my case. So far i haven't found how :

Let's say i want to draw time-based values like those :
monday : 9:20 => 10
monday : 10:20 => 15
friday : 10:34 => 25

I'd like my x-axis to go from monday 00:00 to friday : 23:59:59

When unzoomed, the graph i'd like to build would have 2 dots close one to another on the left, and a third one on the far right.

How would I configure ChartView to do that ?

Single press on bar

Hello ! Nice framework first of all.
For single press on a bar, the detail label is not dismissing/disappearing, as it is for dragging.

Footer Views - Can they be perpendicular to the x-axis

Hi, in the sample JBLineChartViewController class,
the footer view labels [ footerView.leftLabel.text = [[self.daysInYear firstObject] uppercaseString]; are parallel to the x-axis.
Is there anyway to make them perpendicular to the x-axis so that if the label is long, the left and right label texts do not intersect?

Thanks!

Line Chart Collapse Animation Changed?

The animation on change from collapsed/expanded state on the line chart used to be very beautiful. The line would collapse into the center of the graph and disappear. Now, I see in both my own custom graph and the JBChartViewDemo app the entire line graph just slides downward and fades off screen. Was this an intentional change? I used to think I had done something in my chart setup that broke the animation, but now I noticed it in the demo app.

I went way back in commit history to a point where I saw the original animation in the demo app: http://youtu.be/58d4yAxv-YY

This is what it looks like now: http://youtu.be/6xAJ7QRitAs

Zoom and scrolling? (Question)

Does JBChartView supports zooming and scrolling of content?

I looked at the main classes because I would like to show certain portions of the data in the graph and let the user zoom and scroll the content as they need but I don't know if this is supported "out-of-the-box" for the charts.

Thanks.

Following the tutorial creates an empty/blank view

I followed the tutorial to create the bar chart, and the result was an empty screen. I am assuming the problem is in the initialization code:

JBBarChartView *barChartView = [[JBBarChartView alloc] init];

Can someone double check this and see if they can reproduce the issue on an empty project?

Problem with Bar Height

I followed the tutorial and had a problem with bar height. Every time one bar has zero height (not showing in a view).

This is my code:

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    // data array
    _data = @[@20, @30, @50];

    JBBarChartView *barChartView = [[JBBarChartView alloc] init];
    barChartView.delegate = self;
    barChartView.dataSource = self;
    barChartView.frame = CGRectMake(20, 120, 280, 200);
    barChartView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    barChartView.layer.borderWidth = 1;
    [self.view addSubview:barChartView];

    [barChartView reloadData];
    }

  • (NSUInteger)numberOfBarsInBarChartView:(JBBarChartView *)barChartView{
    NSLog(@"numberOfBarsInBarChartView: %lu", (unsigned long)[self.data count]);
    return [self.data count];
    }

  • (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index{
    NSLog(@"heightForBarViewAtAtIndex: %lu, height: %f", index, [[self.data objectAtIndex:index] floatValue]);
    return [[self.data objectAtIndex:index] floatValue];
    }

Debug log:

12:51:55.054 App[5116:60b] numberOfBarsInBarChartView: 3
12:51:55.055 App[5116:60b] heightForBarViewAtAtIndex: 0, height: 20.000000
12:51:55.056 App[5116:60b] heightForBarViewAtAtIndex: 1, height: 30.000000
12:51:55.057 App[5116:60b] heightForBarViewAtAtIndex: 2, height: 50.000000

bar-image

Nav bar background remains black

After viewing a chart in a VC and returning to the app VC, which has a navigation bar, the nav bar's bg or tint is black (using default values for bar chart, which has black bg/tint).

I have tried to change this behavior in the UI to revert to proper nav controller bg/tint but the nav button text color is also affected.

What can be done when the VC disappears to revert to the standard colorization ?

blank result

The following code gives me a blank result and that's all. No warning on compliation. If I touch the chart zone, index is always at -1

  • (void)viewDidLoad
    {
    [super viewDidLoad];

    [self initFakeData];

}

  • (void)loadView
    {
    [super loadView];

    JBLineChartView *lineChartView = [[JBLineChartView alloc]initWithFrame:CGRectMake(10, 150, 300, 200)];
    lineChartView.delegate = self;
    lineChartView.dataSource = self;

    self.lineChartView.frame = CGRectMake(10.0f, 10.0f, self.view.bounds.size.width - (10.0f * 2), 250.0f);

    lineChartView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    lineChartView.layer.borderWidth = 1;
    self.lineChartView.backgroundColor = [UIColor grayColor];
    [self.lineChartView setState:JBChartViewStateExpanded animated:YES];

    [self.view addSubview:lineChartView];

    [self.lineChartView reloadData];

}

  • (void)initFakeData
    {
    NSMutableArray *mutableChartData = [NSMutableArray array];
    for (int i=0; i<25; i++)
    {
    [mutableChartData addObject:[NSNumber numberWithFloat:((double)arc4random() / ARC4RANDOM_MAX) ]]; // random number between 0 and 1
    }
    _chartData = [NSArray arrayWithArray:mutableChartData];
    }

  • (CGFloat)lineChartView:(JBLineChartView *)lineChartView heightForIndex:(NSInteger)index
    {
    return [[self.chartData objectAtIndex:index] floatValue];
    }

  • (void)lineChartView:(JBLineChartView *)lineChartView didSelectChartAtIndex:(NSInteger)index
    {

    NSLog(@"index:%ld",(long)index);
    }

pragma mark - JBLineChartViewDataSource

  • (NSInteger)numberOfPointsInLineChartView:(JBLineChartView *)lineChartView
    {
    return [self.chartData count];
    }
  • (UIColor *)lineColorForLineChartView:(JBLineChartView *)lineChartView
    {
    return [UIColor blackColor];
    }
  • (CGFloat)lineWidthForLineChartView:(JBLineChartView *)lineChartView
    {
    return 5;
    }
  • (UIColor *)selectionColorForLineChartView:(JBLineChartView *)lineChartView
    {
    return [UIColor redColor];
    }
  • (void)lineChartView:(JBLineChartView *)lineChartView didUnselectChartAtIndex:(NSInteger)index
    {

}

  • (void)didReceiveMemoryWarning
    {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    }
  • (void)viewDidAppear:(BOOL)animated
    {
    [super viewDidAppear:animated];
    [self.lineChartView setState:JBChartViewStateExpanded animated:YES];
    }
  • (void)viewWillAppear:(BOOL)animated
    {
    [super viewWillAppear:animated];
    [self.lineChartView setState:JBChartViewStateCollapsed];
    }
    '''

Real time

Is it possible to use this for real time linear graphs? for example to show the acceleration x,y,z components whenever the delegate has new values?

JBBarChartView Bar Height Problem With Storyboard/Autolayout

When I setup my view controllers in a storyboard with autolayout, I end up with a JBBarChartView that starts animating the bars on viewDidAppear, but then the bars just stop and disappear (1st image below). On the other hand, an identical setup that I create in code rather than in storyboard works just fine (2nd image below).

img_3629
img_3628

Curved line charts

Wanted to see what you guys think of the possible option for curved/smooth line charts? Or if you have already consider it?

Either way, love what you're doing with this. Working great.

(This can be marked as an enhancement)

Using minimum of 0 as default

After I updated to the current version I got really confused with a BarChart having a minimum value above 0. In the earlier version 0 was used as the base value for bar height calculation. In the current version the lowest number is used. (Bar with 10, 20, 40 on 40px is shown with heights of 0px, 10px, 40px - not my expected 10px, 20px, 40px). It took some time until I figured out why this happened.

However, I think using 0 as default minimum value is what you would expect using a JBBarChart and therefore should be the default setting.

Btw: great tool and keep on with constant improvements!

Moving podspec to root

I think the podspec should be moved to the root as at the moment including JBChartView from a local folder doesn't work correctly.

NSInternalInconsistencyException - JBLineChartView // dataSource must implement

I've been using JBLineChartView and it has been working great, but now I'm getting this error:

*** Assertion failure in -[JBLineChartView padding], /Users/Psycho/Work/ios/bluewave/Pods/JBChartView/Classes/JBLineChartView.m:411
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView'
*** First throw call stack:
(0x309fafd3 0x3b145ccf 0x309faead 0x313a7d5b 0x76f3b 0x746c7 0x3631b 0x33349917 0x332f0c47 0x332f049d 0x33216d79 0x32e9462b 0x32e8fe3b 0x3322beab 0x33c03 0x3321b4cb 0x3321b289 0x333a738b 0x332c4d83 0x332c4b8d 0x332c4b25 0x33216d79 0x32e9462b 0x32e8fe3b 0x32e8fccd 0x32e8f6df 0x32e8f4ef 0x3321a401 0x309c625b 0x309c572b 0x309c3f1f 0x3092ef0f 0x3092ecf3 0x35850663 0x3327a16d 0x126c5 0x3b652ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException

The flow of my app is something like this:

  • I've four UIViewControllers in a Navigation Controller (All push segues) for
    • Year Selection
    • Month Selection (has charts)
    • Day Selection (has charts)
    • Day Details
  • Month and Day Selection UIViewControllers have JBLineChartViews
  • When I select a year, and go into Month Selection the Charts works perfectly
  • If I go further down into Day Selection, the charts works again
  • Now, if I go back to the first ViewController (Pop the views) and repeat the procedure (i.e. Go into Month Selection and Day Selection), the app crashes as soon as the Day Selection View is loaded with the above error.

I can't understand why is this happening, even though I implemented the above mentioned method and the chart loads in Month Selection the second time (but not in the Day Selection).

Here are the JBLineChartView delegate and datasource methods in my Day Selection View Controller:
screen shot 2014-06-24 at 4 55 23 pm

What about ios6

Dear developers,

It is really a nice chart, how could we make it work with ios 6? Any hints?

Regards,
Ahmed Hammad

Bar Highlight Offset Issue

I am using BarGraph a clear footer view, and the bar selection highlight offsets seem to be off - is there a know fix for this? In the demo, the footer has an opaque color so this issue doesn't show up.

photo

Multiple Lines on chart

Is it possible to show multiple lines on a chart? I would like to draw a chart representation to see the evolution of different events on the same chart.
Thank you!

Add bar/line caching for only visible content.

Table method is called for 'view' (barChartView: barViewAtIndex:) only visible cells. Currently data is loaded completely. Because it requires a lot of memory.

JBBarChartView -> UIView -> UIScrollView

Succinctly:
JBBarChartView *jbChartView = [[JBBarChartView alloc] init];
UIView *chartView = [[UIView alloc] init];
[chartView addSubview:jbChartView];
UIScrollView *chartScrollView = [[UIView alloc] init];
[chartScrollView addSubview:chartView];

Bars not drawn when all have the same height

When the BarChart data source method -(CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index returns the same value for every index somehow the bars are not drawn.

Add barViewAtIndex: to datasource

We are reaching a ceiling with how much we can customize bar views via protocol functions (barColorAtIndex.... etc).

Following the UITableView pattern, it's better to request a UIView subclass via barViewAtIndex:, leaving it up the implementor to customize the look & feel. The size of the subview (height and width) would be resized by the chart's implementation.

As a result, we have removed bar shadows via issue #4, as this is a specific implementation detail that shouldn't have been assumed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.