jQWidgets Forums

jQuery UI Widgets Forums Chart decimalPlaces error

Tagged: 

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • decimalPlaces error #121562

    jmshim
    Participant

    hello please help me

    my test data is

    var sampleData = [{
    a: -10.35,
    b: 14.5
    }, {
    a: 10,
    b: 2.5
    }, {
    a: 10,
    b: 0.2
    }, {
    a: 100,
    b: 205
    }, {
    a: 1,
    b: 100
    }, {
    a: 5.11,
    b: 10.13
    }, {
    a: 20.13,
    b: 10.13
    }, {
    a: 600,
    b: 300
    }];
    var settings = {
    title: “Logarithmic Scale Axis Example”,
    description: “Sample logarithmic scale axis with base 2″,
    enableAnimations:true,
    animationDuration:1000,
    padding: {
    left: 5,
    top: 5,
    right: 5,
    bottom: 5
    },
    titlePadding: {
    left: 0,
    top: 0,
    right: 0,
    bottom: 10
    },
    source: sampleData,
    enableAnimations: true,
    categoryAxis: {
    dataField: ”,
    description: ”,
    showGridLines: true,
    showTickMarks: true
    },
    seriesGroups: [{
    type: ‘column’,
    valueAxis: {
    visible: true,
    title: { text: ‘Daily Closing Price<br>’ },
    tickMarks: { color: ‘#BCBCBC’ },
    labels: {
    formatSettings: {
    decimalPlaces: 0
    }
    }
    },
    series: [{
    dataField: ‘a’,
    displayText: ‘A’
    }, {
    dataField: ‘b’,
    displayText: ‘B’
    }]
    }]
    };
    $(‘#jqxChart’).jqxChart(settings);

    and i’m setting decimalPlaces = 0 but chart show decimalPlaces =3

    decimalPlaces error #121563

    Martin
    Participant

    Hello jmshim,

    This is because you have a column with value 0.2 that can not be displayed if the decimal places are set to 0.
    If you remove it then you will get the expected outcome.
    Here is an Example.

    Best Regards,
    Martin Yotov

    jQWidgets team
    https://www.jqwidgets.com

    decimalPlaces error #121564

    jmshim
    Participant

    thank you Martin Yotov!

    but i have one question
    My data has negative and decimal points ex(-4.555 or 2.666 ->>> -4,3). Is there any way to set it in the chart options?

    decimalPlaces error #121569

    ivanpeevski
    Participant

    Hi jmshim,

    Unfortunately, it is not possible to display 0 or negative values in a logarithmic scale since it is mathematically impossible for a logarithm to be equal to those values.
    In your case, I suggest using a linear scale with unitInterval set to 100: https://jsfiddle.net/k1fq5y62/
    Or you can show your data in absolute values(example: -10 -> 10) and use the colorFunction to show users which values are supposed to be negative:
    https://jsfiddle.net/u2e941z8/ – In the example, red values are negative and green are positive

    I hope this answers your question. If you have any other problems, please do not hesitate to contact us again!
    Best Regards,
    Ivan Peevski

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.