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

How to add marker to center position in ios charts while scrolling horizontally with increasing scaleX and enabling drag #2658

Closed
hananRiazz opened this issue Aug 1, 2017 · 2 comments

Comments

@hananRiazz
Copy link

hananRiazz commented Aug 1, 2017

I am scrolling chart horizontally by increasing scaleX value and enabled drag as described in answer of this question

https://stackoverflow.com/questions/36884745/set-an-horizontal-scroll-to-my-barchart-in-swift/36907495#36907495

I want to add marker at center position when user scrolls horizontally. I know "chartTranslated" delegate is called whenever user drags the chart but it doesn't contain the value of "ChartDataEntry" and "Highlighted" like in "chartValueSelected" delegate method.

@liuxuan30
Copy link
Member

liuxuan30 commented Aug 3, 2017

markers has nothing to do with your scale or scrolling. To draw markers you only need to give highlight object

    /// draws all MarkerViews on the highlighted positions
    internal func drawMarkers(context: CGContext)

But notice if you want to use marker not on what you have highlighted, you may need to create another highlight object and manually passed to

// callbacks to update the content
marker.refreshContent(entry: e, highlight: highlight) 
// draw the marker
marker.draw(context: context, point: pos)

And you also may need to override some method or change the source code. Always remember the library can't satisfy everyone's demand, so don't think the library can do anything you want without changing the source code or override

Also remember ChartMarker is protocol now, it's highly flexible
public protocol IMarker: NSObjectProtocol

@hananRiazz
Copy link
Author

hananRiazz commented Aug 3, 2017

Thanks a lot for your support.

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