In the js file below
'use strict';
$(document).ready(function() {
    buildchart()
    $(window).on('resize', function() {
        buildchart();
    });
    $('#mobile-collapse').on('click', function() {
        setTimeout(function() {
            buildchart();
        }, 700);
    });
});
function buildchart() {
    $(function() {
        var graph = Morris.Donut({
            element: 'chart-pie-moris',
            data: [{
                    value: 60,
                    label: 'Order'
                },
                {
                    value: 20,
                    label: 'Stock'
                },
                {
                    value: 10,
                    label: 'Profit'
                },
                {
                    value: 5,
                    label: 'Sale'
                }
            ],
            ......
I want to be updating the values in buildchart() function the values returned by my views file functions.
Example
def order(request):
    a = 'calculated integer value'
    return a
So I would like to pass in order function to replace 60 in buildchart() function.
how can I achieve this? Please help a newbie
 
    