Java Code Examples for org.jfree.chart.renderer.category.BarRenderer#setBaseToolTipGenerator()
The following examples show how to use
org.jfree.chart.renderer.category.BarRenderer#setBaseToolTipGenerator() .
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: ChartFactory.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates a bar chart. The chart object returned by this method uses a * {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis} * for the domain axis, a {@link NumberAxis} as the range axis, and a * {@link BarRenderer} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis * (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag specifying whether or not a legend is required. * * @return A bar chart. */ public static JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean legend) { CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis(valueAxisLabel); BarRenderer renderer = new BarRenderer(); ItemLabelPosition position1 = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); renderer.setBasePositiveItemLabelPosition(position1); ItemLabelPosition position2 = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER); renderer.setBaseNegativeItemLabelPosition(position2); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example 2
Source File: CombinedRangeCategoryPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); CategoryAxis catAxis1 = new CategoryAxis("Category"); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); CategoryAxis catAxis2 = new CategoryAxis("Category"); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot( rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 3
Source File: BarChartBuilder.java From nmonvisualizer with Apache License 2.0 | 5 votes |
@Override protected void formatChart() { super.formatChart(); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getDomainAxis().setLabel(definition.getCategoryAxisLabel()); plot.getRangeAxis().setLabel(definition.getYAxisLabel()); if (definition.hasSecondaryYAxis()) { plot.getRangeAxis(1).setLabel(definition.getSecondaryYAxisLabel()); } if (definition.usePercentYAxis()) { setPercentYAxis(); } for (int i = 0; i < plot.getRendererCount(); i++) { BarRenderer renderer = (BarRenderer) plot.getRenderer(i); formatter.formatRenderer(renderer); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{1} {0} - {2} ({3})", Styles.NUMBER_FORMAT)); } plot.getDomainAxis().setCategoryMargin(0.15d); plot.getDomainAxis().setTickMarksVisible(false); // position of first bar start and last bar end // 1.5% of the chart area within the axis will be blank space on each end plot.getDomainAxis().setLowerMargin(.015); plot.getDomainAxis().setUpperMargin(.015); }
Example 4
Source File: CombinedRangeCategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot(rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 5
Source File: CombinedDomainCategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 6
Source File: CombinedRangeCategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); CategoryAxis catAxis1 = new CategoryAxis("Category"); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); CategoryAxis catAxis2 = new CategoryAxis("Category"); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot( rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 7
Source File: CombinedDomainCategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 8
Source File: CombinedDomainCategoryPlotTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 9
Source File: CombinedDomainCategoryPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 10
Source File: CombinedCategoryPlotDemo1.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Creates a chart. * * @return A chart. */ private static JFreeChart createChart() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedCategoryPlot plot = new CombinedCategoryPlot( domainAxis, new NumberAxis("Range")); plot.add(subplot1, 2); plot.add(subplot2, 1); JFreeChart result = new JFreeChart( "Combined Domain Category Plot Demo", new Font("SansSerif", Font.BOLD, 12), plot, true); return result; }
Example 11
Source File: CombinedCategoryPlotDemo1.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Creates a chart. * * @return A chart. */ private static JFreeChart createChart() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedCategoryPlot plot = new CombinedCategoryPlot( domainAxis, new NumberAxis("Range")); plot.add(subplot1, 2); plot.add(subplot2, 1); JFreeChart result = new JFreeChart( "Combined Domain Category Plot Demo", new Font("SansSerif", Font.BOLD, 12), plot, true); return result; }
Example 12
Source File: CombinedDomainCategoryPlotTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 13
Source File: CombinedRangeCategoryPlotTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); CategoryAxis catAxis1 = new CategoryAxis("Category"); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); CategoryAxis catAxis2 = new CategoryAxis("Category"); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot( rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 14
Source File: CombinedCategoryPlotDemo1.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Creates a chart. * * @return A chart. */ private static JFreeChart createChart() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedCategoryPlot plot = new CombinedCategoryPlot( domainAxis, new NumberAxis("Range")); plot.add(subplot1, 2); plot.add(subplot2, 1); JFreeChart result = new JFreeChart( "Combined Domain Category Plot Demo", new Font("SansSerif", Font.BOLD, 12), plot, true); return result; }
Example 15
Source File: CombinedDomainCategoryPlotTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 16
Source File: CombinedRangeCategoryPlotTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); CategoryAxis catAxis1 = new CategoryAxis("Category"); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); CategoryAxis catAxis2 = new CategoryAxis("Category"); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot( rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 17
Source File: CombinedCategoryPlotDemo1.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates a chart. * * @return A chart. */ private static JFreeChart createChart() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedCategoryPlot plot = new CombinedCategoryPlot( domainAxis, new NumberAxis("Range")); plot.add(subplot1, 2); plot.add(subplot2, 1); JFreeChart result = new JFreeChart( "Combined Domain Category Plot Demo", new Font("SansSerif", Font.BOLD, 12), plot, true); return result; }
Example 18
Source File: CombinedDomainCategoryPlotTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Creates a sample plot. * * @return A sample plot. */ private CombinedDomainCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot1 = new CategoryPlot( dataset1, null, rangeAxis1, renderer1 ); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator() ); CategoryPlot subplot2 = new CategoryPlot( dataset2, null, rangeAxis2, renderer2 ); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Category"); CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 19
Source File: CombinedRangeCategoryPlotTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); CategoryAxis catAxis1 = new CategoryAxis("Category"); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); CategoryAxis catAxis2 = new CategoryAxis("Category"); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot( rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example 20
Source File: AbstractCategoryItemRendererTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Checks that all fields are distinguished. */ public void testEquals() { BarRenderer r1 = new BarRenderer(); BarRenderer r2 = new BarRenderer(); assertEquals(r1, r2); // the plot field is NOT tested // toolTipGeneratorList r1.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator()); assertFalse(r1.equals(r2)); r2.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator()); assertTrue(r1.equals(r2)); // baseToolTipGenerator r1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{2}", NumberFormat.getInstance())); assertFalse(r1.equals(r2)); r2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{2}", NumberFormat.getInstance())); assertTrue(r1.equals(r2)); // itemLabelGeneratorList r1.setSeriesItemLabelGenerator(1, new StandardCategoryItemLabelGenerator()); assertFalse(r1.equals(r2)); r2.setSeriesItemLabelGenerator(1, new StandardCategoryItemLabelGenerator()); assertTrue(r1.equals(r2)); // baseItemLabelGenerator r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( "{2}", NumberFormat.getInstance())); assertFalse(r1.equals(r2)); r2.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( "{2}", NumberFormat.getInstance())); assertTrue(r1.equals(r2)); // urlGeneratorList r1.setSeriesURLGenerator(1, new StandardCategoryURLGenerator()); assertFalse(r1.equals(r2)); r2.setSeriesURLGenerator(1, new StandardCategoryURLGenerator()); assertTrue(r1.equals(r2)); // baseItemURLGenerator r1.setBaseURLGenerator(new StandardCategoryURLGenerator( "abc.html")); assertFalse(r1.equals(r2)); r2.setBaseURLGenerator(new StandardCategoryURLGenerator( "abc.html")); assertTrue(r1.equals(r2)); // legendItemLabelGenerator r1.setLegendItemLabelGenerator(new StandardCategorySeriesLabelGenerator( "XYZ")); assertFalse(r1.equals(r2)); r2.setLegendItemLabelGenerator(new StandardCategorySeriesLabelGenerator( "XYZ")); assertTrue(r1.equals(r2)); // legendItemToolTipGenerator r1.setLegendItemToolTipGenerator( new StandardCategorySeriesLabelGenerator("ToolTip")); assertFalse(r1.equals(r2)); r2.setLegendItemToolTipGenerator( new StandardCategorySeriesLabelGenerator("ToolTip")); assertTrue(r1.equals(r2)); // legendItemURLGenerator r1.setLegendItemURLGenerator( new StandardCategorySeriesLabelGenerator("URL")); assertFalse(r1.equals(r2)); r2.setLegendItemURLGenerator( new StandardCategorySeriesLabelGenerator("URL")); assertTrue(r1.equals(r2)); // background annotation r1.addAnnotation(new CategoryTextAnnotation("ABC", "A", 2.0), Layer.BACKGROUND); assertFalse(r1.equals(r2)); r2.addAnnotation(new CategoryTextAnnotation("ABC", "A", 2.0), Layer.BACKGROUND); assertTrue(r1.equals(r2)); // foreground annotation r1.addAnnotation(new CategoryTextAnnotation("DEF", "B", 4.0), Layer.FOREGROUND); assertFalse(r1.equals(r2)); r2.addAnnotation(new CategoryTextAnnotation("DEF", "B", 4.0), Layer.FOREGROUND); assertTrue(r1.equals(r2)); }