當前位置: 首頁>>代碼示例>>Java>>正文


Java XYItemRenderer.setStroke方法代碼示例

本文整理匯總了Java中org.jfree.chart.renderer.xy.XYItemRenderer.setStroke方法的典型用法代碼示例。如果您正苦於以下問題:Java XYItemRenderer.setStroke方法的具體用法?Java XYItemRenderer.setStroke怎麽用?Java XYItemRenderer.setStroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.renderer.xy.XYItemRenderer的用法示例。


在下文中一共展示了XYItemRenderer.setStroke方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPlot

import org.jfree.chart.renderer.xy.XYItemRenderer; //導入方法依賴的package包/類
private XYPlot createPlot( XYSeriesCollection dataset ) {
    XYPlot plot = new XYPlot();

    ValueAxis domainAxis = new NumberAxis( "Time" );
    domainAxis.setTickLabelsVisible( false );
    domainAxis.setRange( 0, RANGE );
    plot.setDomainAxis( domainAxis );

    ValueAxis rangeAxis = new NumberAxis( "Population" );
    rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
    plot.setRangeAxis( rangeAxis );
    rangeAxis.setRange( 0, 50 );

    plot.setRenderer( new StandardXYItemRenderer() );

    final int seriesIndex = 0;
    plot.setDataset( seriesIndex, dataset );
    XYItemRenderer renderer = new StandardXYItemRenderer(); // TODO: maybe use XYLineAndShapeRenderer?
    renderer.setStroke( new BasicStroke( 2f ) );
    renderer.setSeriesPaint( TOTAL_INDEX, Color.BLACK );
    renderer.setSeriesPaint( FUR_WHITE_INDEX, Color.RED );
    plot.setRenderer( seriesIndex, renderer );

    return plot;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:26,代碼來源:TestCanvas.java

示例2: createXYLineChart

import org.jfree.chart.renderer.xy.XYItemRenderer; //導入方法依賴的package包/類
/**
 * Create the JFreeChart chart that will show the data and that will be
 * contained by this node.
 *
 * @param title
 * @param xAxisLabel
 * @param yAxisLabel
 * @param dataSet
 * @param orientation
 * @return
 */
private static JFreeChart createXYLineChart( String title, String xAxisLabel, String yAxisLabel,
                                             XYDataset dataSet, PlotOrientation orientation ) {

    if ( orientation == null ) {
        throw new IllegalArgumentException( "Null 'orientation' argument." );
    }

    JFreeChart chart = ChartFactory.createXYLineChart(
            title,
            xAxisLabel,
            yAxisLabel,
            dataSet,
            PlotOrientation.VERTICAL,
            false, // legend
            false, // tooltips
            false // urls
    );

    // Set the stroke for the data line to be larger than the default.
    XYPlot plot = chart.getXYPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setStroke( new BasicStroke( 2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL ) );

    return chart;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:37,代碼來源:ProteinLevelChartNode.java

示例3: createXYLineChart

import org.jfree.chart.renderer.xy.XYItemRenderer; //導入方法依賴的package包/類
/**
 * Create the JFreeChart chart that will show the data and that will be
 * contained by this node.
 *
 * @param title
 * @param xAxisLabel
 * @param yAxisLabel
 * @param dataset
 * @param orientation
 * @return
 */
private static JFreeChart createXYLineChart( String title, String xAxisLabel, String yAxisLabel,
                                             XYDataset dataset, PlotOrientation orientation ) {

    if ( orientation == null ) {
        throw new IllegalArgumentException( "Null 'orientation' argument." );
    }

    JFreeChart chart = ChartFactory.createXYLineChart(
            title,
            xAxisLabel,
            yAxisLabel,
            dataset,
            PlotOrientation.VERTICAL,
            false, // legend
            false, // tooltips
            false // urls
    );

    // Set the stroke for the data line to be larger than the default.
    XYPlot plot = chart.getXYPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setStroke( new BasicStroke( 3f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL ) );

    return chart;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:37,代碼來源:MembranePotentialChart.java

示例4: createPlot

import org.jfree.chart.renderer.xy.XYItemRenderer; //導入方法依賴的package包/類
private XYPlot createPlot( XYSeriesCollection dataset ) {
    XYPlot plot = new XYPlot();

    ValueAxis domainAxis = new NumberAxis( NaturalSelectionStrings.STATS_TIME );
    domainAxis.setTickLabelsVisible( false );
    domainAxis.setRange( 0, RANGE );
    plot.setDomainAxis( domainAxis );

    ValueAxis rangeAxis = new NumberAxis( NaturalSelectionStrings.STATS_POPULATION );
    rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
    plot.setRangeAxis( rangeAxis );
    rangeAxis.setRange( 0, 50 );

    plot.setRenderer( new StandardXYItemRenderer() );

    final int seriesIndex = 0;
    plot.setDataset( seriesIndex, dataset );
    XYItemRenderer renderer = new StandardXYItemRenderer();
    renderer.setStroke( new BasicStroke( 3f ) );
    if ( NaturalSelectionApplication.isHighContrast() ) {
        domainAxis.setAxisLinePaint( Color.WHITE );
        domainAxis.setLabelPaint( Color.WHITE );
        domainAxis.setTickLabelPaint( Color.WHITE );
        domainAxis.setTickMarkPaint( Color.WHITE );

        rangeAxis.setAxisLinePaint( Color.WHITE );
        rangeAxis.setLabelPaint( Color.WHITE );
        rangeAxis.setTickLabelPaint( Color.WHITE );
        rangeAxis.setTickMarkPaint( Color.WHITE );

        renderer.setSeriesPaint( TOTAL_INDEX, Color.WHITE );
        renderer.setSeriesPaint( FUR_WHITE_INDEX, Color.RED );
        renderer.setSeriesPaint( FUR_BROWN_INDEX, Color.CYAN );
        renderer.setSeriesPaint( TAIL_SHORT_INDEX, Color.BLUE );
        renderer.setSeriesPaint( TAIL_LONG_INDEX, Color.ORANGE );
        renderer.setSeriesPaint( TEETH_SHORT_INDEX, Color.YELLOW );
        renderer.setSeriesPaint( TEETH_LONG_INDEX, Color.MAGENTA );

        plot.setBackgroundPaint( Color.BLACK );
        plot.setDomainGridlinePaint( Color.WHITE );
        plot.setRangeGridlinePaint( Color.WHITE );
        plot.setDomainZeroBaselinePaint( Color.WHITE );
        plot.setOutlinePaint( Color.WHITE );
        plot.setRangeTickBandPaint( new Color( 32, 32, 32 ) );
        plot.setRangeZeroBaselinePaint( Color.WHITE );
    }
    else {
        // TODO: (low) consolidate colors somewhere for data? maybe they should be changable easily?
        renderer.setSeriesPaint( TOTAL_INDEX, Color.BLACK );
        renderer.setSeriesPaint( FUR_WHITE_INDEX, Color.RED );
        renderer.setSeriesPaint( FUR_BROWN_INDEX, Color.CYAN );
        renderer.setSeriesPaint( TAIL_SHORT_INDEX, Color.BLUE );
        renderer.setSeriesPaint( TAIL_LONG_INDEX, Color.ORANGE );
        renderer.setSeriesPaint( TEETH_SHORT_INDEX, Color.YELLOW.darker() );
        renderer.setSeriesPaint( TEETH_LONG_INDEX, Color.MAGENTA );
    }
    plot.setRenderer( seriesIndex, renderer );

    return plot;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:61,代碼來源:BunnyStatsCanvas.java


注:本文中的org.jfree.chart.renderer.xy.XYItemRenderer.setStroke方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。