5 Answers, 1 is accepted
Hello, Edward,
You could use javascript events such as mousemove or click to get the coordinates of the pointer when clicking on the diagram.
$("#diagram").kendoDiagram({
...options
})
// get X and Y coordinates of the pointer on click.
$("#diagram").on("click", function (e) {
console.log(e.offsetX)
console.log(e.offsetY)
});
Let me know if you have any questions.
Best Regards,
Georgi Denchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Georgi,
Thanks for the reply, but what I need is the coordinates in the diagram widget (the coordinates that you draw shapes), like e.point in diagram's click event. Can I get that somewhere or can I calculate it myself with the coordinates you have mentioned?
Hello, Edward,
I am not certain I understand, using the method below you can obtain the X and Y coordinates of the clicked point on the entire diagram widget.
You can test it in the following dojo:
https://dojo.telerik.com/@gdenchev/ahuQICOc
Clicking on one of the shapes is going to call the Diagram.click() event(where you can access e.point) and it is also going to call the Custom event function that I provided. Both are going to return the same value, except the Custom event is going to work outside of the shapes/connectors as well.
The result can be observed in the Browser Console(F12).
Could you please provide me with a bit more details if this is not the functionality you are looking for?
Best Regards,
Georgi Denchev
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Georgi,
They are actually not the same value, zoom in the diagram and you will see the difference I talked about.
Thanks!
Hello, Edward,
Thank you for the clarification.
You can use the diagram's internal _eventPositions() method to get the click coordinates in the same manner as the click event.
I have updated the dojo:
https://dojo.telerik.com/@gdenchev/ahuQICOc
Let me know in case further assistance is required.
Best Regards,
Georgi Denchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.