bugfix> javascript > 投稿

棒グラフのインデックスラベルを表示する必要があります

コードは次のとおりです。

var chart = AmCharts.makeChart( "chartdiv", {
  "hideCredits":true,
  "type": "serial",
  "theme": "light",
  "dataProvider": [ {
    "Status": "Completed",
    "visits": Total
  }, {
    "Status": "On-Going",
    "visits": 1882
  }, {
    "Status": "Procurement",
    "visits": 1809
  }, {
    "Status": "DED Prep",
    "visits": 1322
  }, {
    "Status": "Under Prep",
    "visits": 1122
  }, {
    "Status": "Suspended",
    "visits": 1114
  }, {
    "Status": "Cancelled",
    "visits": 984
  }, {
    "Status": "No Status Yet",
    "visits": 711
  } ],
  "valueAxes": [ {
    "gridColor": "#FFFFFF",
    "gridAlpha": 0.2,
    "dashLength": 0
  } ],
  "gridAboveGraphs": true,
  "startDuration": 1,
  "graphs": [ {
    "balloonText": "[[category]]: <b>[[value]]</b>",
    "fillAlphas": 0.8,
    "lineAlpha": 0.2,
    "type": "column",
    "valueField": "visits"
  } ],
  "chartCursor": {
    "categoryBalloonEnabled": false,
    "cursorAlpha": 0,
    "zoomable": false
  },
  "categoryField": "Status",
  "categoryAxis": {
    "gridPosition": "start",
    "gridAlpha": 0,
    "tickPosition": "start",
    "tickLength": 20
  },
  "export": {
    "enabled": true
  }
} );

回答 1 件
  • これはどう?

    これらの2行をグラフセクションに追加しました

    "labelText": "[[visits]]",
     "labelPosition": "top"
    
    

あなたの答え