Giter Club home page Giter Club logo

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

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]

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!

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...

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

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

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];
    }
    '''

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!

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.

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!

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!

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.

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

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 ?

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 ?

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.

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;

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?

Negative Bars?

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

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.

Stach bars?

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

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.

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.

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

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

`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

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];

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

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

`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.

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)

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

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.