jQuery UI Widgets Forums Chart Mapping dataField to complex json structures

This topic contains 2 replies, has 2 voices, and was last updated by  lordbalmung 9 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • lordbalmung


    The example provided in the “demos” section is quite clear and uses a standard data structure, data[{Date:'', value1:7, value2:77}], the coresponding series have data fields value1 and value2. How do you map complex structures? for example, if data is something like data[{comp:{x:5, y:6}}, {comp:{x:7, y:8}}] and I wish to make two series out of it and the dataField I wish to use is comp.x is it possible to assign this without transforming the data?


    Hi lordbalmung,

    This can probably be achieved by setting the datafield map. Here is a basic example:

    var data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi"}];
    // prepare the data
    var source =
        datatype: "json",
        datafields: [
            { name: 'empName' },
            { name: 'age' },
            { name: 'id', map: 'department>id' },
            { name: 'name', map: 'department>name' },
            { name: 'author' }
        localdata: data
    var dataAdapter = new $.jqx.dataAdapter(source);

    For more information and examples, please refer to the jqxDataAdapter help topic.

    Best Regards,

    jQWidgets team


    @dimitar, Thank you very much for spending time to explain. I realized that I could use the dataAdapter but I couldn’t quite accurately figure out how. I appreciate your time and effort.

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

You must be logged in to reply to this topic.