jQuery UI Widgets Forums Chart Json Number type Modified to Date

This topic contains 3 replies, has 2 voices, and was last updated by  Pix 7 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Json Number type Modified to Date #95884

    Pix
    Participant

    Dears,

    I am having the below json object:

    [{“product_id”:”23401224563737″,”success_rate”:”90.9836″},
    {“product_id”:”23401220000011356″,”success_rate”:”90.2222″},
    {“product_id”:”23401223434″,”success_rate”:”81.2818″}]

    I am trying to display the data in a chart:

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘product_id’,type: ‘string’},
    { name: ‘success_rate’,type: ‘number’}
    ],
    cache: false,
    id: ‘product_id’,
    url: php_link
    };

    While plotting the data jqwidgets is trying automatically to take product ID as a date and not as string.

    How can I force jqxChart to consider it as a string and dont try to convert it to date?

    Thanks.

    Cheers,
    Pierre

    Json Number type Modified to Date #95902

    Peter Stoev
    Keymaster

    Hi Pierre,

    Where is your dataAdapter code? Do you use dataAdapter?

    Regards,
    Peter

    Json Number type Modified to Date #95908

    Pix
    Participant

    Dear Peter,

    Here you go:

    var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert(‘Error loading “‘ + source.url + ‘” : ‘ + error); } });

    Cheers,
    Pierre

    Json Number type Modified to Date #95909

    Pix
    Participant

    More details:

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘product_id’,type: ‘string’},
    { name: ‘success_rate’,type: ‘number’}
    ],
    cache: false,
    id: ‘product_id’,
    url: php_link
    };

    var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert(‘Error loading “‘ + source.url + ‘” : ‘ + error); } });

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

You must be logged in to reply to this topic.