React native with d3 and webView

Viewed 2635

I trying to get my head around how to add d3 graphs to react native app. Only information I found is to use webView but would be very appreciated to have some example of working stuff maybe in github.

2 Answers

I made a pie chart with d3 without using a webview. Using d3, you generate your chart and place the resulting SVG code to a Shape component:

<Surface width={100} height={100} >
  <Group x={50} y={50} >
    <Shape d={'M...Here goes the svg code'} 
            stroke={'#000'} 
            strokeWidth={1} 
            fill={'#FF0000'} />
  </Group>
</Surface>

A simple example can be found here: https://github.com/radogost/PieChartExample

Maybe using this approach, you are able to create live updated charts?

Related