hongyin163 / react-native-chart-android

react native chart modules come from mpandroidchart.
206 stars 81 forks source link

Feature Request Pie Charts #11

Closed Kielan closed 8 years ago

Kielan commented 8 years ago

Hello first I'd like to start off by saying thanks for this repo, the best charting lib for android.

I see in the source PieCharts are partly built. Out of necessity I have started to make the API for a PieChart and forked this repo but as someone who has not used MPACharts, Java, or react-native much before this is a a slow process.

There is no PieChart component as far as I can tell for React Android. In my own project I have (hopefully temporarily) switched to creating a factory to render a native webview. From what I can reason this seems to be the most viable alternative approach.

I suppose this is a little bit of a feature request or at least to open up dialogue to discuss what outstanding parts of MPACharts need an API to react-native remain?

hongyin163 commented 8 years ago

@Kielan I will add piechart,thanks!

Kielan commented 8 years ago

@hongyin163 thanks so much hongyin I saw some commits trying it out now

Kielan commented 8 years ago

@hongyin163 I've attempted to make a PieChart and I'm pretty confident in saying that it does not currently work. I have referenced to MPAndroid charts as well as the native modules and I think some proptypes are missing that are required in the java.

If it does work maybe an example would be nice, pretty sure it does not though.

hongyin163 commented 8 years ago

@Kielan Sorry , I have not use PieChart in my project , so There is only java code , You can debug it in your project ,improve it when I have time , I will test PieChart in my project , thanks.

msathis commented 8 years ago

Pie chart is working fine. The code i used

const data = { xValues: [''], yValues: [{ data: [35, 22, 11, 18], label: '', config: { colors: randomColor({count: 4}) }}] }

<PieChart style={{flex: 1}} holeRadius={68} description={""} yAxis={{drawGridLines: false}} legend={{enable: false}} yAxisRight={{enable: false}} data={data} />

Kielan commented 8 years ago

I also have Pie chart working.

white-ubuntu commented 8 years ago
const data = {
xValues: [''],
yValues: [{ data: [35, 22, 11, 18], label: '', config: {
colors: ['red','yellow','blue','gray'])
}}]
}

<PieChart 
style={{flex: 1}}
holeRadius={68}
description={""}
yAxis={{drawGridLines: false}}
legend={{enable: false}}
yAxisRight={{enable: false}}
data={data}
/>

make it more easier to start.