react-native-ios-charts icon indicating copy to clipboard operation
react-native-ios-charts copied to clipboard

Chart interactions

Open prithsharma opened this issue 8 years ago • 9 comments

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?

prithsharma avatar Nov 22 '16 14:11 prithsharma

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.

prithsharma avatar Nov 23 '16 10:11 prithsharma

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. 😄

prithsharma avatar Nov 23 '16 11:11 prithsharma

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.

prithsharma avatar Nov 23 '16 12:11 prithsharma

@Jpadilla1 did you get a chance to look at this?

prithsharma avatar Nov 25 '16 06:11 prithsharma

This a great PR, congrats.

basequatro avatar Nov 25 '16 11:11 basequatro

Sorry for the late response @prithsharma, will take a look at it today.

Jpadilla1 avatar Nov 25 '16 12:11 Jpadilla1

@Jpadilla1 did you get a chance to look at this one?

prithsharma avatar Jan 09 '17 20:01 prithsharma

@prithsharma cool, and I notice the author don't have enough time to continue maintain the project from this issue :(

L-Jovi avatar Jan 10 '17 02:01 L-Jovi

@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

wuxudong avatar Mar 09 '17 15:03 wuxudong