Преглед на файлове

Add search box (doesn't work)

Petra Lamborn преди 4 години
родител
ревизия
6b63864447
променени са 1 файла, в които са добавени 14 реда и са изтрити 4 реда
  1. 14
    4
      MedicalCentres/app.R

+ 14
- 4
MedicalCentres/app.R Целия файл

@@ -1,6 +1,7 @@
1 1
 #! /usr/bin/Rscript
2 2
 library(shiny)
3 3
 library(leaflet)
4
+library(leaflet.extras)
4 5
 library(dplyr)
5 6
 library(shinyWidgets)
6 7
 library(htmltools)
@@ -91,8 +92,11 @@ server <- function(input, output, session) {
91 92
         gl <- addCircleMarkers(gl, lng = Geo2017$lon,
92 93
                    lat = Geo2017$lat,
93 94
                    popup = popups(Geo2017),
94
-                   col= "blue"
95
+                   col= "blue",
96
+                   label = Geo2017$name,
97
+                   group = "locations"
95 98
                    )
99
+        gl <- addSearchFeatures(gl, targetGroups = "locations")
96 100
         gl
97 101
     })
98 102
 
@@ -107,19 +111,25 @@ server <- function(input, output, session) {
107 111
           gl <- addCircleMarkers(gl, lng = Geo2017$lon,
108 112
                      lat = Geo2017$lat,
109 113
                      popup = popups(Geo2017),
110
-                     col = snargcol(Geo2017$Snargle)
114
+                     col = snargcol(Geo2017$Snargle),
115
+                     label = Geo2017$name,
116
+                     group = "locations"
111 117
                      )
112 118
       } else if (input$selcol == "DHB") {
113 119
           gl <- addCircleMarkers(gl, lng = Geo2017$lon,
114 120
                      lat = Geo2017$lat,
115 121
                      popup = popups(Geo2017),
116
-                     col = dhbcol(Geo2017$dhb_name)
122
+                     col = dhbcol(Geo2017$dhb_name),
123
+                     label = Geo2017$name,
124
+                     group = "locations"
117 125
                      )
118 126
       } else {
119 127
           gl <- addCircleMarkers(gl, lng = Geo2017$lon,
120 128
                      lat = Geo2017$lat,
121 129
                      popup = popups(Geo2017),
122
-                     col= "blue"
130
+                     col= "blue",
131
+                     label = Geo2017$name,
132
+                     group = "locations"
123 133
                      )
124 134
       }
125 135
     })