无法使用 amcharts 添加所有标签
Unable to add all labels using amcharts
根据图像,我只在第一列和第三列上获得标签,如何在所有列中获得标签?下面我附上了一张图片。
JavaScript代码:
<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>
这里是HTML代码:
<div id="chartdiv1"></div>
图形图像
请帮我解决这个问题。提前致谢。
在 JSFiddle 中测试了您的代码,它显示了所有标签,但它的图表数据与您图片中的示例不同。
https://jsfiddle.net/hfqcvauv/
CSS 已添加以显示图表
#chartdiv1 {
width: 100%;
height: 500px;
}
根据图中的示例,可能是因为没有为第二个和第四个图表数据插入月份?
根据图像,我只在第一列和第三列上获得标签,如何在所有列中获得标签?下面我附上了一张图片。
JavaScript代码:
<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>
这里是HTML代码:
<div id="chartdiv1"></div>
图形图像
请帮我解决这个问题。提前致谢。
在 JSFiddle 中测试了您的代码,它显示了所有标签,但它的图表数据与您图片中的示例不同。
https://jsfiddle.net/hfqcvauv/
CSS 已添加以显示图表
#chartdiv1 {
width: 100%;
height: 500px;
}
根据图中的示例,可能是因为没有为第二个和第四个图表数据插入月份?