ChartDirector Ver 4.1 (PHP Edition Edition)

JsChartViewer


JsChartViewer is a browser side Javascript control for supporting advanced chart user interactions. Its main functions are:

In many applications, the JsChartViewer needs to be used with the WebChartViewer on the server side. For example, when JsChartViewer sends a partial chart update request (AJAX request) to the server, the server needs to use a WebChartViewer to interpret the request and to send back the result.

To use JsChartViewer in a web page, it is necessary to include the "cdjcv.js" Javascript library in the HTML code. Typically, this is achieved by inserting a script block in the <HEAD> section of the HTML code:

    <SCRIPT SRC="/path/to/cdjcv.js">

Note: Please replace "/path/to" above to the actual path you put the "cdjcv.js" to.

The "cdjcv.js" requires the following files, which must be located in the same directory as "cdjcv.js".

FilenameDescription
cdjcv.jsThe main Javascript library file.
zoomin.curZoom in cursor.
zoomin.curZoom out cursor.
nozoom.curNo zoom cursor.
wait.gifRotating clock wait symbol.

During operation, "cdjcv.js" will detect the absolute URL of itself, and use it to load other files in the above table. (It cannot use relative URL, because the URL will be relative to the containing HTML web page, which may or may not be in the same directory as "cdjcv.js".) However, in some cases, you may want to explicitly specify the path for "cdjcv.js" to use. This can be by defining a global Javascript variable "cdjcv_path" that contains the URL directory that contains the files.

To create a JsChartViewer object, one should use the JsChartViewer.get method instead of using the "new" statement. The JsChartViewer.get method creates a JsChartViewer object and binds it the an <IMG> tag for displaying the chart.

JsChartViewer stores its state in a hidden field created by WebChartViewer.renderHTML. This allows a JsChartViewer object to transfer information to WebChartViewer on the server side using standard FORM POST or GET. This is useful for browsers that do not support partial chart update request (AJAX request). to enable using FORM POST or GET, one should include a HTML FORM in the web page, and the FORM should include the <IMG> tag associated with the JsChartViewer object.

JsChartViewer is designed to work with IE 4.0 or above, or any W3C DOM compliant browsers. However, as there are thousands of browser/version combinations in the market, it is practically impossible to test all of them. The followings are the browsers that have been tested as of the date this paragraph is written:

JsChartViewer is designed to remain silent during loading (no error message will pop up) on older browsers or non-DOM compliant browsers.

Properties
NameDescription
updatingMsgGets or sets the HTML message displayed when partial chart update is in progress.
serverErrorMsgGets or sets the HTML template for displaying server error messages.
msgContainerGets or sets the default message container template.
okButtonGets or sets the "OK" button for closing the chart message window.
xButtonGets or sets the "X" button for closing the chart message window.

Methods
NameDescription
getGets a JsChartViewer object that binds to the given <IMG> tag for chart display.
getIdGets the id of the JsChartViewer.
setViewPortLeftSets the position of the left side of the view port.
getViewPortLeftGets the position of the left side of the view port.
setViewPortTopSets the position of the top side of the view port.
getViewPortTopGets the position of the top side of the view port.
setViewPortWidthSets the width of the view port.
getViewPortWidthGets the width of the view port.
setViewPortHeightSets the height of the view port.
getViewPortHeightGets the height of the view port.
setMouseUsageSets the mouse usage mode of the control.
getMouseUsageGets the mouse usage mode of the control.
setZoomDirectionSets the zoom direction for mouse zoom in/out actions.
getZoomDirectionGets the zoom direction for mouse zoom in/out actions.
setScrollDirectionSets the scroll direction for mouse scroll actions.
getScrollDirectionGets the scroll direction for mouse scroll actions.
setZoomInRatioSets the magnification ratio for each zoom in click of the mouse.
getZoomInRatioGets the magnification ratio for each zoom in click of the mouse.
setZoomOutRatioSets the magnification ratio for each zoom out click of the mouse.
getZoomOutRatioGets the magnification ratio for each zoom out click of the mouse.
setZoomInWidthLimitSets the view port width at maximum zoom in.
getZoomInWidthLimitGets the view port width at maximum zoom in for mouse zoom in actions.
setZoomOutWidthLimitSets the view port width at maximum zoom out.
getZoomOutWidthLimitGets the view port width at maximum zoom out for mouse zoom out actions.
setZoomInHeightLimitSets the view port height at maximum zoom in.
getZoomInHeightLimitGets the view port height at maximum zoom in for mouse zoom in actions.
setZoomOutHeightLimitSets the view port height at maximum zoom out.
getZoomOutHeightLimitGets the view port height at maximum zoom out for mouse zoom out actions.
setMinimumDragSets the minimum mouse drag distance before it is considered as an intentional drag.
getMinimumDragGets the minimum mouse drag distance before it is considered as an intentional drag.
setSelectionBorderWidthSets the border width of the zoom selection box.
getSelectionBorderWidthGets the border width of the zoom selection box.
setSelectionBorderColorSets the border color of the zoom selection box as an HTML color.
getSelectionBorderColorGets the border color of the zoom selection box.
setZoomInCursorSets the mouse cursor to be used when the mouse is used for zoom in.
getZoomInCursorGets the mouse cursor to be used when the mouse is used for zoom in.
setZoomOutCursorSets the mouse cursor to be used when the mouse is used for zoom out.
getZoomOutCursorGets the mouse cursor to be used when the mouse is used for zoom out.
setNoZoomCursorSets the mouse cursor to be used when the mouse is used for zoom in/out, but the zoom in/out limits has been reached.
getNoZoomCursorGets the mouse cursor to be used when the mouse is used for zoom in/out, but the zoom in/out limits has been reached.
setScrollCursorSets the mouse cursor to be used when the mouse is used for scrolling.
getScrollCursorGets the mouse cursor to be used when the mouse is used for scrolling.
setCustomAttrSets a custom attribute.
getCustomAttrGets a custom attribute.
canSupportPartialUpdateChecks if the browser is capable of supporting partial chart updates (AJAX requests).
partialUpdateSends a partial update request (AJAX request) to the server.
streamUpdateRefreshes the <IMG> that the JsChartViewer is bound to.
attachHandlerAttaches a function to be used as the event handler for an event.
detachHandlerDetaches a function from being an event handler for an event.
applyHandlersCalls the handlers for an event.

Events
NameDescription
ViewPortChangedThis event occurs when the view port is changed through mouse actions (see JsChartViewer.setMouseUsage).
PreUpdateThis event occurs immediately before a partial chart update request is sent to the server (see JsChartViewer.partialUpdate).
PostUpdateThis event occurs after a partial update response is received from the server and is processed successfully.
UpdateErrorThis event occurs if an error occurs in during a partial update.