简体   繁体   English

反应 JVectorMap 标记

[英]React JVectorMap marker

The problem refers to marker appearing - Im using React问题是指标记出现 - 我正在使用 React

https://i.stack.imgur.com/hkqnZ.jpg https://i.stack.imgur.com/hkqnZ.jpg

My markers shows up in right places I have no doubts, but there is some initial marker on 0,0 which is not disappearing and I have no idea how to remove it.我的标记出现在正确的位置,我毫不怀疑,但是 0,0 上有一些初始标记并没有消失,我不知道如何将其删除。 It disappears only when I remove 'markers' property from VectorMap component but as you know none of markers would appear after then.只有当我从 VectorMap 组件中删除 'markers' 属性时它才会消失,但正如您所知,此后不会出现任何标记。

Moreover I've tried fill markers 'transparently' etc, but it also affect to correct markers.此外,我尝试过“透明地”填充标记等,但它也会影响正确的标记。

Is there some setup to delete this bugged one?是否有一些设置可以删除这个被窃听的程序? Have I done anything wrong or is it just the library bug?我做错了什么还是只是库错误?

 <VectorMap
            map={"world_mill"}
            markers={{
              latLng: [this.state.CountryFetchLat, this.state.CountryFetchLon],
              name: this.state.CountryRegion
            }}
            backgroundColor="transparent"
            zoomOnScroll={true}
            zoomButtons={false}
            containerStyle={{
              width: "100%",
              height: "90%"
            }}
            containerClassName="map"
            markerStyle={{
              initial: {
                fill: "#4DAC26"
              }
            }}
            regionStyle={{
              initial: {
                fill: "#cccccc",
                "fill-opacity": 1,
                stroke: "none",
                "stroke-width": 0,
                "stroke-opacity": 0
              },
              hover: {
                "fill-opacity": 1,
                fill: "#99ff99",
                cursor: "pointer"
              },
              selected: {
                fill: "#ff0000"
              }
            }}
            selectedRegions={
              this.state.CountryRegion
                ? this.state.CountryRegion.toUpperCase()
                : null
            }
          />

Try arranging the markers in this format:尝试以这种格式排列标记:

markers={{
          US: { latLng: [38.9, -98.45], name: 'Name of City' }
        }}

That will make the "phantom" marker go away.这将使“幻影”标记消失。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM