wip: use sqrt for computing circles radius to smooth the sizes

The theory is that the circles surface should be proportional, not
the radius.
This commit is contained in:
Yohan Boniface 2024-08-13 10:01:19 +02:00
parent 6b60b0de64
commit cbb022f804
2 changed files with 7 additions and 7 deletions

View file

@ -263,7 +263,7 @@ export const Circles = FeatureGroup.extend({
_getValue: function (feature) { _getValue: function (feature) {
const key = this.datalayer.options.circles.property || 'value' const key = this.datalayer.options.circles.property || 'value'
const value = +feature.properties[key] const value = +feature.properties[key]
if (!Number.isNaN(value)) return value if (!Number.isNaN(value)) return Math.sqrt(value)
}, },
compute: function () { compute: function () {

View file

@ -25,32 +25,32 @@ def test_basic_circles_layer(map, live_server, page):
assert ( assert (
page.locator("[data-feature=ca676]") page.locator("[data-feature=ca676]")
.get_attribute("d") .get_attribute("d")
.endswith("a24,24 0 1,0 -48,0 ") .endswith("a31,31 0 1,0 -62,0 ")
) )
assert ( assert (
page.locator("[data-feature=cap64]") page.locator("[data-feature=cap64]")
.get_attribute("d") .get_attribute("d")
.endswith("a4,4 0 1,0 -8,0 ") .endswith("a10,10 0 1,0 -20,0 ")
) )
assert ( assert (
page.locator("[data-feature=cap27]") page.locator("[data-feature=cap27]")
.get_attribute("d") .get_attribute("d")
.endswith("a3,3 0 1,0 -6,0 ") .endswith("a6,6 0 1,0 -12,0 ")
) )
assert ( assert (
page.locator("[data-feature=capa8]") page.locator("[data-feature=capa8]")
.get_attribute("d") .get_attribute("d")
.endswith("a2,2 0 1,0 -4,0 ") .endswith("a4,4 0 1,0 -8,0 ")
) )
assert ( assert (
page.locator("[data-feature=capa6]") page.locator("[data-feature=capa6]")
.get_attribute("d") .get_attribute("d")
.endswith("a2,2 0 1,0 -4,0 ") .endswith("a3,3 0 1,0 -6,0 ")
) )
assert ( assert (
page.locator("[data-feature=capa4]") page.locator("[data-feature=capa4]")
.get_attribute("d") .get_attribute("d")
.endswith("a2,2 0 1,0 -4,0 ") .endswith("a3,3 0 1,0 -6,0 ")
) )
assert ( assert (
page.locator("[data-feature=capa3]") page.locator("[data-feature=capa3]")