empowerplan / epp-app

EmPowerPlan - App
GNU Affero General Public License v3.0
0 stars 0 forks source link

Fix choropleth legend and RE share choropleth #156

Closed henhuy closed 4 days ago

henhuy commented 6 months ago

Fixes #142 Fixes #141

Needs poetry update due to fix in mapengine

henhuy commented 6 months ago

Indeed, the ranges are too wide now. As for your example above - this is a tricky one, as choropleth legend and colors try to fit for all given values. Now, range is very high, but even in older implementation the legend would go up to 27000% We must add special behaviour for percentage choropleths in order to prevent this high values. I will come up with a solution for both.

nesnoj commented 5 months ago

@henhuy Could you please have a look how this could be solved taking the issues from above into account?

henhuy commented 5 months ago

Fixed RE share legend to 100% - but then many municiaplities colored dark blue as they exceed 100%. Good, or do you want to have it somehow different?

henhuy commented 4 months ago

Fixed RE share legend to 100% - but then many municiaplities colored dark blue as they exceed 100%. Good, or do you want to have it somehow different?

Could you have a look @nesnoj ?

nesnoj commented 1 month ago

To list the issues and their status again:

Old: image

New: image

Can you solve this please?

nesnoj commented 1 month ago

Could you have a look @henhuy ?

henhuy commented 1 month ago

Hey @nesnoj please review again. I made a rebase - so you have to throw away your current local branch and checkout fresh. And you have to update poetry, as i had to update mapengine.

Please check different choropleths and especially chorpleths for energy shares (%)

nesnoj commented 1 month ago

From today @henhuy

henhuy commented 4 days ago

From today @henhuy

* Colors seem to be continuous and do not match discrete colors

Cannot change continuous coloring - there is no option to do so... Only workaround would be to adapt feature data to match legend colors - would only do this if really necessary.

* Increase default number of legend colors from 5 to 6

Done.

* The param `num_colors` in `static/config/choropleths.json` seem to have no effect 🤔

There is a mismatched between chorpleth names i choropleth.json and choropleth.py. Once keys are mapping, number of legend entries gets adapted. For now, this is not needed, as I simply changed default number to 6 in mapengine.

henhuy commented 4 days ago

Would like to merge now and encounter continuous coloring in a new issue if necessary.

nesnoj commented 4 days ago

Thx @henhuy for the fix, looks good now! And do not worry about the continuous coloring. However, the result popups do not work and raise

  File "/app/digiplan/map/charts.py", line 53, in render
    values = self.chart_data.iloc[i]
AttributeError: 'list' object has no attribute 'iloc'

pointing to your "Minor fix" in 4f0d0026a73c63a742f33b4889eddbac8999c296 . After undoing popups work again. What's the reason for this change?

henhuy commented 4 days ago

What's the reason for this change?

A shit, this is due to pandas warnings in the console - but apparently chart_data isn't always a pandas.Series but can be a simple list as well. I will apply a quick fix.

henhuy commented 4 days ago

I will apply a quick fix.

Done.

nesnoj commented 4 days ago

I will apply a quick fix.

Done.

Great, thanks! I'm happy to finally merge this :)