JavaScript Iteration
The switch is awkward, and the nextIndex != 2 special case is cumbersome.  It would be a bit simpler if you regularized everything:

function makeCanvasBundleIterator(canvasBundle) {
  var i = 0, j = 0;
  var items = [
    [canvasBundle.grid],
    [canvasBundle.axes],
    canvasBundle.functions,
    [canvasBundle.overlay],
  };
  return {
    next: function() {
      if (i &gt;= items.length) {
        return {done: true};
      }
      if (j &gt;= items[i].length) {
        i++;
        j = 0;
      }
      return {done: false, value: items[i][j++]};
  };
}


But that could be simplified further by linearizing the list up front using Array.concat():

function makeCanvasBundleIterator(canvasBundle) {
  var i = 0;
  var items = [].concat(
    canvasBundle.grid,
    canvasBundle.axes,
    canvasBundle.functions,
    canvasBundle.overlay
  );
  return {
    next: function() {
      return (i &gt;= items.length) ? {done: true}
                                 : {done: false, value: items[i++]};
  };
}


For that matter, why bother making an iterator at all?  Just return the linearized array.  The caller can iterate through it conventionally using a for loop or Array.forEach().

Note that the behaviour of these alternate solutions is different from the original if the canvasBundle is modified during iteration.  (You wouldn't want to do that, I hope?)