org.jfree.chart.renderer.category.AbstractCategoryItemRenderer Java Examples
The following examples show how to use
org.jfree.chart.renderer.category.AbstractCategoryItemRenderer.
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: AbstractCategoryItemRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * A test that reproduces the problem reported in bug 2947660. */ public void test2947660() { AbstractCategoryItemRenderer r = new LineAndShapeRenderer(); assertNotNull(r.getLegendItems()); assertEquals(0, r.getLegendItems().getItemCount()); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); CategoryPlot plot = new CategoryPlot(); plot.setDataset(dataset); plot.setRenderer(r); assertEquals(0, r.getLegendItems().getItemCount()); dataset.addValue(1.0, "S1", "C1"); LegendItemCollection lic = r.getLegendItems(); assertEquals(1, lic.getItemCount()); assertEquals("S1", lic.get(0).getLabel()); }
Example #2
Source File: AbstractCategoryItemRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the findRangeBounds() method. */ public void testFindRangeBounds() { AbstractCategoryItemRenderer r = new LineAndShapeRenderer(); assertNull(r.findRangeBounds(null)); // an empty dataset should return a null range DefaultCategoryDataset dataset = new DefaultCategoryDataset(); assertNull(r.findRangeBounds(dataset)); dataset.addValue(1.0, "R1", "C1"); assertEquals(new Range(1.0, 1.0), r.findRangeBounds(dataset)); dataset.addValue(-2.0, "R1", "C2"); assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); dataset.addValue(null, "R1", "C3"); assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); }
Example #3
Source File: cfCHART.java From openbd-core with GNU General Public License v3.0 | 6 votes |
private AbstractCategoryItemRenderer getBarRenderer(String seriesPlacement, boolean bShow3D, int xOffset, int yOffset, Paint[] colors) { AbstractCategoryItemRenderer renderer; if (bShow3D) { if (seriesPlacement.equals("stacked")) renderer = new CustomStackedBarRenderer3D(colors, xOffset, yOffset); else renderer = new CustomBarRenderer3D(colors, xOffset, yOffset); } else { if (seriesPlacement.equals("stacked")) renderer = new CustomStackedBarRenderer(colors); else if (seriesPlacement.equals("percent")) renderer = new CustomStackedBarRenderer(colors, true); else renderer = new CustomBarRenderer(colors); } return renderer; }
Example #4
Source File: CategoryPlot.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Draws a base line across the chart at value zero on the range axis. * * @param g2 the graphics device. * @param area the data area. * * @see #setRangeZeroBaselineVisible(boolean) * * @since 1.0.13 */ protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) { if (!isRangeZeroBaselineVisible()) { return; } CategoryItemRenderer r = getRenderer(); if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke); } else { r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0); } }
Example #5
Source File: CategoryPlot.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Draws a base line across the chart at value zero on the range axis. * * @param g2 the graphics device. * @param area the data area. * * @see #setRangeZeroBaselineVisible(boolean) * * @since 1.0.13 */ protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) { if (!isRangeZeroBaselineVisible()) { return; } CategoryItemRenderer r = getRenderer(); if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke); } else { r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0); } }
Example #6
Source File: CategoryPlot.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Draws a base line across the chart at value zero on the range axis. * * @param g2 the graphics device. * @param area the data area. * * @see #setRangeZeroBaselineVisible(boolean) * * @since 1.0.13 */ protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) { if (!isRangeZeroBaselineVisible()) { return; } CategoryItemRenderer r = getRenderer(); if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke); } else { r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0); } }
Example #7
Source File: CategoryPlot.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Draws a base line across the chart at value zero on the range axis. * * @param g2 the graphics device. * @param area the data area. * * @see #setRangeZeroBaselineVisible(boolean) * * @since 1.0.13 */ protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) { if (!isRangeZeroBaselineVisible()) { return; } CategoryItemRenderer r = getRenderer(); if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke); } else { r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0); } }
Example #8
Source File: CategoryPlot.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Draws a base line across the chart at value zero on the range axis. * * @param g2 the graphics device. * @param area the data area. * * @see #setRangeZeroBaselineVisible(boolean) * * @since 1.0.13 */ protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) { if (!isRangeZeroBaselineVisible()) { return; } CategoryItemRenderer r = getRenderer(); if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke); } else { r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0); } }
Example #9
Source File: CategoryPlot.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Draws a base line across the chart at value zero on the range axis. * * @param g2 the graphics device. * @param area the data area. * * @see #setRangeZeroBaselineVisible(boolean) * * @since 1.0.13 */ protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) { if (!isRangeZeroBaselineVisible()) { return; } CategoryItemRenderer r = getRenderer(); if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke); } else { r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0); } }
Example #10
Source File: ChartJFreeChartOutputHistogram.java From gama with GNU General Public License v3.0 | 4 votes |
protected void resetRenderer(final IScope scope, final String serieid) { // AbstractCategoryItemRenderer // newr=(AbstractCategoryItemRenderer)this.getOrCreateRenderer(scope, // serieid); final CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); final AbstractCategoryItemRenderer newr = (AbstractCategoryItemRenderer) plot.getRenderer(); // if // (serieid!=this.getChartdataset().series.keySet().iterator().next()) // newr=(AbstractCategoryItemRenderer)this.getOrCreateRenderer(scope, // serieid); final ChartDataSeries myserie = this.getChartdataset().getDataSeries(scope, serieid); if (!IdPosition.containsKey(serieid)) { // DEBUG.LOG("pb!!!"); } else { final int myrow = IdPosition.get(serieid); if (myserie.getMycolor() != null) { newr.setSeriesPaint(myrow, myserie.getMycolor()); } if (this.series_label_position.equals("onchart")) { // ((BarRenderer)newr).setBaseItemLabelGenerator(new // LabelGenerator()); newr.setDefaultItemLabelGenerator(new LabelGenerator()); final ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); newr.setDefaultPositiveItemLabelPosition(itemlabelposition); newr.setDefaultNegativeItemLabelPosition(itemlabelposition); newr.setDefaultItemLabelsVisible(true); } if (newr instanceof BarRenderer) { if (gap >= 0) { ((BarRenderer) newr).setMaximumBarWidth(1 - gap); } } } }
Example #11
Source File: cfCHART.java From openbd-core with GNU General Public License v3.0 | 4 votes |
private void setCategoryItemLabelsData(AbstractCategoryItemRenderer renderer, cfCHARTSERIESData seriesData) throws cfmRunTimeException { // Set them as visible renderer.setItemLabelsVisible(true); // Set their color renderer.setItemLabelPaint(convertStringToColor(seriesData.getDataLabelColor())); // Set their font renderer.setItemLabelFont(getFont(seriesData.getDataLabelFont(), seriesData.getDataLabelFontBold(), seriesData.getDataLabelFontItalic(), seriesData.getDataLabelFontSize())); // Set the item label position for negative data values double degrees = seriesData.getDataLabelAngle(); double radians = Math.toRadians(degrees); String negPosition = seriesData.getNegativeDataLabelPosition(); if (negPosition.equals("top")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians)); else if (negPosition.equals("top_inside")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians)); else if (negPosition.equals("left")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians)); else if (negPosition.equals("left_inside")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE9, TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians)); else if (negPosition.equals("center")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, radians)); else if (negPosition.equals("right")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians)); else if (negPosition.equals("right_inside")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians)); else if (negPosition.equals("bottom_inside")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians)); else if (negPosition.equals("bottom")) renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians)); // Set the item label position for positive data values String posPosition = seriesData.getPositiveDataLabelPosition(); if (posPosition.equals("top")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians)); else if (posPosition.equals("top_inside")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians)); else if (posPosition.equals("left")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians)); else if (posPosition.equals("left_inside")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE9, TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians)); else if (posPosition.equals("center")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, radians)); else if (posPosition.equals("right")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT, TextAnchor.CENTER, radians)); else if (posPosition.equals("right_inside")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, radians)); else if (posPosition.equals("bottom_inside")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, radians)); else if (posPosition.equals("bottom")) renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER, TextAnchor.CENTER, radians)); // With Bar graphs and an inside position, we want to force the item labels // to be drawn even if they don't fit inside the bar graph. if (renderer instanceof BarRenderer) { ((BarRenderer) renderer).setNegativeItemLabelPositionFallback(renderer.getNegativeItemLabelPosition()); ((BarRenderer) renderer).setPositiveItemLabelPositionFallback(renderer.getPositiveItemLabelPosition()); } }
Example #12
Source File: CategoryPlot.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Draws the range gridlines for the plot, if they are visible. * * @param g2 the graphics device ({@code null} not permitted). * @param dataArea the area inside the axes ({@code null} not permitted). * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) { return; } // no axis, no gridlines... ValueAxis axis = getRangeAxis(); if (axis == null) { return; } // no renderer, no gridlines... CategoryItemRenderer r = getRenderer(); if (r == null) { return; } Stroke gridStroke = null; Paint gridPaint = null; boolean paintLine; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) { gridStroke = getRangeMinorGridlineStroke(); gridPaint = getRangeMinorGridlinePaint(); paintLine = true; } else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) { gridStroke = getRangeGridlineStroke(); gridPaint = getRangeGridlinePaint(); paintLine = true; } if (((tick.getValue() != 0.0) || !isRangeZeroBaselineVisible()) && paintLine) { // the method we want isn't in the CategoryItemRenderer // interface... if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke); } else { // we'll have to use the method in the interface, but // this doesn't have the paint and stroke settings... r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue()); } } } }
Example #13
Source File: CategoryPlot.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Draws the range gridlines for the plot, if they are visible. * * @param g2 the graphics device ({@code null} not permitted). * @param dataArea the area inside the axes ({@code null} not permitted). * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) { return; } // no axis, no gridlines... ValueAxis axis = getRangeAxis(); if (axis == null) { return; } // no renderer, no gridlines... CategoryItemRenderer r = getRenderer(); if (r == null) { return; } Stroke gridStroke = null; Paint gridPaint = null; boolean paintLine; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) { gridStroke = getRangeMinorGridlineStroke(); gridPaint = getRangeMinorGridlinePaint(); paintLine = true; } else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) { gridStroke = getRangeGridlineStroke(); gridPaint = getRangeGridlinePaint(); paintLine = true; } if (((tick.getValue() != 0.0) || !isRangeZeroBaselineVisible()) && paintLine) { // the method we want isn't in the CategoryItemRenderer // interface... if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke); } else { // we'll have to use the method in the interface, but // this doesn't have the paint and stroke settings... r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue()); } } } }
Example #14
Source File: CategoryPlot.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Draws the range gridlines for the plot, if they are visible. * * @param g2 the graphics device ({@code null} not permitted). * @param dataArea the area inside the axes ({@code null} not permitted). * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) { return; } // no axis, no gridlines... ValueAxis axis = getRangeAxis(); if (axis == null) { return; } // no renderer, no gridlines... CategoryItemRenderer r = getRenderer(); if (r == null) { return; } Stroke gridStroke = null; Paint gridPaint = null; boolean paintLine; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) { gridStroke = getRangeMinorGridlineStroke(); gridPaint = getRangeMinorGridlinePaint(); paintLine = true; } else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) { gridStroke = getRangeGridlineStroke(); gridPaint = getRangeGridlinePaint(); paintLine = true; } if (((tick.getValue() != 0.0) || !isRangeZeroBaselineVisible()) && paintLine) { // the method we want isn't in the CategoryItemRenderer // interface... if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke); } else { // we'll have to use the method in the interface, but // this doesn't have the paint and stroke settings... r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue()); } } } }
Example #15
Source File: CategoryPlot.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Draws the range gridlines for the plot, if they are visible. * * @param g2 the graphics device ({@code null} not permitted). * @param dataArea the area inside the axes ({@code null} not permitted). * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) { return; } // no axis, no gridlines... ValueAxis axis = getRangeAxis(); if (axis == null) { return; } // no renderer, no gridlines... CategoryItemRenderer r = getRenderer(); if (r == null) { return; } Stroke gridStroke = null; Paint gridPaint = null; boolean paintLine; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) { gridStroke = getRangeMinorGridlineStroke(); gridPaint = getRangeMinorGridlinePaint(); paintLine = true; } else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) { gridStroke = getRangeGridlineStroke(); gridPaint = getRangeGridlinePaint(); paintLine = true; } if (((tick.getValue() != 0.0) || !isRangeZeroBaselineVisible()) && paintLine) { // the method we want isn't in the CategoryItemRenderer // interface... if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke); } else { // we'll have to use the method in the interface, but // this doesn't have the paint and stroke settings... r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue()); } } } }
Example #16
Source File: CategoryPlot.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Draws the range gridlines for the plot, if they are visible. * * @param g2 the graphics device ({@code null} not permitted). * @param dataArea the area inside the axes ({@code null} not permitted). * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) { return; } // no axis, no gridlines... ValueAxis axis = getRangeAxis(); if (axis == null) { return; } // no renderer, no gridlines... CategoryItemRenderer r = getRenderer(); if (r == null) { return; } Stroke gridStroke = null; Paint gridPaint = null; boolean paintLine; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) { gridStroke = getRangeMinorGridlineStroke(); gridPaint = getRangeMinorGridlinePaint(); paintLine = true; } else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) { gridStroke = getRangeGridlineStroke(); gridPaint = getRangeGridlinePaint(); paintLine = true; } if (((tick.getValue() != 0.0) || !isRangeZeroBaselineVisible()) && paintLine) { // the method we want isn't in the CategoryItemRenderer // interface... if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke); } else { // we'll have to use the method in the interface, but // this doesn't have the paint and stroke settings... r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue()); } } } }
Example #17
Source File: CategoryPlot.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Draws the range gridlines for the plot, if they are visible. * * @param g2 the graphics device ({@code null} not permitted). * @param dataArea the area inside the axes ({@code null} not permitted). * @param ticks the ticks. * * @see #drawDomainGridlines(Graphics2D, Rectangle2D) */ protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) { // draw the range grid lines, if any... if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) { return; } // no axis, no gridlines... ValueAxis axis = getRangeAxis(); if (axis == null) { return; } // no renderer, no gridlines... CategoryItemRenderer r = getRenderer(); if (r == null) { return; } Stroke gridStroke = null; Paint gridPaint = null; boolean paintLine; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) { gridStroke = getRangeMinorGridlineStroke(); gridPaint = getRangeMinorGridlinePaint(); paintLine = true; } else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) { gridStroke = getRangeGridlineStroke(); gridPaint = getRangeGridlinePaint(); paintLine = true; } if (((tick.getValue() != 0.0) || !isRangeZeroBaselineVisible()) && paintLine) { // the method we want isn't in the CategoryItemRenderer // interface... if (r instanceof AbstractCategoryItemRenderer) { AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r; aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke); } else { // we'll have to use the method in the interface, but // this doesn't have the paint and stroke settings... r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue()); } } } }