ChartDirector 5.1 (PHP Edition)

JsChartViewer


As ChartDirector charts are in standard image formats, and the hot spots are in standard HTML formats, the browser by itself can display the charts and support the hot spot tooltips and events.

The JsChartViewer control is a browser side Javascript control to support other advanced chart user interactions, including:

  • Programmable Track Cursor Support

    The JsChartViewer control includes special methods and events for supporting programmable track cursors. It includes methods for drawing track cursors and other dynamic contents on the browser side.

  • Zoom and Scroll Support

    The JsChartViewer control includes special methods and events for supporting using mouse clicks and drags to control the "view port". There are also methods to facilitate using custom user interface to control the view port.

  • AJAX chart update

    The JsChartViewer allows the chart, including the associated image map and data for programmable track cursor, to be updated without refreshing the web page. Custom parameters can also be passed during the AJAX chart update between the browser and the server.

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

    To use JsChartViewer in a web page, it is necessary to include the ChartDirector Javascript Library "cdjcv.js" and other supporting files in the web page. Please refer to ChartDirector Javascript Library for details.

    JsChartViewer is designed to work with IE 6.0 or above, FireFox 3.0 or above, Chrome 4.0 or above, and Safari 4.0 or above.

    Properties
    NameDescription
    DefaultA constant equals to 0 to represent using the default mouse behaviour.
    ScrollA constant equals to 2 to represent using the mouse for drag scrolling.
    ZoomInA constant equals to 3 to represent using the mouse for zoom in actions.
    ZoomOutA constant equals to 4 to represent using the mouse for zoom out actions.
    HorizontalA constant equals to 0 to represent that the zoom and/or scroll orientation is horizontal.
    VerticalA constant equals to 1 to represent that the zoom and/or scroll orientation is vertical.
    HorizontalVerticalA constant equals to 2 to represent that the zoom and/or scroll orientation can be both horizontal and vertical.
    BottomLeftA constant equals to 1 to represent the bottom left position.
    BottomCenterA constant equals to 2 to represent the bottom center position.
    BottomRightA constant equals to 3 to represent the bottom right position.
    LeftA constant equals to 4 to represent the left position.
    CenterA constant equals to 5 to represent the center position.
    RightA constant equals to 6 to represent the right position.
    TopLeftA constant equals to 7 to represent the top left position.
    TopCenterA constant equals to 8 to represent the top center position.
    TopRightA constant equals to 9 to represent the top right position.
    BottomA constant equals to 2 to represent the bottom position.
    TopA constant equals to 8 to represent the top position.
    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.
    getValueAtViewPortConverts a view port coordinate to a value of the specified data scale.
    getViewPortAtValueConverts a value of the specified data scale to a view port coordinate.
    setPlotAreaMouseMarginSets all margins (left, right, top, and bottom) of the plot area mouse event region to the same value.
    setPlotAreaMouseMargin2Sets the margins of the plot area mouse event region.
    isMouseOnPlotAreaChecks if the mouse cursor is on the extended plot area.
    getChartMouseXGets the mouse cursor x-coordinate in the chart pixel coordinate system.
    getChartMouseYGets the mouse cursor y-coordinate in the chart pixel coordinate system.
    getPlotAreaMouseXGets the mouse cursor x-coordinate on the plot area in the chart pixel coordinate system.
    getPlotAreaMouseYGets the mouse cursor y-coordinate on the plot area in the chart pixel coordinate system.
    setMouseUsageSets the mouse usage mode.
    getMouseUsageGets the mouse usage mode.
    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.
    raiseViewPortChangedEventRaises a JsChartViewer.ViewPortChanged event.
    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.
    getChartGets the specified chart in the Javascript Chart Model.
    getChartCountGets the number of charts in the Javascript Chart Model.
    drawHLineDraws a horizontal line on the chart.
    drawVLineDraws a vertical line on the chart.
    showCrossHairDisplays the crosshair cursor.
    showTextBoxDraws a textbox on the chart.
    hideObjHides one or more objects drawn by JsChartViewer.
    setAutoHideHides one or more objects drawn by JsChartViewer when a certain event occurs.
    removeAutoHideCancels the automatic action sets up by JsChartViewer.setAutoHide.
    htmlRectGenerates HTML code that represents an inline color box.
    addEventListenerA utility to attach an event handler to a Javascript event.
    removeEventListenerRemoves an event handler attached via a previous call to JsChartViewer.addEventListener.
    NTimeConverts a date/time in ChartDirector's date/time format to a Javascript Date object.
    CTimeConverts a Javascript Date object to ChartDirector's date/time format.

    Events
    NameDescription
    MouseMoveChartThis event occurs when the mouse cursor moves on the chart.
    MouseOutChartThis event occurs when the mouse cursor leaves the chart.
    MouseMovePlotAreaThis event occurs when the mouse cursor moves on the extended plot area.
    MouseOutPlotAreaThis event occurs when the mouse cursor leaves the extended plot area.
    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.