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

moveViewToX #258

Closed
donaldkingdt opened this issue Jul 30, 2015 · 12 comments
Closed

moveViewToX #258

donaldkingdt opened this issue Jul 30, 2015 · 12 comments

Comments

@donaldkingdt
Copy link

Hi,

I'm trying to set the chat to scroll to last value in data set X using moveViewToX(entries.count) but this doesn't seem to move to the last value. Any Ideas?

Cheers

@danielgindi
Copy link
Collaborator

You are passing an invalid index

@donaldkingdt
Copy link
Author

My data set has up to 1100 data points, i want to move to the last index. Shouldn't this be the right value? if not, how can i get it?

@danielgindi
Copy link
Collaborator

1099

On Thu, Jul 30, 2015 at 3:32 PM, donaldkingdt [email protected]
wrote:

My data set has up to 1100 data points, i want to move to the last index.
Shouldn't this be the right value? if not, how can i get it?


Reply to this email directly or view it on GitHub
#258 (comment)
.

@donaldkingdt
Copy link
Author

How is that about? pls explain as this should be dynamic. 1099 doesn't work

@danielgindi
Copy link
Collaborator

The first item is at 0

@donaldkingdt
Copy link
Author

Exactly my point. The last item should be at lastItem.count right?

@danielgindi
Copy link
Collaborator

No. If you have two items, and first one is 0, then the second one is 1. Which means that you cannot pass 2 for the last item of two, but 1.

@donaldkingdt
Copy link
Author

self.chartView.setVisibleXRangeMaximum(20)
self.chartView.moveViewToX(self.measurementEntries.count - 1)

self.measurementEntries.count has 1136 entries now but I don't want to show all of this on the chart as it would be just an overkill. I only want to show a maximum of 20 at anytime but initially, scroll to the last value in the index.

does this look right?

@donaldkingdt
Copy link
Author

Fixed. Had to call self.chartView.moveViewToX(self.measurementEntries.count - 1) in ViewDidAppear().

Cheers Daniel. BTW, @danielgindi I sent you a PayPal donation yesterday :)

@yas375
Copy link
Contributor

yas375 commented Aug 5, 2015

Had to do similar thing in viewDidAppear as well. It results in weird jump to the most recent values. But if I do this in viewWillAppear then I get the wrong position with partly blank graph.

Happy to share more details about the issue if needed.

@NicolasLourenco
Copy link

I've the same issue.
I have 28 points and I show only 4 in a view.
I want to show (in the first time) the last point of my dataSet. But with this method, I've a blank space a the right of my last point. Any idea?

[_lineChartView moveViewToX:_lineChartView.data.yValCount-1];
[_lineChartView zoom:7 scaleY:0 x:0 y:0];

@daisoreanu
Copy link

the thing is from what I noticed that you will get another plotted value to the right side, also you should change the order of the lines from:
[_lineChartView moveViewToX:_lineChartView.data.yValCount-1]; [_lineChartView zoom:7 scaleY:0 x:0 y:0];

to:

[_lineChartView zoom:7 scaleY:0 x:0 y:0]; [_lineChartView moveViewToX:_lineChartView.data.yValCount-1];

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

5 participants