title: React Native how to create a VictoryPie from nested data
body: <p>In my React Native application, I am accessing data from my store in the following form:</p>
  <pre><code>Array [
    Checkout {
      &quot;date&quot;: 2020-12-27T13:24:08.734Z,
      &quot;id&quot;: &quot;Sun Dec 27 2020 08:24:08 GMT-0500 (EST)&quot;,
      &quot;items&quot;: Array [
        Object {
          &quot;productBrand&quot;: &quot;Microsoft&quot;,
          &quot;productCategory&quot;: &quot;Gaming&quot;,
          &quot;productId&quot;: &quot;p1&quot;,
          &quot;productTitle&quot;: &quot;Xbox&quot;,
          &quot;quantity&quot;: 2,
          &quot;x&quot;: 1.815,
        },
        Object {
          &quot;productBrand&quot;: &quot;Apple&quot;,
          &quot;productCategory&quot;: &quot;Computers&quot;,
          &quot;productId&quot;: &quot;p2&quot;,
          &quot;productTitle&quot;: &quot;MacBook Pro&quot;,
          &quot;quantity&quot;: 1,
          &quot;x&quot;: 1.905,
        },
      ],
      &quot;total&quot;: 3.720,
    },
    Checkout {
      &quot;date&quot;: 2020-12-27T13:24:47.790Z,
      &quot;id&quot;: &quot;Sun Dec 27 2020 08:24:47 GMT-0500 (EST)&quot;,
      &quot;items&quot;: Array [
        Object {
          &quot;productBrand&quot;: &quot;Apple&quot;,
          &quot;productCategory&quot;: &quot;Computers&quot;,
          &quot;productId&quot;: &quot;p2&quot;,
          &quot;productTitle&quot;: &quot;MacBook Pro&quot;,
          &quot;quantity&quot;: 1,
          &quot;x&quot;: 1.905,
        },
      ],
      &quot;total&quot;: 1.905,
    },
  ]
  </code></pre>
  <p>I am trying to use <code>VictoryPie</code> to create a pie chart that shows <code>productBrand</code> weighted by the sum of <code>x</code> over all the objects. In this example, I would need a pie chart showing Microsoft and Apple, weighted by 1.815 and 2*1.905 = 3.81, respectively. Is there any way to do this without writing a separate function to calculate these sums? I would like the pie chart to update automatically every time new data is added to the store.</p>
  <p>I tried this, where <code>history</code> is a variable containing the above array but no pie chart is produced.</p>
  <pre><code>&lt;VictoryPie data={history} x={(data) =&gt; data.items.productBrand} y={(data) =&gt; data.items.x} /&gt;
  </code></pre>