Skip to content

Commit 4111174

Browse files
committed
popups #1206
1 parent 2b31be2 commit 4111174

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

R/tmapLeafletDataPlot_polygons.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ tmapLeafletDataPlot.tm_data_polygons = function(a, shpTM, dt, pdt, popup.format,
1313

1414
dt = res$dt
1515

16+
idt_null = is.null(idt)
1617
if (!is.null(idt)) {
1718
idt = idt$id[match(dt$tmapID__, idt$tmapID__)]
19+
} else {
20+
idt = sprintf("%07d", dt$tmapID__)[shpTM_match]
1821
}
1922
if (!is.null(hdt)) {
2023
hdt = hdt$hover[match(dt$tmapID__, hdt$tmapID__)]
@@ -27,7 +30,7 @@ tmapLeafletDataPlot.tm_data_polygons = function(a, shpTM, dt, pdt, popup.format,
2730
mtch = match(dt$tmapID__, pdt$tmapID__)
2831
pdt = pdt[mtch][, tmapID__ := NULL]
2932

30-
if (is.null(idt) && !is.null(hdt)) {
33+
if (idt_null && !is.null(hdt)) {
3134
popups = view_format_popups(id = hdt, titles = names(pdt), values = pdt, format = popup.format)
3235
} else {
3336
popups = view_format_popups(id = idt, titles = names(pdt), values = pdt, format = popup.format)

R/tmapLeafletDataPlot_symbols.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ tmapLeafletDataPlot.tm_data_symbols = function(a, shpTM, dt, pdt, popup.format,
2828
shpTM_match = TRUE
2929
}
3030

31-
if (!is.null(idt)) {
31+
idt_null = is.null(idt)
32+
33+
if (!idt_null) {
3234
idt = idt$id[match(dt$tmapID__[shpTM_match], idt$tmapID__)]
3335
} else {
3436
idt = sprintf("%07d", dt$tmapID__)[shpTM_match]
@@ -43,7 +45,11 @@ tmapLeafletDataPlot.tm_data_symbols = function(a, shpTM, dt, pdt, popup.format,
4345
mtch = match(dt$tmapID__[shpTM_match], pdt$tmapID__)
4446
pdt = pdt[mtch][, tmapID__ := NULL]
4547

46-
popups = view_format_popups(id = idt, titles = names(pdt), values = pdt, format = popup.format)
48+
if (idt_null) {
49+
popups = view_format_popups(titles = names(pdt), values = pdt, format = popup.format)
50+
} else {
51+
popups = view_format_popups(id = idt, titles = names(pdt), values = pdt, format = popup.format)
52+
}
4753
}
4854

4955
idt = submit_labels(idt, "symbols", pane, group)

R/tmapLeaflet_layers.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ tmapLeafletDataPlot.default = function(a, shpTM, dt, pdt, popup.format, hdt, idt
123123
# x * scale
124124
# })
125125
lty2dash = function(lty, lwd) {
126-
po(lty,lwd)
127126
k = max(length(lty), length(lwd))
128127
lty = rep(lty, length.out = k)
129128
lwd = rep(lwd, length.out = k)

R/view_format_popups.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ view_format_popups <- function(id=NULL, titles, format, values) {
2121
}
2222
})
2323
if (!is.null(id)) {
24-
labels <- paste("<b>", h[[1]](id), "</b>", sep="")
24+
labels <- (paste("<b>", id, "</b>", sep=""))
2525
} else {
2626
labels <- ""
2727
}

0 commit comments

Comments
 (0)