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

Extending Views to create custom views isn't working due to file private and internal properties #408

Open
arthursady opened this issue Jan 24, 2020 · 0 comments

Comments

@arthursady
Copy link

In the wiki we can find this session under custom views:

Custom views
All bar layers allow to pass a generator that returns instances of ChartPointViewBar (or ChartPointViewBarStacked in the case of stacked bars), which extends UIView. You can subclass these classes to customize the views however you want, allowing to add e.g. outlines, patterns (e.g. for hatched bars) or any other kind of effect.

If you actually try to extend ChartPointViewBarStacked for instance, all the variables you need to access in order to customize the view bezierpath for instance are internal or fileprivate, therefore either you recreate the whole class(which will require other classes that we can't import with just the import SwiftCharts import or that will also have the same problems with fileprivate and internal variables.)

I found this out trying to make a bar chart that would have rounded top corners and is scrollable in the x axis. Everything is fine if I try things separately. However the current logic for stacked bars rounded corners stops working if we change the chart scaleX. I believed it would be possible to extend the ChartPointViewBarStacked and change the corners logic, but so far I have been unable to do so. I will possibly try manually importing the lib instead of using cocoapods.

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

1 participant