Remove crosstalk from listings and sales tabs
All checks were successful
Deploy stAndrews / deploy (push) Successful in 6s
All checks were successful
Deploy stAndrews / deploy (push) Successful in 6s
This commit is contained in:
31
app.R
31
app.R
@@ -6,7 +6,6 @@ library(sf)
|
||||
library(dplyr)
|
||||
library(leafpop)
|
||||
library(DT)
|
||||
library(crosstalk)
|
||||
|
||||
# load data ----
|
||||
owners <- readRDS("./data/owners.rds")
|
||||
@@ -16,14 +15,12 @@ listings <- readRDS("./data/listings.rds") |>
|
||||
price_fmt = scales::dollar(price),
|
||||
ppsf_fmt = scales::dollar(price_per_sqft)
|
||||
)
|
||||
shared_listings <- SharedData$new(listings, key = ~address)
|
||||
sales <- readRDS("./data/sales.rds") |>
|
||||
arrange(desc(listed_date)) |>
|
||||
mutate(
|
||||
price_fmt = scales::dollar(price),
|
||||
ppsf_fmt = scales::dollar(price_per_sqft)
|
||||
)
|
||||
shared_sales <- SharedData$new(sales, key = ~address)
|
||||
last_sale_date <- format(attr(owners, "last_sale_date"), "%Y-%m-%d")
|
||||
sbdvn <- sf::st_read("./data/plats/plats.shp")
|
||||
beaches <- readRDS("./data/beaches.rds")
|
||||
@@ -491,7 +488,7 @@ server <- function(input, output) {
|
||||
|
||||
# listings map ----
|
||||
output$listings_map <- renderLeaflet({
|
||||
leaflet(shared_listings) |>
|
||||
leaflet(listings) |>
|
||||
addProviderTiles("CartoDB.Voyager") |>
|
||||
addPolygons(
|
||||
data = sbdvn,
|
||||
@@ -515,26 +512,22 @@ server <- function(input, output) {
|
||||
})
|
||||
|
||||
# listings table ----
|
||||
output$listings_table <- renderDT(server = FALSE, {
|
||||
output$listings_table <- renderDT({
|
||||
datatable(
|
||||
shared_listings,
|
||||
colnames = c("Listed", "Address", "Sq Ft", "Price (raw)", "$/Sq Ft (raw)",
|
||||
"Lat", "Lng", "Price", "$/Sq Ft"),
|
||||
listings |> select(listed_date, address, sqft, price_fmt, ppsf_fmt),
|
||||
colnames = c("Listed", "Address", "Sq Ft", "Price", "$/Sq Ft"),
|
||||
rownames = FALSE,
|
||||
options = list(
|
||||
pageLength = 25,
|
||||
searching = FALSE,
|
||||
dom = 't',
|
||||
columnDefs = list(
|
||||
list(visible = FALSE, targets = c(3, 4, 5, 6))
|
||||
)
|
||||
dom = 't'
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
# sales map ----
|
||||
output$sales_map <- renderLeaflet({
|
||||
leaflet(shared_sales) |>
|
||||
leaflet(sales) |>
|
||||
addProviderTiles("CartoDB.Voyager") |>
|
||||
addPolygons(
|
||||
data = sbdvn,
|
||||
@@ -559,19 +552,15 @@ server <- function(input, output) {
|
||||
})
|
||||
|
||||
# sales table ----
|
||||
output$sales_table <- renderDT(server = FALSE, {
|
||||
output$sales_table <- renderDT({
|
||||
datatable(
|
||||
shared_sales,
|
||||
colnames = c("Date", "Address", "Sq Ft", "Price (raw)", "$/Sq Ft (raw)",
|
||||
"Lat", "Lng", "Price", "$/Sq Ft"),
|
||||
sales |> select(listed_date, address, sqft, price_fmt, ppsf_fmt),
|
||||
colnames = c("Date", "Address", "Sq Ft", "Price", "$/Sq Ft"),
|
||||
rownames = FALSE,
|
||||
options = list(
|
||||
pageLength = 10,
|
||||
searching = FALSE,
|
||||
dom = 't',
|
||||
columnDefs = list(
|
||||
list(visible = FALSE, targets = c(3, 4, 5, 6))
|
||||
)
|
||||
dom = 't'
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user