Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh problem with 3+ countries #67

Open
benstigsen opened this issue Jun 19, 2022 · 0 comments
Open

Refresh problem with 3+ countries #67

benstigsen opened this issue Jun 19, 2022 · 0 comments

Comments

@benstigsen
Copy link

I'm trying to apply data to the map, then using map.applyData(), which sort of works, but only when I have changed the data for 2 countries. If I do it for 3 or more, it simply doesn't redraw or update colors (something like that).

Try using the example below. Hover the mouse over Canada, nothing changes, but hover it over the US and it works. The only difference being one more country when hovering on Canada.

var map = new svgMap({
  targetElementID: 'svgMap',
  onGetTooltip: myCustomData,
  data: {
    data: {
      applicable: {
        name: 'Applicable',
        format: '{0}',
        thousandSeparator: ',',
        thresholdMax: 1,
        thresholdMin: 0
      }
    },
    applyData: 'applicable',
    values: {
      AF: { applicable: 1 },
      AL: { applicable: 1 },
      SE: { applicable: 1 }
    },
  }
});

function myCustomData(tooltipDiv, countryID, countryValues) {
  if (countryID === "CA") {
    map.options.data.values["AF"].applicable = 0;
    map.options.data.values["AL"].applicable = 0;
    map.options.data.values["SE"].applicable = 0;
    map.applyData(map.options.data);
  }
  
  if (countryID === "US") {
    map.options.data.values["AF"].applicable = 0;
    map.options.data.values["AL"].applicable = 0;
    map.applyData(map.options.data);
  }

  return "Hello world!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant