// x-Axis needs to be shared
XAxis xAxis = new XAxis(new LinearNumericalAxisScaling(), "X");
xAxis.axisScaling.setMinValue(0);
xAxis.axisScaling.setMaxValue(100);
XYChart topChart = (XYChart) new TestDataBar_5_PosNegColor().getChart();
topChart.xAxis = xAxis;
XYChart bottomChart = (XYChart) new TestDataXY_SineCurve().getChart();
bottomChart.xAxis = xAxis;
XYChart middleChart = (XYChart) new TestDataXY_Scatter().getChart();
middleChart.xAxis = xAxis;
ArrayList<XYChart> charts = new ArrayList<XYChart>();
charts.add(topChart);
charts.add(middleChart);
charts.add(bottomChart);
// height percentages
ArrayList<Integer> percentages = new ArrayList<Integer>();
percentages.add(40);
percentages.add(30);
percentages.add(30);
StackedXYChart chart = new StackedXYChart(
"Three random charts with same X Axis", charts, percentages);