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

Dynamic data update #16

Open
ud-klee opened this issue Mar 30, 2020 · 8 comments
Open

Dynamic data update #16

ud-klee opened this issue Mar 30, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@ud-klee
Copy link

ud-klee commented Mar 30, 2020

I figured that the applyData() method can be used to update the map data after the map has been rendered, but the tooltips are not aware of the data change. Can it expose the API to rebuild the tooltips, or use custom events to notify the tooltips on model change? Thanks!

@ud-klee
Copy link
Author

ud-klee commented Mar 30, 2020

Aha! Looks like I also need to update options.data too... kind of hacky though, it'd be nice if there's a public API for this :)

@StephanWagner
Copy link
Owner

Yeah, the tooltips get the data from the options object. Maybe a new method updateData() would be a good solution.

@StephanWagner StephanWagner added the enhancement New feature or request label Apr 8, 2020
@xaja
Copy link

xaja commented May 5, 2020

is there any public api methods? how to update map with new data?

@StephanWagner
Copy link
Owner

At the moment there are none. It's just really what's in the readme or here: https://stephanwagner.me/create-world-map-charts-with-svgmap

It definitely would be a good addition and I hope I'll get around to improve svgmap soon.

@arelidev
Copy link

Does anyone find a solution for this? I'm assuming it's not being developed anymore.

@xaja
Copy link

xaja commented Aug 23, 2022

Does anyone find a solution for this? I'm assuming it's not being developed anymore.

some thoughts and minimal demo

when you update your map data via computed you change the key with new unique value, that forces component <Svgmap> to rerender with your new data. it is not beautiful, but works

<template>
  <div>
    <Svgmap :data="mapData" :key="componentKeyForceRerender"></Svgmap>
  </div>
</template>
<script>
import Svgmap from "@/components/Svgmap.vue";

export default {
  components: {
    Svgmap
  },
  data() {
    return {
      componentKeyForceRerender: 0
    };
  },
  methods: {
    forceRerender() {
      this.componentKeyForceRerender += 1;
    }
  },
  computed: {
    mapData() {
      const result = "your data for map";
      this.forceRerender();
      return result;
    }
  }
};
</script>

@tipsy
Copy link

tipsy commented Jul 30, 2024

@ud-klee did you figure out how to do this?

@tipsy
Copy link

tipsy commented Jul 30, 2024

Okay, it's actually quite simple: #121 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants