本文整理汇总了Java中org.jfree.chart.renderer.category.BoxAndWhiskerRenderer.setFillBox方法的典型用法代码示例。如果您正苦于以下问题:Java BoxAndWhiskerRenderer.setFillBox方法的具体用法?Java BoxAndWhiskerRenderer.setFillBox怎么用?Java BoxAndWhiskerRenderer.setFillBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.category.BoxAndWhiskerRenderer
的用法示例。
在下文中一共展示了BoxAndWhiskerRenderer.setFillBox方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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 );
}
示例4: boxWhiskerPlot
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
/**
* Plots Data for Chart
*/
private void boxWhiskerPlot() {
BoxAndWhiskerCategoryDataset dataset = createDataset();
CategoryAxis xAxis = new CategoryAxis("Model");
NumberAxis yAxis = new NumberAxis("Fitness");
yAxis.setRange(0.0, 1.0);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox(false);
renderer.setMaximumBarWidth(0.2);
renderer.setItemMargin(0.5);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
chart = new JFreeChart(
"Model comparison",
new Font("Palatino", Font.BOLD, 14),
plot,
true
);
chart.removeLegend();
// boxWhiskerPane.setCenter(viewer);
}
示例5: init
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
protected void init()
{
dataset = new DefaultBoxAndWhiskerCategoryDataset();
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox(false);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
final CategoryAxis xAxis = new CategoryAxis("Type");
final NumberAxis yAxis = new NumberAxis("Value");
final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
final JFreeChart chart = new JFreeChart(
getName(),
new Font("SansSerif", Font.BOLD, 14),
plot,
true
);
init(chart.getPlot());
}
示例6: updateCategoryPlot
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public CategoryPlot updateCategoryPlot(CategoryPlot categoryPlot, NumberFormat numberFormat,
BoxAndWhiskerItem boxAndWhiskerItem, Color color, boolean notify) {
// Box and Whisker Plot
NumberAxis valueAxis = new NumberAxis();
valueAxis.setAutoRangeIncludesZero(false);
valueAxis.setNumberFormatOverride(numberFormat);
valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BoxAndWhiskerRenderer boxAndWhiskerRenderer = new BoxAndWhiskerRenderer();
boxAndWhiskerRenderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
boxAndWhiskerRenderer.setMaximumBarWidth(0.3);
boxAndWhiskerRenderer.setBasePaint(color);
boxAndWhiskerRenderer.setBaseOutlinePaint(color);
boxAndWhiskerRenderer.setAutoPopulateSeriesPaint(false);
boxAndWhiskerRenderer.setFillBox(false);
boxAndWhiskerRenderer.setUseOutlinePaintForWhiskers(true);
DefaultBoxAndWhiskerCategoryDataset dbawcd = new DefaultBoxAndWhiskerCategoryDataset();
dbawcd.add(boxAndWhiskerItem, "", "");
categoryPlot.setRenderer(boxAndWhiskerRenderer, notify);
categoryPlot.setRangeAxis(0, valueAxis, notify);
categoryPlot.setDataset(dbawcd);
return categoryPlot;
}
示例7: createRenderer
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
/**
* Creates a Renderer object to that can draw the BoxPlot.
*
* @return a BoxAndWhiskerRenderer that can render the boxplot
*/
private static BoxAndWhiskerRenderer createRenderer(
final boolean meanVisible, final boolean fillBox) {
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setMeanVisible(meanVisible);
renderer.setFillBox(fillBox);
renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
return renderer;
}
示例8: createChart2
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
protected JFreeChart createChart2(BoxAndWhiskerCategoryDataset dataset) {
//System.out.println("createChart2 called");
CategoryAxis domainAxis = new CategoryAxis(null);
// NumberAxis rangeAxis = new NumberAxis("X");
// System.out.println("using the common RangeAxis\n");
common_rangeAxis.setAutoRange(false);
// NumberAxis rangeAxis = common_rangeAxis;
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
CategoryPlot plot = new CategoryPlot(
dataset, domainAxis, common_rangeAxis, renderer
);
JFreeChart chart = new JFreeChart("", plot);
chart.setBackgroundPaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDomainGridlinePaint(Color.lightGray);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.lightGray);
plot.setOrientation( PlotOrientation.HORIZONTAL);
//rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
renderer.setFillBox(false);
// renderer.setLegendItemLabelGenerator(new SOCRCategoryCellLabelGenerator(dataset, values_storage,SERIES_COUNT, CATEGORY_COUNT));
domainAxis.setLowerMargin(0.46);
domainAxis.setUpperMargin(0.46);
chart.removeLegend();
return chart;
}
示例9: 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);
r1.setMaximumBarWidth(0.99);
assertFalse(r1.equals(r2));
r2.setMaximumBarWidth(0.99);
assertTrue(r1.equals(r2));
// the default for meanVisible is false in 1.2.x
r1.setMeanVisible(true);
assertFalse(r1.equals(r2));
r2.setMeanVisible(true);
assertTrue(r1.equals(r2));
r1.setMedianVisible(false);
assertFalse(r1.equals(r2));
r2.setMedianVisible(false);
assertTrue(r1.equals(r2));
}
示例10: getChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public JFreeChart getChart() {
if (chart == null) {
createDataset();
chart = ChartFactory.createBarChart(getTitle(),
// chart title
"Category",
// domain axis label
"Value",
// range axis label
dataset,
// data
PlotOrientation.VERTICAL,
// orientation
false,
// include legend
true,
// tooltips?
false
// URLs?
);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryAxis rangeAxis = plot.getDomainAxis();
rangeAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox(true);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
renderer.setMeanVisible(isMeanVisible);
plot.setRenderer(renderer);
}
return chart;
}
示例11: getBoxPlotFromSummaryData
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
/**
* Create a box plot from summary data (mean, median, q1, q3, min, max,
* minOutlier, maxOutlier, list of outliers)
*
* @param summary summary data
* @param outliers list of outlier values
* @param additionalArgs additional options to the renderer
* @return a box plot chart
* @throws Exception if a problem occurs
*/
protected static JFreeChart getBoxPlotFromSummaryData(List<Double> summary,
List<Double> outliers, List<String> additionalArgs) throws Exception {
if (summary.size() != 8) {
throw new Exception(
"Expected 8 values in the summary argument: mean, median, "
+ "q1, q3, min, max, minOutlier, maxOutlier");
}
String plotTitle = "Box Plog";
String userTitle = getOption(additionalArgs, "-title");
plotTitle = (userTitle != null) ? userTitle : plotTitle;
String xLabel = getOption(additionalArgs, "-x-label");
xLabel = xLabel == null ? "" : xLabel;
String yLabel = getOption(additionalArgs, "-y-label");
yLabel = yLabel == null ? "" : yLabel;
DefaultBoxAndWhiskerCategoryDataset dataset =
new DefaultBoxAndWhiskerCategoryDataset();
Double mean = summary.get(0);
Double median = summary.get(1);
Double q1 = summary.get(2);
Double q3 = summary.get(3);
Double min = summary.get(4);
Double max = summary.get(5);
Double minOutlier = summary.get(6);
Double maxOutlier = summary.get(7);
if (mean.isNaN() || median.isNaN() || min.isNaN() || max.isNaN()
|| q1.isNaN() || q3.isNaN()) {
throw new Exception("NaN in summary data - can't generate box plot");
}
BoxAndWhiskerItem item =
new BoxAndWhiskerItem(mean, median, q1, q3, min, max, minOutlier,
maxOutlier, outliers);
dataset.add(item, "", "");
CategoryAxis xAxis = new CategoryAxis();
NumberAxis yAxis = new NumberAxis();
yAxis.setAutoRangeIncludesZero(false);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox(false);
renderer.setMaximumBarWidth(0.15);
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
JFreeChart chart =
new JFreeChart(plotTitle, new Font("SansSerif", Font.BOLD, 12), plot,
false);
return chart;
}
示例12: writeToFile
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public void writeToFile(String outName) throws FileNotFoundException, UnsupportedEncodingException, IOException
{
//calcMeans();
// Create JFreeChart Dataset
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset( );
HashMap<String, ArrayList<Double> > measuresFirst = algorithmMeasures.entrySet().iterator().next().getValue();
for (Map.Entry<String, ArrayList<Double> > measure : measuresFirst.entrySet())
{
String measureName = measure.getKey();
//Double measureValue = measure.getValue();
dataset.clear();
for (Map.Entry<String, HashMap<String, ArrayList<Double> >> entry : algorithmMeasures.entrySet())
{
String alg = entry.getKey();
ArrayList<Double> measureValues = entry.getValue().get(measureName);
// Parse algorithm name to show it correctly
String aName = alg.substring(0, alg.length()-1);
int startAlgName = aName.lastIndexOf("/");
aName = aName.substring(startAlgName + 1);
dataset.add(measureValues, aName, measureName);
}
// Tutorial: http://www.java2s.com/Code/Java/Chart/JFreeChartBoxAndWhiskerDemo.htm
final CategoryAxis xAxis = new CategoryAxis("Algorithm");
final NumberAxis yAxis = new NumberAxis("Value");
yAxis.setAutoRangeIncludesZero(false);
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
// Black and White
int numItems = algorithmMeasures.size();
for(int i=0;i<numItems;i++)
{
Color color = Color.DARK_GRAY;
if(i%2 == 1)
{
color = Color.LIGHT_GRAY;
}
renderer.setSeriesPaint(i, color);
renderer.setSeriesOutlinePaint(i, Color.BLACK);
}
renderer.setMeanVisible(false);
renderer.setFillBox(false);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
Font font = new Font("SansSerif", Font.BOLD, 10);
//ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart jchart = new JFreeChart("Assotiation Rules Measures - BoxPlot", font, plot, true);
//StandardChartTheme.createLegacyTheme().apply(jchart);
int width = 640 * 2; /* Width of the image */
int height = 480 * 2; /* Height of the image */
// JPEG
File chart = new File( outName + "_" + measureName + "_boxplot.jpg" );
ChartUtilities.saveChartAsJPEG( chart , jchart , width , height );
// SVG
SVGGraphics2D g2 = new SVGGraphics2D(width, height);
Rectangle r = new Rectangle(0, 0, width, height);
jchart.draw(g2, r);
File BarChartSVG = new File( outName + "_" + measureName + "_boxplot.svg" );
SVGUtils.writeToSVG(BarChartSVG, g2.getSVGElement());
}
}