I have one array like this:
[{
"coin": "AION",
"profit": "3.10",
"timestamp": "2021-01-26 00:48:01"
},
{
"coin": "BTC",
"profit": "77.00",
"timestamp": "2021-01-26 00:08:04"
},
{
"coin": "AION",
"profit": "4.00",
"timestamp": "2021-01-26 01:08:01"
},
{
"coin": "BTC",
"profit": "78.10",
"timestamp": "2021-01-26 01:08:04"
}]
But what i actually need is four (four is variable) arrays:
array coins:
[{ "AION", "BTC" }]
(variable with extra coins, depending on the first array i already have) > AION, BTC, ETH, ZIL, ARK, etc....
array profit[AION]:
[{ "3.10", "4.00" }]
array profit[BTC]:
[{ "77.00", "78.10" }]
(Variable extra coins/profits) [ETH, ZIL, ARK, etc...]
array timestamp:
[{ "2021-01-26 00:48","2021-01-26 01:08" }]
(Variable extra timestamps depending on first array i already have)
I need this to fill chartsData array for am4charts.LineSeries.
Can someone help me please? Or is there any better option for this?
question from:
https://stackoverflow.com/questions/65907973/one-array-to-four-arrays 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…