Open goocarlos opened 9 years ago
I've been working with this library with Swift as well, and have had to make a few changes to make it more Swift-friendly. You can take a peek/fork them here: https://github.com/adoxner/PNChart
Have nothing to do with swift! yLabelFormatter function pointer (block) is missing and there is no default for it. Here is how you can fix it
PNBarChart * barChart = [[PNBarChart alloc] initWithFrame:frame];
//Do whatever
barChart.yLabelFormatter = ^(CGFloat yValue){
return [NSString stringWithFormat:@"%1.f",yValue];
};
//Now do setY and SetX
[barChart setYValues:...];
Note that I used barChart as an example, this can be applied to any PNChart.
The problem is that you're adding 7 values on the XLabels and just 5 in YValues. It has to be the same number. The YLabels appear on your bar chart? I can't get them to work.
@acroventus That is a different thing, I don't think it's related to yLabelFormatter not being defined anywhere.
@mojtabacazi I think you're right but It might help anyways. I'm having troubles showing my YLabels on the bar chart with swift. I publish the new Issue, can you give me a hand with that please?
@acroventus sure, but not seeing any new issue, link?
@mojtabacazi Here's the link for the issue on the Swift version: https://github.com/kevinzhow/PNChart-Swift/issues/31
this work for me
@goocarlos: based in your example and the corrections made by @adoxner, just replacing the conflicting line with the fixed in the @adoxner code, your example works fine.
I am a beginner for iOS and really need some help from here. It has a question when I run this PNChart on the Ojb-C version.It seems like there is no such head file named UICountingLabel.h in the project. So...how can I fix this problem?
I use PNChart v0.7.5 with Swift at a New Project.