DataMap
A library for defining an abstract interface around datasets (alternatively: a well-intentioned attempt to simplify d3.chart).
Usage
This utility allows library authors to define an abstract "shape" for datasets. Library consumers may have datasets that conform to a different structure. They can use this data directly if they provide a "mapping" function.
// (library code: setup)// Create a datamap with the abstract attribute names: // ... thisdm = 'time' 'space'; // ... // (consumer code: configuration)// Define a mapping that translates the abstract attribute names to the names// that fit your data:Librarydm; // (consumer code: data specification)// Supply your dataset to the libraryLibrary; // (library code: dereferencing)// Wrap incoming data to normalize its "shape": { var normalized = thisdm; normalizedtime; // => 23 normalizedspace; // => 45 }
License
Copyright (c) 2013 Mike Pennisi
Licensed under the MIT license.