本文整理匯總了Java中org.jfree.chart.renderer.xy.StandardXYItemRenderer類的典型用法代碼示例。如果您正苦於以下問題:Java StandardXYItemRenderer類的具體用法?Java StandardXYItemRenderer怎麽用?Java StandardXYItemRenderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StandardXYItemRenderer類屬於org.jfree.chart.renderer.xy包,在下文中一共展示了StandardXYItemRenderer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createPlot
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的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: testEquals
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
StandardXYItemRenderer r1 = new StandardXYItemRenderer();
StandardXYItemRenderer r2 = new StandardXYItemRenderer();
assertEquals(r1, r2);
r1.setPlotShapes(true);
assertFalse(r1.equals(r2));
r2.setPlotShapes(true);
assertTrue(r1.equals(r2));
r1.setShapesFilled(false);
assertFalse(r1.equals(r2));
r2.setShapesFilled(false);
assertTrue(r1.equals(r2));
}
示例3: testCloning2
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* Tests cloning for a more complex plot.
*/
@Test
public void testCloning2() throws CloneNotSupportedException {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
new NumberAxis("Range Axis"), new StandardXYItemRenderer());
p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
new Integer(1)});
p1.mapDatasetToDomainAxes(0, axisIndices);
p1.mapDatasetToRangeAxes(0, axisIndices);
p1.setRenderer(1, new XYBarRenderer());
XYPlot p2 = (XYPlot) p1.clone();
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
}
示例4: testCloning3
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* Tests cloning for a plot where the fixed legend items have been
* specified.
*/
@Test
public void testCloning3() throws CloneNotSupportedException {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
new NumberAxis("Range Axis"), new StandardXYItemRenderer());
LegendItemCollection c1 = new LegendItemCollection();
p1.setFixedLegendItems(c1);
XYPlot p2 = (XYPlot) p1.clone();
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
// verify independence of fixed legend item collection
c1.add(new LegendItem("X"));
assertFalse(p1.equals(p2));
}
示例5: TPPlot
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
public TPPlot() {
super();
// axes
setDomainAxis( new TPDomainAxis() );
setRangeAxis( new TPRangeAxis() );
// series
series = new XYSeries( "real", true /* autoSort */);
// dataset
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries( series );
setDataset( dataset );
// renderer
StandardXYItemRenderer renderer = new StandardXYItemRenderer();
renderer.setDrawSeriesLineAsPath( true );
setRenderer( renderer );
}
示例6: initComponents
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
protected void initComponents() {
setLayout(new BorderLayout());
// create chart
theDataset = new DefaultXYDataset();
theIsotopesDataset = new DefaultXYDataset();
theChart = org.jfree.chart.ChartFactory.createScatterPlot("PeakList", "m/z ratio", "Intensity", new XYBarDataset(theDataset,0.001), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new XYBarRenderer());
thePlot.setDataset(1, theIsotopesDataset);
thePlot.setRenderer(1,new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
theChartPanel = new ChartPanel(theChart);
theChartPanel.setDomainZoomable(false);
theChartPanel.setRangeZoomable(false);
theChartPanel.setPopupMenu(null);
add(theChartPanel,BorderLayout.CENTER);
// create toolbar
theToolBar = createToolBar();
add(theToolBar,BorderLayout.SOUTH);
}
示例7: initComponents
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
protected void initComponents() {
setLayout(new BorderLayout());
// create chart
theDataset = new DefaultXYDataset();
theChart = org.jfree.chart.ChartFactory.createScatterPlot("Annotation", "Count", "Intensity", theDataset, org.jfree.chart.plot.PlotOrientation.VERTICAL, true, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
theChartPanel = new ChartPanel(theChart);
theChartPanel.setDomainZoomable(true);
theChartPanel.setRangeZoomable(false);
//theChartPanel.setPopupMenu(null);
add(theChartPanel,BorderLayout.CENTER);
// create toolbar
theToolBar = createToolBar();
add(theToolBar,BorderLayout.SOUTH);
}
示例8: createOverlaidChart
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
public static JFreeChart createOverlaidChart( SuccessfulAttack sa )
{
// create subplot 1...
final XYSeries data1 = createDatasetResponseTime( RequestType.UNTAMPERED, sa.getUntamperedMetrics() );
final XYSeries data2 = createDatasetResponseTime( RequestType.TAMPERED, sa.getTamperedMetrics() );
final XYSeries data3 = createDatasetResponseTime( RequestType.TESTPROBES, sa.getTestProbes() );
final XYSeriesCollection collection = new XYSeriesCollection();
collection.addSeries( data1 );
collection.addSeries( data2 );
collection.addSeries( data3 );
final XYItemRenderer renderer = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis( "duration in ms" );
final XYPlot plot = new XYPlot( collection, new NumberAxis( "" ), rangeAxis1, renderer );
plot.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
renderer.setSeriesPaint( 0, Color.GREEN );
renderer.setSeriesPaint( 1, Color.RED );
renderer.setSeriesPaint( 2, Color.BLUE );
// return a new chart containing the overlaid plot...
return new JFreeChart( "", JFreeChart.DEFAULT_TITLE_FONT, plot, true );
}
示例9: testCloning2
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* Tests cloning for a more complex plot.
*/
public void testCloning2() {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
new NumberAxis("Range Axis"), new StandardXYItemRenderer());
p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
p1.setRenderer(1, new XYBarRenderer());
XYPlot p2 = null;
try {
p2 = (XYPlot) p1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
}
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
}
示例10: testNoDisplayedItem
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* A check to ensure that an item that falls outside the plot's data area
* does NOT generate an item entity.
*/
public void testNoDisplayedItem() {
XYSeriesCollection dataset = new XYSeriesCollection();
XYSeries s1 = new XYSeries("S1");
s1.add(10.0, 10.0);
dataset.addSeries(s1);
JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
dataset, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(new StandardXYItemRenderer());
NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
xAxis.setRange(0.0, 5.0);
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setRange(0.0, 5.0);
BufferedImage image = new BufferedImage(200 , 100,
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
ChartRenderingInfo info = new ChartRenderingInfo();
chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, info);
g2.dispose();
EntityCollection ec = info.getEntityCollection();
assertFalse(TestUtilities.containsInstanceOf(ec.getEntities(),
XYItemEntity.class));
}
示例11: testCloning2
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* Tests cloning for a more complex plot.
*/
public void testCloning2() {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
new NumberAxis("Range Axis"), new StandardXYItemRenderer());
p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
new Integer(1)});
p1.mapDatasetToDomainAxes(0, axisIndices);
p1.mapDatasetToRangeAxes(0, axisIndices);
p1.setRenderer(1, new XYBarRenderer());
XYPlot p2 = null;
try {
p2 = (XYPlot) p1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
}
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
}
示例12: testCloning3
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* Tests cloning for a plot where the fixed legend items have been
* specified.
*/
public void testCloning3() {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
new NumberAxis("Range Axis"), new StandardXYItemRenderer());
LegendItemCollection c1 = new LegendItemCollection();
p1.setFixedLegendItems(c1);
XYPlot p2 = null;
try {
p2 = (XYPlot) p1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
}
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
// verify independence of fixed legend item collection
c1.add(new LegendItem("X"));
assertFalse(p1.equals(p2));
}
示例13: createGradientConfig
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
private static DatasetConfig createGradientConfig() {
DatasetConfig config = new DatasetConfigDelegate(
new DefaultDatasetConfig.Builder(2)
.description(
i18n.getText("com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.gradient")) //$NON-NLS-1$
.yFunc(createGradientFunction(DistanceUnit.METERS))
.renderer(
rendererColor(new StandardXYItemRenderer(),
Color.RED)).build()) {
@Override
public NumberAxis createNumberAxis(Track track) {
NumberAxis axis = super.createNumberAxis(track);
axis.setAutoRange(true);
return axis;
}
};
return new MovingAverageConfigDecorator(config,
"", MOVING_AVG_VALUE, MOVING_AVG_SKIP); //$NON-NLS-1$
}
示例14: WaterTemperatureDemo
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
/**
* A demonstration application showing an XY series containing a null value.
*
* @param title the frame title.
*/
public WaterTemperatureDemo(final String title) {
super(title);
final XYDataset dataset = createDataset();
final NumberAxis rangeAxis = new NumberAxis("Temperature");
rangeAxis.setRange(-0.55, -0.15);
final NumberAxis domainAxis = new NumberAxis("Depth");
domainAxis.setInverted(true);
domainAxis.setRange(0.0, 35.0);
domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
final XYItemRenderer renderer = new StandardXYItemRenderer();
final XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
final JFreeChart chart = new JFreeChart("Water Temperature By Depth", plot);
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
setContentPane(chartPanel);
}
示例15: init
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; //導入依賴的package包/類
protected void init()
{
seriesColors = new Color[SERIES_COLORS.length];
System.arraycopy(SERIES_COLORS, 0, seriesColors, 0, SERIES_COLORS.length);
dataset = new XYSeriesCollection();
renderer = new StandardXYItemRenderer();
renderer.setPlotLines(false);
renderer.setBaseShapesVisible(true);
renderer.setShapesFilled(true);
//set all possible series to the default shape
for (int i=0; i<10; i++)
renderer.setSeriesShape(i, defaultShape);
XYPlot scatterPlot = new XYPlot(dataset, xAxis, yAxis, renderer);
init(scatterPlot);
}