cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
thickey
Level III

SVG Difference between JMP and the WEB

I'm trying to generate a set of Standardised SVG Strings that can be used both in JSL Scripts and in a Web Application. However, from my initial investigations I notice that for the same SVG d-Path String, JSL draws the image using the BOTTOM-LEFT as the 0,0 Point and Browsers use the TOP-LEFT as the 0,0 Point.

 

Is there a JMP Setting to modify the 0,0 position for this use case? Otherwise I would need to store two strings for each item I want to draw, one for our JSL Developers and another for our Web Developers....which is OK but not ideal

 

Cheers, Troy 

 

SVG String = "M 0 0 h17.231 v16.915 h-17.231 z M 0.653 0 h16.578 v16.273 h-16.578 z"

 

thickey_0-1678643967077.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
XanGregg
Staff

Re: SVG Difference between JMP and the WEB

In JMP, you can reverse the Y axis scale in Axis Settings.

In HTML, you can wrap the SVG in a <g> with scale transformation, such as:

transform="translate(0 100) scale(1 -1)">

 

View solution in original post

2 REPLIES 2
XanGregg
Staff

Re: SVG Difference between JMP and the WEB

In JMP, you can reverse the Y axis scale in Axis Settings.

In HTML, you can wrap the SVG in a <g> with scale transformation, such as:

transform="translate(0 100) scale(1 -1)">

 

thickey
Level III

Re: SVG Difference between JMP and the WEB

Thanks for your reply Xan. I was aware of the translate option but not the JMP Y-Axis Option. I guess it just comes down to making it known to our scripters and developers that they need to translate one or the other. I definitely do not want to store two strings, one for each situation.

 

In JSL, the vast majority of users will expect 0,0 on charts to be the Bottom Left, asking them to switch will be confusing. I think the translation will need to happen on the Browser side. I can publish the requirement to translate in my demo code for web browsers.

 

I don't see another way around it.