line chart using json django
from django.http import JsonResponse
def get_data(request, *args, **kwargs):
title = 'World population per region (in millions)'
labels = [1500,1600,1700,1750,1800,1850,1900,1950,1999,2050]
items = [{ "data" : [86, 114, 106, 106, 107, 111, 133, 221, 783, 278],
"label" : "Africa",
"borderColor" : "#3e95cd",
"fill" : False},
{ "data" : [282, 350, 411, 502, 635, 809, 947, 1402, 3700, 5267],
"label" : "Asia",
"borderColor" : "#8e5ea2",
"fill" : False}, ]
data = { "title" : title,
"labels": labels,
"items" : items }
return JsonResponse(data, safe=False)