Help with Data Format Keyed Array

I very well might be overthinking this, but I have a database query that outputs data like this…

What I need is to output the data like this…

options = {
  series: [
    {
      name: "09:32:00",
      data: [{
        x: 'QTY_250',
        y: 69
      }, {
        x: 'QTY_375',
        y: 151
      }, {
        x: 'QTY_500',
        y: 73
      }, {
        x: 'QTY_625',
        y: 29
...
      }]
    },
    {
      name: "09:33:00",
      data: [{
        x: 'QTY_250',
        y: 209
      }, {
        x: 'QTY_375',
        y: 302
      }, {
        x: 'QTY_500',
        y: 385
      }, {
        x: 'QTY_625',
        y: 357
...
      }]
    }
  ]
}

I was thinking I could use a keyed array but I can’t figure out how and I can’t find any information on using keyed arrays server side.

Any pointers would be most appreciated!

Community Page
Last updated: