堆积柱形图的显示(amcharts库)

时间:2014-11-20 09:17:11

标签: javascript charts amcharts

问题是列似乎一个接一个地位于另一个

之上,而不是一个位于另一个

之上

请查看http://jsfiddle.net/LLWft/2/

var chart1=new AmCharts.AmSerialChart();
chart1.theme="light";
chart1.colors=["#00a0db", "#428bca"];
var legend = new AmCharts.AmLegend();
legend.horizontalGap=10;
legend.maxColumns=1;
legend.position="right";
legend.useGraphSettings=true;
  legend.markerSize=10;
   chart1.addLegend(legend);
   chart1.dataProvider=chartData;
   chart1.valueAxes.stackType="regular";
   chart1.valueAxes.axisAlpha=0.3;
   chart1.valueAxes.gridAlpha=0.3;
   chart1.graphs=chartGraphs;
   chart1.categoryField="year";
   chart1.categoryAxis.gridPosition="start";
   chart1.categoryAxis.axisAlpha=0;
   chart1.categoryAxis.gridAlpha=0;
   chart1.categoryAxis.position = "left";
   chart1.write('chartdiv');

1 个答案:

答案 0 :(得分:1)

最后我发现了问题

我已经通过数组设置了valueAxis,它解决了我的问题

请查看http://jsfiddle.net/LLWft/3/

chart1.valueAxes=[{
        "stackType": "regular",
        "axisAlpha": 0.3,
        "gridAlpha": 0.3
    }];