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

How to get clicked country name? #243

Open
piotrgolawski opened this issue Sep 2, 2019 · 4 comments
Open

How to get clicked country name? #243

piotrgolawski opened this issue Sep 2, 2019 · 4 comments

Comments

@piotrgolawski
Copy link

piotrgolawski commented Sep 2, 2019

Hello, as in the title,
which event I can use?
ClickEvent does not provide that information,
clickMapObjectEvent does not work.

Hacks like
document.elementFromPoint(e.chart.mouseX, e.chart.mouseY).getAttribute('aria-label')
are pointing to wrong places, propably cuz of margins, paddings etc.

@piotrgolawski
Copy link
Author

Bump.
Hello, I really need this one, do you have any idea? :)

@piotrgolawski
Copy link
Author

piotrgolawski commented Sep 16, 2019

I found ugly AF solution

     new MutationObserver(() => {
          const countryTooltip = document.getElementsByClassName('amcharts-balloon-div').item(0);
          if (countryTooltip) {
              console.log('countryTooltip', countryTooltip.textContent)
              return;
          }
      }).observe(document, {
          childList: true,
          subtree: true
      });

@piotrgolawski
Copy link
Author

Bump. Do you have better one?

@piotrgolawski
Copy link
Author

Heeeeeeeeey

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