Hi Zhou,
Thank you for contacting Syncfusion support.
We can achieve your requirement of using “v-for in Vue” in the Maps component. To display the list of data from our “dataSource” in the tooltip template, please find the code snippet below.
Code Snippet:
|
<div id="dataSource" style="display:none"> <div class="toolback"> <div class="listing2"></div> <div> <span class="listing1"></span> <span class="listing2"></span> </div> <div v-for="(item, index) in dataSource" :key="index"> <span class="listing2"> Name : {{item.name}} ; </span> <span class="listing2"> Code : {{item.code}} ; </span> <span class="listing2"> Density : {{item.density}} ; </span> </div> </div> </div>
export default { data() { return { dataSource: [ { 'code': 'AF', 'value': 53, 'name': 'Afghanistan', 'population': 29863010, 'density': 119, 'color': '#DEEBAE' }, //.. //.. ],
tooltipSettings: { visible: true, valuePath: 'name', template:'#dataSource' }, } }, |
We have created a sample to demonstrate the same and it can be found from the below link.
Sample - https://www.syncfusion.com/downloads/support/directtrac/general/ze/VueInVFor-1401230537
Screenshot –
Please let us know if the above sample meets your requirement and let us know if you need any further assistance.
Regards,
Indumathi R.
Thanks for your reply, I had solved this problem yet .
Through listening the before tooltipRender event to get the current province's bindingData and then set it to the label's dataSource, it works...
I have a another questions to ask that how can i adjust the label's position in the map? I had tried my best to adjust it's position like modify the province's center longitude and latitude in the mapData.json or set the labelsetting properties (rx,ry) ,but it doesn't work.
Thanks for your reply, I had solved this problem yet .
Through listening the before tooltipRender event to get the current province's bindingData and then set it to the label's dataSource, it works...
I have a another questions to ask that how can i adjust the label's position in the map? I had tried my best to adjust it's position like modify the province's center longitude and latitude in the mapData.json or set the labelsetting properties (rx,ry) ,but it doesn't work.
Hi Zhou,
Thank you for the update.
Currently, we do not support customizing the position of the data labels in the Maps component. The properties “rx” and “ry” are used to customize the corner radius of the border for the labels and it cannot be used for achieving your requirement. However, we will analyze the feasibility of this scenario and provide you further details on May 30, 2022.
Meanwhile, we can use annotations to render texts in the Maps component. Please find the documentation link below to know more about the functionalities of the annotations.
https://ej2.syncfusion.com/vue/documentation/maps/annotations/#annotation
Please let us know if you need any further assistance.
Regards,
Indumathi R.
Hi Zhou,
We have considered your requirement in customizing the position of the data labels as an improvement and added it to our features request list. This feature will be available in our 2022 Volume 3 main release. Meanwhile, please find the feedback link below to keep track of this feature.
https://www.syncfusion.com/feedback/35273
Regards,
Indumathi R.
Hi Zhou,
We have implemented the reported improvement – "Support to customize the label position in the dataLabelRendering event of the Maps". Now, you can use the "offsetX" and "offsetY" properties in the event argument of the "dataLabelRendering" event in the Maps component to position the label for each label in the Maps. Please find the sample from the below link for your reference.
https://www.syncfusion.com/downloads/support/directtrac/general/ze/VueSample1515133787
This improvement is included in our Essential Studio 2022 Volume 3 release v20.3.0.47 which is rolled out and is available for download under the following link.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Indumathi R.