pyOFC2 Python Open Flash Chart 2

Horizontal Bar Chart

Make a horizontal bar chart

def test_horizontal_bar():
                            
    t = title(text="Our New House Schedule")
    hb = hbar(colour="#86BBEF")
    hb.tooltip = ("Months: #val#")
    values = [ hbar_value(left=0, right=4), 
        hbar_value(left=4, right=8)]
    h3 = hbar_value(left=8, right=11)
    h3.tip = "#left# to #right#<br>%s to %s (#val# months)" % (months[8], months[11]) 
    values.append(h3)
    hb.values = values
    chart = open_flash_chart()
    chart.title = t    
    chart.add_element(hb)    
    x = x_axis()
    x.offset = False
    x.labels = labels(labels=months)
    y = y_axis()
    y.offset = 1
    y.labels = ["Make garden look sexy","Paint house","Move into house"]
    chart.x_axis = x
    chart.y_axis = y
    return chart

Data used to generate the chart — horizontal_bar.json

© 2009 Pradeep Kishore Gowda