In real-time drawing of a large number of (million-level) graphics on the map, the reason for real-time drawing is because the shape of the various shapes, graphics to follow the parameters of the back-end to draw.
It is convenient to draw graphics with canvas, and the API interface of JavaScript is relatively simple. Now there are a lot of JS Canvas library, such as this: Createjs in the EASELJS, the canvas is a lightweight package, support chain operation, support for graphics add events, although it is designed to do game development, but take it to real-time drawing graphics, add events on the graph, The staff were very friendly and helpful.
For example, to draw a solid circle or sector, you can use the arc () function:
But here's the problem, the ARC function is very slow, very CPU-intensive. So how to optimize it? If only from the perspective of canvas painting: The other way to replace the arc is a good choice, such as the Createjs provided by the bitmap to introduce the existing image, and then the image rotation, deformation, etc., if you can meet the needs, then it is also very good.
Canvas drawing optimization using bitmaps--based on the Createjs library