Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to load array of data into dataset format using React Native?

$
0
0

In my-scenario, I am trying to restructure the array before loading into line chart. Here,I am receiving props like: const data = [26.727, 26.952, 12.132, 25.933, 12.151, 28.492, 12.134, 26.191]

I want to restructure the data like below, before loading into line chart

   const dataTwo = [{          value: 26.727,          svg: {            fill: Colors.WHITE,          },        },        {          value: 26.952,          svg: {            fill: Colors.WHITE,          },        },       {          value: 12.132,          svg: {            fill: Colors.WHITE,          },        },,        {          value: 25.933,          svg: {            fill: Colors.WHITE,          },        },        {          value: 12.151,          svg: {            fill: Colors.WHITE,          },        },        {          value: 28.492,          svg: {            fill: Colors.WHITE,          },        },,        {          value: 12.134,          svg: {            fill: Colors.RED,          },        },        {          value: 12.134,          svg: {            fill: Colors.WHITE,          },        },

The array of last before index, I need to insert unique colour value.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>