jQuery UI Widgets Forums Chart categoryAxis formatFunction

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 11 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • categoryAxis formatFunction #29965

    RCW
    Participant

    I’m trying to format the text displayed in the categoryAxis but I’m getting the default datField displayed.

    I have a csv file with a datafield “year” holding 25 years (2010, 2011, 2012…etc.) and series data for those years.

    I want the categoryAxis to show 2010, 11, 12, 13, 14, 2015, 16, 17… etc so skipping the full year text every 5 years.

    If I have this as my years array and create this function:

    dataField: 'Year',
    formatFunction: function (value) {
    var years = ['2010', '11', '12', '13', '14', '2015', etc ...];
    return years[value];
    },
    type: 'date', // also tried default
    baseUnit: 'year'

    I don’t get anything back from the function.

    Any ideas ?

    Thanks

    RCW

    categoryAxis formatFunction #30018

    Dimitar
    Participant

    Hello RCW,

    Your function should be as follows:

    formatFunction: function (value) {
    var years = ['2010', '11', '12', '13', '14', '2015'];
    return years[years.indexOf(value)];
    }

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    categoryAxis formatFunction #30064

    RCW
    Participant

    Hi Dimitar,

    This still gives me back the text from the data file rather than from the variable”years” on my categoryAxis

    Do I need type: and baseUnit: set a particular way or is there something else I need to be doing ?

    Thanks

    RCW

    categoryAxis formatFunction #30108

    Dimitar
    Participant

    Hi RCW,

    Please provide us with your whole chart initialization code so that we may determine what causes the issue.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.