skip to main content
Programmer's documentation > Building Web Applications > Developing JViews Charts JSF applications > JavaScript objects
 
JavaScript objects
Each time a JViews Charts JSF component is created, a corresponding JavaScript object is also created. You can access this object through a global JavaScript variable whose name is the same as the id attribute of the tag. For example, the tag:
 
<jvcf:chartView id="chart9" [...] />
is rendered as the following JavaScript code:
 
var chart9 = new IlvChartViewProxy ('chart9',' ...);
You can modify the object locally by using a set of methods attached to this object. For further information about available JavaScript objects, see Javascript API.
For example, the following code defines two buttons that install respectively a zoom interactor and a pan interactor on a chartView.
 
<jvf:imageButton [...] onclick="chart9.setInteractor(zoomInteractor)" />
<jvf:imageButton [...] onclick="chart9.setInteractor(panInteractor)" />
<jvcf:chartView id="chart9" [...] />
At rendering time, an IlvChartViewProxy JavaScript object is created that is accessible through the chart JavaScript variable. Then, since zoomInteractor and panInteractor JavaScript objects have been created in the same way, you can directly set one of these interactors with the setInteractor method.
Additionally, the behavior of these JavaScript objects is to keep their state so that, if a submit request is issued, the state of the object is sent to the server. This behavior makes sure that the client and the server remain coherent.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.