Home Forums Chart Support LabelFormatter Error

LabelFormatter Error

Viewing 2 posts - 1 through 2 (of 2 total)
  • #32882

    Hello.

    I use canvasJS for charts.

    When I use labelFormatter in YAxis Options, it seems work weird.

    This is an example.

    https://jsfiddle.net/Lqegab5v/5/

    I did not fix the value. But number 1.2 is changed 1.20000000002.

    So how to solve this problem?

    Thank you.

    #32892

    @jeonkook,

    The issue seems to be happening as you are returning the value as such in labelFormatter without formatting it. You can format the number to fix the number of decimal values by using formatNumber method.
    CanvasJS.formatNumber(e.value, "#,##0.##")
    Please take a look at this updated JSFiddle for working sample.

    line chart with labelformatter in y axis

    Also, please refer to valueFormatString which lets you format the value that appears in axis / parameter that you pass in formatNumber method.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.