Use chartjs

On Wed, 1 Jul 2020, 07:45 ratnadeep ray <[email protected]> wrote:

> Hi all,
>
> I have wrote a python program to display the line graph as follows:
>
> import matplotlib.pyplot as plt
>
> x = [1,2,3]
> y = [2,4,1]
>
>
> plt.plot(x, y)
>
>
> plt.xlabel('x - axis')
> plt.ylabel('y - axis')
>
>
> plt.title('My first graph!')
>
> plt.show()
>
>
> Now I need to display the same via Django. So I think I need to write the
> above code in the view and then redirect the same to the html template
> file. Am I right?
>
> In that case, how to send the request objects related to the line chart to
> the template?
>
> Normally, we send in the following format:
>
> def view1(request)
>
>
>  return render(request, 'display_report.html', { 'var1': "abc", ...
>  ... })
>
> So if we are trying to display the line graph generated by the above code,
> how to do so ?
>
> Please share your inputs.
>
> Thanks.
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/827e0d0c-6bbb-4511-af73-9fa379df699do%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/827e0d0c-6bbb-4511-af73-9fa379df699do%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALY6ddd%3DN_WdOY%2B4xSUx13BjVeAdEo3ywQR5F3xUZk%2B6O4Q2jA%40mail.gmail.com.

Reply via email to