Create g1.scale to build a scale using configurations
Summary
g1.scale()
is a function that takes a dataset and a configuration, and returns a scale function. For example:
var scale = g1.scale(data, { // Rename scales to scale
metric: 'age',
scale: 'Linear', // This should be case insensitive (linear / LINEAR / Linear should all work)
domain: [0, 100],
range: ['red', 'blue'],
scheme: 'RdYlGn',
})
var result = scale(data[0])
Benefits
This is used by g1.sanddance
and g1.mapviewer
for configuration-based d3 transformations.
Edited by S Anand