JGInternational
JGInternational

Reputation: 57

Fusioncharts line is rounding values

I'm using the latest version of Fusionchart (3.13.1-sr.1). I'm trying to insert this chart:

{
"chart": {
    "caption": "Capacitat",
    "subcaption": "Capacitat",
    "decimalSeparator ": ",",
    "decimals": "2",
    "exportEnabled": "1",
    "yaxisname": "Preu €/MWh",
    "xaxisname": "Date",
    "yaxisminValue": "0,0464",
    "yaxismaxValue": "10,0488",
    "pixelsPerPoint": "0",
    "pixelsPerLabel": "30",
    "lineThickness": "1",
    "compactdatamode": "1",
    "dataseparator": "|",
    "labelHeight": "30",
    "scrollheight": "10",
    "flatScrollBars": "1",
    "scrollShowButtons": "0",
    "yAxisValueDecimals": "2",
    "forceYAxisValueDecimals": "1",
    "scrollColor": "#cccccc",
    "theme": "fusion"
    },
"categories": [
    {
        "category": "1/6/2018 12:00:00| 2/6/2018 12:00:00| 3/6/2018 12:00:00| 1/6/2018 1:00:00| 2/6/2018 1:00:00| 3/6/2018 1:00:00| 1/6/2018 2:00:00| 2/6/2018 2:00:00| 3/6/2018 2:00:00| 1/6/2018 3:00:00| 2/6/2018 3:00:00| 3/6/2018 3:00:00| 1/6/2018 4:00:00| 2/6/2018 4:00:00| 3/6/2018 4:00:00| 1/6/2018 5:00:00| 2/6/2018 5:00:00| 3/6/2018 5:00:00| 1/6/2018 6:00:00| 2/6/2018 6:00:00| 3/6/2018 6:00:00| 1/6/2018 7:00:00| 2/6/2018 7:00:00| 3/6/2018 7:00:00| 1/6/2018 8:00:00| 2/6/2018 8:00:00| 3/6/2018 8:00:00| 1/6/2018 9:00:00| 2/6/2018 9:00:00| 3/6/2018 9:00:00| 1/6/2018 10:00:00| 2/6/2018 10:00:00| 3/6/2018 10:00:00| 1/6/2018 11:00:00| 2/6/2018 11:00:00| 3/6/2018 11:00:00| 1/6/2018 12:00:00| 2/6/2018 12:00:00| 3/6/2018 12:00:00| 1/6/2018 1:00:00| 2/6/2018 1:00:00| 3/6/2018 1:00:00| 1/6/2018 2:00:00| 2/6/2018 2:00:00| 3/6/2018 2:00:00| 1/6/2018 3:00:00| 2/6/2018 3:00:00| 3/6/2018 3:00:00| 1/6/2018 4:00:00| 2/6/2018 4:00:00| 3/6/2018 4:00:00| 1/6/2018 5:00:00| 2/6/2018 5:00:00| 3/6/2018 5:00:00| 1/6/2018 6:00:00| 2/6/2018 6:00:00| 3/6/2018 6:00:00| 1/6/2018 7:00:00| 2/6/2018 7:00:00| 3/6/2018 7:00:00| 1/6/2018 8:00:00| 2/6/2018 8:00:00| 3/6/2018 8:00:00| 1/6/2018 9:00:00| 2/6/2018 9:00:00| 3/6/2018 9:00:00| 1/6/2018 10:00:00| 2/6/2018 10:00:00| 3/6/2018 10:00:00| 1/6/2018 11:00:00| 2/6/2018 11:00:00| 3/6/2018 11:00:00"
    }
],
"dataset": [
    {
        "seriesname": "Preu",
        "data": "0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000"
    }
]
}

And the result chart is rounding the decimals. In the example, I expect to see 4.30 but it's showing 4.0

Image of the error showing 4.0

Upvotes: 0

Views: 290

Answers (1)

Akash
Akash

Reputation: 301

When you are providing the values as 4,304000 with decimal separator as ',' in the data object of the dataSource.

Then you need to set the attribute "inDecimalSeparator" with the character "," in the dataSource to specify the chart that the input values will be using ',' as the decimal separator.

