Giter VIP home page Giter VIP logo

pnchart-swift's Introduction

PNChart-Swift

PNChart(https://github.com/kevinzhow/PNChart) Swift Implementation

Installation

This isn't on CocoaPods yet, so to install, add this to your Podfile

pod 'PNChartSwift',:git => 'https://github.com/kevinzhow/PNChart-Swift.git'

pnchart-swift's People

Contributors

bradddd avatar corosuke avatar daveadams88 avatar karupanerura avatar kevinzhow avatar ladiesman218 avatar vernon99 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

pnchart-swift's Issues

XCODE 6 GM issue

func getYValueMax(yLabels:NSArray) {

  // XCODE 6 GM      
 //PNBarChart.swift:355:43: 'AnyObject?' does not have a member named 'floatValue'
//

var max:CGFloat = CGFloat(yLabels.valueForKeyPath("@max.floatValue").floatValue)

    if max == 0 {
        yValueMax = yMinValue
    }else{
        yValueMax = max
    }

}

XCODE 6 GM issue

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    var viewController:UIViewController = segue.destinationViewController as UIViewController
    var ChartLabel:UILabel = UILabel(frame: CGRectMake(0, 90, 320.0, 30))

    ChartLabel.textColor = PNGreenColor
    ChartLabel.font = UIFont(name: "Avenir-Medium", size:23.0)
    ChartLabel.textAlignment = NSTextAlignment.Center

//
////MasterViewController.swift:39:33: Cannot convert the expression's type 'String?' to type 'NSString'
//
switch segue.identifier as NSString {
case "lineChart":
//Add LineChart
ChartLabel.text = "Line Chart"

when yValueMax == yValueMin the app crash !

The easy solution is that you should add a piece of code in PNLineChart.swift,Found the property public var charade:NSArray =[]{...}
add code below yValueMin = yin; yValueMax = yMax; add judge if yValueMax == yValueMin{ yValueMax += 1// you could modify the value}

Support for Legends and Circle/Pie/Scatter charts

In the PNChart readme (Objective C) it shows that there is functionality for circle, pie, and scatter charts as well as legends for your chart. When will this functionality be available in the Swift version of this project?

Update to Xcode6 Beta4

Now, Xcode6 Beta4 had been around for a couple of days, the notable change was the Access control added. You should update to the Beta4.

Unable to run the ExampleApp

Hi! I am trying to run the example app but i am getting this error:

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

I understand i need to install cocoa pods, but i am unclear as to why if i am using swift?

No such module 'PNChartSwift'

I got this error message in MasterViewController.swift

/Users/MNurdin/Documents/Github/PNChart-Swift/ExampleApp/ExampleApp/MasterViewController.swift:10:8: No such module 'PNChartSwift'

Please advice. Thank you.

unable to compile in Swift beta 5

like this tool so far, and plan on using it on one of my projects but now it won't compile on beta 5 when it worked on beta 4. Anyone else tried it? When I remove the PNChart files my project compiles and runs. It complained about adding override to init functions and after that now I get the error below.
Referring to an argument in another function!
store %swift.type* %T, %swift.type** %2
LLVM ERROR: Broken function found, compilation aborted!
Command /Applications/Xcode6-Beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
I saw that in another post you were going to make some changes for beta 5, so maybe this will be fixed with that update.
Thanks so much

Error when running strokeChart

Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void CGPathMoveToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat), file Paths/CGPath.cc, line 254.

It's happening on progressline.moveToPoint(CGPointMake(x, y))

My code is pretty simplistic:

            var weekData:NSDictionary = JSON["week"] as! NSDictionary
            // Example: { "02/15": 7 }

            self.chartView?.xLabels = weekData.allKeys
            var data = PNLineChartData()
            data.color = UIColor(red: 77.0 / 255.0, green: 186.0 / 255.0, blue: 122.0 / 255.0, alpha: 1.0)
            data.itemCount = weekData.allKeys.count
            data.getData = ({(index: Int) -> PNLineChartDataItem in
                var yValue:CGFloat = weekData.allValues[index] as! CGFloat
                var item = PNLineChartDataItem(y: yValue)
                return item
            })
            self.chartView?.chartData = [data]
            self.chartView?.strokeChart()

Fails when tapped on multiline graph

It works fine with single line graph and no errors when tapped on graph but when multi line graph is plotted, it fails on tapping the graph with the following error

Could not cast value of type '__NSArrayM' (0x102bb48d8) to 'PNChartSwift.PNValue' (0x10280fba0).

How can I use this library from another project?

A bit of a noob question, but I'm looking to use the PNChart-Swift library in a swift project I'm working on. Is there a trick to using is as a framework, or referencing it from an external project?

Question on ability to reload chart

I'm using a pieChart (which I love btw)... When a user taps a cell in a tableView, I want to reset the pieChart so that it animates while updating to display the new data. Is there a good way to go about this. So far all I have done is remove the subview and then re-add it but the pie chart doesn't animate back in, and only the labels to the pie slices look like they animate back in. Not sure how to go about this so that the pieChart will show re-animating into view with the new data

addobserver

Hi, how I can make the current value automatic checking and update value automatic if value has changed

PROBLEM SOLVED!

   NSTimer.scheduledTimerWithTimeInterval(0.9, target: self, selector: "updateValues", userInfo: nil, repeats: true)
}
func updateValues() {
    lineChart!.updateChartByCurrent("YOUR NEW VALUE!!")
}

}

