简体   繁体   English

在Django模板中渲染画布

[英]render canvas in Django templates

I am using matplotlib library in django app to create diagrams. 我在Django应用程序中使用matplotlib库创建图表。

I am trying to render canvas object of matplotlib library to django templates with the aid of thread . 我试图借助thread将matplotlib库的canvas对象渲染为Django模板。

Is there some way to render only canvas object in django templates? 有什么方法可以在Django模板中仅渲染画布对象?

There is another way to do this. 还有另一种方法可以做到这一点。 I saved figure using 'figure.savefig' function of matplotlib library in local media directory and loaded the figure using django templates. 我使用matplotlib库的'figure.savefig'函数将图形保存在本地媒体目录中,并使用django模板加载该图形。 Views generating figure pass the figure location and name to django templates. 生成图形的视图将图形的位置和名称传递给Django模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM