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


Java Marker.setLabelOffset方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.Marker.setLabelOffset方法的典型用法代码示例。如果您正苦于以下问题:Java Marker.setLabelOffset方法的具体用法?Java Marker.setLabelOffset怎么用?Java Marker.setLabelOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.Marker的用法示例。


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

示例1: getMarker

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
/**
 * Returns a horizontal line marker for the given x value and label.
 */
private Marker getMarker( Double value, String label )
{
    Marker marker = new ValueMarker( value );
    marker.setPaint( Color.BLACK );
    marker.setStroke( new BasicStroke( 1.1f ) );
    marker.setLabel( label );
    marker.setLabelOffset( new RectangleInsets( -10, 50, 0, 0 ) );
    marker.setLabelFont( SUB_TITLE_FONT );

    return marker;
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:15,代码来源:DefaultChartService.java

示例2: createMarker

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
/** Factory method that creates the marker for the annotation */
public void createMarker(XYPlot plot) {
	Marker marker = doCreateMarker();
	marker.setLabel(getMnemonic());
	marker.setLabelOffset(new RectangleInsets(PAD, PAD, PAD, PAD));
	plot.addDomainMarker(marker, Layer.BACKGROUND);
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:8,代码来源:EventAnnotationBase.java

示例3: addDomainMarker

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
public void addDomainMarker(Amount<X> x, String label, Color c){
	double xVal = x.doubleValue(xUnit);
	Marker marker = new ValueMarker(xVal);
	marker.setStroke(dashed);
	marker.setPaint(c);
	marker.setLabelPaint(c);
	marker.setLabelFont(labelFont);
	marker.setLabel(label + ": " + RocketScience.ammountToRoundedString(x));
	marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
	marker.setLabelOffset(new RectangleInsets(0, -5, 0, 0));
	chart.getXYPlot().addDomainMarker(marker);
}
 
开发者ID:bkuker,项目名称:motorsim,代码行数:13,代码来源:Chart.java

示例4: addRangeMarker

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
public void addRangeMarker(Amount<Y> y, String label, Color c){
	double yVal = y.doubleValue(yUnit);
	Marker marker = new ValueMarker(yVal);
	marker.setStroke(dashed);
	marker.setPaint(c);
	marker.setLabelPaint(c);
	marker.setLabelFont(labelFont);
	marker.setLabel(label + ": " + RocketScience.ammountToRoundedString(y));
	marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
	marker.setLabelOffset(new RectangleInsets(0, 5, 0, 0));
	chart.getXYPlot().addRangeMarker(marker);
}
 
开发者ID:bkuker,项目名称:motorsim,代码行数:13,代码来源:Chart.java

示例5: testEquals

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    Marker m1 = new ValueMarker(45.0);
    Marker m2 = new ValueMarker(45.0);
    assertTrue(m1.equals(m2));
    assertTrue(m2.equals(m1));
    
    m1.setPaint(Color.red);
    assertFalse(m1.equals(m2));
    m2.setPaint(Color.red);
    assertTrue(m1.equals(m2));
    
    BasicStroke stroke = new BasicStroke(2.2f);
    m1.setStroke(stroke);
    assertFalse(m1.equals(m2));
    m2.setStroke(stroke);
    assertTrue(m1.equals(m2));
    
    m1.setOutlinePaint(Color.red);
    assertFalse(m1.equals(m2));
    m2.setOutlinePaint(Color.red);
    assertTrue(m1.equals(m2));
    
    m1.setOutlineStroke(stroke);
    assertFalse(m1.equals(m2));
    m2.setOutlineStroke(stroke);
    assertTrue(m1.equals(m2));

    m1.setAlpha(0.1f);
    assertFalse(m1.equals(m2));
    m2.setAlpha(0.1f);
    assertTrue(m1.equals(m2));
    
    m1.setLabel("New Label");
    assertFalse(m1.equals(m2));
    m2.setLabel("New Label");
    assertTrue(m1.equals(m2));
    
    m1.setLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    assertFalse(m1.equals(m2));
    m2.setLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    assertTrue(m1.equals(m2));

    m1.setLabelPaint(Color.red);
    assertFalse(m1.equals(m2));
    m2.setLabelPaint(Color.red);
    assertTrue(m1.equals(m2));

    m1.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    assertFalse(m1.equals(m2));
    m2.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    assertTrue(m1.equals(m2));
    
    m1.setLabelTextAnchor(TextAnchor.BASELINE_RIGHT);
    assertFalse(m1.equals(m2));
    m2.setLabelTextAnchor(TextAnchor.BASELINE_RIGHT);
    assertTrue(m1.equals(m2));
    
    m1.setLabelOffset(new RectangleInsets(UnitType.ABSOLUTE, 10.0, 10.0, 10.0, 10.0));
    assertFalse(m1.equals(m2));
    m2.setLabelOffset(new RectangleInsets(UnitType.ABSOLUTE, 10.0, 10.0, 10.0, 10.0));
    assertTrue(m1.equals(m2));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:67,代码来源:ValueMarkerTests.java

示例6: configureMarker

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
protected void configureMarker(Marker marker)
{
	String label = getProperty(PROPERTY_LABEL);
	if (label != null && label.length() > 0)
	{
		marker.setLabel(label);
	}

	RectangleAnchorEnum labelAnchor = RectangleAnchorEnum.getByName(getProperty(PROPERTY_LABEL_ANCHOR));
	if (labelAnchor != null)
	{
		marker.setLabelAnchor(labelAnchor.getRectangleAnchor());
	}

	Double offsetTop = getDoubleProperty(PROPERTY_LABEL_OFFSET_TOP);
	Double offsetLeft = getDoubleProperty(PROPERTY_LABEL_OFFSET_LEFT);
	Double offsetBottom = getDoubleProperty(PROPERTY_LABEL_OFFSET_BOTTOM);
	Double offsetRight = getDoubleProperty(PROPERTY_LABEL_OFFSET_RIGHT);
	if (
		offsetTop != null
		|| offsetLeft != null
		|| offsetBottom != null
		|| offsetRight != null
		)
	{
		RectangleInsets currentOffset = marker.getLabelOffset();
		marker.setLabelOffset(
			new RectangleInsets(
				offsetTop == null ? currentOffset.getTop() : offsetTop, 
				offsetLeft == null ? currentOffset.getLeft() : offsetLeft, 
				offsetBottom == null ? currentOffset.getBottom() : offsetBottom, 
				offsetRight == null ? currentOffset.getRight() : offsetRight
				)
			);
	}

	TextAnchorEnum labelTextAnchor = TextAnchorEnum.getByName(getProperty(PROPERTY_LABEL_TEXT_ANCHOR));
	if (labelTextAnchor != null) 
	{
		marker.setLabelTextAnchor(labelTextAnchor.getTextAnchor());
	}

	Color color = JRColorUtil.getColor(getProperty(PROPERTY_COLOR), null);
	if (color != null)
	{
		marker.setPaint(color);
	}

	Float alpha = getFloatProperty(PROPERTY_ALPHA);
	if (alpha != null)
	{
		marker.setAlpha(alpha);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:55,代码来源:AbstractMarkerCustomizer.java

示例7: decorate

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
@Override
protected void decorate(final NumberAnalyzerResult result, final DCTable table,
        final DisplayChartCallback displayChartCallback) {
    // find the std. deviation row number.
    int rowNumber = -1;
    {
        for (int i = 0; i < table.getRowCount(); i++) {
            final Object value = table.getValueAt(i, 0);
            if (NumberAnalyzer.MEASURE_STANDARD_DEVIATION.equals(value)) {
                rowNumber = i;
                break;
            }
        }
        if (rowNumber == -1) {
            throw new IllegalStateException("Could not determine Std. deviation row number!");
        }
    }

    final Crosstab<?> crosstab = result.getCrosstab();

    final InputColumn<? extends Number>[] columns = result.getColumns();
    int columnNumber = 1;
    for (final InputColumn<? extends Number> column : columns) {
        final CrosstabNavigator<?> nav = crosstab.where(NumberAnalyzer.DIMENSION_COLUMN, column.getName());

        final Number numRows =
                (Number) nav.where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_ROW_COUNT).get();
        if (numRows.intValue() > 0) {
            final Number standardDeviation =
                    (Number) nav.where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_STANDARD_DEVIATION)
                            .get();
            if (standardDeviation != null) {

                final ActionListener action = e -> {
                    final Number mean =
                            (Number) nav.where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_MEAN).get();
                    final Number min = (Number) nav
                            .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_LOWEST_VALUE).get();
                    final Number max = (Number) nav
                            .where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_HIGHEST_VALUE).get();

                    final NormalDistributionFunction2D normalDistributionFunction =
                            new NormalDistributionFunction2D(mean.doubleValue(), standardDeviation.doubleValue());
                    final XYDataset dataset = DatasetUtilities
                            .sampleFunction2D(normalDistributionFunction, min.doubleValue(), max.doubleValue(), 100,
                                    "Normal");

                    final JFreeChart chart = ChartFactory
                            .createXYLineChart("Normal distribution of " + column.getName(), column.getName(), "",
                                    dataset, PlotOrientation.VERTICAL, false, true, false);
                    ChartUtils.applyStyles(chart);
                    final Marker meanMarker = new ValueMarker(mean.doubleValue(), WidgetUtils.BG_COLOR_BLUE_DARK,
                            new BasicStroke(2f));
                    meanMarker.setLabel("Mean");
                    meanMarker.setLabelOffset(new RectangleInsets(70d, 25d, 0d, 0d));
                    meanMarker.setLabelFont(WidgetUtils.FONT_SMALL);
                    chart.getXYPlot().addDomainMarker(meanMarker);

                    final ChartPanel chartPanel = ChartUtils.createPanel(chart, true);
                    displayChartCallback.displayChart(chartPanel);
                };

                final DCPanel panel = AbstractCrosstabResultSwingRenderer
                        .createActionableValuePanel(standardDeviation, Alignment.RIGHT, action,
                                IconUtils.CHART_LINE);
                table.setValueAt(panel, rowNumber, columnNumber);
            }
        }

        columnNumber++;
    }

    super.decorate(result, table, displayChartCallback);
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:75,代码来源:NumberAnalyzerResultSwingRenderer.java


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