Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

draw only grouped multibar chars using nvd3

I draw a multibarChart using nvd3 library and it 's working very well but it gives me two radio buttons to choose wether i want stacked bars or grouped bars.

Can i disable this and make it only show grouped bars?

This is the javascript code :

nv.addGraph(function() {
    var chart = nv.models.multiBarChart();

    chart.xAxis.tickFormat(d3.format(',f'));

    chart.yAxis.tickFormat(d3.format(',.1f'));
    var x = data();
    d3.select('#chart svg').datum(data()).transition().duration(500).call(chart);

    nv.utils.windowResize(chart.update);

    return chart;
});
like image 820
Amr Kamel Avatar asked Aug 05 '13 13:08

Amr Kamel


1 Answers

The code below will show you bars in a Grouped manner while hiding the controls to the flip between Stacked/Grouped

var chart = nv.models.multiBarChart().stacked(false).showControls(false);

Hope it helps.

like image 179
shabeer90 Avatar answered Nov 11 '22 16:11

shabeer90