illinois
illinois

Reputation: 508

AmChart Columns not showing may be for data set problem

hi everyone hi do have a problemi with a chart that just do not appears.

i think the problem is related with the number of colums that i have to show because with a little number of data is working.

than when i put all the data in the chart it stopped working. i do not think is a limit on the amchart itself.

i post here my code

<script>

var chart = AmCharts.makeChart( "confrontogas", {
  "type": "serial",
  "theme": "light",
  "dataProvider": [ {
            "offerta": "Energia Italia 150€",
            "costo": 150,
            "color": "#0C3B54",
            "labelcolor": "#FFFFFF"
         },{
            "offerta": "",
            "costo": 229,
            "color": "#CACACA",
            "labelcolor": "#FFFFFF"
         },{
            "offerta": "",
            "costo": 418,
            "color": "#CACACA",
            "labelcolor": "#FFFFFF"
         },{
            "offerta": "",
            "costo": 419,
            "color": "#CACACA",
            "labelcolor": "#FFFFFF"
         },{
            "offerta": "",
            "costo": 420,
            "color": "#CACACA",
            "labelcolor": "#FFFFFF"
         },{
            "offerta": "",
            "costo": 425,
            "color": "#CACACA",
            "labelcolor": "#FFFFFF"
         },{
            "offerta": "",
            "costo": 1,460,
            "color": "#CACACA",
            "labelcolor": "#FFFFFF"
         } ],
  "valueAxes": [ {
    "gridColor": "#FFFFFF",
    "gridAlpha": 0,
    "dashLength": 0,
    "axisAlpha": 0,
    "minimum": 0,
    "labelsEnabled": false
  } ],
  "gridAboveGraphs": true,
  "startDuration": 1,
  "graphs": [ {
    "balloonText": "<b>[[value]]</b> €",
    "fillAlphas": 0.8,
    "lineAlpha": 0.2,
    "type": "column",
    "colorField": "color",
    "valueField": "costo"
  } ],
  "chartCursor": {
    "categoryBalloonEnabled": false,
    "cursorAlpha": 0,
    "zoomable": false
  },
  "categoryField": "offerta",
  "categoryAxis": {
    "gridPosition": "start",
    "gridAlpha": 0,
    "tickPosition": "start",
    "tickLength": 0,
    "labelRotation": 90,
    "autoGridCount": false,
    "gridCount": 548,
    "equalSpacing": true,
    "inside": true,
    "labelFrequency": 1,
    "labelColorField": "labelcolor",
    "forceShowField": "true"
  },


  "export": {
    "enabled": true
  }

} );

as you can see "gridCount": 548, i posted less data just to keep it easy

Upvotes: 1

Views: 395

Answers (1)

xorspark
xorspark

Reputation: 16012

Going by your last datapoint in the fiddle, your valueField costo has numeric values with commas, which isn't valid JavaScript:

{
    "offerta": "",
    "costo": 1,460, //should be 1460 or 1.460 depending on what ',' means in your region
    "color": "#CACACA",
    "labelcolor": "#FFFFFF"
}

Make sure your numeric data only contains numbers or dots (.) for decimals. AmCharts will automatically use commas for thouand separators and dots for decimals to format your values, but your numeric values must be valid in JavaScript first. If you need to change the separators in the output once your values are valid, use thousandsSeparator and decimalSeparator

Upvotes: 2

Related Questions