I have the following nvd3 stacked Area Chart:
I want to add margin between the numbers/dates and the graph as well as the legend at the top and the graph. (please see the picture, I've marked the positions with a red line:
I've been investigating the rendered html but can't access the margin values via css, even if I try it inline with firefox's console. I've been able to change font-family and color with this css:
#chart1
height: 300px
text
fill: #1a1f22
font-size: 0.7em
font-family: 'Source Sans Pro', sans-serif
But still whatever element (text,g,svg,...) I'm trying to attach a style to, nothing in terms of margin is changing.
Here's the javascript code for the chart:
nv.addGraph(function() {
var histcatexplong = [
<?= $array ?>
];
var colors = d3.scale.category20();
var keyColor = function(d, i) {return colors(d.key)};
var chart;
chart = nv.models.stackedAreaChart()
.useInteractiveGuideline(true)
.showControls(false)
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.color(keyColor)
.transitionDuration(300);
chart.xAxis
.tickFormat(function(d) { return d3.time.format('%e.%m.%y')(new Date(d)) });
chart.yAxis
.tickFormat(d3.format(',.2f'));
d3.select('#chart1')
.datum(histcatexplong)
.transition().duration(1000)
.call(chart)
.each('start', function() {
setTimeout(function() {
d3.selectAll('#chart1 *').each(function() {
if(this.__transition__)
this.__transition__.duration = 1;
})
}, 0)
});
nv.utils.windowResize(chart.update);
return chart;
});
I've been reading all over nvd3's examples and docs, but still can't find a way to manipulate above said. Does somebody know of a way to do?