[Fixed]-Mixing HTML5 Canvas and Python

12👍

The server side is much more developed than the client side in this case. (Rich JS libraries are a newer phenomenon, is all.) Django is an acceptable choice on the server, although I would at least consider Twisted.

My recommendation on the client side:

  1. First choice is paper.js which is a library for manipulating canvas. Excellent performance, allows event binding, rich graphics operations, tutorials are fantastic. Seems to have a very gentle learning curve as well, compared to similar software.

  2. Second choice would be raphael or a similar SVG library. Performance not quite as good as paper.js although it depends a lot on what will be onscreen.

Can you elaborate on what kind of things you will be doing on the client? Number of visible objects, what events will be bound to what objects, types of graphics filters you need, and so on, all inform this choice heavily.

You will probably find yourself fighting to get good graphics performance on the client, so expect to spend a lot of time on that.

Edit: Based on your comments, I think you would find either solution workable, so I would lean toward paper.js only because it’s a little more fun, and if you do go somewhere unexpected it will be able to go there with you.

Since your application sounds like it has to do with a lot of charting, I would suggest you check out HighCharts or another charting library, of which there are several, both commercial and non-. HighCharts itself is free for everything except production use in a for-profit application, and reasonably priced otherwise.

👤Cory

4👍

I do exactly what you have mentioned using Django on the server side and HTML5 canvas/javascript on the client side. I’m pretty happy with the results but would like to point out that what you do with a Canvas on the client side doesn’t have anything to do with what you use on the server side for Python.

👤Sid

2👍

A viable approach for a rich client widget like this is to use a stack like:

  • [ your javascript user interface ]
  • [ a js lib for your graphics ]
  • backbone.js for managing your objects client side
  • django-tastypie for wrapping your django objects in a RESTful API
  • django for defining your backend
👤kdt

Leave a comment