Within my specific use case, I am seeking to reform the array structure prior to loading it into a line chart. In this context, the props received are as follows:
const data = [26.727, 26.952, 12.132, 25.933, 12.151, 28.492, 12.134, 26.191]
The objective is to reformat the data as shown below before introducing it to the 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 requirement is to assign a unique color value to the second-to-last element in the array.