I have data that looks like this.....
    errorTypes = ["newview","oldview","noview","someview"]
    var myData = [
      [{
        "timeBucket": 1472058000000,
        "errors": 534,
        "errorFree": 0,
        "business": 0,
        "errorRate": 1.0,
        "breakdown": [{
          "type": "newview",
          "count": 359,
          "errorRate": 1.0
        }, {
          "type": "oldview",
          "count": 169,
          "errorRate": 1.0
        }, {
          "type": "noview",
          "count": 6,
          "errorRate": 1.0
        }]
      }],
      [{
        "timeBucket": 1472061600000,
        "errors": 537,
        "errorFree": 0,
        "business": 0,
        "errorRate": 1.0,
        "breakdown": [{
          "type": "newview",
          "count": 338,
          "errorRate": 1.0
        }, {
          "type": "oldview",
          "count": 184,
          "errorRate": 1.0
        }, {
          "type": "noview",
          "count": 14,
          "errorRate": 1.0
        }, {
          "type": "someview",
          "count": 1,
          "errorRate": 1.0
        }]
      }]
    ];
I started deconstructing the JSON by the methodology below but it gives me multiple objects which is what the original is so I think it's probably headed the wrong way... (with timeBucket as the first element)
var result = [];
errorTypes.map( function (item) {
myData.forEach(function(ele, idx) {
  var count = ele[0].breakdown.filter(function(ele, idx) {
    return ele.type == item;
  })[0];
  count = (count === undefined) ? 0 : +count.count
  result.push(
    [ele[0].timeBucket, parseFloat(ele[0].errors), count]);
  });
});
console.log(result);
Results in ....
[[1472058000000, 534, 359], [1472061600000, 537, 338], [1472058000000, 534, 169], [1472061600000, 537, 184], [1472058000000, 534, 6], [1472061600000, 537, 14], [1472058000000, 534, 0], [1472061600000, 537, 1]]
and what I am needing to create is a table that looks like this....
<TABLE BORDER=1>
<TR><TD>Error</TD><TD>1472058000000</TD><TD>1472061600000</TD></TR>
<TR><TD>newview</TD><TD>359</TD><TD>338</TD></TR>
<TR><TD>oldview</TD><TD>169</TD><TD>184</TD></TR>
<TR><TD>noview</TD><TD>6</TD><TD>14</TD></TR>
<TR><TD>someview</TD><TD>0</TD><TD>1</TD></TR>
<TR><TD>TOTALS</TD><TD>534</TD><TD>537</TD></TR>
</TABLE>
I do have a JSFiddle here: https://jsfiddle.net/wilkiejane/1k1tbmxy/
Normally, being a novice Python developer, I'd just use pandas on it and be done but our HTML developer took another job and so now I'm the IT "team". :-( I don't need to do any sort of tabulation, it's just a sorting of the data and a whole series of anonymous arrays just confuses the heck out of me. Anyone have any advice on how I can solve this? Many, many thanks! JW
 
     
    