/** * Check that the legendItemLabelGenerator is cloned. */ @Test public void testCloning_LegendItemLabelGenerator() throws CloneNotSupportedException { StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}"); BarRenderer r1 = new BarRenderer(); r1.setLegendItemLabelGenerator(generator); BarRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check that the generator has been cloned assertTrue(r1.getLegendItemLabelGenerator() != r2.getLegendItemLabelGenerator()); }
/** * Check that the legendItemToolTipGenerator is cloned. */ @Test public void testCloning_LegendItemToolTipGenerator() throws CloneNotSupportedException { StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}"); BarRenderer r1 = new BarRenderer(); r1.setLegendItemToolTipGenerator(generator); BarRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check that the generator has been cloned assertTrue(r1.getLegendItemToolTipGenerator() != r2.getLegendItemToolTipGenerator()); }
/** * Check that the legendItemURLGenerator is cloned. */ @Test public void testCloning_LegendItemURLGenerator() throws CloneNotSupportedException { StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}"); BarRenderer r1 = new BarRenderer(); r1.setLegendItemURLGenerator(generator); BarRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check that the generator has been cloned assertTrue(r1.getLegendItemURLGenerator() != r2.getLegendItemURLGenerator()); }
public void initSubPubCountChart(){ subpubCountChart = ChartFactory.createBarChart( SUB_PUB_COUNT_CATEGORY, "category", SUB_PUB_COUNT_CATEGORY, subpubCountSet); CategoryPlot localCategoryPlot = (CategoryPlot)subpubCountChart.getPlot(); localCategoryPlot.setOrientation(PlotOrientation.HORIZONTAL); localCategoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis localNumberAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); localNumberAxis.setRange(0.0D, 100.0D); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer localBarRenderer = (BarRenderer)localCategoryPlot.getRenderer(); localBarRenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); localBarRenderer.setDrawBarOutline(false); localBarRenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); }
public void initOprCountChart(){ oprCountChart = ChartFactory.createBarChart( OPR_COUNT_CATEGORY, "category", OPR_COUNT_CATEGORY, oprCountSet); CategoryPlot localCategoryPlot = (CategoryPlot)oprCountChart.getPlot(); localCategoryPlot.setOrientation(PlotOrientation.HORIZONTAL); localCategoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis localNumberAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); localNumberAxis.setRange(0.0D, 100.0D); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer localBarRenderer = (BarRenderer)localCategoryPlot.getRenderer(); localBarRenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); localBarRenderer.setDrawBarOutline(false); localBarRenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); }
public void initTimeChart(){ timeChart = ChartFactory.createBarChart( TIME_CATEGORY, "category", TIME_CATEGORY, timeSet); CategoryPlot localCategoryPlot = (CategoryPlot)timeChart.getPlot(); localCategoryPlot.setOrientation(PlotOrientation.HORIZONTAL); localCategoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis localNumberAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); localNumberAxis.setRange(0.0D, 100.0D); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer localBarRenderer = (BarRenderer)localCategoryPlot.getRenderer(); localBarRenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); localBarRenderer.setDrawBarOutline(false); localBarRenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); }
public void initSubPubCountChart(){ subpubCountChart = ChartFactory.createBarChart( SUB_PUB_COUNT_CATEGORY, "category", SUB_PUB_COUNT_CATEGORY, subpubCountSet); CategoryPlot localCategoryPlot = (CategoryPlot)subpubCountChart.getPlot(); localCategoryPlot.setOrientation(PlotOrientation.HORIZONTAL); localCategoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis localNumberAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); //localNumberAxis.setRange(0.0D, 100.0D); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer localBarRenderer = (BarRenderer)localCategoryPlot.getRenderer(); localBarRenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); localBarRenderer.setDrawBarOutline(false); localBarRenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); }
public void initOprCountChart(){ oprCountChart = ChartFactory.createBarChart( OPR_COUNT_CATEGORY, "category", OPR_COUNT_CATEGORY, oprCountSet); CategoryPlot localCategoryPlot = (CategoryPlot)oprCountChart.getPlot(); localCategoryPlot.setOrientation(PlotOrientation.HORIZONTAL); localCategoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis localNumberAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); //localNumberAxis.setRange(0.0D, 100.0D); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer localBarRenderer = (BarRenderer)localCategoryPlot.getRenderer(); localBarRenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); localBarRenderer.setDrawBarOutline(false); localBarRenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); }
public void initTimeChart(){ timeChart = ChartFactory.createBarChart( TIME_CATEGORY, "category", TIME_CATEGORY, timeSet); CategoryPlot localCategoryPlot = (CategoryPlot)timeChart.getPlot(); localCategoryPlot.setOrientation(PlotOrientation.HORIZONTAL); localCategoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis localNumberAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); //localNumberAxis.setRange(0.0D, 100.0D); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer localBarRenderer = (BarRenderer)localCategoryPlot.getRenderer(); localBarRenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); localBarRenderer.setDrawBarOutline(false); localBarRenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); }
/** * Check that the legendItemLabelGenerator is cloned. */ public void testCloning_LegendItemLabelGenerator() { StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}"); BarRenderer r1 = new BarRenderer(); r1.setLegendItemLabelGenerator(generator); BarRenderer r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check that the generator has been cloned assertTrue(r1.getLegendItemLabelGenerator() != r2.getLegendItemLabelGenerator()); }
/** * Check that the legendItemToolTipGenerator is cloned. */ public void testCloning_LegendItemToolTipGenerator() { StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}"); BarRenderer r1 = new BarRenderer(); r1.setLegendItemToolTipGenerator(generator); BarRenderer r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check that the generator has been cloned assertTrue(r1.getLegendItemToolTipGenerator() != r2.getLegendItemToolTipGenerator()); }
/** * Check that the legendItemURLGenerator is cloned. */ public void testCloning_LegendItemURLGenerator() { StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}"); BarRenderer r1 = new BarRenderer(); r1.setLegendItemURLGenerator(generator); BarRenderer r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); // check that the generator has been cloned assertTrue(r1.getLegendItemURLGenerator() != r2.getLegendItemURLGenerator()); }
/** * Some checks for the generalLabel() method. */ public void testGenerateLabel() { StandardCategorySeriesLabelGenerator g = new StandardCategorySeriesLabelGenerator("{0}"); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(1.0, "R0", "C0"); dataset.addValue(2.0, "R0", "C1"); dataset.addValue(3.0, "R1", "C0"); dataset.addValue(null, "R1", "C1"); String s = g.generateLabel(dataset, 0); assertEquals("R0", s); }
/** * Creates a new renderer with no tool tip generator and no URL generator. * The defaults (no tool tip or URL generators) have been chosen to * minimise the processing required to generate a default chart. If you * require tool tips or URLs, then you can easily add the required * generators. */ protected AbstractCategoryItemRenderer() { this.itemLabelGenerator = null; this.itemLabelGeneratorList = new ObjectList(); this.toolTipGenerator = null; this.toolTipGeneratorList = new ObjectList(); this.itemURLGenerator = null; this.itemURLGeneratorList = new ObjectList(); this.legendItemLabelGenerator = new StandardCategorySeriesLabelGenerator(); }
/** * Creates a new renderer with no tool tip generator and no URL generator. * The defaults (no tool tip or URL generators) have been chosen to * minimise the processing required to generate a default chart. If you * require tool tips or URLs, then you can easily add the required * generators. */ protected AbstractCategoryItemRenderer() { this.itemLabelGenerator = null; this.itemLabelGeneratorMap = new HashMap<Integer, CategoryItemLabelGenerator>(); this.toolTipGenerator = null; this.toolTipGeneratorMap = new HashMap<Integer, CategoryToolTipGenerator>(); this.itemURLGenerator = null; this.itemURLGeneratorMap = new HashMap<Integer, CategoryURLGenerator>(); this.legendItemLabelGenerator = new StandardCategorySeriesLabelGenerator(); }
/** * Creates a new renderer with no tool tip generator and no URL generator. * The defaults (no tool tip or URL generators) have been chosen to * minimise the processing required to generate a default chart. If you * require tool tips or URLs, then you can easily add the required * generators. */ protected AbstractCategoryItemRenderer() { this.itemLabelGeneratorMap = new HashMap<Integer, CategoryItemLabelGenerator>(); this.toolTipGeneratorMap = new HashMap<Integer, CategoryToolTipGenerator>(); this.itemURLGeneratorMap = new HashMap<Integer, CategoryURLGenerator>(); this.legendItemLabelGenerator = new StandardCategorySeriesLabelGenerator(); }