d3js v5 + topojson v3 Access to the object's properties in the background
I'm looking for a tip to access to the object's properties in the background.
Indeed, with a mousehover, I want to reveal the properties of layer ze.json (the geographical unit).
However, my proportionnal circles hide this layer.
I have not really idea of the procedure envisaged because :
- Circle proportional must be on the top
- Opacity doesn't solve the problem
Maybe I should report the information on proportional circles. But how could I transfer this information ? (not only the population but also the ZE name)
Proportionnal Circles
let rMax = d3.max(featureCollectionZe.features,(d)=>{return d.properties.pop;});
let propCircle = g.attr("class","prop_circle")
.selectAll(".prop_circle")
.data(featureCollectionZe.features)
.enter()
.append("circle")
.attr("transform", (d)=>{return "translate(" + path.centroid(d) + ")";})
.attr("r",(d)=>{return(Math.sqrt(d.properties.pop/rMax))*30;})
.attr("fill","#ffa500")
.attr("fill-opacity",0.8)
.attr("stroke-width",1)
Mouse event
svgZe
.on("mouseover",
(e)=>{return document.getElementById("name").innerHTML=e.properties.nom_ze,
document.getElementById("pop").innerHTML=e.properties.pop;}
)
.on("mouseout",
(e)=>{return document.getElementById("name").innerHTML=" ",
document.getElementById("pop").innerHTML=" ";}
)
Here is my code : https://plnkr.co/edit/ZzeHWfChXa348iNBcHWQ
javascript d3.js topojson
add a comment |
I'm looking for a tip to access to the object's properties in the background.
Indeed, with a mousehover, I want to reveal the properties of layer ze.json (the geographical unit).
However, my proportionnal circles hide this layer.
I have not really idea of the procedure envisaged because :
- Circle proportional must be on the top
- Opacity doesn't solve the problem
Maybe I should report the information on proportional circles. But how could I transfer this information ? (not only the population but also the ZE name)
Proportionnal Circles
let rMax = d3.max(featureCollectionZe.features,(d)=>{return d.properties.pop;});
let propCircle = g.attr("class","prop_circle")
.selectAll(".prop_circle")
.data(featureCollectionZe.features)
.enter()
.append("circle")
.attr("transform", (d)=>{return "translate(" + path.centroid(d) + ")";})
.attr("r",(d)=>{return(Math.sqrt(d.properties.pop/rMax))*30;})
.attr("fill","#ffa500")
.attr("fill-opacity",0.8)
.attr("stroke-width",1)
Mouse event
svgZe
.on("mouseover",
(e)=>{return document.getElementById("name").innerHTML=e.properties.nom_ze,
document.getElementById("pop").innerHTML=e.properties.pop;}
)
.on("mouseout",
(e)=>{return document.getElementById("name").innerHTML=" ",
document.getElementById("pop").innerHTML=" ";}
)
Here is my code : https://plnkr.co/edit/ZzeHWfChXa348iNBcHWQ
javascript d3.js topojson
side notes: zoom can be shortened byg.attr("transform", d3.event.transform);
, what is that purpose of the last.append("g");
, make the stroke of the.ze.
more explicit in the style, it is now due to render artefacts that you see the edges
– rioV8
Nov 22 '18 at 21:10
Thank you for the tip! Indeed,.append("g")
has no sense. I had a displacement problem when I click+move the map with the mouse (latency) but seems disappeared now.
– Bellice
Nov 23 '18 at 10:06
add a comment |
I'm looking for a tip to access to the object's properties in the background.
Indeed, with a mousehover, I want to reveal the properties of layer ze.json (the geographical unit).
However, my proportionnal circles hide this layer.
I have not really idea of the procedure envisaged because :
- Circle proportional must be on the top
- Opacity doesn't solve the problem
Maybe I should report the information on proportional circles. But how could I transfer this information ? (not only the population but also the ZE name)
Proportionnal Circles
let rMax = d3.max(featureCollectionZe.features,(d)=>{return d.properties.pop;});
let propCircle = g.attr("class","prop_circle")
.selectAll(".prop_circle")
.data(featureCollectionZe.features)
.enter()
.append("circle")
.attr("transform", (d)=>{return "translate(" + path.centroid(d) + ")";})
.attr("r",(d)=>{return(Math.sqrt(d.properties.pop/rMax))*30;})
.attr("fill","#ffa500")
.attr("fill-opacity",0.8)
.attr("stroke-width",1)
Mouse event
svgZe
.on("mouseover",
(e)=>{return document.getElementById("name").innerHTML=e.properties.nom_ze,
document.getElementById("pop").innerHTML=e.properties.pop;}
)
.on("mouseout",
(e)=>{return document.getElementById("name").innerHTML=" ",
document.getElementById("pop").innerHTML=" ";}
)
Here is my code : https://plnkr.co/edit/ZzeHWfChXa348iNBcHWQ
javascript d3.js topojson
I'm looking for a tip to access to the object's properties in the background.
Indeed, with a mousehover, I want to reveal the properties of layer ze.json (the geographical unit).
However, my proportionnal circles hide this layer.
I have not really idea of the procedure envisaged because :
- Circle proportional must be on the top
- Opacity doesn't solve the problem
Maybe I should report the information on proportional circles. But how could I transfer this information ? (not only the population but also the ZE name)
Proportionnal Circles
let rMax = d3.max(featureCollectionZe.features,(d)=>{return d.properties.pop;});
let propCircle = g.attr("class","prop_circle")
.selectAll(".prop_circle")
.data(featureCollectionZe.features)
.enter()
.append("circle")
.attr("transform", (d)=>{return "translate(" + path.centroid(d) + ")";})
.attr("r",(d)=>{return(Math.sqrt(d.properties.pop/rMax))*30;})
.attr("fill","#ffa500")
.attr("fill-opacity",0.8)
.attr("stroke-width",1)
Mouse event
svgZe
.on("mouseover",
(e)=>{return document.getElementById("name").innerHTML=e.properties.nom_ze,
document.getElementById("pop").innerHTML=e.properties.pop;}
)
.on("mouseout",
(e)=>{return document.getElementById("name").innerHTML=" ",
document.getElementById("pop").innerHTML=" ";}
)
Here is my code : https://plnkr.co/edit/ZzeHWfChXa348iNBcHWQ
javascript d3.js topojson
javascript d3.js topojson
asked Nov 22 '18 at 17:20
BelliceBellice
1138
1138
side notes: zoom can be shortened byg.attr("transform", d3.event.transform);
, what is that purpose of the last.append("g");
, make the stroke of the.ze.
more explicit in the style, it is now due to render artefacts that you see the edges
– rioV8
Nov 22 '18 at 21:10
Thank you for the tip! Indeed,.append("g")
has no sense. I had a displacement problem when I click+move the map with the mouse (latency) but seems disappeared now.
– Bellice
Nov 23 '18 at 10:06
add a comment |
side notes: zoom can be shortened byg.attr("transform", d3.event.transform);
, what is that purpose of the last.append("g");
, make the stroke of the.ze.
more explicit in the style, it is now due to render artefacts that you see the edges
– rioV8
Nov 22 '18 at 21:10
Thank you for the tip! Indeed,.append("g")
has no sense. I had a displacement problem when I click+move the map with the mouse (latency) but seems disappeared now.
– Bellice
Nov 23 '18 at 10:06
side notes: zoom can be shortened by
g.attr("transform", d3.event.transform);
, what is that purpose of the last .append("g");
, make the stroke of the .ze.
more explicit in the style, it is now due to render artefacts that you see the edges– rioV8
Nov 22 '18 at 21:10
side notes: zoom can be shortened by
g.attr("transform", d3.event.transform);
, what is that purpose of the last .append("g");
, make the stroke of the .ze.
more explicit in the style, it is now due to render artefacts that you see the edges– rioV8
Nov 22 '18 at 21:10
Thank you for the tip! Indeed,
.append("g")
has no sense. I had a displacement problem when I click+move the map with the mouse (latency) but seems disappeared now.– Bellice
Nov 23 '18 at 10:06
Thank you for the tip! Indeed,
.append("g")
has no sense. I had a displacement problem when I click+move the map with the mouse (latency) but seems disappeared now.– Bellice
Nov 23 '18 at 10:06
add a comment |
1 Answer
1
active
oldest
votes
I am not sure, that this solves your problem completely, but have you tried to apply pointer-events: none
CSS property to circles?
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435757%2fd3js-v5-topojson-v3-access-to-the-objects-properties-in-the-background%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am not sure, that this solves your problem completely, but have you tried to apply pointer-events: none
CSS property to circles?
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
add a comment |
I am not sure, that this solves your problem completely, but have you tried to apply pointer-events: none
CSS property to circles?
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
add a comment |
I am not sure, that this solves your problem completely, but have you tried to apply pointer-events: none
CSS property to circles?
I am not sure, that this solves your problem completely, but have you tried to apply pointer-events: none
CSS property to circles?
answered Nov 22 '18 at 17:29
Yaroslav SergienkoYaroslav Sergienko
40016
40016
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
add a comment |
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
Indeed, it works. Thank you again!
– Bellice
Nov 23 '18 at 8:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435757%2fd3js-v5-topojson-v3-access-to-the-objects-properties-in-the-background%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
side notes: zoom can be shortened by
g.attr("transform", d3.event.transform);
, what is that purpose of the last.append("g");
, make the stroke of the.ze.
more explicit in the style, it is now due to render artefacts that you see the edges– rioV8
Nov 22 '18 at 21:10
Thank you for the tip! Indeed,
.append("g")
has no sense. I had a displacement problem when I click+move the map with the mouse (latency) but seems disappeared now.– Bellice
Nov 23 '18 at 10:06