This is the data structure that I got after doing query database.
[
{ name: 'xx1', date: '2017-09-03', value: 49 },
{ name: 'xx2', date: '2017-10-23', value: 67 },
{ name: 'xx2', date: '2017-12-01', value: 70 },
...
]
I want to transform it into:
[
{ name: 'xx1', data: { '2017-09-03': 49 } },
{ name: 'xx2', data: { '2017-10-23': 67, '2017-12-01': 70 } },
...
]
That data structure is needed in order to build chart using react-chartkick.
Can anyone give me suggestion to solve this? (Especially with lodash or ramda)