Public
Edited
Dec 13, 2022
Insert cell
Insert cell
Insert cell
Insert cell
viewof annee = Inputs.radio(["2022", "2021", "2020", "2019", "2018","2017"], {label: "Année"})
Insert cell
{
const Geo_lille =
vl.markGeoshape({color:'#2A2A2A',stroke: '#FFF', strokeWidth:1, strokeDash: [3, 3]})
.data(vl.topojson(Lille_Geo).feature('poly') )
//.encode({"color": {"field": "valeur_fonciere","type": "quantitative"}})

// MAISONS
const plotALl =
vl.markSquare(
{color:'#FF6600',opacity: '1', filled: false, size:1, strokeWidth: 0.5 , strokeOpacity:'1'}
)
.title("Lille, mutations > "+ + " euros")
.data(Computed)
.encode({
"longitude": { "field": "longitude", "type": "quantitative" },
"latitude": { "field": "latitude", "type": "quantitative" },
"size": { "field": "valeur_fonciere", "type": "quantitative", "title":"Valeur Foncière"},
"color": { "field": "type_local", "type": "nominal", "title":"Nature du bien"},
"tooltip" : {"field": "valeur_fonciere"},
})


//.transform(vl.filter({"and": [{ "field": "valeur_fonciere","gt": n}, {"field": "date_mutation", "range": [{"year": annee, "month": "jan", "date": 1}, {"year": annee, "month": "dec", "date": 1}]}]}))

.transform(vl.filter({ "field": "surface_reelle_bati","gt": n}))
// .encode(
// // vl.color().fieldN('type_local').scale({domain: [50, 300], clamp: true}).legend({format: '%'}),
// vl.size().fieldQ('valeur_fonciere').scale({domain: [200000, 3000000], clamp: true}).legend({}),
// // vl.tooltip().fieldQ('valeur_fonciere').format('.0%')
// )
// RENDER
return vl.layer(Geo_lille,plotALl)
.project(vl.projection('mercator'))
//.width(700)
//.height(400)
.width(900).height(500)
.height(Math.floor(0.5 * width))
.padding(100)
//.autosize({ "type": "none","resize":false, "contains": "padding"})
//.background('#000')
.config({view: {stroke: null}})
.render();
}
Insert cell
Insert cell

// To use copied code replace "data" with your own variable
viewof rr = aq
.from(Lille_Mutations)
// incohérences à gérer
.filter(d => d["valeur_fonciere"] < 3000000)
//.filter(d => d["valeur_fonciere"] > 10000)
.filter(d => d["surface_reelle_bati"] > 100)
.filter(d => d["surface_reelle_bati"] < 150)
.filter(d => d["type_local"] == "Appartement")

.derive({ prixdum2: d => d["valeur_fonciere"]/d["surface_reelle_bati"] })
.rename({ prixdum2: 'Prix du m2' })

// .rollup({
// min:d => op.min(d["valeur_fonciere"]),
// max:d => op.max(d["valeur_fonciere"]),
// mean:d => op.mean(d["valeur_fonciere"]),
// median:d => op.median(d["valeur_fonciere"]),
// count:d => op.count()
// })
.orderby(aq.desc("surface_reelle_bati"))

.view(200000)

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { aq, op } from '@uwdata/arquero'
Insert cell
Insert cell
Insert cell
// import {Wrangler, op} from "@observablehq/data-wrangler"
Insert cell
Insert cell
import {columns} from "@bcardiff/observable-columns"
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more