本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}