Java 类org.jfree.chart.renderer.category.AbstractCategoryItemRenderer 实例源码

项目:openbd-core    文件:cfCHART.java   
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;
}
项目:astor    文件:AbstractCategoryItemRendererTests.java   
/**
 * 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));
}
项目:astor    文件:AbstractCategoryItemRendererTests.java   
/**
 * 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());
}
项目:ccu-historian    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:aya-lang    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:populus    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:PI    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:ECG-Viewer    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:group-five    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:manydesigns.cn    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:buffer_bci    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:buffer_bci    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:proyecto-teoria-control-utn-frro    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:Memetic-Algorithm-for-TSP    文件:CategoryPlot.java   
/**
 * 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);
    }
}
项目:ccu-historian    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:aya-lang    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:HTML5_WebSite    文件:CategoryStepChartDemo1.java   
/**
   * Creates a chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {

      CategoryItemRenderer renderer = new CategoryStepRenderer(true);

      CategoryAxis domainAxis = new CategoryAxis(domainLabel);
      NumberAxis rangeAxis = new NumberAxis(rangeLabel);
      CategoryPlot plot = new CategoryPlot(
          dataset, domainAxis, rangeAxis, renderer
      );
      JFreeChart chart = new JFreeChart(chartTitle, plot);

      // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
      chart.setBackgroundPaint(Color.white);

      plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
      plot.setBackgroundPaint(Color.lightGray);
      plot.setDomainGridlinesVisible(true);
      plot.setDomainGridlinePaint(Color.white);
      plot.setRangeGridlinesVisible(true);
      plot.setRangeGridlinePaint(Color.white);

AbstractCategoryItemRenderer renderer2 = (AbstractCategoryItemRenderer)plot.getRenderer();
renderer2.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

      domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
      domainAxis.setLowerMargin(0.0);
      domainAxis.setUpperMargin(0.0);
      domainAxis.addCategoryLabelToolTip("Type 1", "The first type.");
      domainAxis.addCategoryLabelToolTip("Type 2", "The second type.");
      domainAxis.addCategoryLabelToolTip("Type 3", "The third type.");

      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
      // OPTIONAL CUSTOMISATION COMPLETED.

setCategorySummary(dataset);
if (legendPanelOn)
    chart.removeLegend();
      return chart;

  }
项目:populus    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:PI    文件:CategoryPlot.java   
/**
 * Draws the range gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @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 = false;
    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());
            }
        }
    }
}
项目:gama    文件:ChartJFreeChartOutputHistogram.java   
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)) {
        // System.out.println("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.setBaseItemLabelGenerator(new LabelGenerator());
            final ItemLabelPosition itemlabelposition =
                    new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
            newr.setBasePositiveItemLabelPosition(itemlabelposition);
            newr.setBaseNegativeItemLabelPosition(itemlabelposition);
            newr.setBaseItemLabelsVisible(true);
        }

        if (newr instanceof BarRenderer) {
            if (gap >= 0) {
                ((BarRenderer) newr).setMaximumBarWidth(1 - gap);

            }

        }
    }

}
项目:openbd-core    文件:cfCHART.java   
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());
    }
}
项目:ECG-Viewer    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:group-five    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:manydesigns.cn    文件:CategoryPlot.java   
/**
 * Draws the range gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @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());
            }
        }
    }
}
项目:buffer_bci    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:buffer_bci    文件:CategoryPlot.java   
/**
 * 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());
            }
        }
    }
}
项目:proyecto-teoria-control-utn-frro    文件:CategoryPlot.java   
/**
 * Draws the range gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @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());
            }
        }
    }
}
项目:Memetic-Algorithm-for-TSP    文件:CategoryPlot.java   
/**
 * Draws the range gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @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());
            }
        }
    }
}