How to apply JS to diagram ruler to change units
Hi,
I really need to be able to change the units on the rulers. Whatever the default measurement units are, they do not translate into a real world user experience. I have created a quick piece of java script that can convert the ruler labels but need some support in where and how to deploy it in a Blazor WebAssembly scenario whilst still being able to support the zoom and pan functionality built into diagram.
Here is the JS function, how should I deploy it for good runtime UX?
function updaterulerlabels() {
var myClasses = document.getElementsByClassName("e-ruler-tick-label");
for (var i = 0; i < myClasses.length; i++) {
var oldcontent = myClasses[i].innerHTML;
if (!isNaN(oldcontent)) {
myClasses[i].innerHTML = oldcontent / 25 + "ft";
}
}
}
Yes, I understand that you do not have the feature built in. I am trying to apply a work around using JS to rename the labels after rendering and want to know the best place to apply this code.
I tried in OnAfterRenderAsync which worked most of the time but it was not consistent.
- 3 Replies
- 2 Participants
-
SI Simon
- Oct 5, 2021 11:44 PM UTC
- Oct 7, 2021 12:56 PM UTC