jQuery UI Widgets Forums Chart Get X-Value via Chart's event

This topic contains 4 replies, has 2 voices, and was last updated by  SpaceQuester 12 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Get X-Value via Chart's event #4274

    SpaceQuester
    Member

    Hi, All!

    Dear developers,

    jqWidgets is a good tool for draw statistics in our corporate project.

    There is a problem with ur documentation about chart’s events. Some demo is located here on ur site: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-events.htm
    But how can I get the X-value of column, selected by mouse? I need to get the X-values such as “Monday”, “Tuesday” etc.
    Function:
    function myEventHandler(e)
    {
    var eventData = e.serie.dataField;
    }
    returns only the name of selected serie.
    function myEventHandler(e)
    {
    var eventData = e.elementValue;
    }
    returns the Y-value of selected column.
    But I need the X-value. How can I do it? What is the set of methods has the event in this function?

    Thank u.

    Get X-Value via Chart's event #4290

    Peter Stoev
    Keymaster

    Hi SpaceQuester,

    The event handler passes the index of the Chart’s Data Column under the mouse cursor.

    To get whether the Chart column that displays data for “Monday”, “Tuesday”, etc, you can use the following code:

    function myEventHandler(e) {
    alert(sampleData[e.elementIndex].Day);
    };

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Get X-Value via Chart's event #4292

    SpaceQuester
    Member

    Thank u, Peter.

    But I use dataAdapter instead of sampleData.
    How should this example works?

    var dataAdapter = new $.jqx.dataAdapter(sampleData);

    dataAdapter does not know about “[e.elementIndex].Day”, so “alert(dataAdapter[e.elementIndex].Day)” would not work(((

    Get X-Value via Chart's event #4320

    Peter Stoev
    Keymaster

    Hi SpaceQuester,

    The Data Adapter has a member named ‘records’ which is an Array. You can access a specific data record by using the ‘records’ member and the index of the data record.

    For example:

    var firstRecord = dataAdapter.records[0];

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Get X-Value via Chart's event #4329

    SpaceQuester
    Member

    That’s greate!
    Thank u very much!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.