本文整理汇总了Java中org.jfree.chart.renderer.category.BoxAndWhiskerRenderer类的典型用法代码示例。如果您正苦于以下问题:Java BoxAndWhiskerRenderer类的具体用法?Java BoxAndWhiskerRenderer怎么用?Java BoxAndWhiskerRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BoxAndWhiskerRenderer类属于org.jfree.chart.renderer.category包,在下文中一共展示了BoxAndWhiskerRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
BoxAndWhiskerRenderer r1 = new BoxAndWhiskerRenderer();
BoxAndWhiskerRenderer r2 = new BoxAndWhiskerRenderer();
assertEquals(r1, r2);
r1.setArtifactPaint(Color.yellow);
assertFalse(r1.equals(r2));
r2.setArtifactPaint(Color.yellow);
assertEquals(r1, r2);
r1.setFillBox(!r1.getFillBox());
assertFalse(r1.equals(r2));
r2.setFillBox(!r2.getFillBox());
assertEquals(r1, r2);
r1.setItemMargin(0.11);
assertFalse(r1.equals(r2));
r2.setItemMargin(0.11);
assertEquals(r1, r2);
}
示例2: testEquals
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
BoxAndWhiskerRenderer r1 = new BoxAndWhiskerRenderer();
BoxAndWhiskerRenderer r2 = new BoxAndWhiskerRenderer();
assertEquals(r1, r2);
r1.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
3.0f, 4.0f, Color.blue));
assertFalse(r1.equals(r2));
r2.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
3.0f, 4.0f, Color.blue));
assertEquals(r1, r2);
r1.setFillBox(!r1.getFillBox());
assertFalse(r1.equals(r2));
r2.setFillBox(!r2.getFillBox());
assertEquals(r1, r2);
r1.setItemMargin(0.11);
assertFalse(r1.equals(r2));
r2.setItemMargin(0.11);
assertEquals(r1, r2);
}
示例3: testDrawWithNullInfo
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Draws the chart with a <code>null</code> info object to make sure that
* no exceptions are thrown (particularly by code in the renderer).
*/
public void testDrawWithNullInfo() {
boolean success = false;
try {
DefaultBoxAndWhiskerCategoryDataset dataset
= new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
new Double(0.0), new Double(4.0), new Double(0.5),
new Double(4.5), new Double(-0.5), new Double(5.5),
null), "S1", "C1");
CategoryPlot plot = new CategoryPlot(dataset,
new CategoryAxis("Category"), new NumberAxis("Value"),
new BoxAndWhiskerRenderer());
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */ chart.createBufferedImage(300, 200,
null);
success = true;
}
catch (NullPointerException e) {
success = false;
}
assertTrue(success);
}
示例4: createBoxAndWhiskerChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a box and whisker chart
* based on data from a {@link BoxAndWhiskerCategoryDataset}.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel a label for the category axis
* (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A box and whisker chart.
*
* @since 1.0.4
*/
public static JFreeChart createBoxAndWhiskerChart(String title,
String categoryAxisLabel, String valueAxisLabel,
BoxAndWhiskerCategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot,
legend);
}
示例5: createBoxAndWhiskerChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a box and whisker chart
* based on data from a {@link BoxAndWhiskerCategoryDataset}.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel a label for the category axis
* (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A box and whisker chart.
*
* @since 1.0.4
*/
public static JFreeChart createBoxAndWhiskerChart(String title,
String categoryAxisLabel, String valueAxisLabel,
BoxAndWhiskerCategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例6: createBoxAndWhiskerChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a box and whisker chart
* based on data from a {@link BoxAndWhiskerCategoryDataset}.
*
* @param title the chart title ({@code null} permitted).
* @param categoryAxisLabel a label for the category axis
* ({@code null} permitted).
* @param valueAxisLabel a label for the value axis ({@code null}
* permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A box and whisker chart.
*
* @since 1.0.4
*/
public static JFreeChart createBoxAndWhiskerChart(String title,
String categoryAxisLabel, String valueAxisLabel,
BoxAndWhiskerCategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setDefaultToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例7: createChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return a chart.
*/
protected JFreeChart createChart(BoxAndWhiskerCategoryDataset dataset) {
// create the chart...
CategoryAxis domainAxis = new CategoryAxis(null);
NumberAxis rangeAxis = new NumberAxis("Value");
CategoryItemRenderer renderer = new BoxAndWhiskerRenderer();
CategoryPlot plot = new CategoryPlot(
dataset, domainAxis, rangeAxis, renderer
);
JFreeChart chart = new JFreeChart(chartTitle, plot);
chart.setBackgroundPaint(Color.white);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.white);
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
return chart;
}
示例8: createLegend
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
protected JFreeChart createLegend(BoxAndWhiskerCategoryDataset dataset) {
CategoryAxis domainAxis = new CategoryAxis(null);
NumberAxis rangeAxis = new NumberAxis("Value");
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
CategoryPlot plot = new CategoryPlot(
dataset, domainAxis, rangeAxis, renderer
);
JFreeChart chart = new JFreeChart(chartTitle, plot);
System.out.println(SERIES_COUNT + ","+CATEGORY_COUNT);
renderer.setLegendItemLabelGenerator(new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT));
return chart;
}
示例9: createDumyChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
public static JFreeChart createDumyChart()
{
final BoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
final CategoryAxis xAxis = new CategoryAxis( "Type" );
final NumberAxis yAxis = new NumberAxis( "Value" );
yAxis.setAutoRangeIncludesZero( false );
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox( true );
renderer.setMeanVisible( false );
renderer.setMedianVisible( false );
// renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
final CategoryPlot plot = new CategoryPlot( dataset, xAxis, yAxis, renderer );
return new JFreeChart( plot );
}
示例10: createWhiskerChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
public static JFreeChart createWhiskerChart( SuccessfulAttack sa )
{
BoxAndWhiskerCategoryDataset boxandwhiskercategorydataset = createDataset( sa );
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setMaximumBarWidth( 0.05 );
renderer.setMeanVisible( false );
renderer.setSeriesPaint( 0, Color.GREEN );
renderer.setSeriesPaint( 1, Color.RED );
renderer.setSeriesPaint( 2, Color.BLUE );
NumberAxis numberAxis = new NumberAxis( "duration in ms" );
CategoryPlot categoryplot =
new CategoryPlot( boxandwhiskercategorydataset, new CategoryAxis( "" ), numberAxis, renderer );
categoryplot.setDomainGridlinesVisible( true );
categoryplot.setRangePannable( true );
NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
JFreeChart jFreeChart = new JFreeChart( "", new Font( "SansSerif", Font.BOLD, 14 ), categoryplot, true );
jFreeChart.removeLegend();
return jFreeChart;
}
示例11: testDrawWithNullInfo
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Draws the chart with a <code>null</code> info object to make sure that
* no exceptions are thrown (particularly by code in the renderer).
*/
public void testDrawWithNullInfo() {
boolean success = false;
try {
DefaultBoxAndWhiskerCategoryDataset dataset
= new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
new Double(0.0), new Double(4.0), new Double(0.5),
new Double(4.5), new Double(-0.5), new Double(5.5),
null), "S1", "C1");
CategoryPlot plot = new CategoryPlot(dataset,
new CategoryAxis("Category"), new NumberAxis("Value"),
new BoxAndWhiskerRenderer());
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */ chart.createBufferedImage(300, 200,
null);
success = true;
}
catch (NullPointerException e) {
success = false;
}
assertTrue(success);
}
示例12: testGetLegendItem
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Some checks for the getLegendItem() method.
*/
public void testGetLegendItem() {
DefaultBoxAndWhiskerCategoryDataset dataset
= new DefaultBoxAndWhiskerCategoryDataset();
List values = new ArrayList();
values.add(new Double(1.10));
values.add(new Double(1.45));
values.add(new Double(1.33));
values.add(new Double(1.23));
dataset.add(values, "R1", "C1");
BoxAndWhiskerRenderer r = new BoxAndWhiskerRenderer();
CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"),
new NumberAxis("y"), r);
/*JFreeChart chart =*/ new JFreeChart(plot);
LegendItem li = r.getLegendItem(0, 0);
assertNotNull(li);
r.setSeriesVisibleInLegend(0, Boolean.FALSE);
li = r.getLegendItem(0, 0);
assertNull(li);
}
示例13: testGetLegendItemSeriesIndex
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
public void testGetLegendItemSeriesIndex() {
DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
dataset0.addValue(21.0, "R1", "C1");
dataset0.addValue(22.0, "R2", "C1");
DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
dataset1.addValue(23.0, "R3", "C1");
dataset1.addValue(24.0, "R4", "C1");
dataset1.addValue(25.0, "R5", "C1");
BoxAndWhiskerRenderer r = new BoxAndWhiskerRenderer();
CategoryPlot plot = new CategoryPlot(dataset0, new CategoryAxis("x"),
new NumberAxis("y"), r);
plot.setDataset(1, dataset1);
/*JFreeChart chart =*/ new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("R5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
示例14: testDrawWithNullMean
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Draws a chart where the dataset contains a null mean value.
*/
public void testDrawWithNullMean() {
boolean success = false;
try {
DefaultBoxAndWhiskerCategoryDataset dataset
= new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(null, new Double(2.0),
new Double(0.0), new Double(4.0), new Double(0.5),
new Double(4.5), new Double(-0.5), new Double(5.5),
null), "S1", "C1");
CategoryPlot plot = new CategoryPlot(dataset,
new CategoryAxis("Category"), new NumberAxis("Value"),
new BoxAndWhiskerRenderer());
ChartRenderingInfo info = new ChartRenderingInfo();
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */ chart.createBufferedImage(300, 200,
info);
success = true;
}
catch (Exception e) {
success = false;
e.printStackTrace();
}
assertTrue(success);
}
示例15: testDrawWithNullMedian
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入依赖的package包/类
/**
* Draws a chart where the dataset contains a null median value.
*/
public void testDrawWithNullMedian() {
boolean success = false;
try {
DefaultBoxAndWhiskerCategoryDataset dataset
= new DefaultBoxAndWhiskerCategoryDataset();
dataset.add(new BoxAndWhiskerItem(new Double(1.0), null,
new Double(0.0), new Double(4.0), new Double(0.5),
new Double(4.5), new Double(-0.5), new Double(5.5),
null), "S1", "C1");
CategoryPlot plot = new CategoryPlot(dataset,
new CategoryAxis("Category"), new NumberAxis("Value"),
new BoxAndWhiskerRenderer());
ChartRenderingInfo info = new ChartRenderingInfo();
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */ chart.createBufferedImage(300, 200,
info);
success = true;
}
catch (Exception e) {
success = false;
}
assertTrue(success);
}