我正在使用amcharts创建条形图我正确地显示了信息,但需要在两个图形之间换行。
我正在为以两种不同模式运行的代码版本提取数据,并且在一个图形中具有一种模式而在另一种图形中具有另一种模式。
示例:图表包含modea的数据以及该代码行的RC和GA版本。图2包含modeb的数据以及该代码行的RC和GA版本。版本相同,只是模式不同。
它们以正确的顺序显示,我只是无法在2之间换行以显示分离。
示例代码:
var chart;
var chartData = [{
os: "2.1",
GAc: 2,
RCc: 1
},{
os: "2.2",
GAc: 6,
RCc: 1
},{
os: "2.1",
GAb: 5,
RCb: 1
},{
os: "2.2",
GAb: 2,
RCb: 9
}];
AmCharts.ready(function () {
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "os";
chart.plotAreaBorderAlpha = 0.2;
chart.numberFormatter = {
precision : 0
};
var categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0.1;
categoryAxis.axisAlpha = 0
categoryAxis.gridPosition = "start";
categoryAxis.autoWrap = true;
categoryAxis.labelRotation = 90;
var valueAxis = new AmCharts.ValueAxis();
valueAxis.stackType = "regular";
valueAxis.gridAlpha = 0.1;
valueAxis.axisAlpha = 0;
chart.addValueAxis(valueAxis);
var graph = new AmCharts.AmGraph();
graph.title = "Mode-Charlie";
graph.valueField = "GAc";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "orange";
chart.addGraph(graph);
var graph = new AmCharts.AmGraph();
graph.title = "Mode-Charlie";
graph.valueField = "RCc";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "blue";
chart.addGraph(graph);
var graph2 = new AmCharts.AmGraph();
graph2.title = "Mode-Beta";
graph2.valueField = "GAb";
graph2.type = "column";
graph2.lineAlpha = 0;
graph2.fillAlphas = 1;
graph2.lineColor = "orange";
chart.addGraph(graph2);
var graph2 = new AmCharts.AmGraph();
graph2.title = "Mode-Beta";
graph2.valueField = "RCb";
graph2.type = "column";
graph2.lineAlpha = 0;
graph2.fillAlphas = 1;
graph2.lineColor = "blue";
chart.addGraph(graph2);
chart.write("chartdiv");
});