Skip to content Skip to sidebar Skip to footer

Why Does This Title Graphic Not Update With World

For the following I am happy that the combobox is defaulting to world - but when a radio is hit I'd also like the title to move back to 'world' - how do I do this? I have this plun

Solution 1:

My solution involves passing an argument to the function addProdTitl:

var menu = d3.select("#projection-menu")
    .on("change", function(){
        var thisvalue = this.value;
        addProdTitl(thisvalue);
    });

So, we can rewrite the function as:

functionaddProdTitl(thisvalue) {
    var combSel = thisvalue;
    //the rest of the function.

That way, everytime you change the radio, just do:

if (!d3.select("#prodTitle").empty()){
    addProdTitl("world");
}

Here is the plunker: http://plnkr.co/edit/VvjHHp6KZrypwc9ApSPN?p=preview

Solution 2:

Adding to Gerardo Furtado 's solution to load the first time:

// to initialize on first loadvar e = document.getElementById( "projection-menu" );
addProdTitl(e.options[e.selectedIndex].value);

http://plnkr.co/edit/RezPI5iuuW84tlCLVB00?p=preview

Post a Comment for "Why Does This Title Graphic Not Update With World"