As you have not set this attribute, the chart took all the values till the character ',' for all the plots. For example : 4,304000 was considered as 4 and hence it was displayed as 4.00.

Find a sample fiddle modifying the provided dataSource with the above mentioned attribute : http://jsfiddle.net/n2L4ekg3/2/

{
  "chart": {
    "caption": "Capacitat",
    "subcaption": "Capacitat",
    "decimalSeparator ": ",",
    "decimals": "2",
    "exportEnabled": "1",
    "yaxisname": "Preu €/MWh",
    "xaxisname": "Date",
    "yaxisminValue": "0,0464",
    "yaxismaxValue": "10,0488",
    "pixelsPerPoint": "0",
    "pixelsPerLabel": "30",
    "lineThickness": "1",
    "compactdatamode": "1",
    "dataseparator": "|",
    "labelHeight": "30",
    "scrollheight": "10",
    "flatScrollBars": "1",
    "scrollShowButtons": "0",
    "yAxisValueDecimals": "2",
    "forceYAxisValueDecimals": "1",
    "scrollColor": "#cccccc",
    "inDecimalSeparator": ",",
    "theme": "fusion"
  },
  "categories": [{
    "category": "1/6/2018 12:00:00| 2/6/2018 12:00:00| 3/6/2018 12:00:00| 1/6/2018 1:00:00| 2/6/2018 1:00:00| 3/6/2018 1:00:00| 1/6/2018 2:00:00| 2/6/2018 2:00:00| 3/6/2018 2:00:00| 1/6/2018 3:00:00| 2/6/2018 3:00:00| 3/6/2018 3:00:00| 1/6/2018 4:00:00| 2/6/2018 4:00:00| 3/6/2018 4:00:00| 1/6/2018 5:00:00| 2/6/2018 5:00:00| 3/6/2018 5:00:00| 1/6/2018 6:00:00| 2/6/2018 6:00:00| 3/6/2018 6:00:00| 1/6/2018 7:00:00| 2/6/2018 7:00:00| 3/6/2018 7:00:00| 1/6/2018 8:00:00| 2/6/2018 8:00:00| 3/6/2018 8:00:00| 1/6/2018 9:00:00| 2/6/2018 9:00:00| 3/6/2018 9:00:00| 1/6/2018 10:00:00| 2/6/2018 10:00:00| 3/6/2018 10:00:00| 1/6/2018 11:00:00| 2/6/2018 11:00:00| 3/6/2018 11:00:00| 1/6/2018 12:00:00| 2/6/2018 12:00:00| 3/6/2018 12:00:00| 1/6/2018 1:00:00| 2/6/2018 1:00:00| 3/6/2018 1:00:00| 1/6/2018 2:00:00| 2/6/2018 2:00:00| 3/6/2018 2:00:00| 1/6/2018 3:00:00| 2/6/2018 3:00:00| 3/6/2018 3:00:00| 1/6/2018 4:00:00| 2/6/2018 4:00:00| 3/6/2018 4:00:00| 1/6/2018 5:00:00| 2/6/2018 5:00:00| 3/6/2018 5:00:00| 1/6/2018 6:00:00| 2/6/2018 6:00:00| 3/6/2018 6:00:00| 1/6/2018 7:00:00| 2/6/2018 7:00:00| 3/6/2018 7:00:00| 1/6/2018 8:00:00| 2/6/2018 8:00:00| 3/6/2018 8:00:00| 1/6/2018 9:00:00| 2/6/2018 9:00:00| 3/6/2018 9:00:00| 1/6/2018 10:00:00| 2/6/2018 10:00:00| 3/6/2018 10:00:00| 1/6/2018 11:00:00| 2/6/2018 11:00:00| 3/6/2018 11:00:00"
  }],
  "dataset": [{
    "seriesname": "Preu",
    "data": "0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|0,058000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|8,374000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000|4,304000"
  }]
}

Documentation reference : https://www.fusioncharts.com/dev/chart-guide/chart-configurations/number-format#customize-thousand-and-decimal-separator-4

Upvotes: 3

Related Questions