Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineChart ylabels #125

Closed
PhilJay opened this issue Dec 12, 2014 · 6 comments
Closed

LineChart ylabels #125

PhilJay opened this issue Dec 12, 2014 · 6 comments

Comments

@PhilJay
Copy link

PhilJay commented Dec 12, 2014

I have an issue concerning the labels on the y-axis of the LineChart.

For some reason, I have weird numbers appearing below the actual labels of my LineChart.

See the image here: (0 - 7 are my actual numbers, the large numbers below are the ones I'm talking about)
bildschirmfoto 2014-12-12 um 21 34 18

Anyone know how to fix this?

@kevinzhow
Copy link
Owner

Are you using the latest version 0.5.6 ?
if you are, please post you code, so that I can debug on my side.

@PhilJay
Copy link
Author

PhilJay commented Dec 12, 2014

Thank you for your fast response. Yes I am using the latest version 0.5.6
As a matter of fact I was just able to resolve the issue by myself.

For everyone facing the same issue:

I was setting the data for the chart "in a wrong way":

lineChart.chartData = [];

for .... {
     var lineData = PNLineChartData();
    // build data object...

    lineChart.chartData.append(lineData);
}

In order to get rid of the issue, add your data like this:

var data: [AnyObject] = [];

for .... {
     var lineData = PNLineChartData();
    // build data object...

    data.append(lineData);
}

lineChart.chartData = data;

For some reason, PNChartData objects cannot be appended one by one to the chartData array. You need to set the whole array at once.

Thank you anyway, great library!

@kevinzhow
Copy link
Owner

Yes, this lib was not designed for updating data dynamically.
But I am having fun with making it happen.

@PhilJay
Copy link
Author

PhilJay commented Dec 12, 2014

Yep, good to know!

Follow up question: Is there any way to reduce the space between x-labels and the lower (bottom) points of the lines? As you can see in my image there is quite a lot of space:
bildschirmfoto 2014-12-12 um 21 56 18

@kevinzhow
Copy link
Owner

Well, You need to dive into the source code.
For the first question.
https://github.com/kevinzhow/PNChart/blob/master/PNChart/PNLineChart.m#L107

For the 2nd one
https://github.com/kevinzhow/PNChart/blob/master/PNChart/PNLineChart.m#L283

@PhilJay
Copy link
Author

PhilJay commented Dec 12, 2014

Thank you for pointing out the correct lines in the source code to look at. I just modified it to my desires!

Again, great library!

@PhilJay PhilJay closed this as completed Dec 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants