This belongs in dygraph-utils.js