pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<small id='DxqDH'></small><noframes id='DxqDH'>

<tfoot id='DxqDH'></tfoot>
    <i id='DxqDH'><tr id='DxqDH'><dt id='DxqDH'><q id='DxqDH'><span id='DxqDH'><b id='DxqDH'><form id='DxqDH'><ins id='DxqDH'></ins><ul id='DxqDH'></ul><sub id='DxqDH'></sub></form><legend id='DxqDH'></legend><bdo id='DxqDH'><pre id='DxqDH'><center id='DxqDH'></center></pre></bdo></b><th id='DxqDH'></th></span></q></dt></tr></i><div class="uu0w2qs" id='DxqDH'><tfoot id='DxqDH'></tfoot><dl id='DxqDH'><fieldset id='DxqDH'></fieldset></dl></div>

        • <bdo id='DxqDH'></bdo><ul id='DxqDH'></ul>
      1. <legend id='DxqDH'><style id='DxqDH'><dir id='DxqDH'><q id='DxqDH'></q></dir></style></legend>

        R Leaflet:將多個組分配給一個層以過濾數(shù)據(jù)并更改

        R Leaflet: Assign multiple groups to a layer to filter data and change column represented(R Leaflet:將多個組分配給一個層以過濾數(shù)據(jù)并更改表示的列)
        <i id='naHJ8'><tr id='naHJ8'><dt id='naHJ8'><q id='naHJ8'><span id='naHJ8'><b id='naHJ8'><form id='naHJ8'><ins id='naHJ8'></ins><ul id='naHJ8'></ul><sub id='naHJ8'></sub></form><legend id='naHJ8'></legend><bdo id='naHJ8'><pre id='naHJ8'><center id='naHJ8'></center></pre></bdo></b><th id='naHJ8'></th></span></q></dt></tr></i><div class="m0qc6ys" id='naHJ8'><tfoot id='naHJ8'></tfoot><dl id='naHJ8'><fieldset id='naHJ8'></fieldset></dl></div>
      2. <legend id='naHJ8'><style id='naHJ8'><dir id='naHJ8'><q id='naHJ8'></q></dir></style></legend>

            <small id='naHJ8'></small><noframes id='naHJ8'>

                <tbody id='naHJ8'></tbody>
                <bdo id='naHJ8'></bdo><ul id='naHJ8'></ul>

                • <tfoot id='naHJ8'></tfoot>

                • 本文介紹了R Leaflet:將多個組分配給一個層以過濾數(shù)據(jù)并更改表示的列的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我試圖在 R 傳單中找到一種方法來包含覆蓋按鈕,以過濾掉數(shù)據(jù)中的組.我還需要包含用于切換數(shù)據(jù)中表示的列的單選按鈕.我似乎找不到使用 addLayersControl() 函數(shù)在 R 傳單中執(zhí)行此操作的方法.

                  I am trying to find a way in R leaflet to include overlay buttons which filters out groups in the data. I also need to include radio buttons which switch the column which is being represented in the data. I can't seem to find a way to do this in R leaflet using the addLayersControl() function.

                  我最初認(rèn)為可以將多個組添加到單個圖層并使用 baseGroups 和 overlayGroups(如下面的代碼所示).然而,這并沒有達(dá)到預(yù)期的結(jié)果.如果有人可以提出另一種方法來實現(xiàn)這一目標(biāo),我將不勝感激.最好不要發(fā)亮.

                  I initial thought it would be possible to add multiple groups to a single layer and use baseGroups and overlayGroups (as seen in the code below). However, this does not achieve the desired results. I would appreciate it if someone could suggest an alternative way to achieve this. Preferably without shiny.

                  library(dplyr)
                  library(leaflet)
                  
                  data <- data.frame(Name = c("A", "A", "A", "B", "B", "C", "C", "C"),
                                     Value1 = c(12,43,54,34,23,77,44,22),
                                     Value2 = c(6,5,2,7,5,6,4,3),
                                     Lat = c(51.1, 51.6, 57.3, 52.4, 56.3, 54.3, 60.4, 49.2),
                                     Lon = c(5, -3, -2, -1, 4, 3, -5, 0))
                  data %>%
                    leaflet() %>%
                    addProviderTiles(providers$CartoDB.Positron) %>%
                    addCircles(lat=~Lat, lng=~Lon, radius = ~Value1*1000, group=c(~Name, "Value1")) %>%
                    addCircles(lat=~Lat, lng=~Lon, radius = ~Value2, group=c(~Name, "Value2")) %>%
                    addLayersControl(
                      baseGroups = c("Value1", "Value2"),
                      overlayGroups = c("A", "B", "C"),
                      options = layersControlOptions(collapsed = F)
                    )
                  

                  圖像:輸出不是我所期望的

                  推薦答案

                  下面是一個非常不優(yōu)雅和 hacky 的問題解決方案.它為每個圓圈分配一個圖層 ID,并使用一些 javascript 來確定在給定輸入復(fù)選框的情況下應(yīng)該顯示哪個圓圈.

                  Below is a very inelegant and hacky solution to the problem. It assigns a layer id to each circle and uses some javascript to determine which circle should be displayed given the input checkboxes.

                  可以在此處找到工作演示:https://rpubs.com/Jumble/leaflet_layer_control

                  A working demonstration can be found here: https://rpubs.com/Jumble/leaflet_layer_control

                  如果有人有更優(yōu)雅的解決方案,請分享.

                  Please share if anyone has a more elegant solution.

                  library(dplyr)
                  library(leaflet)
                  library(htmlwidgets)
                  
                  data <- data.frame(ID = c("1", "2","3","4","5","6","7","8"),
                                     Name = c("A", "A", "A", "B", "B", "C", "C", "C"),
                                     Value1 = c(12,43,54,34,23,77,44,22),
                                     Value2 = c(6,5,2,7,5,6,4,3),
                                     Lat = c(51.1, 51.6, 57.3, 52.4, 56.3, 54.3, 60.4, 49.2),
                                     Lon = c(5, -3, -2, -1, 4, 3, -5, 0))
                  data %>%
                    leaflet() %>%
                    addProviderTiles(providers$CartoDB.Positron) %>%
                    addCircles(lat=~Lat, lng=~Lon, radius = ~Value1*1000, group=~Name, label=~Name, popup=~as.character(Value1), layerId = ~paste(ID,"Value1", sep="")) %>%
                    addCircles(lat=~Lat, lng=~Lon, radius = ~Value2, group=~Name, label=~Name, popup=~as.character(Value2), layerId = ~paste(ID,"Value2", sep="")) %>%
                    addLayersControl(
                      baseGroups = c("Value1", "Value2"),
                      overlayGroups = c("A", "B", "C"),
                      options = layersControlOptions(collapsed = F)
                    ) %>%
                    htmlwidgets::onRender("
                      function(el, x) {
                        var myMap = this;
                        var baseLayer = 'Value1';
                        myMap.eachLayer(function(layer){
                          var id = layer.options.layerId;
                          if (id){
                            if ('Value1' !== id.substring(1,)){
                              layer.getElement().style.display = 'none';
                            }
                          }
                        })
                        console.log(myMap.baselayer);
                        myMap.on('baselayerchange',
                          function (e) {
                            baseLayer=e.name;
                            myMap.eachLayer(function (layer) {
                                var id = layer.options.layerId;
                                if (id){
                                  if (e.name !== id.substring(1,)){
                                    layer.getElement().style.display = 'none';
                                    layer.closePopup();
                                  }
                                  if (e.name === id.substring(1,)){
                                    layer.getElement().style.display = 'block';
                                  }
                                }
                  
                            });
                          })
                          myMap.on('overlayadd', function(e){
                            myMap.eachLayer(function(layer){
                              var id = layer.options.layerId;
                              if (id){
                                  if (baseLayer !== id.substring(1,)){
                                    layer.getElement().style.display = 'none';
                                  }
                              }    
                            })
                          })
                      }")
                  

                  這篇關(guān)于R Leaflet:將多個組分配給一個層以過濾數(shù)據(jù)并更改表示的列的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點(diǎn)是否在傳單中的另一個內(nèi)部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標(biāo)記群集圖標(biāo)顏色,繼承其余默認(rèn) CSS 屬性)
                  Trigger click on leaflet marker(觸發(fā)點(diǎn)擊傳單標(biāo)記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認(rèn)加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側(cè)邊欄)

                  <legend id='pS1iW'><style id='pS1iW'><dir id='pS1iW'><q id='pS1iW'></q></dir></style></legend>
                    <tbody id='pS1iW'></tbody>
                  <tfoot id='pS1iW'></tfoot>

                  <small id='pS1iW'></small><noframes id='pS1iW'>

                        <bdo id='pS1iW'></bdo><ul id='pS1iW'></ul>

                        1. <i id='pS1iW'><tr id='pS1iW'><dt id='pS1iW'><q id='pS1iW'><span id='pS1iW'><b id='pS1iW'><form id='pS1iW'><ins id='pS1iW'></ins><ul id='pS1iW'></ul><sub id='pS1iW'></sub></form><legend id='pS1iW'></legend><bdo id='pS1iW'><pre id='pS1iW'><center id='pS1iW'></center></pre></bdo></b><th id='pS1iW'></th></span></q></dt></tr></i><div class="gk6uugm" id='pS1iW'><tfoot id='pS1iW'></tfoot><dl id='pS1iW'><fieldset id='pS1iW'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 扒渣机,铁水扒渣机,钢水扒渣机,铁水捞渣机,钢水捞渣机-烟台盛利达工程技术有限公司 | 120kv/2mA直流高压发生器-60kv/2mA-30kva/50kv工频耐压试验装置-旭明电工 | bng防爆挠性连接管-定做金属防爆挠性管-依客思防爆科技 | 山东彩钢板房,山东彩钢活动房,临沂彩钢房-临沂市贵通钢结构工程有限公司 | 玻璃钢型材_拉挤模具_玻璃钢拉挤设备——滑县康百思 | BAUER减速机|ROSSI-MERSEN熔断器-APTECH调压阀-上海爱泽工业设备有限公司 | 卫生人才网-中国专业的医疗卫生医学人才网招聘网站! | 软启动器-上海能曼电气有限公司 真空搅拌机-行星搅拌机-双行星动力混合机-广州市番禺区源创化工设备厂 | 成都软件开发_OA|ERP|CRM|管理系统定制开发_成都码邻蜀科技 | 仓储货架_南京货架_钢制托盘_仓储笼_隔离网_环球零件盒_诺力液压车_货架-南京一品仓储设备制造公司 | 酒精检测棒,数显温湿度计,酒安酒精测试仪,酒精检测仪,呼气式酒精检测仪-郑州欧诺仪器有限公司 | 2025世界机器人大会_IC China_半导体展_集成电路博览会_智能制造展览网 | 济南律师,济南法律咨询,山东法律顾问-山东沃德律师事务所 | 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 纯化水设备-EDI-制药-实验室-二级反渗透-高纯水|超纯水设备 | 旋振筛|圆形摇摆筛|直线振动筛|滚筒筛|压榨机|河南天众机械设备有限公司 | 精密模具-双色注塑模具加工-深圳铭洋宇通 | 悬浮拼装地板_幼儿园_篮球场_悬浮拼接地板-山东悬浮拼装地板厂家 | 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 耐磨陶瓷,耐磨陶瓷管道_厂家-淄博拓创陶瓷科技 | 桌上式超净工作台-水平送风超净工作台-上海康路仪器设备有限公司 | 膜结构_ETFE膜结构_膜结构厂家_膜结构设计-深圳市烨兴智能空间技术有限公司 | 【电子厂招聘_普工招工网_工厂招聘信息平台】-工立方打工网 | 免费网站网址收录网_海企优网站推荐平台 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 | 水热合成反应釜-防爆高压消解罐-西安常仪仪器设备有限公司 | 破碎机锤头_合金耐磨锤头_郑州宇耐机械工程技术有限公司 | 防火卷帘门价格-聊城一维工贸特级防火卷帘门厂家▲ | 齿轮减速机电机一体机_齿轮减速箱加电机一体化-德国BOSERL蜗轮蜗杆减速机电机生产厂家 | 不锈钢闸阀_球阀_蝶阀_止回阀_调节阀_截止阀-可拉伐阀门(上海)有限公司 | 东莞市天进机械有限公司-钉箱机-粘箱机-糊箱机-打钉机认准东莞天进机械-厂家直供更放心! | 天津试验仪器-电液伺服万能材料试验机,恒温恒湿标准养护箱,水泥恒应力压力试验机-天津鑫高伟业科技有限公司 | 直流电能表-充电桩电能表-导轨式电能表-智能电能表-浙江科为电气有限公司 | 光栅尺厂家_数显表维修-苏州泽升精密机械 | 阜阳在线-阜阳综合门户| 合肥注册公司|合肥代办营业执照、2024注册公司流程 | 精密冲床,高速冲床等冲压设备生产商-常州晋志德压力机厂 | 工控机,嵌入式主板,工业主板,arm主板,图像采集卡,poe网卡,朗锐智科 | 捷码低代码平台 - 3D数字孪生_大数据可视化开发平台「免费体验」 | 日本细胞免疫疗法_肿瘤免疫治疗_NK细胞疗法 - 免疫密码 |