ghtmtt / DataPlotly

D3 like plots creation with plotly in QGIS
GNU General Public License v2.0
191 stars 50 forks source link

Feature pie labels and scale #348

Closed paul-dorsetcouncil closed 5 months ago

paul-dorsetcouncil commented 5 months ago

The current version of the plugin allows you to add a pie chart but the labels are in percentages and there appeared to be no way to configure this.

I have a use case where I would like the pie to be labelled with the actual values rather than the relative percentage and I found information online stating that you can use the "text": [] object to achieve this goal.

I was unable to work out how to do this without doing a regex replacement after the HTML is created but I was able to successfully test the changes in my local QGIS and convert the percentages of a pie chart from percentage to value.

I also found that if a pie chart item is small then the chart becomes unusable so I also added the ability to override the default scale of 10.0 with a lower number. The results of my initial test are shown in the following screenshots: Before: image

After: image © Crown copyright [and database rights] [2024] AC0000830671.

paul-dorsetcouncil commented 5 months ago

I have created this pull request accidentally on the main branch and was meaning to create it as a draft on my own fork but it may be just as well that you can see what I'm trying to do. It is likely that I will need to cancel the actual pull request and try again after I've discussed it more with the core developers so I'll close it for now for now but hopefully you can still see it and it will at least allow us to see a useful diff.

ghtmtt commented 4 months ago

Hi @paul-dorsetcouncil. Sorry for the delay of the answer. I really appreciate your work! I'll try to have a look at it and to make a review (and re-open the pull request). Thanks again!