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

restrainViewPort is not working. Chart stays the same! #2423

Closed
hernanarber opened this issue May 9, 2017 · 2 comments
Closed

restrainViewPort is not working. Chart stays the same! #2423

hernanarber opened this issue May 9, 2017 · 2 comments

Comments

@hernanarber
Copy link

hernanarber commented May 9, 2017

Hi:

in order to obtain same widths and same spaces in my Chart (barChart) I had to add dummy values to both ends, left and Right, when Data is Less that my design requirements.

I Would Like to LIMIT the Scrolling to the REAL Values and leave these "Dummy" Values Out of Range for Scrolling.

I Tried the Following:
let barSize = Double(view.frame.size.width) / Double(maxBarsPerScreen)
barChartView.viewPortHandler.restrainViewPort(offsetLeft: CGFloat(Double(leftSideDummies)*barSize), offsetTop: 0.0, offsetRight: CGFloat(Double(rightSideDummies)*barSize), offsetBottom: 0.0)

The Result is that the Chart is Exactly the same and STILL Scrolls to the Dummy Values.

Could you please help me out? What else can I Try?

Thanks

@hernanarber hernanarber changed the title restrainViewPort not working restrainViewPort is not working. Chart stays the same! May 10, 2017
@hernanarber
Copy link
Author

Well, just to Update:

I Now Tried:
barChartView.setViewPortOffsets(left: CGFloat(Double(leftSideDummies)*barSize), top: 0.0, right: CGFloat(Double(rightSideDummies)*barSize), bottom: 0.0)

Which Runs the restrainViewPort in the MainThread and Actually Performs this operation.

However, this Changes the SIZE of the Whole Chart regarding the View and Adjusts all the Graph Accordingly.

I ONLY Want to Limit the SCROLLING to certain Values. Can Anyone Help me?

Thanks

@hernanarber
Copy link
Author

hernanarber commented May 11, 2017

Ok I THink I Solved this and it was Simpler than I Thought:
`
// Limiting the Drag:

        barChartView.viewPortHandler.setDragOffsetX(CGFloat(Double(0 - leftSideDummies)*barSize))

`

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