org.jfree.chart.labels.ItemLabelAnchor Java Examples
The following examples show how to use
org.jfree.chart.labels.ItemLabelAnchor.
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: BarRenderer3D.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setPositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setNegativeItemLabelPosition(p2); }
Example #2
Source File: XYBarRenderer.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #3
Source File: BarRenderer3D.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBasePositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBaseNegativeItemLabelPosition(p2); }
Example #4
Source File: BarRenderer.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #5
Source File: XYBarRenderer.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #6
Source File: XYBarRenderer.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #7
Source File: BarRenderer.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #8
Source File: BarRenderer3D.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBasePositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBaseNegativeItemLabelPosition(p2); }
Example #9
Source File: XYBarRenderer.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #10
Source File: BarRenderer.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #11
Source File: BarRenderer3D.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBasePositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBaseNegativeItemLabelPosition(p2); }
Example #12
Source File: XYBarRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #13
Source File: BarRenderer3D.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBasePositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBaseNegativeItemLabelPosition(p2); }
Example #14
Source File: BarRenderer.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #15
Source File: BarRenderer.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #16
Source File: BarRenderer3D.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBasePositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBaseNegativeItemLabelPosition(p2); }
Example #17
Source File: BarRenderer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #18
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #19
Source File: BarRenderer.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #20
Source File: BarRenderer3D.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Constructs a new renderer with the specified '3D effect'. * * @param xOffset the x-offset for the 3D effect. * @param yOffset the y-offset for the 3D effect. */ public BarRenderer3D(double xOffset, double yOffset) { super(); this.xOffset = xOffset; this.yOffset = yOffset; this.wallPaint = DEFAULT_WALL_PAINT; // set the default item label positions ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBasePositiveItemLabelPosition(p1); ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER); setBaseNegativeItemLabelPosition(p2); }
Example #21
Source File: BarRenderer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #22
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #23
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 #24
Source File: BarRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Returns <code>true</code> if the specified anchor point is inside a bar. * * @param anchor the anchor point. * * @return A boolean. */ private boolean isInternalAnchor(ItemLabelAnchor anchor) { return anchor == ItemLabelAnchor.CENTER || anchor == ItemLabelAnchor.INSIDE1 || anchor == ItemLabelAnchor.INSIDE2 || anchor == ItemLabelAnchor.INSIDE3 || anchor == ItemLabelAnchor.INSIDE4 || anchor == ItemLabelAnchor.INSIDE5 || anchor == ItemLabelAnchor.INSIDE6 || anchor == ItemLabelAnchor.INSIDE7 || anchor == ItemLabelAnchor.INSIDE8 || anchor == ItemLabelAnchor.INSIDE9 || anchor == ItemLabelAnchor.INSIDE10 || anchor == ItemLabelAnchor.INSIDE11 || anchor == ItemLabelAnchor.INSIDE12; }
Example #25
Source File: Histogram.java From chipster with MIT License | 5 votes |
private void updateHistogram() throws MicroarrayException, IOException { updateChipBox(); int barCount = ((SpinnerNumberModel) barCountSpinner.getModel()).getNumber().intValue(); String expression = ((Variable) chipBox.getSelectedItem()).getExpression(); FloatArrayList histogram = getHistogram(barCount, expression); if (histogram != null) { CategoryDataset dataset = toCategoryDataset(histogram); CategoryAxis categoryAxis = new CategoryAxis("value"); ValueAxis valueAxis = new NumberAxis("count"); 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); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart(data.getName(), JFreeChart.DEFAULT_TITLE_FONT, plot, false); visualisationPanel.removeAll(); visualisationPanel.add(makePanel(chart), BorderLayout.CENTER); visualisationPanel.validate(); } else { throw new IllegalArgumentException("histogram not supported for " + data.getName()); } }
Example #26
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a waterfall 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 WaterfallBarRenderer} 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 waterfall chart. */ public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean legend) { CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel); categoryAxis.setCategoryMargin(0.0); ValueAxis valueAxis = new NumberAxis(valueAxisLabel); WaterfallBarRenderer renderer = new WaterfallBarRenderer(); ItemLabelPosition position = new ItemLabelPosition( ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0); renderer.setBasePositiveItemLabelPosition(position); renderer.setBaseNegativeItemLabelPosition(position); StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator(); renderer.setBaseToolTipGenerator(generator); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.clearRangeMarkers(); Marker baseline = new ValueMarker(0.0); baseline.setPaint(Color.black); plot.addRangeMarker(baseline, Layer.FOREGROUND); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #27
Source File: AbstractRendererTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Test that setting the negative item label position for ALL series does * in fact work. */ @Test public void testSetNegativeItemLabelPosition() { BarRenderer r = new BarRenderer(); r.setNegativeItemLabelPosition(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT)); assertEquals(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT), r.getNegativeItemLabelPosition(0, 0)); }
Example #28
Source File: StackedBarRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Creates a new renderer. * * @param renderAsPercentages a flag that controls whether the data values * are rendered as percentages. */ public StackedBarRenderer(boolean renderAsPercentages) { super(); this.renderAsPercentages = renderAsPercentages; // set the default item label positions, which will only be used if // the user requests visible item labels... ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER); setBasePositiveItemLabelPosition(p); setBaseNegativeItemLabelPosition(p); setPositiveItemLabelPositionFallback(null); setNegativeItemLabelPositionFallback(null); }
Example #29
Source File: AbstractRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
@Test public void testEquals_ObjectList4() { BarRenderer r1 = new BarRenderer(); r1.setSeriesNegativeItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); BarRenderer r2 = new BarRenderer(); r2.setSeriesNegativeItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); assertEquals(r1, r2); r2.setSeriesNegativeItemLabelPosition(1, new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER)); assertNotEquals(r1, r2); }
Example #30
Source File: AbstractRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Test that setting the negative item label position for ALL series does * in fact work. */ @Test public void testSetNegativeItemLabelPosition() { BarRenderer r = new BarRenderer(); r.setNegativeItemLabelPosition(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT)); assertEquals(new ItemLabelPosition( ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT), r.getNegativeItemLabelPosition(0, 0)); }