Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Support for React Native

Open gutenye opened this issue 8 years ago • 9 comments

I'm looking for a chart library for React Native, is there's a way to do it?


This issue is dedicated for React Native support, any info and discussions on this matter should go here

gutenye avatar Dec 08 '15 09:12 gutenye

I'm currently trying to develop a module to use this lib in react native. I'm really new in Swift or Objective C so it's quite difficult for me.

I follow a tutorial to bind swift module to react native and it's quite easy : http://browniefed.com/blog/2015/11/28/react-native-how-to-bridge-a-swift-view/

But for this lib I don't really know where to start.

Your help is welcome :)

DavoCg avatar Dec 08 '15 14:12 DavoCg

I'm also new to Apple Development. I've followed your tutorial, only get importing works, but can not get chart showing. I need some help, what's missing with below code?

  LineChartView *chart = [[LineChartView alloc] init];
  chart.descriptionText = @"hello";
  chart.noDataTextDescription = @"You need to provide data for the chart.";

  NSMutableArray *xVals = [[NSMutableArray alloc] init];
  [xVals addObject:@"1"];
  [xVals addObject:@"2"];

  NSMutableArray *yVals = [[NSMutableArray alloc] init];
  [yVals addObject:[[ChartDataEntry alloc] initWithValue:1 xIndex:1]];
  [yVals addObject:[[ChartDataEntry alloc] initWithValue:2 xIndex:2]];

  LineChartDataSet *set1 = [[LineChartDataSet alloc] initWithYVals:yVals label:@"hello"];

  NSMutableArray *dataSets = [[NSMutableArray alloc] init];
  [dataSets addObject:set1];

  chart.data = [[LineChartData alloc] initWithXVals:xVals dataSets:dataSets];

  return chart; // the view is used by React Native
  // return [[UIDatePicker alloc] init]; // e.g. this works fine.

Build and run have no errors, but the app show as blank.

gutenye avatar Dec 09 '15 07:12 gutenye

Has anyone started a separate GitHub project for react native bindings to ios-charts? It'd be good to pool resources.

tannewt avatar Dec 16 '15 00:12 tannewt

I do not use React (yet?) but we'll leave this issue for React people coming here - so you could all join forces :-)

danielgindi avatar Dec 16 '15 19:12 danielgindi

I've been working on this library https://github.com/Jpadilla1/react-native-ios-charts in the past few weeks that has react-native bindings to ios-charts. It currently supports Bar chart and Line chart with most of their properties. You can view the properties here https://github.com/Jpadilla1/react-native-ios-charts/blob/master/components/BarChart.js#L131-L389

Jpadilla1 avatar Jan 11 '16 21:01 Jpadilla1

@Jpadilla1 nice work :+1:

gutenye avatar Jan 12 '16 05:01 gutenye

+1

MattyK14 avatar Feb 07 '17 19:02 MattyK14

I extended https://github.com/Jpadilla1/react-native-ios-charts. Now it support both android and iOS. You can find it here https://github.com/wuxudong/react-native-charts-wrapper

wuxudong avatar Mar 12 '17 01:03 wuxudong

any love for this?

lukasa1993 avatar May 12 '22 19:05 lukasa1993