Python-nvd3 is a Python wrapper for NVD3 graph library. NVD3 is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js gives you.

Project location : https://github.com/areski/python-nvd3

multiBarChart

class nvd3.multiBarChart.multiBarChart(**kwargs)

A multiple bar graph contains comparisons of two or more categories or bars. One axis represents a quantity and the other axis identifies a specific feature about the categories. Reading a multiple bar graph includes looking at extremes (tallest/longest vs. shortest) in each grouping.

../_images/multiBarChart.png

Python example:

from nvd3 import multiBarChart
chart = multiBarChart(width=500, height=400, x_axis_format=None)
xdata = ['one', 'two', 'three', 'four']
ydata1 = [6, 12, 9, 16]
ydata2 = [8, 14, 7, 11]

chart.add_serie(name="Serie 1", y=ydata1, x=xdata)
chart.add_serie(name="Serie 2", y=ydata2, x=xdata)
chart.buildhtml()

Javascript generated:

nv.addGraph(function() {
    var chart = nv.models.multiBarChart();
    chart.yAxis
        .tickFormat(d3.format(',.2f'));
    chart.showLegend(true);
    d3.select('#multiBarChart svg')
        .datum(data_multiBarChart)
        .transition().duration(500)
        .attr('width', 500)
        .attr('height', 400)
        .call(chart);

return chart;
});
data_multiBarChart=[
    {"yAxis": "1",
     "values": [{"x": "one", "y": 6},
                {"x": "two", "y": 12},
                {"x": "three", "y": 9},
                {"x": "four", "y": 16}],
     "key": "Serie 1"},
    {"yAxis": "1",
     "values": [{"x": "one", "y": 8},
                {"x": "two", "y": 14},
                {"x": "three", "y": 7},
                {"x": "four", "y": 11}],
     "key": "Serie 2"}];