react-native-ios-charts
react-native-ios-charts copied to clipboard
Chart interactions
Work in progress
Since I am not very familiar with both Objective-C and Swift, bootstrapping PR for early comments. Apart from general comments, looking for suggestions on the question below:
- Since the implementation for the delegate would mostly remain same for all chart types, how can I write the implementation once instead of copying it over to class definitions of all charts?
I tried to add an onSelect
property to RNLineChart and use it in the chartValueSelected
delegate implementation. Unfortunately, I am facing a weird error that Value of type RNLineChart has no member 'onSelect'
. Properties declared in Objective-C should be accessible in Swift class definitions, but I am most probably missing some basic concept.
Concerned commit - https://github.com/Jpadilla1/react-native-ios-charts/pull/72/commits/ffceb1f58f3d1dba7396f281fe169629efcb5b18
@Jpadilla1 would you be able to help on this? The intermixing of Swift and Objective-C code is making it more confusing for a noob like me.
So I made a little progress. In the commit https://github.com/Jpadilla1/react-native-ios-charts/pull/72/commits/dd3fe04874b0c4daf2c425602a23d4dae6285586, I was able to get hold of the onSelect
property using an instance variable and pass on an event to JS.
@Jpadilla1 please take a look and see if this looks OK to you. I can really use some Objective-C/iOS knowledge here. 😄
Selection/unselection selectors work for LineChart now. @Jpadilla1 please review. If there is a neater way than copying the delegate implementation to all chart class definitions, I'll really appreciate the suggestion.
@Jpadilla1 did you get a chance to look at this?
This a great PR, congrats.
Sorry for the late response @prithsharma, will take a look at it today.
@Jpadilla1 did you get a chance to look at this one?
@prithsharma cool, and I notice the author don't have enough time to continue maintain the project from this issue :(
@prithsharma chartValueSelected listener is also implemented at https://github.com/wuxudong/react-native-charts-wrapper . and it is shared among all chart type. may be you will want to take a look