Called by XMLHTTPrequest function periodically to get new graph data.

    Usage description:
    This function queries the database and returns all the newly added values.

    :return: JSON Object, passed on to the JS script.

def update():
    """
    Called by XMLHTTPrequest function periodically to get new graph data.

    Usage description:
    This function queries the database and returns all the newly added values.

    :return: JSON Object, passed on to the JS script.
    """
    assert request.method == "POST", "POST request expected received {}".format(request.method)
    if request.method == 'POST':
        # Get figure stats
        selected_run = request.form['selected_run']
        variable_names = utils.get_variables(selected_run).items()

        if len(current_index) < 1:
            for _, v_n in variable_names:
                current_index[v_n] = 0

        logging.info("Current index: {}".format(current_index))
        data = utils.get_variable_update_dicts(current_index, variable_names, selected_run)

        return jsonify(data)