Java Code Examples for org.jfree.chart.plot.CategoryPlot#getDomainAxisForDataset()
The following examples show how to use
org.jfree.chart.plot.CategoryPlot#getDomainAxisForDataset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StackedBarRenderer.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Calculates the bar width and stores it in the renderer state. * * @param plot the plot. * @param dataArea the data area. * @param rendererIndex the renderer index. * @param state the renderer state. */ @Override protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) { // calculate the bar width CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int columns = data.getColumnCount(); double categoryMargin = 0.0; if (columns > 1) { categoryMargin = xAxis.getCategoryMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); } } }
Example 2
Source File: StackedBarRenderer.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Calculates the bar width and stores it in the renderer state. * * @param plot the plot. * @param dataArea the data area. * @param rendererIndex the renderer index. * @param state the renderer state. */ @Override protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) { // calculate the bar width CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int columns = data.getColumnCount(); double categoryMargin = 0.0; if (columns > 1) { categoryMargin = xAxis.getCategoryMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); } } }
Example 3
Source File: StackedBarRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Calculates the bar width and stores it in the renderer state. * * @param plot the plot. * @param dataArea the data area. * @param rendererIndex the renderer index. * @param state the renderer state. */ @Override protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) { // calculate the bar width CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int columns = data.getColumnCount(); double categoryMargin = 0.0; if (columns > 1) { categoryMargin = xAxis.getCategoryMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); } } }
Example 4
Source File: CategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the getDomainAxisForDataset() method. */ public void testGetDomainAxisForDataset() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(xAxis, plot.getDomainAxisForDataset(0)); // should get IllegalArgumentException for negative index boolean pass = false; try { plot.getDomainAxisForDataset(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); // if multiple axes are mapped, the first in the list should be // returned... CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(1, xAxis2); assertEquals(xAxis, plot.getDomainAxisForDataset(0)); plot.mapDatasetToDomainAxis(0, 1); assertEquals(xAxis2, plot.getDomainAxisForDataset(0)); List axisIndices = Arrays.asList(new Integer[] {new Integer(0), new Integer(1)}); plot.mapDatasetToDomainAxes(0, axisIndices); assertEquals(xAxis, plot.getDomainAxisForDataset(0)); axisIndices = Arrays.asList(new Integer[] {new Integer(1), new Integer(2)}); plot.mapDatasetToDomainAxes(0, axisIndices); assertEquals(xAxis2, plot.getDomainAxisForDataset(0)); }
Example 5
Source File: GroupedStackedBarRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Calculates the bar width and stores it in the renderer state. We * override the method in the base class to take account of the * series-to-group mapping. * * @param plot the plot. * @param dataArea the data area. * @param rendererIndex the renderer index. * @param state the renderer state. */ @Override protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) { // calculate the bar width CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int groups = this.seriesToGroupMap.getGroupCount(); int categories = data.getColumnCount(); int columns = groups * categories; double categoryMargin = 0.0; double itemMargin = 0.0; if (categories > 1) { categoryMargin = xAxis.getCategoryMargin(); } if (groups > 1) { itemMargin = getItemMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); } } }
Example 6
Source File: GroupedStackedBarRenderer.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Calculates the bar width and stores it in the renderer state. We * override the method in the base class to take account of the * series-to-group mapping. * * @param plot the plot. * @param dataArea the data area. * @param rendererIndex the renderer index. * @param state the renderer state. */ @Override protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) { // calculate the bar width CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int groups = this.seriesToGroupMap.getGroupCount(); int categories = data.getColumnCount(); int columns = groups * categories; double categoryMargin = 0.0; double itemMargin = 0.0; if (categories > 1) { categoryMargin = xAxis.getCategoryMargin(); } if (groups > 1) { itemMargin = getItemMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); } } }
Example 7
Source File: GroupedStackedBarRenderer.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Calculates the bar width and stores it in the renderer state. We * override the method in the base class to take account of the * series-to-group mapping. * * @param plot the plot. * @param dataArea the data area. * @param rendererIndex the renderer index. * @param state the renderer state. */ protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) { // calculate the bar width CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { PlotOrientation orientation = plot.getOrientation(); double space = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { space = dataArea.getHeight(); } else if (orientation == PlotOrientation.VERTICAL) { space = dataArea.getWidth(); } double maxWidth = space * getMaximumBarWidth(); int groups = this.seriesToGroupMap.getGroupCount(); int categories = data.getColumnCount(); int columns = groups * categories; double categoryMargin = 0.0; double itemMargin = 0.0; if (categories > 1) { categoryMargin = xAxis.getCategoryMargin(); } if (groups > 1) { itemMargin = getItemMargin(); } double used = space * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin - itemMargin); if (columns > 0) { state.setBarWidth(Math.min(used / columns, maxWidth)); } else { state.setBarWidth(Math.min(used, maxWidth)); } } }
Example 8
Source File: JGenProg2017_0078_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 9
Source File: JGenProg2017_000_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 10
Source File: Chart_1_AbstractCategoryItemRenderer_s.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 11
Source File: JGenProg2017_00124_s.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 12
Source File: patch1-Chart-1-jMutRepair_patch1-Chart-1-jMutRepair_s.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 13
Source File: JGenProg2017_00124_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 14
Source File: Arja_0062_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 15
Source File: jMutRepair_0020_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 16
Source File: jKali_0031_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 17
Source File: Arja_0089_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 18
Source File: jKali_0019_t.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 19
Source File: JGenProg2017_0078_s.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }
Example 20
Source File: jKali_0019_s.java From coming with MIT License | 2 votes |
/** * Returns the domain axis that is used for the specified dataset. * * @param plot the plot (<code>null</code> not permitted). * @param dataset the dataset (<code>null</code> not permitted). * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, CategoryDataset dataset) { int datasetIndex = plot.indexOf(dataset); return plot.getDomainAxisForDataset(datasetIndex); }