3 Replies Latest reply: Mar 31, 2015 3:20 AM by Sowmya Pai RSS

    SVG Map Disabled Countries still show popup and drilldown values

      Hello,

       

      I am utilizing the World SVG map extension developed by Brian Munz. Basically, I am trying to calculate market share by country based on three different factors - data source, product line and country. When I toggle between data source and product line, the World map will grey out (disable) the countries where there is no market share; however, you can still hover over that country and see the market share for the previous product line/data source. You can also drill into the country, even through it's greyed out/disabled. I was able to work around this by creating a new instance of the World Map for each data source/product line, but that is a clunky fix and there are performance concerns (as well as code maintenance concerns) since we will have numerous product lines and data sources.I fell like I am missing something fundamental here, such as a specific function I should be using when assigning the world map to use ISO Country Code.

       

      Curious if anyone has any suggestions for how to fix this?

       

      Thanks,

       

      Carsten

        • Re: SVG Map Disabled Countries still show popup and drilldown values

          Maybe this will help to further clarify things. The below calculation is what is being used to calculate the popup content (as well as Measure) values for each ISO_Country_Code. So, basically this is a percentage that pops up on mouseover. Problem is that disabled countries retain values from previous selections, so even though there is no share for that country for specific product line, a value is still present.

           

          =

          (Round(

          (

          Sum ({<YearMon={"$(=min(MaxDate))"},Vendor = {'ABC'}>} Value)

          /

          Sum ({<YearMon={"$(=min(MaxDate))"}>}Value)

          )

          *100,0.1)

          ) & '%'

            • Re: SVG Map Disabled Countries still show popup and drilldown values

              I actually think this is a bug in the World SVG. It is not clearing historical calculations/values based on current selections. I am surprised nobody else has run into this issue.

                • Re: SVG Map Disabled Countries still show popup and drilldown values

                  Hi Carsten,

                   

                  This is indeed a bug in the script. I found the solution to this problem... the script has to be modified in the script.js file.

                   

                  Original Code Snippet

                        else if (window["sj" + r]) {
                                  window["R" + r].forEach(function(e) {
                                      if (e.attr("fill") != h && e.attr("fill") != "none") {

                                          e.attr("fill", h);
                                          e.attr("fill-opacity", 1)
                                      }
                        });

                   

                  Modified Code Snippet

                        else if (window["sj" + r]) {
                                  window["R" + r].forEach(function(e) {
                                      if (e.attr("fill") != h && e.attr("fill") != "none") {

                   

                                  // BEGIN - Edit to hide the values of the unselected locations
                                  e.mousemove(popS).hover(function() {
                                      $("#hoverBox p").html("N/A")
                                  }, function() {
                                      $("#hoverBox").hide()
                                  })
                                  // END

                   

                                          e.attr("fill", h);
                                          e.attr("fill-opacity", 1)
                                      }
                        });