openlayersgeoserveropenlayers-6

How to put charts in openlayers


I'm looking for a way to put a pie chart(base on some fields) inside the map at the center of my polygons. is there any ways to create the chart on sld styles(wms) or ol.style.Style(wfs)? or maybe totally another solution?

There isn't any force on pie chart, any chart can solve this. Also, I can create a point layer from polygon centroids, so charts on points can solve my problem too.

Currently, I'm using ol 6.1.1 and I can't downgrade it less than 6 (I'm using new scalebar).

I checked StackOverflow for similar questions but they were too old(ol 2/3). Also, I checked ol-ext but couldn't find any documents about this feature/extension.

I would greatly appreciate it if you give me any suggestions or solutions. Thanks


Solution

  • Try the ol-ext library. Here is the link --> https://viglino.github.io/ol-ext/

    Here is the documentation --> https://viglino.github.io/ol-ext/doc/doc-pages/

    It has some very cool features. One of them looks like the one you are asking for.

    This --> https://viglino.github.io/ol-ext/examples/style/map.style.chart.html

    Or this --> https://viglino.github.io/ol-ext/examples/style/map.style.chart+text.html