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

image instead of text on Y Axis #233

Closed
Yoooj opened this issue Mar 14, 2017 · 2 comments
Closed

image instead of text on Y Axis #233

Yoooj opened this issue Mar 14, 2017 · 2 comments

Comments

@Yoooj
Copy link

Yoooj commented Mar 14, 2017

Greetings,
I was wondering if You can accomplish something like this using SwiftCharts. Any tips?

y_axis_images

Thanks in advance.

@ivnsch
Copy link
Owner

ivnsch commented Mar 14, 2017

Yep, in the current release version this is very easy. You can display these images as if they were chart points. You just have to use a ChartPointsViewsLayer, similar to how it's done here. You have to pass chart points that correspond to the locations of the images, e.g. (origin.x, 1), (origin.x, 2), (origin.x, 3), etc. (it doesn't have to match 100% - the location, in this case along the y-axis just serves as guide for you to position the images).

In master it's a bit more complicated, since the inner space is clipped, and if you use zooming and panning (the current release version doesn't support it) you also have to ensure that the images only move along the y axis, i.e. don't move to left or right like it would happen with normal chart points. For all this you can orient with this example. It's the one with black background and landscape mode in the readme. You can see at the right side 3 markers, which work exactly like your images. You could try, as a start, to modify this example to display images instead of markers and then pass chart points to their layer that position them at even intervals. There are many things in this example you don't need - just focus on the part with the markers.

I recommend using master, if you want to use zooming and panning and of course because it's more up to date.

@Yoooj
Copy link
Author

Yoooj commented Mar 15, 2017

Solid answer. Thank You very much :)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants