Giter VIP home page Giter VIP logo

graphkit's People

Contributors

michalkonturek avatar ppaulojr 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

graphkit's Issues

Crashing on [self.graph reset] calling

I have to draw day, week, month and year graph in segmented view and when I try to change the segment tab just need to reset the graph lines and redraw graph but when I call [self.graph reset] in viewwillappear and call [self.graph draw] its crashing the app in _removeTitleLabels method.

  • (void)_removeTitleLabels {

    if (self.titleLabels.count > 0) {
    [self.titleLabels mk_each:^(id item) {
    [item removeFromSuperview];
    }];
    }
    self.titleLabels = nil;
    }
    -[_UILabelLayer convertPoint:fromLayer:]: message sent to deallocated instance
    Please help
    I'm using https://github.com/ermalkaleci/CarbonKit for plot graph for, today, week, month and year, when switch between the tabs I call draw method everytime but it still crash at some points

FR - Custom Labels

Initial request created by @crewshin:

Excellent little library you have here. Thanks for sharing.

If there's anything I could nitpick about it's the lack of control with the labels. That and for whatever reason I can't figure out how to keep my lines within the views frame if the value is above 200. They get clipped at the top of the view. Some kind of auto scaling would be nice.

Also a horizontal version of the bar chart would be nice.

Cheers

Graph not plotted correctly if I apply OrderedSet on title labels.

If I pass an array of titleValues e.g. [23 May, 31May, 31May, 31May, 31May]. Now I want X-axis to plot "31 May" one time only, for this I applied OrderedSet to get an array of unique values in "_constructTitleLabels" & "_positionTitleLabels" methods. This solved my problem of plotting only unique values on X-axis, but the line plotted on the graph is not proper, as it is plotted considering 5 values plotted on X-axis. Sharing a screen shot for the same.

screen shot 2017-06-06 at 11 32 16 am

Any help will be appreciated.

GKLineGraph issue

self.data = @[
    @[@70, @68, @65, @61, @63, @64],
    @[@70, @67, @64, @61, @59, @58],
];
self.labels = @[@"Apr", @"May", @"June", @"July", @"Aug", @"Sept"];

Smooth curves?

Possible to make the edges (point to point) smooth so it flows like a nice curve?

fix for the NaN exception on GKLineGraph

In the _positionYForLineValue method, the denominator ([self _maxValue] - [self _minValue]) may have 0 value. In this case, exception arise for NaN.

The fix should be:

int diff = ([self _maxValue] - [self _minValue]);
  CGFloat scale;
  if (diff > 0) {
    scale = (value - [self _minValue]) / diff;
  }else{
      scale = 0;
  }

Line Chart Crashes if it only has equal values for a line

Hi,

I have a chart with a single line
I set startFromZero as true
I set data values to [0,0]

you then get

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [20 nan]'

Caused by

