This is a migrated thread and some comments may be shown as answers.

Map tooltip template

4 Answers 164 Views
Map
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 10 Sep 2016, 03:56 AM

I've got the tooltip showing on click, but I cannot access any of the variables from my datasource read method in the template. I either get undefined, or errors when trying different combinations with the template. 

 

<script id="Map_Tooltip_Template" type="text/x-kendo-template">
        <p>#=latlng#</p>
</script>

4 Answers, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 12 Sep 2016, 08:18 PM
Hello Adam,

The fields that can be used for the template are the location and marker.  In order to set the location like you've described into the template, use the following:

<script id="Map_Tooltip_Template" type="text/x-kendo-template">
        <p>#=location.lat##=location.lng#</p>
</script>

Here is a Kendo UI Dojo by Progress which illustrates this approach.

You can find more information on the markers.tooltip.template configuration here in our helpful documentation.

Hope this helps!

Regards,
Patrick
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Max
Top achievements
Rank 2
answered on 09 Nov 2017, 09:54 PM
What if you wanted to return the name of the location not the lat and long?
0
Eduardo Serra
Telerik team
answered on 13 Nov 2017, 06:34 PM
Hello Max,

In the Map tooltip template, we can access the kendo.dataviz.map.Location instance (read more about the template here) and the fields available in it are only lat and lng; take a look at them in our API here.

The names of locations depend on the actual map providers and not Kendo UI, so they're unavailable to the tooltip. If you had a list of names and locations in a DataSource, you could through some customization show tooltips at certain positions: take a look at this sample in the Kendo UI Dojo demonstrating how it could be done.

I hope this helps!

Regards,
Eduardo Serra
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Max
Top achievements
Rank 2
answered on 21 Nov 2017, 06:34 PM
Thank you that was perfect!
Tags
Map
Asked by
Adam
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Max
Top achievements
Rank 2
Eduardo Serra
Telerik team
Share this question
or