当前位置: 首页>>代码示例>>Java>>正文


Java XYItemLabelGenerator类代码示例

本文整理汇总了Java中org.jfree.chart.labels.XYItemLabelGenerator的典型用法代码示例。如果您正苦于以下问题:Java XYItemLabelGenerator类的具体用法?Java XYItemLabelGenerator怎么用?Java XYItemLabelGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XYItemLabelGenerator类属于org.jfree.chart.labels包,在下文中一共展示了XYItemLabelGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getItemLabelGenerator

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Returns the label generator for a data item.  This implementation simply
 * passes control to the {@link #getSeriesItemLabelGenerator(int)} method.
 * If, for some reason, you want a different generator for individual
 * items, you can override this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
@Override
public XYItemLabelGenerator getItemLabelGenerator(int series, int item) {
    // return the generator for ALL series, if there is one...
    if (this.itemLabelGenerator != null) {
        return this.itemLabelGenerator;
    }

    // otherwise look up the generator table
    XYItemLabelGenerator generator
        = (XYItemLabelGenerator) this.itemLabelGeneratorMap.get(series);
    if (generator == null) {
        generator = this.baseItemLabelGenerator;
    }
    return generator;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:27,代码来源:AbstractXYItemRenderer.java

示例2: DiagonalLineRenderer

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
public DiagonalLineRenderer() {

	super(true, true);

	setDefaultShapesFilled(true);
	setDrawOutlines(true);
	setUseFillPaint(true);

	for (int i = 0; i < plotDiagonalColors.length; i++) {
	    setSeriesShape(i, diagonalPointsShape);
	    setSeriesPaint(i, plotDiagonalColors[i]);
	    setSeriesFillPaint(i, plotDiagonalColors[i]);
	}

	setDefaultShapesVisible(true);

	XYItemLabelGenerator diagonallabelGenerator = new DiagonalLineLabelGenerator();
	setDefaultItemLabelGenerator(diagonallabelGenerator);
	setDefaultItemLabelsVisible(true);

	setDrawSeriesLineAsPath(true);
    }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:23,代码来源:DiagonalLineRenderer.java

示例3: ScatterPlotRenderer

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
public ScatterPlotRenderer() {

	super(false, true);

	ScatterPlotToolTipGenerator toolTipGenerator = new ScatterPlotToolTipGenerator();
	setDefaultToolTipGenerator(toolTipGenerator);

	XYItemLabelGenerator ItemlabelGenerator = new ScatterPlotItemLabelGenerator();
	setDefaultItemLabelGenerator(ItemlabelGenerator);
	setDefaultItemLabelFont(new Font("SansSerif", Font.BOLD, 11));
	setDefaultItemLabelPaint(Color.black);
	setDefaultItemLabelsVisible(false);

	setSeriesItemLabelsVisible(0, false);
	setSeriesPaint(0, pointColor);
	setSeriesShape(0, dataPointsShape);

	setSeriesItemLabelsVisible(1, false);
	setSeriesPaint(1, searchColor);
	setSeriesShape(1, dataPointsShape);
	
	setDrawSeriesLineAsPath(true);

    }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:25,代码来源:ScatterPlotRenderer.java

示例4: getSeriesItemLabelGenerator

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Returns the item label generator for a series.
 *
 * @param series  the series index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
public XYItemLabelGenerator getSeriesItemLabelGenerator(int series) {

    // return the generator for ALL series, if there is one...
    if (this.itemLabelGenerator != null) {
        return this.itemLabelGenerator;
    }

    // otherwise look up the generator table
    XYItemLabelGenerator generator
        = (XYItemLabelGenerator) this.itemLabelGeneratorList.get(series);
    if (generator == null) {
        generator = this.baseItemLabelGenerator;
    }
    return generator;

}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:24,代码来源:AbstractXYItemRenderer.java

示例5: createAdditionalDataset

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
public void createAdditionalDataset(String setTitle, boolean showDataLabels) {
	dataCollection.add(createDataset(setTitle));
	plot.setDataset(dataCollection.size() - 1, dataCollection.get(dataCollection.size() - 1));

	XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

	if(showDataLabels){
		XYItemLabelGenerator itemLabelGenerator = new CustomItemLabelGenerator();
		renderer.setBaseItemLabelGenerator(itemLabelGenerator);
		renderer.setSeriesItemLabelsVisible(0, true);
	}

	renderer.setBaseShapesVisible(true);
	renderer.setBaseShapesFilled(true);
	renderer.setDrawSeriesLineAsPath(true);
	plot.setRenderer(dataCollection.size() - 1, renderer);
}
 
开发者ID:yeokm1,项目名称:odroid-power-measure,代码行数:18,代码来源:Chart.java

示例6: getItemLabelGenerator

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Returns the label generator for a data item.  This implementation simply
 * passes control to the {@link #getSeriesItemLabelGenerator(int)} method.
 * If, for some reason, you want a different generator for individual
 * items, you can override this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
@Override
public XYItemLabelGenerator getItemLabelGenerator(int series, int item) {
    // return the generator for ALL series, if there is one...
    if (this.itemLabelGenerator != null) {
        return this.itemLabelGenerator;
    }

    // otherwise look up the generator table
    XYItemLabelGenerator generator
        = (XYItemLabelGenerator) this.itemLabelGeneratorList.get(series);
    if (generator == null) {
        generator = this.baseItemLabelGenerator;
    }
    return generator;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:27,代码来源:AbstractXYItemRenderer.java

示例7: getItemLabelGenerator

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Returns the label generator for a data item.  This implementation simply
 * passes control to the {@link #getSeriesItemLabelGenerator(int)} method.
 * If, for some reason, you want a different generator for individual
 * items, you can override this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
public XYItemLabelGenerator getItemLabelGenerator(int series, int item) {
    // return the generator for ALL series, if there is one...
    if (this.itemLabelGenerator != null) {
        return this.itemLabelGenerator;
    }

    // otherwise look up the generator table
    XYItemLabelGenerator generator
        = (XYItemLabelGenerator) this.itemLabelGeneratorList.get(series);
    if (generator == null) {
        generator = this.baseItemLabelGenerator;
    }
    return generator;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:AbstractXYItemRenderer.java

示例8: drawItemLabel

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item
 *                  label position).
 */
protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation,
        XYDataset dataset, int series, int item, double x, double y,
        boolean negative) {

    XYItemLabelGenerator generator = getItemLabelGenerator(series, item);
    if (generator != null) {
        Font labelFont = getItemLabelFont(series, item);
        Paint paint = getItemLabelPaint(series, item);
        g2.setFont(labelFont);
        g2.setPaint(paint);
        String label = generator.generateLabel(dataset, series, item);

        // get the label position..
        ItemLabelPosition position = null;
        if (!negative) {
            position = getPositiveItemLabelPosition(series, item);
        }
        else {
            position = getNegativeItemLabelPosition(series, item);
        }

        // work out the label anchor point...
        Point2D anchorPoint = calculateLabelAnchorPoint(
                position.getItemLabelAnchor(), x, y, orientation);
        TextUtilities.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:45,代码来源:AbstractXYItemRenderer.java

示例9: AbstractXYItemRenderer

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Creates a renderer where the tooltip generator and the URL generator are
 * both <code>null</code>.
 */
protected AbstractXYItemRenderer() {
    super();
    this.itemLabelGenerator = null;
    this.itemLabelGeneratorMap 
            = new HashMap<Integer, XYItemLabelGenerator>();
    this.toolTipGenerator = null;
    this.toolTipGeneratorMap = new HashMap<Integer, XYToolTipGenerator>();
    this.urlGenerator = null;
    this.backgroundAnnotations = new java.util.ArrayList();
    this.foregroundAnnotations = new java.util.ArrayList();
    this.legendItemLabelGenerator = new StandardXYSeriesLabelGenerator(
            "{0}");
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:18,代码来源:AbstractXYItemRenderer.java

示例10: drawItemLabel

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item
 *                  label position).
 */
protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation,
        XYDataset dataset, int series, int item, double x, double y,
        boolean negative) {

    XYItemLabelGenerator generator = getItemLabelGenerator(series, item);
    if (generator != null) {
        Font labelFont = getItemLabelFont(series, item);
        Paint paint = getItemLabelPaint(series, item);
        g2.setFont(labelFont);
        g2.setPaint(paint);
        String label = generator.generateLabel(dataset, series, item);

        // get the label position..
        ItemLabelPosition position;
        if (!negative) {
            position = getPositiveItemLabelPosition(series, item);
        }
        else {
            position = getNegativeItemLabelPosition(series, item);
        }

        // work out the label anchor point...
        Point2D anchorPoint = calculateLabelAnchorPoint(
                position.getItemLabelAnchor(), x, y, orientation);
        TextUtilities.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
    }

}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:45,代码来源:AbstractXYItemRenderer.java

示例11: AbstractXYItemRenderer

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Creates a renderer where the tooltip generator and the URL generator are
 * both {@code null}.
 */
protected AbstractXYItemRenderer() {
    super();
    this.itemLabelGeneratorMap 
            = new HashMap<Integer, XYItemLabelGenerator>();
    this.toolTipGeneratorMap = new HashMap<Integer, XYToolTipGenerator>();
    this.urlGenerator = null;
    this.backgroundAnnotations = new java.util.ArrayList();
    this.foregroundAnnotations = new java.util.ArrayList();
    this.legendItemLabelGenerator = new StandardXYSeriesLabelGenerator(
            "{0}");
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:16,代码来源:AbstractXYItemRenderer.java

示例12: getItemLabelGenerator

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Returns the label generator for a data item.  This implementation simply
 * passes control to the {@link #getSeriesItemLabelGenerator(int)} method.
 * If, for some reason, you want a different generator for individual
 * items, you can override this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly {@code null}).
 */
@Override
public XYItemLabelGenerator getItemLabelGenerator(int series, int item) {

    // otherwise look up the generator table
    XYItemLabelGenerator generator
        = (XYItemLabelGenerator) this.itemLabelGeneratorMap.get(series);
    if (generator == null) {
        generator = this.defaultItemLabelGenerator;
    }
    return generator;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:23,代码来源:AbstractXYItemRenderer.java

示例13: drawItemLabel

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item
 *                  label position).
 */
protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation,
        XYDataset dataset, int series, int item, double x, double y,
        boolean negative) {

    XYItemLabelGenerator generator = getItemLabelGenerator(series, item);
    if (generator != null) {
        Font labelFont = getItemLabelFont(series, item);
        Paint paint = getItemLabelPaint(series, item);
        g2.setFont(labelFont);
        g2.setPaint(paint);
        String label = generator.generateLabel(dataset, series, item);

        // get the label position..
        ItemLabelPosition position;
        if (!negative) {
            position = getPositiveItemLabelPosition(series, item);
        }
        else {
            position = getNegativeItemLabelPosition(series, item);
        }

        // work out the label anchor point...
        Point2D anchorPoint = calculateLabelAnchorPoint(
                position.getItemLabelAnchor(), x, y, orientation);
        TextUtils.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
    }

}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:45,代码来源:AbstractXYItemRenderer.java

示例14: addLabelledPeakDataset

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
public synchronized void addLabelledPeakDataset(final XYDataset dataSet,
    final String label) {

// Add standard peak data set.
addPeakDataset(dataSet);

// Do we have a label?
if (label != null && label.length() > 0) {

    // Add peak label renderer and data set.
    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(
	    false, false);
    renderer.setDefaultItemLabelsVisible(labelsVisible == 2);
    renderer.setDefaultItemLabelPaint(LABEL_COLOR);
    addDataSetRenderer(dataSet, renderer);
    renderer.setDrawSeriesLineAsPath(true);
    renderer.setDefaultItemLabelGenerator(new XYItemLabelGenerator() {

	@Override
	public String generateLabel(final XYDataset xyDataSet,
		final int series, final int item) {

	    return ((PeakDataSet) xyDataSet).isPeak(item) ? label
		    : null;
	}
    });

    havePeakLabels = true;
}
   }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:31,代码来源:TICPlot.java

示例15: drawItemLabel

import org.jfree.chart.labels.XYItemLabelGenerator; //导入依赖的package包/类
/**
    * Draws an item label.
    * 
    * @param g2
    *            the graphics device.
    * @param orientation
    *            the orientation.
    * @param dataset
    *            the dataset.
    * @param series
    *            the series index (zero-based).
    * @param item
    *            the item index (zero-based).
    * @param x
    *            the x coordinate (in Java2D space).
    * @param y
    *            the y coordinate (in Java2D space).
    * @param negative
    *            indicates a negative value (which affects the item label
    *            position).
    */
   protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation,
    XYDataset dataset, int series, int item, double x, double y,
    boolean negative) {

XYItemLabelGenerator generator = getItemLabelGenerator(series, item);
Font labelFont = getItemLabelFont(series, item);
g2.setFont(labelFont);
String label = generator.generateLabel(dataset, series, item);

if ((label == null) || (label.length() == 0))
    return;

// get the label position..
ItemLabelPosition position = null;
if (!negative) {
    position = getPositiveItemLabelPosition(series, item);
} else {
    position = getNegativeItemLabelPosition(series, item);
}

// work out the label anchor point...
Point2D anchorPoint = calculateLabelAnchorPoint(
	position.getItemLabelAnchor(), x, y, orientation);

FontMetrics metrics = g2.getFontMetrics(labelFont);
int width = SwingUtilities.computeStringWidth(metrics, label) + 2;
int height = metrics.getHeight();

int X = (int) (anchorPoint.getX() - (width / 2));
int Y = (int) (anchorPoint.getY() - (height));

g2.setPaint(searchColor);
g2.fillRect(X, Y, width, height);

super.drawItemLabel(g2, orientation, dataset, series, item, x, y,
	negative);

   }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:60,代码来源:ScatterPlotRenderer.java


注:本文中的org.jfree.chart.labels.XYItemLabelGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。