List of usage examples for org.jfree.chart.plot CategoryPlot setDomainAxisLocation
public void setDomainAxisLocation(int index, AxisLocation location)
From source file:org.jfree.eastwood.ChartEngine.java
/** * Processes a string that indicates the axes that should be visible on * the plot./*w ww .ja va 2 s .co m*/ * * @param plot the plot. * @param axisStr the axis specification. * @param axes a list that will be populated with any axes added to the * plot. */ private static void processAxisStrH(CategoryPlot plot, String axisStr, List axes) { int xAxisCount = 0; int yAxisCount = 0; for (int i = 0; i < axisStr.length(); i++) { char c = axisStr.charAt(i); if (c == 'y') { if (yAxisCount == 0) { CategoryAxis axis = plot.getDomainAxis(); axis.setTickLabelsVisible(true); axes.add(axis); yAxisCount++; } else { GCategoryAxis axis = new GCategoryAxis(); axis.setAxisLineVisible(false); plot.setDomainAxis(yAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); yAxisCount++; } } else if (c == 'x') { if (xAxisCount == 0) { Axis axis = plot.getRangeAxis(); axis.setTickLabelsVisible(true); axis.setTickMarksVisible(true); axes.add(axis); xAxisCount++; } else { GValueAxis axis = new GValueAxis(); axis.setAxisLineVisible(false); plot.setRangeAxis(xAxisCount, axis); plot.setRangeAxisLocation(xAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); xAxisCount++; } } else if (c == 't') { GValueAxis axis = new GValueAxis(); plot.setRangeAxis(xAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.TOP_OR_LEFT); axes.add(axis); xAxisCount++; } else if (c == 'r') { GCategoryAxis axis = new GCategoryAxis(); plot.setDomainAxis(yAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.BOTTOM_OR_RIGHT); axes.add(axis); yAxisCount++; } else if (c == ',') { // nothing to do } else { throw new RuntimeException("Bad character " + c); } } }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Processes a string that indicates the axes that should be visible on * the plot.//from ww w .ja v a 2 s .com * * @param plot the plot. * @param axisStr the axis specification. * @param axes a list that will be populated with any axes added to the * plot. */ private static void processAxisStrV(CategoryPlot plot, String axisStr, List axes) { int xAxisCount = 0; int yAxisCount = 0; for (int i = 0; i < axisStr.length(); i++) { char c = axisStr.charAt(i); if (c == 'x') { if (xAxisCount == 0) { CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setTickLabelsVisible(true); axes.add(xAxis); xAxisCount++; } else { GCategoryAxis axis = new GCategoryAxis(); axis.setAxisLineVisible(false); plot.setDomainAxis(xAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); xAxisCount++; } } else if (c == 'y') { if (yAxisCount == 0) { Axis yAxis = plot.getRangeAxis(); yAxis.setTickLabelsVisible(true); yAxis.setTickMarksVisible(true); axes.add(yAxis); yAxisCount++; } else { GValueAxis axis = new GValueAxis(); axis.setAxisLineVisible(false); plot.setRangeAxis(yAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); yAxisCount++; } } else if (c == 'r') { GValueAxis axis = new GValueAxis(); plot.setRangeAxis(yAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.BOTTOM_OR_RIGHT); axes.add(axis); yAxisCount++; } else if (c == 't') { GCategoryAxis axis = new GCategoryAxis(); axis.setAxisLineVisible(false); plot.setDomainAxis(xAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.TOP_OR_LEFT); axes.add(axis); xAxisCount++; } else if (c == ',') { // nothing to do } else { throw new RuntimeException("Bad character " + c); } } }