I want to show labels on each state with 2 values like stata name and population in separate rows and each state should maintain click event or drilling option also.
Please provide me solution asap.
eg:
state:VA
Population: 222222
Hello ashok_a wrote,
Thank you for posting in our forum.
Do you need something similar to a custom marker template? There’s an example on how to achieve this here:
http://es.infragistics.com/products/jquery/sample/map/marker-template
Using this approach you could add any text you’d like based on the data you have for each specific item (data.item()) and format it accordingly .
There are however no click events for those elements. They’re all painted items on top of a canvas so there’s no way out of the box to check which one of them has been clicked.
One possible custom approach would be to handle the canvas element’s click event and check the coordinates for each click. Then to determine if a specific element has been clicked or not you would have to save its original coordinates when you create it. For example in the specific sample from the sample’s browser when you create the text and add it to the context:
…
context.fillStyle= "black";
for (var n = 0; n < lines.length; n++) {
context.fillText(lines[n], x, yCurrent);
yCurrent += lineHeight;
}
You could save the specific coordinates of the text you’d drawn in an array and on click of the canvas check whether the clicked point is inside one of those coordinates . More on this approach is discussed here: http://stackoverflow.com/questions/9880279/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element
As for drilling I’m not exactly sure what you mean. If you just need to change the data source of the map you can certainly do so in the click event. Setting a new data source of the chart looks like this:
$(".selector").igMap("option", "dataSource", data);
And would re-render the chart with the new data.
Let me know if you have any questions.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support