无法使用amcharts添加所有标签

时间:2016-07-20 04:36:30

标签: javascript amcharts

根据图片我只在第一列和第三列获得标签如何在所有列中获得标签?下面我附上了一张图片。

JavaScript代码:

    // Loading the custom profile;

    FirefoxProfile myProfile = firefoxprofile.getProfile("SeleniumBix");

    // Creating web driver instance
    WebDriver driver = new FirefoxDriver(myProfile);

    //Opening the SeleniumBix in New profile
    driver.get("http://www.seleniumbix.com");

以下是 HTML代码:

<script type="text/javascript">

var chart;

var chartData = [ {
  "month": "JAN",
  "scores": 200,
  "color": "#CD0D74"
}, {
  "month": "FEB",
  "scores": 700,
  "color": "#FF6600"
}, {
  "month": "MAR",
  "scores": 800,
  "color": "#FCD202"
}, {
  "month": "APR",
  "scores": 990,
  "color": "#04D215"
} ];


var chart = AmCharts.makeChart( "chartdiv1", {
  "theme": "light",
  type: "serial",
  dataProvider: chartData,
  categoryField: "month",
  "startDuration": 1,
  categoryAxis: {
    labelRotation: 90,
    gridPosition: "start"
  },


  graphs: [ {

    valueField: "scores",
    colorField: "color",
    type: "column",
    lineAlpha: 0.1,
    fillAlphas: 1
  } ],

  chartCursor: {
    cursorAlpha: 0,
    zoomable: false,
    categoryBalloonEnabled: false
  },
  export: {
    enabled: true
  }
} );
</script>

图形图像

Here is **Graph image:**

请帮我解决这个问题。提前谢谢。

1 个答案:

答案 0 :(得分:0)

在JSFiddle中测试您的代码并显示所有标签,但它与图片中的示例有不同的chartdata。

https://jsfiddle.net/hfqcvauv/

为图表添加了CSS以显示

#chartdiv1 {
  width: 100%;
  height: 500px;
}       

根据图片中的示例,可能是因为第二个和第四个chartdata没有插入月份?