please assist ---------- Forwarded message --------- From: Eugene TUYIZERE <eugenetuyiz...@gmail.com> Date: Thu, 17 Jun 2021 at 11:15 Subject: Django chart using chart.js To: <django-users@googlegroups.com>
Team, I have a table called Indicators. This includes indicator, target and progress. Both target and progress are numbers. What I want is to display a chart target and progress for every indicator. With the code below I only get indicators I failed to display the bars (columns). Please assist [image: image.png] def chart(request): dataset = Indicators.objects.values('indicator','target','progress') indicator = list() target = list() progress = list() for entry in dataset: indicator.append(entry['indicator']) target.append(entry['target']) progress.append(entry['progress']) target_series = { 'name': 'Target', 'data': target, 'color': 'blue', } progress_series = { 'name': 'Progress', 'data': progress, 'color': 'red' } chart = { 'chart': {'type': 'column'}, 'title': {'text': 'Indicator Analysis'}, 'xAxis': {'categories': indicator}, 'series': [target_series,progress_series] } dump = json.dumps(chart) -- *Eugene* -- *TUYIZERE Eugene* *Msc Degree in Mathematical Science* *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal Garden-Lime, Cameroon* Bsc in Computer Science *UR-Nyagatare Campus* Email: eugene.tuyiz...@aims-cameroon.org eugenetuyiz...@gmail.com Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHu7B7gbmmr6ixSk9cisTeU_3U6bM2fKa48%3DvtxQZr0mXQ%40mail.gmail.com.