(CGFloat)_positionYForLineValue:(CGFloat)value { CGFloat scale = (value - [self _minValue]) / ([self _maxValue] - [self _minValue]);

because ([self _maxValue] - [self _minValue]) == 0

I can try and add a possible pull request when I get chance. Thanks!

FR - Custom Labels and Plot Scaling

Excellent little library you have here. Thanks for sharing.

If there's anything I could nitpick about it's the lack of control with the labels. That and for whatever reason I can't figure out how to keep my lines within the views frame if the value is above 200. They get clipped at the top of the view. Some kind of auto scaling would be nice.

Also a horizontal version of the bar chart would be nice.

Cheers

FR - GKBar - add value labels

Great job!
I think if the value of the bar shown in the left side, it would be more intuitive, just like GKLineGraph.

GKBarGraph uses same name as an Apple private selector

When validating the ipa in Xcode 6, I receive a warning saying that the GKBarGraph class is using a method with the same name as an Apple private selector.

The method in question is - (NSInteger)numberOfBars;

If I refactor the name to something like numberOfGraphBar and revalidate, it passes.

This is new in Xcode 6/iOS8 SDK it looks like.

Michael

Tutorial

How i can use it in my project ?
I added it to my project but it's not working.
Plz help

Autolayout issues.

Hi Michal,

I am running a strange issue, the view that I assigned the GKLineGraph is autolayouting its height, but the graph will only show its entire content if I switch the form factor to 3.5'', and than it will only increase if a switch back to 4''. Taking that is just a visual aid, shouldn't the graph be also autoresizing?

Not conform to protocol in Swift project

I got an error like this:

Type 'MyViewController' does not conform to protocol 'GKLineGraphDataSource'

Here is my code:

class MyViewController: UITableViewController, GKLineGraphDataSource {

    @IBOutlet weak var graphView: GKLineGraph!
    var data = NSArray()
    var labels = NSArray()

    override func viewDidLoad() {
        super.viewDidLoad()

        self.data = [20,40,20,60,40,93,80]
        self.labels = ["2001", "2002", "2003", "2004", "2005", "2006", "2007"]        
        self.graphView.dataSource = self
        self.graphView.lineWidth = 3.0
        self.graphView.valueLabelCount = 6
        self.graphView.draw()
    }

    // #pragma mark - GKLineGraphDataSource
    func numberOfLines() -> NSInteger {
        return 1
    }

    func colorForLineAtIndex(index : Int) -> UIColor {
        return UIColor.gk_amethystColor()
    }

    func valuesForLineAtIndex(index : NSInteger) -> NSArray {
        return self.data
    }

Any idea? Thanks

NSInvalidArgumentException Error When Passing an array of NSNumbers

I was following the example and for the ".data" array i did something like this:

      self.data = @[
                  @[self.arrayOfValues]
                  ];


    self.graph.dataSource = self;
    self.graph.lineWidth = 3.0;

    self.graph.valueLabelCount = 6;

    [self.graph draw];

where "arrayOfValues" is a NSMutableArray of NSNumbers. When I try to draw the graph I get an error that says:

-[__NSArrayM floatValue]: unrecognized selector sent to instance 0x138a243d0
2015-12-15 12:28:59.675 Roomie Internal[6732:2644827] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM floatValue]: unrecognized selector sent to instance 0x138a243d0'

So I am wondering if passing a NSNumber type is not allowed, or what might be the problem here?

titleForBarAtIndex on Bar Graph not treated as Optional

the datasource delegate specifies

@optional
- (UIColor *)colorForBarAtIndex:(NSInteger)index;
- (UIColor *)colorForBarBackgroundAtIndex:(NSInteger)index;
- (CFTimeInterval)animationDurationForBarAtIndex:(NSInteger)index;

- (NSString *)titleForBarAtIndex:(NSInteger)index;

however in it is being treated as required in the code..

Several Errors When Loading BarGraph

I've already used GraphKit in another project as I liked it very much, however in a new project I'm working on I seem to be facing several issues.

I installed using cocopods (pod 'GraphKit'), and my project builds fine, however when it runs it crashes and I initially got this stack trace error:

-[UIView setDataSource:]: unrecognized selector sent to instance 0x10962da60
2014-08-19 10:04:28.310 Blackout[63079:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setDataSource:]: unrecognized selector sent to instance 0x10962da60'

Then I added a [GKBarGraph Class] in the AppDelegate which I thought would solve the issue, but then I got the following errors:

2014-08-19 10:01:21.849 Blackout[63044:60b] +[UIColor gk_turquoiseColor]: unrecognized selector sent to class 0x10118b9b0
2014-08-19 10:01:21.852 Blackout[63044:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor gk_turquoiseColor]: unrecognized selector sent to

^This was when I instantiated the BarGraph via storyboard (and set its class to GKBarGraph).

I then also tried adding it programatically and got:

2014-08-19 10:07:29.535 Blackout[63115:60b] *** Assertion failure in -[GKBarGraph _construct], /Users/royhermann/Desktop/Dev/Blackout/Pods/GraphKit/Source/BarGraph/GKBarGraph.m:94
2014-08-19 10:07:29.537 Blackout[63115:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'GKBarGraph : No data source is assgined.'

^When in fact i did set the current view controller to be its delegate.

Is there something wrong with the framework, or am I (more likely) missing something here?

Thanks

Multi line graph with unequal data set

Hi,
Am trying to draw a multi-line graph, what i have noticed is, if the data set have same number if values then only line will be drawn complete, i have attached a sample project, tap on, line graph and see the blue line , if the data is this ,line is perfect
self.data = @[
@[@10, @4, @8, @2, @9, @3, @6],
@[@1, @2, @3, @4, @5, @6, @10]
];

if the data has been changed to this
self.data = @[
@[@10, @4, @8, @2, @9, @3, @6],
@[@1, @2, @3]
];
line doesn't reach till the end, lets assume i have number 3 which is for year 2007 and number 2 is for 2003 but i dont have any data for between 2003 and 2007 but i want by line to reach 2007 to reach till the end. i have attached a sample project, please check line graph.
GraphKit-master 4.zip

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.