Beispiel #1
0
def dau_line_example():
    """ Basic line Example """
    chart = Highchart()
    chart.set_options(EXAMPLE_CONFIG)
    chart.update_yAxis(title_text="活跃人数 (人)")
    chart.update_xAxis(categories=[
        '+0', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '+8', '+9', '+10',
        '+11', '+12'
    ])
    chart.title("活跃用户留存(2014-07-09~2014-07-22)")
    chart.add_data_set([['2014-07-09', 223961], ['2014-07-10', 150964],
                        ['2014-07-11', 134088], ['2014-07-12', 119318],
                        ['2014-07-13', 110857], ['2014-07-14', 109625],
                        ['2014-07-15', 104971], ['2014-07-16', 100415],
                        ['2014-07-17', 96143], ['2014-07-18', 95523],
                        ['2014-07-19', 88619]],
                       series_type="line",
                       name="2014-07-09")
    chart.add_data_set([['2014-07-10', 243910], ['2014-07-11', 161951],
                        ['2014-07-12', 133382], ['2014-07-13', 121328],
                        ['2014-07-14', 122070], ['2014-07-15', 115963],
                        ['2014-07-16', 110135], ['2014-07-17', 104766],
                        ['2014-07-18', 105800], ['2014-07-19', 95100]],
                       series_type="line",
                       name="2014-07-10")

    json_data = json.dumps(chart.__export_json_options__(), ensure_ascii=False)

    # json_data =chart.__export_json_options__()

    chart.show()