本文整理汇总了Java中org.jfree.chart.renderer.xy.DefaultXYItemRenderer类的典型用法代码示例。如果您正苦于以下问题:Java DefaultXYItemRenderer类的具体用法?Java DefaultXYItemRenderer怎么用?Java DefaultXYItemRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultXYItemRenderer类属于org.jfree.chart.renderer.xy包,在下文中一共展示了DefaultXYItemRenderer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDatasetIndices
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
/**
* Datasets are now stored in a Map, and it should be possible to assign
* them an arbitrary key (index).
*/
@Test
public void testDatasetIndices() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
assertEquals(dataset, plot.getDataset(0));
XYSeriesCollection dataset2 = new XYSeriesCollection();
dataset2.addSeries(new XYSeries("Series in dataset 2"));
// we should be able to give a dataset an arbitrary index
plot.setDataset(99, dataset2);
assertEquals(2, plot.getDatasetCount());
assertEquals(dataset2, plot.getDataset(99));
assertEquals(0, plot.indexOf(dataset));
assertEquals(99, plot.indexOf(dataset2));
}
示例2: testAxisIndices
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testAxisIndices() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
assertEquals(xAxis, plot.getDomainAxis(0));
assertEquals(yAxis, plot.getRangeAxis(0));
NumberAxis xAxis2 = new NumberAxis("X2");
plot.setDomainAxis(99, xAxis2);
assertEquals(xAxis2, plot.getDomainAxis(99));
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setRangeAxis(99, yAxis2);
assertEquals(yAxis2, plot.getRangeAxis(99));
}
示例3: testAxisLocationIndices
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testAxisLocationIndices() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
NumberAxis xAxis2 = new NumberAxis("X2");
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setDomainAxis(99, xAxis2);
plot.setRangeAxis(99, yAxis2);
plot.setDomainAxisLocation(99, AxisLocation.BOTTOM_OR_RIGHT);
assertEquals(AxisLocation.BOTTOM_OR_RIGHT,
plot.getDomainAxisLocation(99));
plot.setRangeAxisLocation(99, AxisLocation.BOTTOM_OR_LEFT);
assertEquals(AxisLocation.BOTTOM_OR_LEFT,
plot.getRangeAxisLocation(99));
}
示例4: testRendererIndices
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testRendererIndices() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
assertEquals(renderer, plot.getRenderer(0));
// we should be able to give a renderer an arbitrary index
XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
plot.setRenderer(20, renderer2);
assertEquals(2, plot.getRendererCount());
assertEquals(renderer2, plot.getRenderer(20));
assertEquals(20, plot.getIndexOf(renderer2));
}
示例5: testGetRendererForDataset2
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testGetRendererForDataset2() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
// add a second dataset
XYSeriesCollection dataset2 = new XYSeriesCollection();
dataset2.addSeries(new XYSeries("Series in dataset 2"));
plot.setDataset(99, dataset2);
// by default, the renderer with index 0 is used
assertEquals(renderer, plot.getRendererForDataset(dataset2));
// add a second renderer with the same index as dataset2, now it will
// be used
XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
plot.setRenderer(99, renderer);
assertEquals(renderer2, plot.getRendererForDataset(dataset2));
}
示例6: testMapDatasetToDomainAxis
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testMapDatasetToDomainAxis() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
NumberAxis xAxis2 = new NumberAxis("X2");
plot.setDomainAxis(11, xAxis2);
// add a second dataset
XYSeriesCollection dataset2 = new XYSeriesCollection();
dataset2.addSeries(new XYSeries("Series in dataset 2"));
plot.setDataset(99, dataset);
assertEquals(xAxis, plot.getDomainAxisForDataset(99));
// now map the dataset to the second xAxis
plot.mapDatasetToDomainAxis(99, 11);
assertEquals(xAxis2, plot.getDomainAxisForDataset(99));
}
示例7: testMapDatasetToRangeAxis
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testMapDatasetToRangeAxis() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setRangeAxis(22, yAxis2);
// add a second dataset
XYSeriesCollection dataset2 = new XYSeriesCollection();
dataset2.addSeries(new XYSeries("Series in dataset 2"));
plot.setDataset(99, dataset);
assertEquals(yAxis, plot.getRangeAxisForDataset(99));
// now map the dataset to the second xAxis
plot.mapDatasetToRangeAxis(99, 22);
assertEquals(yAxis2, plot.getRangeAxisForDataset(99));
}
示例8: testDomainMarkerIndices
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testDomainMarkerIndices() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
// add a second dataset, plotted against a second x axis
XYSeriesCollection dataset2 = new XYSeriesCollection();
dataset2.addSeries(new XYSeries("Series in dataset 2"));
plot.setDataset(99, dataset);
NumberAxis xAxis2 = new NumberAxis("X2");
plot.setDomainAxis(1, xAxis2);
XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
plot.setRenderer(99, renderer2);
plot.mapDatasetToDomainAxis(99, 1);
ValueMarker xMarker1 = new ValueMarker(123);
plot.addDomainMarker(99, xMarker1, Layer.FOREGROUND);
assertTrue(plot.getDomainMarkers(99, Layer.FOREGROUND).contains(
xMarker1));
}
示例9: testRangeMarkerIndices
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
@Test
public void testRangeMarkerIndices() {
XYDataset dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
// add a second dataset, plotted against a second axis
XYSeriesCollection dataset2 = new XYSeriesCollection();
dataset2.addSeries(new XYSeries("Series in dataset 2"));
plot.setDataset(99, dataset);
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setRangeAxis(1, yAxis2);
XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
plot.setRenderer(99, renderer2);
plot.mapDatasetToRangeAxis(99, 1);
ValueMarker yMarker1 = new ValueMarker(123);
plot.addRangeMarker(99, yMarker1, Layer.FOREGROUND);
assertTrue(plot.getRangeMarkers(99, Layer.FOREGROUND).contains(yMarker1));
}
示例10: testGetDataRange
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; //导入依赖的package包/类
/**
* Some tests for the getDataRange() method.
*/
@Test
public void testGetDataRange() {
XYSeriesCollection dataset = new XYSeriesCollection();
NumberAxis xAxis = new NumberAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
XYItemRenderer renderer = new DefaultXYItemRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
assertEquals(null, plot.getDataRange(xAxis));
assertEquals(null, plot.getDataRange(yAxis));
XYSeries s1 = new XYSeries("S1");
s1.add(1.0, 2.0);
dataset.addSeries(s1);
assertEquals(new Range(1.0, 1.0), plot.getDataRange(xAxis));
assertEquals(new Range(2.0, 2.0), plot.getDataRange(yAxis));
s1.add(5.0, null);
assertEquals(new Range(1.0, 5.0), plot.getDataRange(xAxis));
assertEquals(new Range(2.0, 2.0), plot.getDataRange(yAxis));
s1.add(6.0, Double.NaN);
assertEquals(new Range(1.0, 6.0), plot.getDataRange(xAxis));
assertEquals(new Range(2.0, 2.0), plot.getDataRange(yAxis));
}