chart
.width(w)
.height(h)
is it possible in some way to use indirection when chaining? I need to something like
var n = 80;
var ind = "width(' + n + ')";
chart
.[ind]
... obviously not legal code but hoping it describes question.
chart
.width(w)
.height(h)
is it possible in some way to use indirection when chaining? I need to something like
var n = 80;
var ind = "width(' + n + ')";
chart
.[ind]
... obviously not legal code but hoping it describes question.
You can use chart.options
for that:
chart.options({width: w, height: h});
https://github.com/dc-js/dc.js/blob/develop/web/docs/api-latest.md#dc.baseMixin+options
Further, if you're reading the options from somewhere,
var opts = {};
while(/* read option opt, val from somewhere */)
options[opt] = val;
chart.options(opts);
It is more a JavaScript question than d3.js.
You can set the function name dynamically in JS.
var n = 80;
var fnc = "width";
chart[func](n);
Do I understand your problem well?