jawbone / jbchartview Goto Github PK
View Code? Open in Web Editor NEWiOS-based charting library for both line and bar graphs.
License: Other
iOS-based charting library for both line and bar graphs.
License: Other
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]
On both the JBLineChartView and JBBarChartView:
I was wondering if was possible for the line not to go to zero if there is missing data. For example for a weight tracking graph, if a user missed a day rather than go to zero and then up again.
Any help appreciated.
example, in your demo, could one month rain fall be blank ?
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!
** 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:
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...
Do you guys have plans to put this on cocoapods http://cocoapods.org/? (All the big guys are doing it :P)
Is it possible to add a Y-Axis that shows X-Axis values and a background grid ?
I have displayed the 365 days in the x-axis in iPhone (Portrait) view. But i have face an issue in the in view last date (i.e today date) in the line chart by tracking the current date.
Is having any solution for this scenario?
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
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
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);
}
}
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!
Hello ! Nice framework first of all.
For single press on a bar, the detail label is not dismissing/disappearing, as it is for dragging.
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
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!
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!
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.
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:
UIViewControllers
in a Navigation Controller (All push segues) for
UIViewControllers
have JBLineChartViews
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:
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 ?
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 ?
I meen in a range from -1 and 1
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.
Hi,
This is in regards to the demo project.
By design, when you touch the line chart, a bar appears with a tool tip.
When you touch up, the bar disappears.
How can we control the height of the bar?
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):
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?
Any plans on adding negative bars? Bars that go below the X-axis?
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.
Can we create stacked bar? or multiple bar types in the same bar chart?
I think the podspec should be moved to the root as at the moment including JBChartView from a local folder doesn't work correctly.
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.
Allows us to do gradient lines
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
When using bar chart view without auto layout in iPhone 3.5", only the tips of the bars will be selectable. Pressing the bottom portion of the bars does not trigger selection.
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:
When a bar's height is taller than the previous maximum, the height of other bars should be reduced (normalized).
Chart view doesn't accommodate (internally) for large line widths (> 5 px)
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];
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
Dear developers,
It is really a nice chart, how could we make it work with ios 6? Any hints?
Regards,
Ahmed Hammad
Sorry. I was wrong.
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.
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?
Is it possible to have more than 1 chart displayed? say 2 of them, one overlaid the other?
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).
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)
In the required methods, the prototype of heightForBarViewAtIndex says:
Note that the word "At" appears twice in heightForBarViewAtAtIndex
Thanks for good charts.
This is common case.
Did you have plans for this feature?
May be I'll try to improve your code to support negative values.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.