Are there any efforts to enable updateChartData for swift?

I love using this, but I'm needing to remove the view and redraw/readd 30 times per second, instead of updating the data dynamically. Are there any motions to enable updateChartData in this swift version?

Also, what's with the state of the issues on this git..? so many nonsensical posts.. must be frustrating...

希望支持swift3.0或者2.3

很喜欢用这个库,简单实用,但是一直没有支持swift3.0或者2.3.希望作者能够支持一下!谢谢!

ScatterChart, Circle, and Pie Chart in Swift?

Any chance you are considering porting the other charts into Swift? I am looking to use the ScatterChart for a project (currently all in Swift) and trying to decide if I need to use the PNChart and bridge to it from my swift code or use the PNChart-swift library.

change font size and color of XY axis

I want to change the font size and color of the X and Y labels on the PNLineChart, they default to a greish color and in my case a bit small to read.
Also is it possible to force the min and max of the labels on the Y axis?

ios simulator screen shot 2 jun 2015 23 36 56

No circle chart

Hi I can't seem to find a circle chart example or any points to the code? Is this left out?

Set PNBarChart.strokeColors fail

hi!~
In PNBarChart.swift, the logic is that if user have set the strokeColor and strokeColors at the same time, then use StrokColor first.(line 243-248)
However, strokeColor:[UIColor] has a default value that is PNGreenColor, so setting value to strokeColors:[NSArray] is in vain because of that. (line 247 can not be reached)

Crash when instantiating PNBarChart

Hello everyone,

I discover PNChart today and I'm very glad because it fits perfectly with my needs. But I have a crash when I try to instantiate a simple PNChartBar. I only want to display a simple chart.
Here is my code :

capture d ecran 2015-04-27 a 18 38 27

When I run it, I get an error when I try to fill the yvalue :

capture d ecran 2015-04-27 a 18 39 31

I probably missed something simple, so if someone could give me an advice, it would be great!

PNBarChart crash if all yValues are 0.

In the code below, if all values are 0, yValueMax tries to ge yMinValue. But since yMinValue is not initialized, the app crashes.

func getYValueMax(yLabels:NSArray) {
    let max:CGFloat = CGFloat(yLabels.valueForKeyPath("@max.floatValue") as! Float)
    if max == 0 {
        yValueMax = yMinValue
    } else{
        yValueMax = max
    }
}

Can be temporarily fixed by manually setting barChart.yMinValue when initializing.

Swift 1.2

Will you upgrade PNCharts to Swift 1.2? Thanks

labels density

Hi, first of all, thanks for library!
I try to figure out how to set line chart to show labels correctly if there are many same values.

For example:

lineChart.xLabels = [
            "27.3","28.3","29.3","30.3","31.3","1.","2.",
            "3.","4.","5.","6.","7.","8.","9.",
            "10.","11.","12.","13.","14.","15.","16.",
            "17.","18.","19.","20.","21.","22.","23.",
            "23.","24."
        ]

var data01Array: [CGFloat] = [
            2, 4, 5, 3, 5, 2, 3,
            1, 4, 2, 0, 5, 6, 4,
            3, 4, 2, 1, 5, 0, 3,
            2, 5, 4, 1, 3, 2, 4,
            1, 5
        ]

produces line chart with same y labels with overflow:

labels

There should be only 7 y labels 0, 1, 2, 3, 4, 5, 6.

Thanks for help.

Xcode 6 Final Version not compiling

Looks like a great piece of work but does not compile under XCODE6 (final) right now. About 20 issues, becoming more after I started to fix some. It would be great if you could take a look! thx

Swift Compiler Error PNBarChart.swift

on Line 354: I get the following Error:
PNChart/PNBarChart/PNBarChart.swift:354:43: 'AnyObject?' does not have a member named 'floatValue'

Any idea how to fix this issue? I've Swift iOS 8.1

PNChart-Swift Licence

Hi Kevin,

Noticed the PNChart-Swift repo doesn't include a license like the Objective C version does. Is it licensed under MIT license as well? Can you post the license right in the Swift repo?

Regards,
OutsideRide

show Y labels in bar chart

Hi! I'm using the demo app that's included on the repository but I'm having troubles showing the YLabels on the Bar Chart. The values are shown but they're all 0. Here's the code:
captura de pantalla 2015-02-23 a las 15 31 59

stacked bar chart

How to make this penchant bar chart in a stacked form with 3 or more bar for each label

License

Is this distributed under the MIT license as the ObjC code?

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.