I am creating a my googlecharts in react like so:
<Chart
width={'inherit'}
height={'400px'}
chartType={'PieChart'}
loader={<div>Loading Data...</div>}
data={[
['Stats', 'All Stats'],
['Submitted', 3],
['Reviewed', 5],
['Approved', 3],
['Rejected', 2],
]}
options={{title: 'Statistics'}}
rootProps={{'data-testid' : '1'}}
/>
with the hard coded data, it works and I get the chart. I would however like to use a dynamic value that i get in the component like so:
const statList = stats && stats.length
when I do:
data={[
['Stats', 'All Stats'],
['Submitted', {statList} ],
['Reviewed', 5],
['Approved', 3],
['Rejected', 2],
]}
It doesnt work. anyone know how to go about this. Will really appreciate any help. Thanks