pyOFC2 Python Open Flash Chart 2

Lines & Spoke labels

Radar Chart with lines, spoke labels and keys For radar charts it is neccessary to set the line style to 'loop' so the first and last points are connected. In the above example you can see that the gold line has not had its loop attribute set.

The default tooltip is of no use with radar charts so we change its behaviour to proximity.

def test_radar_charts_2():
    
    chart = open_flash_chart() 
    chart.title = title(text='Radar Chart')
    line1 = line_hollow()
    line1.width = 1
    line1.dot_size = 3
    line1.halo_size = 2
    line1.colour = '#FBB829'
    line1.values = [3, 4, 5, 4, 3, 3, 2.5]
    line1.tip = "Gold #val#"
    line1.text = 'Mr. Gold'
    line1.font_size = 10
    chart.add_element(line1)
    
    line2 = line_dot()
    line2.values = [2 for i in range(7)]
    line2.halo_size = 2
    line2.width = 1
    line2.dot_size = 3
    line2.colour = '#80000FF'
    line2.tip = 'Purple #val#'
    line2.text = 'Mr. Purple'
    line2.font_size = 10
    line2.loop = True
    chart.add_element(line2)
     
    r = radar_axis(max=5)
    r.colour ='#DAD5E0'
    r.grid_colour = '#DAD5E0'
    ra = radar_axis_labels(labels=['Zero','','','Middle','','High'])
    ra.colour = '#9F819F'
    r.labels = ra
    sa = radar_spoke_labels(labels=['Strength', 'Smarts', 'Sweet<br>Tooth',
            'Armour', 'Max Hit Points', '???', 'Looks Like a Monkey'])
    sa.colour = '#9F819F'
    chart.radar_axis = r 
    r.spoke_labels = sa
    tip = tooltip()
    tip.proximity = 1
    chart.tooltip = tip
    chart.bg_colour = '#FFFFFF'
    return chart

Data used to generate the chart — radar_charts_2.json

© 2009 Pradeep Kishore Gowda