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


Java Marker.setLabelFont方法代码示例

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


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

示例1: updateValuesBarChart

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
/**
 * Update values of a bar chart
 * 
 * @param labelsByFreq Labels ordered by frequency
 * @param nInstances Number of instances
 * @param cp CategoryPlot
 */
public static void updateValuesBarChart(ImbalancedFeature[] labelsByFreq, 
        int nInstances, CategoryPlot cp)
{
    DefaultCategoryDataset data = new DefaultCategoryDataset();
    
    double prob;
        
    labelsByFreq = MetricUtils.sortByFrequency(labelsByFreq);
    
    double sum = 0.0;
    for(int i=0; i<labelsByFreq.length;i++)
    {
        prob = labelsByFreq[i].getAppearances()*1.0/nInstances;
        sum += prob;
        
        data.setValue(prob, labelsByFreq[i].getName()," ");
    }
      
    cp.setDataset(data);
        
    // add mean mark
    sum = sum/labelsByFreq.length;
    Marker start = new ValueMarker(sum);
    start.setPaint(Color.red);
    start.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
    start.setLabel("                        Mean: "+MetricUtils.truncateValue(sum, 3));
    cp.addRangeMarker(start);
}
 
开发者ID:i02momuj,项目名称:MLDA,代码行数:36,代码来源:ChartUtils.java

示例2: updateIRBarChart

import org.jfree.chart.plot.Marker; //导入方法依赖的package包/类
/**
 * Update IR bar chart
 * 
 * @param labelsByFrequency Labels ordered by frequency
 * @param IR Imbalance Ratio values
 * @param cp CategoryPlot
 */
public static void updateIRBarChart(ImbalancedFeature[] labelsByFrequency, 
        double[] IR, CategoryPlot cp)
{
    DefaultCategoryDataset myData = new DefaultCategoryDataset();
  
    double prob = 0;
        
    labelsByFrequency = MetricUtils.sortByFrequency(labelsByFrequency);
        
    double sum = 0.0;
    for(int i=labelsByFrequency.length-1; i>=0; i--)
    {
        prob= IR[i];
        sum += prob;
        myData.setValue(prob, labelsByFrequency[i].getName()," ");
    }
      
    cp.setDataset(myData);
        
    // add mean mark
    sum = sum/labelsByFrequency.length;
    Marker meanMark = new ValueMarker(sum);
    meanMark.setPaint(Color.red);
    meanMark.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
    meanMark.setLabel("                        Mean: "+MetricUtils.truncateValue(sum, 3));
    cp.addRangeMarker(meanMark);
        
    //Add Imbalance limit mark
    Marker limitMark = new ValueMarker(1.5);
    limitMark.setPaint(Color.black);
    limitMark.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
        
    if((sum < 1.3) || (sum > 1.7)){
        limitMark.setLabel("                                                Imbalance limit (IR=1.5)");
    }            
    cp.addRangeMarker(limitMark);
}
 
开发者ID:i02momuj,项目名称:MLDA,代码行数:45,代码来源:ChartUtils.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例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.setLabelFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。