Charts: Support for React Native

Created on 8 Dec 2015  路  8Comments  路  Source: danielgindi/Charts

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

enhancement help wanted

All 8 comments

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 :)

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.

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

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

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 nice work :+1:

+1

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coop44483 picture coop44483  路  3Comments

cilasgimenez picture cilasgimenez  路  4Comments

ahmedsafadii picture ahmedsafadii  路  3Comments

JW00332 picture JW00332  路  4Comments

BrandonShega picture BrandonShega  路  4Comments