neo4j-labs / neodash

NeoDash - a Dashboard Builder for Neo4j
https://neo4j.com/labs/neodash/
Apache License 2.0
397 stars 129 forks source link

Lack in documentation to visualize Regions in Area Map #851

Open Lupanoide opened 3 months ago

Lupanoide commented 3 months ago

Hi! In the documentation page of Area Map visualization of Neodash it is written that:

the supported format for the region polygons is ISO 3166.

And there is an example of italian regions. So I am italian and I would like to reproduce that visualization. So I have downloaded italian regions ISO 3166 codes from wikipedia and I have added those properties to my Regions nodes:

MATCH (r:Regione) RETURN r.nomeRegione, r.regCode LIMIT 5

╒════════════════╤═════════╕
│r.nomeRegione   │r.regCode│
╞════════════════╪═════════╡
│"Abruzzo"       │"IT-65"  │
├────────────────┼─────────┤
│"Basilicata"    │"IT-77"  │
├────────────────┼─────────┤
│"Calabria"      │"IT-78"  │
├────────────────┼─────────┤
│"Campania"      │"IT-72"  │
├────────────────┼─────────┤
│"Emilia-Romagna"│"IT-45"  │
└────────────────┴─────────┘

Now I am trying to create an Area Map visualization trying to coping the documentation page, adding this cypher query into the Area Map settings :

MATCH (r:Regione)<-[:HA_REGIONE]-(p:Provincia)
RETURN r.regCode AS code, count(p) AS totalCount

But nothing happens. What I am doing wrong? Is there a way toI visualize in addition to the regions also the provinces?

alfredorubin96 commented 3 months ago

Hi, looks like it's mapped on another kind of format, for an example look here: https://raw.githubusercontent.com/neo4j-labs/neodash-static/main/world_polymap_level_1_entities.json. I will file a bug for it and add a selector to choose between the iso 3166 and the other

Lupanoide commented 3 months ago

Thank you, I have seen your pull request, but this don't seem to be the problem. I have seen that you are trying to change the ISTAT code of the regions to the ISO_3166 code, but this don't solve the problem.

I have already the ISTAT code of the Italian Regions as property of my nodes:

MATCH (r:Regione) RETURN "IT."+ apoc.text.lpad(toString(r.idRegione), 2, '0'), r.nomeRegione LIMIT 5

╒════════════════════════════════════════════════════╤════════════════╕
│"IT."+ apoc.text.lpad(toString(r.idRegione), 2, '0')│r.nomeRegione   │
╞════════════════════════════════════════════════════╪════════════════╡
│"IT.01"                                             │"Abruzzo"       │
├────────────────────────────────────────────────────┼────────────────┤
│"IT.02"                                             │"Basilicata"    │
├────────────────────────────────────────────────────┼────────────────┤
│"IT.03"                                             │"Calabria"      │
├────────────────────────────────────────────────────┼────────────────┤
│"IT.04"                                             │"Campania"      │
├────────────────────────────────────────────────────┼────────────────┤
│"IT.05"                                             │"Emilia-Romagna"│
└────────────────────────────────────────────────────┴────────────────┘

If I try to convert the query inside of the Area Map visualization settings, nothing happens:

MATCH (r:Regione)<-[:HA_REGIONE]-(p:Provincia)
RETURN "IT."+ apoc.text.lpad(toString(r.idRegione), 2, '0') AS code, count(p) AS value

Probably there is a setting that should be enabled and it is not documented or there is a bug. Could you please verify? Thank you

alfredorubin96 commented 3 months ago

Did you enabled the drilldown options inside the card settings?

Lupanoide commented 3 months ago

Yes, sure. But I haven't passed any country ISO3 format cause I would like to visualize statistics on Italian regions. Regions visualization works only as a drill down of the country?

Lupanoide commented 3 months ago

Yes, It works only as a drilldown of the country!!

MATCH (c:Comune)-[:HA_PROVINCIA]->(p:Provincia)-[:HA_REGIONE]->(r:Regione)-[:IN_COUNTRY]->(n:Nazione)
WITH c, r AS region, n AS country
CALL {
    WITH c, country
    RETURN country.sigla_iso_3166_1_alpha_3_stato as code, count(c) as value
    UNION
    WITH c, region
    RETURN  "IT."+ apoc.text.lpad(toString(region.idRegione), 2, '0') as code, count(c) as value
}
WITH code, sum(value) AS value
RETURN code, value

Thank you for your time! Could you please add to the documentation that the regions visualization is possible only as a drilldown of the country?