How Do WebFigures Work?

WebFigures is made up of several different components that work together:

  • Your web application

  • Client-side code

  • WebFigureService

  • Your server's cache

WebFigures use AJAX to simulate MATLAB® figures in a web browser. When a browser requests a WebFigure, your web application calls the deployed component for the WebFigure. The component returns a collection of static images that show the figure in all available orientations and stores them in the server cache for WebFigureService to access as needed. WebFiguresService, which is exposed by WebFigureServlet, delivers the HTML and JavaScript® to the browser, getting the defaults for a figure, and rendering a figure in any of its available orientations.

The client-side of your web application puts an HTML reference to your WebFigure on a page. This can either be done automatically using the JSP tag or manually by using WebFigureHtmlGenerator. This gives the client browser what it needs to request the client-side code.

The client-side AJAX code provides a user experience similar to that in MATLAB when using a FIGURE. It provides rotation, zooming, and panning in a highly usable medium by using a JavaScript application that monitors for user interaction such as dragging or clicking with a mouse, and calls back into WebFiguresService to service those requests.

For example, when a user selects the rotate icon and clicks in the WebFigureTag and drags it, that drag translates to coordinates and issues a request for the new rotated image from WebFiguresService. A rotating cube is displayed so the user knows what orientation they are looking at. Since there is no efficient way to pass an actual WebFigure from your application to the client-side application and then back to WebFiguresService, the server's built-in cache is leveraged as a central repository.

Was this topic helpful?