@Test public void testCreateStackedValueList1c() { DefaultCategoryDataset d = new DefaultCategoryDataset(); d.addValue(1.0, "s0", "c0"); d.addValue(0.0, "s1", "c0"); MyRenderer r = new MyRenderer(); List l = r.createStackedValueList(d, "c0", new int[] { 0, 1 }, 0.0, false); assertEquals(3, l.size()); assertEquals(0.0, ((Object[]) l.get(0))[1]); assertEquals(1.0, ((Object[]) l.get(1))[1]); assertEquals(1.0, ((Object[]) l.get(2))[1]); }
protected List<Object[]> createStackedValueList(CategoryDataset dataset, Comparable category, int[] includedRows, double base, boolean asPercentages) { List<Object[]> result = new ArrayList<Object[]>(); double posBase = base; double negBase = base; double total = 0.0; if (asPercentages) { total = DataUtilities.calculateColumnTotal(dataset, dataset.getColumnIndex(category), includedRows); } int baseIndex = -1; for (int r : includedRows) { Number n = dataset.getValue(dataset.getRowKey(r), category); if (n == null) { continue; } double v = n.doubleValue(); if (asPercentages) { v = v / total; } if ((v > 0.0) || (!this.ignoreZeroValues && v >= 0.0)) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } posBase = posBase + v; result.add(new Object[]{r, posBase}); } else if (v < 0.0) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } negBase = negBase + v; result.add(0, new Object[]{-r - 1, negBase}); baseIndex++; } } return result; }
StackedBarRenderer3D extends BarRenderer3D implements Cloneable, PublicCloneable, Serializable { protected List<Object[]> createStackedValueList(CategoryDataset dataset, Comparable category, int[] includedRows, double base, boolean asPercentages) { List<Object[]> result = new ArrayList<Object[]>(); double posBase = base; double negBase = base; double total = 0.0; if (asPercentages) { total = DataUtilities.calculateColumnTotal(dataset, dataset.getColumnIndex(category), includedRows); } int baseIndex = -1; for (int r : includedRows) { Number n = dataset.getValue(dataset.getRowKey(r), category); if (n == null) { continue; } double v = n.doubleValue(); if (asPercentages) { v = v / total; } if ((v > 0.0) || (!this.ignoreZeroValues && v >= 0.0)) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } posBase = posBase + v; result.add(new Object[]{r, posBase}); } else if (v < 0.0) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } negBase = negBase + v; result.add(0, new Object[]{-r - 1, negBase}); baseIndex++; } } return result; } }
StackedBarRenderer3D extends BarRenderer3D implements Cloneable, PublicCloneable, Serializable { protected List<Object[]> createStackedValueList(CategoryDataset dataset, Comparable category, int[] includedRows, double base, boolean asPercentages) { List<Object[]> result = new ArrayList<Object[]>(); double posBase = base; double negBase = base; double total = 0.0; if (asPercentages) { total = DataUtilities.calculateColumnTotal(dataset, dataset.getColumnIndex(category), includedRows); } int baseIndex = -1; for (int r : includedRows) { Number n = dataset.getValue(dataset.getRowKey(r), category); if (n == null) { continue; } double v = n.doubleValue(); if (asPercentages) { v = v / total; } if ((v > 0.0) || (!this.ignoreZeroValues && v >= 0.0)) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } posBase = posBase + v; result.add(new Object[]{r, posBase}); } else if (v < 0.0) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } negBase = negBase + v; result.add(0, new Object[]{-r - 1, negBase}); baseIndex++; } } return result; } StackedBarRenderer3D();  StackedBarRenderer3D(double xOffset, double yOffset);  StackedBarRenderer3D(boolean renderAsPercentages);  StackedBarRenderer3D(double xOffset, double yOffset,
            boolean renderAsPercentages); }
StackedBarRenderer3D extends BarRenderer3D implements Cloneable, PublicCloneable, Serializable { protected List<Object[]> createStackedValueList(CategoryDataset dataset, Comparable category, int[] includedRows, double base, boolean asPercentages) { List<Object[]> result = new ArrayList<Object[]>(); double posBase = base; double negBase = base; double total = 0.0; if (asPercentages) { total = DataUtilities.calculateColumnTotal(dataset, dataset.getColumnIndex(category), includedRows); } int baseIndex = -1; for (int r : includedRows) { Number n = dataset.getValue(dataset.getRowKey(r), category); if (n == null) { continue; } double v = n.doubleValue(); if (asPercentages) { v = v / total; } if ((v > 0.0) || (!this.ignoreZeroValues && v >= 0.0)) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } posBase = posBase + v; result.add(new Object[]{r, posBase}); } else if (v < 0.0) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } negBase = negBase + v; result.add(0, new Object[]{-r - 1, negBase}); baseIndex++; } } return result; } StackedBarRenderer3D();  StackedBarRenderer3D(double xOffset, double yOffset);  StackedBarRenderer3D(boolean renderAsPercentages);  StackedBarRenderer3D(double xOffset, double yOffset,
            boolean renderAsPercentages); boolean getRenderAsPercentages(); void setRenderAsPercentages(boolean asPercentages); boolean getIgnoreZeroValues(); void setIgnoreZeroValues(boolean ignore); @Override Range findRangeBounds(CategoryDataset dataset); @Override void drawItem(Graphics2D g2, CategoryItemRendererState state,
            Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
            ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
            int pass); @Override boolean equals(Object obj); @Override int hashCode(); }
StackedBarRenderer3D extends BarRenderer3D implements Cloneable, PublicCloneable, Serializable { protected List<Object[]> createStackedValueList(CategoryDataset dataset, Comparable category, int[] includedRows, double base, boolean asPercentages) { List<Object[]> result = new ArrayList<Object[]>(); double posBase = base; double negBase = base; double total = 0.0; if (asPercentages) { total = DataUtilities.calculateColumnTotal(dataset, dataset.getColumnIndex(category), includedRows); } int baseIndex = -1; for (int r : includedRows) { Number n = dataset.getValue(dataset.getRowKey(r), category); if (n == null) { continue; } double v = n.doubleValue(); if (asPercentages) { v = v / total; } if ((v > 0.0) || (!this.ignoreZeroValues && v >= 0.0)) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } posBase = posBase + v; result.add(new Object[]{r, posBase}); } else if (v < 0.0) { if (baseIndex < 0) { result.add(new Object[]{null, base}); baseIndex = 0; } negBase = negBase + v; result.add(0, new Object[]{-r - 1, negBase}); baseIndex++; } } return result; } StackedBarRenderer3D();  StackedBarRenderer3D(double xOffset, double yOffset);  StackedBarRenderer3D(boolean renderAsPercentages);  StackedBarRenderer3D(double xOffset, double yOffset,
            boolean renderAsPercentages); boolean getRenderAsPercentages(); void setRenderAsPercentages(boolean asPercentages); boolean getIgnoreZeroValues(); void setIgnoreZeroValues(boolean ignore); @Override Range findRangeBounds(CategoryDataset dataset); @Override void drawItem(Graphics2D g2, CategoryItemRendererState state,
            Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
            ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
            int pass); @Override boolean equals(Object obj); @Override int hashCode();  }