Show
Ignore:
Timestamp:
10/17/07 11:18:09 (5 years ago)
Author:
lgs
Message:

Two examples for the price of one

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/barchart.py

    r32 r33  
    2424from lines import lines 
    2525 
    26 def barChart(output): 
     26def barChart(output, chartFactory): 
    2727    surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 400, 200) 
    2828 
     
    4949        }, 
    5050        'padding': { 
    51             'left': 40 
     51            'left': 55 
    5252        } 
    5353    } 
    54     chart = pycha.bar.VerticalBarChart(surface, options) 
     54    chart = chartFactory(surface, options) 
    5555 
    5656    chart.addDataset(dataSet) 
     
    6161if __name__ == '__main__': 
    6262    output = sys.argv[1] if len(sys.argv) > 1 else 'barchart.png' 
    63     barChart(output) 
     63    barChart('v' + output, pycha.bar.VerticalBarChart) 
     64    barChart('h' + output, pycha.bar.HorizontalBarChart)