pyOFC2 Python Open Flash Chart 2

Scatter Line Chart

Make a scatter line chart

def test_scatter_line_chart():
    
    
    chart = open_flash_chart()
    chart.title = title(text='Scatter Line Chart')
    s = scatter_line(colour="#FFD600", dot_size=3)
    x = 0.0
    y = 0
    v = []
    s.values = [ { "x": 0, "y": 0 }, { "x": 1.2, "y": 0.5 }, { "x": 2.5, "y": -0.9 }, { "x": 3.2, "y": -2.6 }, { "x": 4.6, "y": -2.6 }, { "x": 6, "y": -2.3 }, { "x": 7.5, "y": -0.4 }, { "x": 8.9, "y": 0.2 }, { "x": 10, "y": -1.7 }, { "x": 11, "y": -2.1 }, { "x": 11.6, "y": -3.2 }, { "x": 12.2, "y": -3.1 }, { "x": 13.2, "y": -1.3 }, { "x": 14.5, "y": -3.2 }, { "x": 15.3, "y": -4.3 }, { "x": 15.9, "y": -4.2 }, { "x": 16.5, "y": -5.6 }, { "x": 17.3, "y": -4.4 }, { "x": 18.7, "y": -2.7 }, { "x": 19.6, "y": -2.7 }, { "x": 20.1, "y": -1.7 }, { "x": 21.3, "y": -2.8 }, { "x": 22.7, "y": -4.6 }, { "x": 23.3, "y": -4.3 }, { "x": 24.8, "y": -4.5 } ] 
    chart.add_element(s)
    xa = x_axis()
    xa.min, xa.max = 0,25
    chart.x_axis = xa
    ya = y_axis()
    ya.min, ya.max = -10, 10
    chart.y_axis = ya
    return chart

Data used to generate the chart — scatter_line_chart.json

© 2009 Pradeep Kishore Gowda