score:0

i just glanced at the code on the page you referenced the working example at and think i figured out the issue.

here's the line that taking out the ticks from the legend svg:

d3.selectall("text").remove();

which is a part of the onchange function for $("#stateselect").

line number: 279 to be more specific (in index.html file)

i think you want to take out all the texts from the mainsvg i.e. with the id: svgmap2.

changing the above selection will fix the issue. (for eg. if you have a class for the texts to be removed, use d3.selectall('text.<classname>').

hope this helps.

score:0

i figured out why it's "disappearing". the web is a stateless medium. so, every time i changed selection from the dropdownlist, the svg refreshes and losses its current state. so i needed to re-create my legend for the state and county dropdownlists. but also, for the county dropdownlist, since there is a zoom function, it meant that everytime i zoom to another county, i loss my map state again. so i moved the recreate legend function into the zoomedin method (that is, after the zoom state). it works now.


Related Query