Closed jgaffuri closed 3 years ago
1) Should we not expose the d3.format function to the user? to allow them to format the legend values? If unspecified then it could default to the current implementation .labelFormat(format("." + out.labelDecNb_ + "f")
.
2) Would it not be more intuitive to expose the legend configuration as a single method which accepts a single configuration object? See gridviz for example.
Yes, good ideas !
legend = function(map, opts) {
opt.parameter1 = opt.parameter1 || defaultValue1;
...
}
?
Yes, in gridviz I first define a default legend configuration and then allow the user to override its properties:
viewer.legend = function (viewer, config) {
for (let key in config) {
viewer.legend_[key] = config[key];
}
//update legend if necessary
if (viewer._gridLegend) {
updateLegend()
}
return viewer;
};
Excellent !
map("ch", { scale:"01M", ... })
in addition to the map("ch").scale("01M")
. See the new test: test_es.html
.