示例#1
0
def _area_chart_demo():
    """ demonstration of area chart
    """
    table = DataTable()
    table.add_column('Time')
    table.add_column('Site 1')
    table.add_column('Site 2')
    table.add_row([ 4.00, 120,   500])
    table.add_row([ 6.00, 270,   460])
    table.add_row([ 8.30, 1260, 1120])
    table.add_row([10.15, 2030,  540])
    table.add_row([12.00,  520,  890])
    table.add_row([18.20, 1862, 1500])

    chart = AreaChart(table)
    chart.set_horizontal_axis_column(0)
    chart.haxis_title = 'Time'
    chart.haxis_vmin = 0.0
    chart.haxis_vmax = 20.0
    chart.haxis_step = 5

    #chart.save('area.png', QSize(400, 240), 100)

    view = DialogViewer()
    view.set_graph(chart)
    view.resize(400, 240)
    view.exec_()
示例#2
0
def _line_chart_demo():
    """ demonstration of line chart
    """
    table = DataTable()
    table.add_column('Time')
    table.add_column('Site 1')
    table.add_column('Site 2')
    table.add_column('Site 3')
    table.add_row([ 4.00, 120,   80,  400])
    table.add_row([ 6.00, 270,  850,  320])
    table.add_row([ 8.30,  50, 1200,  280])
    table.add_row([10.15, 320, 1520,  510])
    table.add_row([12.00, 150,  930, 1100])
    table.add_row([18.20,  62, 1100,  240])

    chart = LineChart(table)
    chart.set_horizontal_axis_column(0)
    chart.haxis_title = 'Time'
    chart.haxis_vmin = 0.0
    chart.haxis_vmax = 20.0
    chart.haxis_step = 2

    #chart.save('line.png', QSize(400, 240), 100)

    view = DialogViewer()
    view.set_graph(chart)
    view.resize(400, 240)
    view.exec_()