riatelab / magrit

Thematic cartography entirely in the browser ♥
https://magrit.cnrs.fr
GNU General Public License v3.0
128 stars 18 forks source link

Choosing the number of clusters on nested-means - Define different steps according to potential choices #145

Closed RCura closed 4 weeks ago

RCura commented 1 month ago

When trying to define the number of classes for the nested-means method, the "buttons" allowing to increase or decrease the number of clusters don't work, while it works when manually inputting the value we want.

Capture vidéo du 16-10-2024 17_57_16

I guess it's because this method only works with powers of 2, but then, the "step" in the input box might be customized for this.

This also made me realize that while the "buttons" are limited to an upper threshold in all methods, it can always be bypassed by typing the value directly : is this a feature or a bug ?

mthh commented 1 month ago

Thanks for your feedback!

Concerning the first point, you're right but it's not that simple because for Input elements (of type number) you can only define one “step” (but here you'd have to have a different "step" values depending on whether you want more classes or fewer classes, which is not possible).

But I could intercept the user's actions in JS (and say that when it increases by 1, the Input element have to go to the next power of 2, and when it decreases by 1, the Input element have to go to the previous power of 2...). Worth a look, thanks for the suggestion! (since I'm improving other things in the classification panel - notably the creation of custom palettes - I can add a bit of code for handling this special case for nested means!)

In any case, the documentation already indicates that values must be entered as powers of 2.

Concerning the 2nd point, it's totally a feature :)

We don't mean to suggest that it's a good thing to make more than 9 classes, but we think it should remain feasible (it may be useful at least for divergent color progressions, but perhaps for other uses too...). If someone wants to make 100 classes in equal intervals and pretend they have a non-discretized choropleth... that's up to them ;)).

Do you think we should be stricter on this aspect?

RCura commented 1 month ago

For my part, it's definitely a feature, I like the software letting me what I want, but I was afraid it was something forgotten. All's perfect then ;)

mthh commented 4 weeks ago

In the end, a slider was chosen specifically for this classification method, where only very specific values are possible (and we're sticking with a classic input element for the other classification modes).